pc,virtio: regression, test fixes

fixes regressions:
     virtio error message triggered by seabios
     failure in vhost due to VIRTIO_F_RING_RESET
     broken keyboard under seabios
 
 some biosbits test fixes
 
 there's still a known regression with migration and vsock,
 not fixed yet.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmN8os4PHG1zdEByZWRo
 YXQuY29tAAoJECgfDbjSjVRpw+UH/2JOoxqzkkq4QyV5PzmjsiyyMbrBqFSOTro2
 98k9MwxNWHIk6fi3FVIz+LX1EdwDbMl44IHQ88xo7k39V7ThvVvLfjaQySSeoCfE
 04++AvkOQ/O8W7sob17r2iPWIHKPIndq8uB652T89o1I/nhmFMsUkdRWmVQ3XsDk
 DnPZxjBQnKY0oSvBd7SmSI3C+eA4lF1tht50ZxmOshLx4OSjK/maFVpIyLsUGTMn
 6OMxKffDjfvw5z94+pGN1RQm9xu7OwtFZyUnH16xoQUmWSXjzcYXUZ3buTY+eAyJ
 I5j9ox27Cqn1wGcypUiTCKLIExEMBfvNY4ovyRa1xvW+MXluVyE=
 =bF2U
 -----END PGP SIGNATURE-----

Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging

pc,virtio: regression, test fixes

fixes regressions:
    virtio error message triggered by seabios
    failure in vhost due to VIRTIO_F_RING_RESET
    broken keyboard under seabios

some biosbits test fixes

there's still a known regression with migration and vsock,
not fixed yet.

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

# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmN8os4PHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRpw+UH/2JOoxqzkkq4QyV5PzmjsiyyMbrBqFSOTro2
# 98k9MwxNWHIk6fi3FVIz+LX1EdwDbMl44IHQ88xo7k39V7ThvVvLfjaQySSeoCfE
# 04++AvkOQ/O8W7sob17r2iPWIHKPIndq8uB652T89o1I/nhmFMsUkdRWmVQ3XsDk
# DnPZxjBQnKY0oSvBd7SmSI3C+eA4lF1tht50ZxmOshLx4OSjK/maFVpIyLsUGTMn
# 6OMxKffDjfvw5z94+pGN1RQm9xu7OwtFZyUnH16xoQUmWSXjzcYXUZ3buTY+eAyJ
# I5j9ox27Cqn1wGcypUiTCKLIExEMBfvNY4ovyRa1xvW+MXluVyE=
# =bF2U
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 22 Nov 2022 05:22:06 EST
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu:
  virtio: disable error for out of spec queue-enable
  acpi/tests/avocado/bits: keep the work directory when BITS_DEBUG is set in env
  tests/avocado: configure acpi-bits to use avocado timeout
  MAINTAINERS: add mst to list of biosbits maintainers
  tests: acpi: x86: update expected DSDT after moving PRQx fields in _SB scope
  acpi: x86: move RPQx field back to _SB scope
  tests: acpi: whitelist DSDT before moving PRQx to _SB scope
  vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2022-11-22 09:59:26 -05:00
commit ccb8d593e0
51 changed files with 45 additions and 34 deletions

View File

@ -1865,6 +1865,7 @@ F: hw/acpi/viot.h
ACPI/AVOCADO/BIOSBITS ACPI/AVOCADO/BIOSBITS
M: Ani Sinha <ani@anisinha.ca> M: Ani Sinha <ani@anisinha.ca>
M: Michael S. Tsirkin <mst@redhat.com>
S: Supported S: Supported
F: tests/avocado/acpi-bits/* F: tests/avocado/acpi-bits/*
F: tests/avocado/acpi-bits.py F: tests/avocado/acpi-bits.py

View File

@ -52,6 +52,7 @@ static const int user_feature_bits[] = {
VIRTIO_F_NOTIFY_ON_EMPTY, VIRTIO_F_NOTIFY_ON_EMPTY,
VIRTIO_F_RING_PACKED, VIRTIO_F_RING_PACKED,
VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_IOMMU_PLATFORM,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -813,12 +813,13 @@ static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
BusChild *kid; BusChild *kid;
ICH9LPCState *s = ICH9_LPC_DEVICE(adev); ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
BusState *bus = BUS(s->isa_bus); BusState *bus = BUS(s->isa_bus);
Aml *sb_scope = aml_scope("\\_SB");
/* ICH9 PCI to ISA irq remapping */ /* ICH9 PCI to ISA irq remapping */
aml_append(scope, aml_operation_region("PIRQ", AML_PCI_CONFIG, aml_append(scope, aml_operation_region("PIRQ", AML_PCI_CONFIG,
aml_int(0x60), 0x0C)); aml_int(0x60), 0x0C));
/* Fields declarion has to happen *after* operation region */ /* Fields declarion has to happen *after* operation region */
field = aml_field("PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); field = aml_field("PCI0.SF8.PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
aml_append(field, aml_named_field("PRQA", 8)); aml_append(field, aml_named_field("PRQA", 8));
aml_append(field, aml_named_field("PRQB", 8)); aml_append(field, aml_named_field("PRQB", 8));
aml_append(field, aml_named_field("PRQC", 8)); aml_append(field, aml_named_field("PRQC", 8));
@ -828,17 +829,8 @@ static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
aml_append(field, aml_named_field("PRQF", 8)); aml_append(field, aml_named_field("PRQF", 8));
aml_append(field, aml_named_field("PRQG", 8)); aml_append(field, aml_named_field("PRQG", 8));
aml_append(field, aml_named_field("PRQH", 8)); aml_append(field, aml_named_field("PRQH", 8));
aml_append(scope, field); aml_append(sb_scope, field);
aml_append(scope, sb_scope);
/* hack: put fields into _SB scope for LNKx to find them */
aml_append(scope, aml_alias("PRQA", "\\_SB.PRQA"));
aml_append(scope, aml_alias("PRQB", "\\_SB.PRQB"));
aml_append(scope, aml_alias("PRQC", "\\_SB.PRQC"));
aml_append(scope, aml_alias("PRQD", "\\_SB.PRQD"));
aml_append(scope, aml_alias("PRQE", "\\_SB.PRQE"));
aml_append(scope, aml_alias("PRQF", "\\_SB.PRQF"));
aml_append(scope, aml_alias("PRQG", "\\_SB.PRQG"));
aml_append(scope, aml_alias("PRQH", "\\_SB.PRQH"));
QTAILQ_FOREACH(kid, &bus->children, sibling) { QTAILQ_FOREACH(kid, &bus->children, sibling) {
call_dev_aml_func(DEVICE(kid->child), scope); call_dev_aml_func(DEVICE(kid->child), scope);

View File

@ -318,24 +318,20 @@ static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
{ {
Aml *field; Aml *field;
BusChild *kid; BusChild *kid;
Aml *sb_scope = aml_scope("\\_SB");
BusState *bus = qdev_get_child_bus(DEVICE(adev), "isa.0"); BusState *bus = qdev_get_child_bus(DEVICE(adev), "isa.0");
/* PIIX PCI to ISA irq remapping */ /* PIIX PCI to ISA irq remapping */
aml_append(scope, aml_operation_region("P40C", AML_PCI_CONFIG, aml_append(scope, aml_operation_region("P40C", AML_PCI_CONFIG,
aml_int(0x60), 0x04)); aml_int(0x60), 0x04));
/* Fields declarion has to happen *after* operation region */ /* Fields declarion has to happen *after* operation region */
field = aml_field("P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); field = aml_field("PCI0.S08.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
aml_append(field, aml_named_field("PRQ0", 8)); aml_append(field, aml_named_field("PRQ0", 8));
aml_append(field, aml_named_field("PRQ1", 8)); aml_append(field, aml_named_field("PRQ1", 8));
aml_append(field, aml_named_field("PRQ2", 8)); aml_append(field, aml_named_field("PRQ2", 8));
aml_append(field, aml_named_field("PRQ3", 8)); aml_append(field, aml_named_field("PRQ3", 8));
aml_append(scope, field); aml_append(sb_scope, field);
aml_append(scope, sb_scope);
/* hack: put fields into _SB scope for LNKx to find them */
aml_append(scope, aml_alias("PRQ0", "\\_SB.PRQ0"));
aml_append(scope, aml_alias("PRQ1", "\\_SB.PRQ1"));
aml_append(scope, aml_alias("PRQ2", "\\_SB.PRQ2"));
aml_append(scope, aml_alias("PRQ3", "\\_SB.PRQ3"));
QTAILQ_FOREACH(kid, &bus->children, sibling) { QTAILQ_FOREACH(kid, &bus->children, sibling) {
call_dev_aml_func(DEVICE(kid->child), scope); call_dev_aml_func(DEVICE(kid->child), scope);

View File

@ -75,6 +75,7 @@ static const int user_feature_bits[] = {
VIRTIO_NET_F_MTU, VIRTIO_NET_F_MTU,
VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_IOMMU_PLATFORM,
VIRTIO_F_RING_PACKED, VIRTIO_F_RING_PACKED,
VIRTIO_F_RING_RESET,
VIRTIO_NET_F_RSS, VIRTIO_NET_F_RSS,
VIRTIO_NET_F_HASH_REPORT, VIRTIO_NET_F_HASH_REPORT,

View File

@ -38,6 +38,7 @@ static const int kernel_feature_bits[] = {
VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_INDIRECT_DESC,
VIRTIO_RING_F_EVENT_IDX, VIRTIO_RING_F_EVENT_IDX,
VIRTIO_SCSI_F_HOTPLUG, VIRTIO_SCSI_F_HOTPLUG,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -36,6 +36,7 @@ static const int user_feature_bits[] = {
VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_INDIRECT_DESC,
VIRTIO_RING_F_EVENT_IDX, VIRTIO_RING_F_EVENT_IDX,
VIRTIO_SCSI_F_HOTPLUG, VIRTIO_SCSI_F_HOTPLUG,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -32,6 +32,7 @@ static const int user_feature_bits[] = {
VIRTIO_F_NOTIFY_ON_EMPTY, VIRTIO_F_NOTIFY_ON_EMPTY,
VIRTIO_F_RING_PACKED, VIRTIO_F_RING_PACKED,
VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_IOMMU_PLATFORM,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -24,6 +24,7 @@ static const int feature_bits[] = {
VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_INDIRECT_DESC,
VIRTIO_RING_F_EVENT_IDX, VIRTIO_RING_F_EVENT_IDX,
VIRTIO_GPIO_F_IRQ, VIRTIO_GPIO_F_IRQ,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -16,6 +16,7 @@
static const int feature_bits[] = { static const int feature_bits[] = {
VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -16,6 +16,11 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_ids.h"
static const int feature_bits[] = {
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT
};
static void vu_rng_start(VirtIODevice *vdev) static void vu_rng_start(VirtIODevice *vdev)
{ {
VHostUserRNG *rng = VHOST_USER_RNG(vdev); VHostUserRNG *rng = VHOST_USER_RNG(vdev);
@ -106,8 +111,10 @@ static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
static uint64_t vu_rng_get_features(VirtIODevice *vdev, static uint64_t vu_rng_get_features(VirtIODevice *vdev,
uint64_t requested_features, Error **errp) uint64_t requested_features, Error **errp)
{ {
/* No feature bits used yet */ VHostUserRNG *rng = VHOST_USER_RNG(vdev);
return requested_features;
return vhost_get_features(&rng->vhost_dev, feature_bits,
requested_features);
} }
static void vu_rng_handle_output(VirtIODevice *vdev, VirtQueue *vq) static void vu_rng_handle_output(VirtIODevice *vdev, VirtQueue *vq)

View File

@ -21,6 +21,7 @@
const int feature_bits[] = { const int feature_bits[] = {
VIRTIO_VSOCK_F_SEQPACKET, VIRTIO_VSOCK_F_SEQPACKET,
VIRTIO_F_RING_RESET,
VHOST_INVALID_FEATURE_BIT VHOST_INVALID_FEATURE_BIT
}; };

View File

@ -2499,10 +2499,17 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index)
{ {
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
/*
* TODO: Seabios is currently out of spec and triggering this error.
* So this needs to be fixed in Seabios, then this can
* be re-enabled for new machine types only, and also after
* being converted to LOG_GUEST_ERROR.
*
if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
error_report("queue_enable is only suppported in devices of virtio " error_report("queue_enable is only suppported in devices of virtio "
"1.0 or later."); "1.0 or later.");
} }
*/
if (k->queue_enable) { if (k->queue_enable) {
k->queue_enable(vdev, queue_index); k->queue_enable(vdev, queue_index);

View File

@ -69,6 +69,7 @@ const int vdpa_feature_bits[] = {
VIRTIO_NET_F_CTRL_VQ, VIRTIO_NET_F_CTRL_VQ,
VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_IOMMU_PLATFORM,
VIRTIO_F_RING_PACKED, VIRTIO_F_RING_PACKED,
VIRTIO_F_RING_RESET,
VIRTIO_NET_F_RSS, VIRTIO_NET_F_RSS,
VIRTIO_NET_F_HASH_REPORT, VIRTIO_NET_F_HASH_REPORT,
VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_GUEST_ANNOUNCE,

View File

@ -263,7 +263,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
self.logger.info('using grub-mkrescue for generating biosbits iso ...') self.logger.info('using grub-mkrescue for generating biosbits iso ...')
try: try:
if os.getenv('V'): if os.getenv('V') or os.getenv('BITS_DEBUG'):
subprocess.check_call([mkrescue_script, '-o', iso_file, subprocess.check_call([mkrescue_script, '-o', iso_file,
bits_dir], stderr=subprocess.STDOUT) bits_dir], stderr=subprocess.STDOUT)
else: else:
@ -347,7 +347,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
self._print_log(log) self._print_log(log)
raise e raise e
else: else:
if os.getenv('V'): if os.getenv('V') or os.getenv('BITS_DEBUG'):
self._print_log(log) self._print_log(log)
def tearDown(self): def tearDown(self):
@ -356,8 +356,13 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
""" """
if self._vm: if self._vm:
self.assertFalse(not self._vm.is_running) self.assertFalse(not self._vm.is_running)
self.logger.info('removing the work directory %s', self._workDir) if not os.getenv('BITS_DEBUG'):
shutil.rmtree(self._workDir) self.logger.info('removing the work directory %s', self._workDir)
shutil.rmtree(self._workDir)
else:
self.logger.info('not removing the work directory %s ' \
'as BITS_DEBUG is ' \
'passed in the environment', self._workDir)
super().tearDown() super().tearDown()
def test_acpi_smbios_bits(self): def test_acpi_smbios_bits(self):
@ -388,12 +393,6 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
self._vm.launch() self._vm.launch()
# biosbits has been configured to run all the specified test suites # biosbits has been configured to run all the specified test suites
# in batch mode and then automatically initiate a vm shutdown. # in batch mode and then automatically initiate a vm shutdown.
# sleep for maximum of one minute # Rely on avocado's unit test timeout.
max_sleep_time = time.monotonic() + 60 self._vm.wait(timeout=None)
while self._vm.is_running() and time.monotonic() < max_sleep_time:
time.sleep(1)
self.assertFalse(time.monotonic() > max_sleep_time,
'The VM seems to have failed to shutdown in time')
self.parse_log() self.parse_log()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.