acpi,virtio bug fixes

Two bugfixes for virtio-net, and one for a recent
 regression in acpi.
 Both issues have been reported in the wild, so
 I think it's preferable to merge these ASAP so
 that reporters can make sure RC fixes their issue.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJTMrFgAAoJECgfDbjSjVRp8CwH/3df8HDi9kEIu4PRdTbAQTrF
 nBbjmDV4jTCEAaPlBA9L5ohYpsaV01Y5Lg34EtTj3Ad7juyM0s46zf6/ykp84XiZ
 UlBvca5aelu1E38UlkCu0un0+hlQ2zuQIsFNWSs+4hNffJLjdMSZfhBsYuCBNAcb
 6ICPvG7nLPQmt1DoqNVDJc7Nl3ouHv3pKw1QJ2+h6LPmFaGGXs+GeIjo9TEcK/81
 DwUK0i+s+3xtL9rur6qliTFJ1VZ6vwN74YWLQqjGX7526JEKVDqGJS3pIn3KZkNj
 8JBjpAGkMy7rS/jB5/Zc7/7AhehcPslmVELfstcQQZ1NBNl9kn8qLWZN9TjQkgE=
 =sXKT
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi,virtio bug fixes

Two bugfixes for virtio-net, and one for a recent
regression in acpi.
Both issues have been reported in the wild, so
I think it's preferable to merge these ASAP so
that reporters can make sure RC fixes their issue.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Wed 26 Mar 2014 10:52:16 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  virtio-net: add vlan receive state to RxFilterInfo
  virtio-net: Do not filter VLANs without F_CTRL_VLAN
  Revert "acpi-test: rebuild SSDT"
  acpi: make SSDT 1.0 spec compliant when possible

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-03-26 15:15:19 +00:00
commit 0a87466ef3
6 changed files with 54 additions and 15 deletions

View File

@ -1055,9 +1055,21 @@ build_ssdt(GArray *table_data, GArray *linker,
{
GArray *package = build_alloc_array();
uint8_t op = 0x13; /* VarPackageOp */
uint8_t op;
/*
* Note: The ability to create variable-sized packages was first introduced in ACPI 2.0. ACPI 1.0 only
* allowed fixed-size packages with up to 255 elements.
* Windows guests up to win2k8 fail when VarPackageOp is used.
*/
if (acpi_cpus <= 255) {
op = 0x12; /* PackageOp */
build_append_byte(package, acpi_cpus); /* NumElements */
} else {
op = 0x13; /* VarPackageOp */
build_append_int(package, acpi_cpus); /* VarNumElements */
}
build_append_int(package, acpi_cpus); /* VarNumElements */
for (i = 0; i < acpi_cpus; i++) {
uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
build_append_byte(package, b);

View File

@ -222,13 +222,33 @@ static char *mac_strdup_printf(const uint8_t *mac)
mac[1], mac[2], mac[3], mac[4], mac[5]);
}
static intList *get_vlan_table(VirtIONet *n)
{
intList *list, *entry;
int i, j;
list = NULL;
for (i = 0; i < MAX_VLAN >> 5; i++) {
for (j = 0; n->vlans[i] && j <= 0x1f; j++) {
if (n->vlans[i] & (1U << j)) {
entry = g_malloc0(sizeof(*entry));
entry->value = (i << 5) + j;
entry->next = list;
list = entry;
}
}
}
return list;
}
static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
RxFilterInfo *info;
strList *str_list, *entry;
intList *int_list, *int_entry;
int i, j;
int i;
info = g_malloc0(sizeof(*info));
info->name = g_strdup(nc->name);
@ -273,19 +293,15 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
str_list = entry;
}
info->multicast_table = str_list;
info->vlan_table = get_vlan_table(n);
int_list = NULL;
for (i = 0; i < MAX_VLAN >> 5; i++) {
for (j = 0; n->vlans[i] && j < 0x1f; j++) {
if (n->vlans[i] & (1U << j)) {
int_entry = g_malloc0(sizeof(*int_entry));
int_entry->value = (i << 5) + j;
int_entry->next = int_list;
int_list = int_entry;
}
}
if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) {
info->vlan = RX_STATE_ALL;
} else if (!info->vlan_table) {
info->vlan = RX_STATE_NONE;
} else {
info->vlan = RX_STATE_NORMAL;
}
info->vlan_table = int_list;
/* enable event notification after query */
nc->rxfilter_notify_enabled = 1;
@ -514,6 +530,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
}
vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);
}
if ((1 << VIRTIO_NET_F_CTRL_VLAN) & features) {
memset(n->vlans, 0, MAX_VLAN >> 3);
} else {
memset(n->vlans, 0xff, MAX_VLAN >> 3);
}
}
static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,

View File

@ -4184,6 +4184,8 @@
#
# @unicast: unicast receive state
#
# @vlan: vlan receive state (Since 2.0)
#
# @broadcast-allowed: whether to receive broadcast
#
# @multicast-overflow: multicast table is overflowed or not
@ -4207,6 +4209,7 @@
'promiscuous': 'bool',
'multicast': 'RxState',
'unicast': 'RxState',
'vlan': 'RxState',
'broadcast-allowed': 'bool',
'multicast-overflow': 'bool',
'unicast-overflow': 'bool',

View File

@ -3407,6 +3407,7 @@ Each array entry contains the following:
- "promiscuous": promiscuous mode is enabled (json-bool)
- "multicast": multicast receive state (one of 'normal', 'none', 'all')
- "unicast": unicast receive state (one of 'normal', 'none', 'all')
- "vlan": vlan receive state (one of 'normal', 'none', 'all') (Since 2.0)
- "broadcast-allowed": allow to receive broadcast (json-bool)
- "multicast-overflow": multicast table is overflowed (json-bool)
- "unicast-overflow": unicast table is overflowed (json-bool)
@ -3424,6 +3425,7 @@ Example:
"name": "vnet0",
"main-mac": "52:54:00:12:34:56",
"unicast": "normal",
"vlan": "normal",
"vlan-table": [
4,
0

Binary file not shown.

Binary file not shown.