All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/55] pc,virtio: features, tests, fixes, cleanups
@ 2022-10-10 17:28 Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 01/55] hw/virtio: incorporate backend features in features Michael S. Tsirkin
                   ` (56 more replies)
  0 siblings, 57 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

The following changes since commit f1d33f55c47dfdaf8daacd618588ad3ae4c452d1:

  Merge tag 'pull-testing-gdbstub-plugins-gitdm-061022-3' of https://github.com/stsquad/qemu into staging (2022-10-06 07:11:56 -0400)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 3216ab2acb08b47d4ff83e709406690d37e44aff:

  x86: pci: acpi: consolidate PCI slots creation (2022-10-09 16:38:46 -0400)

----------------------------------------------------------------
pc,virtio: features, tests, fixes, cleanups

virtio introspection
new serial number opton for cxl
vhost user blk dynamic config size
virtio-gpio vhost user backend

Tests fixes cleanups all over the place

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

----------------------------------------------------------------
Alex Bennée (17):
      hw/virtio: incorporate backend features in features
      include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE
      include/hw: document vhost_dev feature life-cycle
      hw/virtio: fix some coding style issues
      hw/virtio: log potentially buggy guest drivers
      hw/virtio: add some vhost-user trace events
      hw/virtio: move vm_running check to virtio_device_started
      hw/virtio: move vhd->started check into helper and add FIXME
      tests/qtest: pass stdout/stderr down to subtests
      tests/qtest: add a timeout for subprocess_run_one_test
      tests/qtest: use qos_printf instead of g_test_message
      tests/qtest: catch unhandled vhost-user messages
      tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES
      tests/qtest: add assert to catch bad features
      tests/qtest: implement stub for VHOST_USER_GET_CONFIG
      tests/qtest: add a get_features op to vhost-user-test
      tests/qtest: enable tests for virtio-gpio

Daniil Tatianin (5):
      virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size
      virtio-blk: move config size params to virtio-blk-common
      vhost-user-blk: make it possible to disable write-zeroes/discard
      vhost-user-blk: make 'config_wce' part of 'host_features'
      vhost-user-blk: dynamically resize config space based on features

Hal Martin (1):
      hw/smbios: support for type 8 (port connector)

Igor Mammedov (17):
      tests: acpi: whitelist pc/q35 DSDT due to HPET AML move
      acpi: x86: deduplicate HPET AML building
      tests: acpi: update expected blobs after HPET move
      tests: acpi: whitelist pc/q35 DSDT due to HPET AML move
      acpi: x86: refactor PDSM method to reduce nesting
      x86: acpi: _DSM: use Package to pass parameters
      tests: acpi: update expected blobs
      tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN
      x86: acpi: cleanup PCI device _DSM duplication
      tests: acpi: update expected blobs
      tests: acpi: whitelist pc/q35 DSDT before moving _ADR field
      x86: pci: acpi: reorder Device's _ADR and _SUN fields
      tests: acpi: update expected blobs
      tests: acpi: whitelist pc/q35 DSDT before moving _ADR field
      x86: pci: acpi: reorder Device's _DSM method
      tests: acpi: update expected blobs
      x86: pci: acpi: consolidate PCI slots creation

Jonathan Cameron (1):
      mem/cxl-type3: Add sn option to provide serial number for PCI ecap

Laurent Vivier (6):
      qmp: add QMP command x-query-virtio
      qmp: add QMP command x-query-virtio-status
      qmp: decode feature & status bits in virtio-status
      qmp: add QMP commands for virtio/vhost queue-status
      qmp: add QMP command x-query-virtio-queue-element
      hmp: add virtio commands

Miguel Luis (3):
      tests/acpi: virt: allow acpi GTDT changes
      acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses
      tests/acpi: virt: update ACPI GTDT binaries

Peter Maydell (2):
      pci: Remove unused pci_get_*_by_mask() functions
      pci: Sanity check mask argument to pci_set_*_by_mask()

Peter Xu (1):
      Revert "intel_iommu: Fix irqchip / X2APIC configuration checks"

Viresh Kumar (2):
      hw/virtio: add boilerplate for vhost-user-gpio device
      hw/virtio: add vhost-user-gpio-pci boilerplate

 qapi/qapi-schema.json                 |    1 +
 qapi/virtio.json                      |  954 ++++++++++++++++++++++++++++++
 include/hw/cxl/cxl_device.h           |    1 +
 include/hw/firmware/smbios.h          |   10 +
 include/hw/pci/pci.h                  |   48 +-
 include/hw/virtio/vhost-user-blk.h    |    1 -
 include/hw/virtio/vhost-user-gpio.h   |   35 ++
 include/hw/virtio/vhost.h             |   18 +
 include/hw/virtio/virtio-blk-common.h |   20 +
 include/hw/virtio/virtio.h            |   28 +-
 include/monitor/hmp.h                 |    5 +
 tests/qtest/libqos/virtio-gpio.h      |   35 ++
 hw/arm/virt-acpi-build.c              |    5 +-
 hw/block/vhost-user-blk.c             |   39 +-
 hw/block/virtio-blk-common.c          |   39 ++
 hw/block/virtio-blk.c                 |   28 +-
 hw/i386/acpi-build.c                  |  300 +++++-----
 hw/i386/intel_iommu.c                 |    5 +
 hw/mem/cxl_type3.c                    |   14 +-
 hw/net/virtio-net.c                   |    9 +-
 hw/scsi/vhost-scsi.c                  |    4 +-
 hw/scsi/vhost-user-scsi.c             |    2 +-
 hw/smbios/smbios.c                    |   63 ++
 hw/virtio/vhost-user-fs.c             |    9 +-
 hw/virtio/vhost-user-gpio-pci.c       |   69 +++
 hw/virtio/vhost-user-gpio.c           |  411 +++++++++++++
 hw/virtio/vhost-user-i2c.c            |   10 +-
 hw/virtio/vhost-user-rng.c            |   10 +-
 hw/virtio/vhost-user-vsock.c          |    8 +-
 hw/virtio/vhost-user.c                |   16 +-
 hw/virtio/vhost-vsock-common.c        |    3 +-
 hw/virtio/vhost-vsock.c               |    8 +-
 hw/virtio/vhost.c                     |    6 +
 hw/virtio/virtio-stub.c               |   42 ++
 hw/virtio/virtio.c                    | 1049 ++++++++++++++++++++++++++++++++-
 monitor/hmp-cmds.c                    |  310 ++++++++++
 tests/qtest/libqos/virtio-gpio.c      |  171 ++++++
 tests/qtest/libqos/virtio.c           |    4 +-
 tests/qtest/qmp-cmd-test.c            |    1 +
 tests/qtest/qos-test.c                |    9 +-
 tests/qtest/vhost-user-test.c         |  177 +++++-
 MAINTAINERS                           |   12 +
 hmp-commands-info.hx                  |   70 +++
 hw/block/meson.build                  |    4 +-
 hw/virtio/Kconfig                     |    5 +
 hw/virtio/meson.build                 |    4 +
 hw/virtio/trace-events                |    9 +
 qapi/meson.build                      |    1 +
 qemu-options.hx                       |    2 +
 tests/data/acpi/pc/DSDT               |  Bin 5987 -> 6422 bytes
 tests/data/acpi/pc/DSDT.acpierst      |  Bin 5954 -> 6382 bytes
 tests/data/acpi/pc/DSDT.acpihmat      |  Bin 7312 -> 7747 bytes
 tests/data/acpi/pc/DSDT.bridge        |  Bin 8653 -> 9496 bytes
 tests/data/acpi/pc/DSDT.cphp          |  Bin 6451 -> 6886 bytes
 tests/data/acpi/pc/DSDT.dimmpxm       |  Bin 7641 -> 8076 bytes
 tests/data/acpi/pc/DSDT.hpbridge      |  Bin 5954 -> 6382 bytes
 tests/data/acpi/pc/DSDT.hpbrroot      |  Bin 3069 -> 3069 bytes
 tests/data/acpi/pc/DSDT.ipmikcs       |  Bin 6059 -> 6494 bytes
 tests/data/acpi/pc/DSDT.memhp         |  Bin 7346 -> 7781 bytes
 tests/data/acpi/pc/DSDT.nohpet        |  Bin 5845 -> 6280 bytes
 tests/data/acpi/pc/DSDT.numamem       |  Bin 5993 -> 6428 bytes
 tests/data/acpi/pc/DSDT.roothp        |  Bin 6195 -> 6656 bytes
 tests/data/acpi/q35/DSDT              |  Bin 8274 -> 8320 bytes
 tests/data/acpi/q35/DSDT.acpierst     |  Bin 8291 -> 8337 bytes
 tests/data/acpi/q35/DSDT.acpihmat     |  Bin 9599 -> 9645 bytes
 tests/data/acpi/q35/DSDT.applesmc     |  Bin 8320 -> 8366 bytes
 tests/data/acpi/q35/DSDT.bridge       |  Bin 10988 -> 11449 bytes
 tests/data/acpi/q35/DSDT.cphp         |  Bin 8738 -> 8784 bytes
 tests/data/acpi/q35/DSDT.cxl          |  Bin 9600 -> 9646 bytes
 tests/data/acpi/q35/DSDT.dimmpxm      |  Bin 9928 -> 9974 bytes
 tests/data/acpi/q35/DSDT.ipmibt       |  Bin 8349 -> 8395 bytes
 tests/data/acpi/q35/DSDT.ipmismbus    |  Bin 8363 -> 8409 bytes
 tests/data/acpi/q35/DSDT.ivrs         |  Bin 8291 -> 8337 bytes
 tests/data/acpi/q35/DSDT.memhp        |  Bin 9633 -> 9679 bytes
 tests/data/acpi/q35/DSDT.mmio64       |  Bin 9404 -> 9450 bytes
 tests/data/acpi/q35/DSDT.multi-bridge |  Bin 8568 -> 8640 bytes
 tests/data/acpi/q35/DSDT.nohpet       |  Bin 8132 -> 8178 bytes
 tests/data/acpi/q35/DSDT.numamem      |  Bin 8280 -> 8326 bytes
 tests/data/acpi/q35/DSDT.pvpanic-isa  |  Bin 8375 -> 8421 bytes
 tests/data/acpi/q35/DSDT.tis.tpm12    |  Bin 8880 -> 8926 bytes
 tests/data/acpi/q35/DSDT.tis.tpm2     |  Bin 8906 -> 8952 bytes
 tests/data/acpi/q35/DSDT.viot         |  Bin 9383 -> 9429 bytes
 tests/data/acpi/q35/DSDT.xapic        |  Bin 35637 -> 35683 bytes
 tests/data/acpi/virt/GTDT             |  Bin 96 -> 96 bytes
 tests/data/acpi/virt/GTDT.memhp       |  Bin 96 -> 96 bytes
 tests/data/acpi/virt/GTDT.numamem     |  Bin 96 -> 96 bytes
 tests/qtest/libqos/meson.build        |    1 +
 87 files changed, 3796 insertions(+), 289 deletions(-)
 create mode 100644 qapi/virtio.json
 create mode 100644 include/hw/virtio/vhost-user-gpio.h
 create mode 100644 include/hw/virtio/virtio-blk-common.h
 create mode 100644 tests/qtest/libqos/virtio-gpio.h
 create mode 100644 hw/block/virtio-blk-common.c
 create mode 100644 hw/virtio/vhost-user-gpio-pci.c
 create mode 100644 hw/virtio/vhost-user-gpio.c
 create mode 100644 hw/virtio/virtio-stub.c
 create mode 100644 tests/qtest/libqos/virtio-gpio.c



^ permalink raw reply	[flat|nested] 82+ messages in thread

* [PULL 01/55] hw/virtio: incorporate backend features in features
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
@ 2022-10-10 17:28 ` Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Michael S. Tsirkin
                   ` (55 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennée, Philippe Mathieu-Daudé

From: Alex Bennée <alex.bennee@linaro.org>

There are some extra bits used over a vhost-user connection which are
hidden from the device itself. We need to set them here to ensure we
enable things like the protocol extensions.

Currently net/vhost-user.c has it's own inscrutable way of persisting
this data but it really should live in the core vhost_user code.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220726192150.2435175-7-alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-2-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/virtio/vhost-user.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 70748e61e0..0b7e41ffe8 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1460,7 +1460,14 @@ static int vhost_user_set_features(struct vhost_dev *dev,
      */
     bool log_enabled = features & (0x1ULL << VHOST_F_LOG_ALL);
 
-    return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, features,
+    /*
+     * We need to include any extra backend only feature bits that
+     * might be needed by our device. Currently this includes the
+     * VHOST_USER_F_PROTOCOL_FEATURES bit for enabling protocol
+     * features.
+     */
+    return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES,
+                              features | dev->backend_features,
                               log_enabled);
 }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 01/55] hw/virtio: incorporate backend features in features Michael S. Tsirkin
@ 2022-10-10 17:28 ` Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 03/55] include/hw: document vhost_dev feature life-cycle Michael S. Tsirkin
                   ` (54 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennée

From: Alex Bennée <alex.bennee@linaro.org>

When debugging a new vhost user you may be surprised to see
VHOST_USER_F_PROTOCOL getting squashed in the maze of
backend_features, acked_features and guest_features. Expand the
description here to help the next poor soul trying to work through
this.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20220802095010.3330793-6-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index db1c0ddf6b..9bb2485415 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -24,7 +24,12 @@
 #include "qom/object.h"
 #include "hw/virtio/vhost.h"
 
-/* A guest should never accept this.  It implies negotiation is broken. */
+/*
+ * A guest should never accept this. It implies negotiation is broken
+ * between the driver frontend and the device. This bit is re-used for
+ * vhost-user to advertise VHOST_USER_F_PROTOCOL_FEATURES between QEMU
+ * and a vhost-user backend.
+ */
 #define VIRTIO_F_BAD_FEATURE		30
 
 #define VIRTIO_LEGACY_FEATURES ((0x1ULL << VIRTIO_F_BAD_FEATURE) | \
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 03/55] include/hw: document vhost_dev feature life-cycle
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 01/55] hw/virtio: incorporate backend features in features Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Michael S. Tsirkin
@ 2022-10-10 17:28 ` Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 04/55] hw/virtio: fix some coding style issues Michael S. Tsirkin
                   ` (53 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Jason Wang, Philippe Mathieu-Daudé

From: Alex Bennée <alex.bennee@linaro.org>

Try and explicitly document the various state of feature bits as
related to the vhost_dev structure. Importantly the backend_features
can advertise things like VHOST_USER_F_PROTOCOL_FEATURES which is
never exposed to the driver and is only present in the vhost-user
feature negotiation.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220802095010.3330793-7-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/virtio/vhost.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index a346f23d13..586c5457e2 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -86,8 +86,11 @@ struct vhost_dev {
     /* if non-zero, minimum required value for max_queues */
     int num_queues;
     uint64_t features;
+    /** @acked_features: final set of negotiated features */
     uint64_t acked_features;
+    /** @backend_features: backend specific feature bits */
     uint64_t backend_features;
+    /** @protocol_features: final negotiated protocol features */
     uint64_t protocol_features;
     uint64_t max_queues;
     uint64_t backend_cap;
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 04/55] hw/virtio: fix some coding style issues
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2022-10-10 17:28 ` [PULL 03/55] include/hw: document vhost_dev feature life-cycle Michael S. Tsirkin
@ 2022-10-10 17:28 ` Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 05/55] hw/virtio: log potentially buggy guest drivers Michael S. Tsirkin
                   ` (52 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Jason Wang, Philippe Mathieu-Daudé

From: Alex Bennée <alex.bennee@linaro.org>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220802095010.3330793-8-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/virtio/vhost-user.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 0b7e41ffe8..03415b6c95 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -200,7 +200,7 @@ typedef struct {
     VhostUserRequest request;
 
 #define VHOST_USER_VERSION_MASK     (0x3)
-#define VHOST_USER_REPLY_MASK       (0x1<<2)
+#define VHOST_USER_REPLY_MASK       (0x1 << 2)
 #define VHOST_USER_NEED_REPLY_MASK  (0x1 << 3)
     uint32_t flags;
     uint32_t size; /* the following payload size */
@@ -208,7 +208,7 @@ typedef struct {
 
 typedef union {
 #define VHOST_USER_VRING_IDX_MASK   (0xff)
-#define VHOST_USER_VRING_NOFD_MASK  (0x1<<8)
+#define VHOST_USER_VRING_NOFD_MASK  (0x1 << 8)
         uint64_t u64;
         struct vhost_vring_state state;
         struct vhost_vring_addr addr;
@@ -248,7 +248,8 @@ struct vhost_user {
     size_t             region_rb_len;
     /* RAMBlock associated with a given region */
     RAMBlock         **region_rb;
-    /* The offset from the start of the RAMBlock to the start of the
+    /*
+     * The offset from the start of the RAMBlock to the start of the
      * vhost region.
      */
     ram_addr_t        *region_rb_offset;
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 05/55] hw/virtio: log potentially buggy guest drivers
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  2022-10-10 17:28 ` [PULL 04/55] hw/virtio: fix some coding style issues Michael S. Tsirkin
@ 2022-10-10 17:28 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 06/55] hw/virtio: add some vhost-user trace events Michael S. Tsirkin
                   ` (51 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennée, Jason Wang

From: Alex Bennée <alex.bennee@linaro.org>

If the guest driver attempts to use the UNUSED(30) bit it is
potentially buggy as 6.3 Legacy Interface: Reserved Feature Bits
states it "SHOULD NOT be negotiated". For now just log this guest
error.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220802095010.3330793-9-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5d607aeaa0..97a6307c0f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2980,6 +2980,13 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
     if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) {
         return -EINVAL;
     }
+
+    if (val & (1ull << VIRTIO_F_BAD_FEATURE)) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: guest driver for %s has enabled UNUSED(30) feature bit!\n",
+                      __func__, vdev->name);
+    }
+
     ret = virtio_set_features_nocheck(vdev, val);
     if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
         /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches.  */
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 06/55] hw/virtio: add some vhost-user trace events
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (4 preceding siblings ...)
  2022-10-10 17:28 ` [PULL 05/55] hw/virtio: log potentially buggy guest drivers Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29   ` [Virtio-fs] " Michael S. Tsirkin
                   ` (50 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennée, Philippe Mathieu-Daudé

From: Alex Bennée <alex.bennee@linaro.org>

These are useful for tracing the lifetime of vhost-user connections.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-10-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/virtio/vhost.c      | 6 ++++++
 hw/virtio/trace-events | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index f758f177bb..5185c15295 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1477,6 +1477,8 @@ void vhost_dev_cleanup(struct vhost_dev *hdev)
 {
     int i;
 
+    trace_vhost_dev_cleanup(hdev);
+
     for (i = 0; i < hdev->nvqs; ++i) {
         vhost_virtqueue_cleanup(hdev->vqs + i);
     }
@@ -1783,6 +1785,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
     /* should only be called after backend is connected */
     assert(hdev->vhost_ops);
 
+    trace_vhost_dev_start(hdev, vdev->name);
+
     vdev->vhost_started = true;
     hdev->started = true;
     hdev->vdev = vdev;
@@ -1869,6 +1873,8 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
     /* should only be called after backend is connected */
     assert(hdev->vhost_ops);
 
+    trace_vhost_dev_stop(hdev, vdev->name);
+
     if (hdev->vhost_ops->vhost_dev_start) {
         hdev->vhost_ops->vhost_dev_start(hdev, false);
     }
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 20af2e7ebd..887ca7afa8 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -8,6 +8,10 @@ vhost_region_add_section_aligned(const char *name, uint64_t gpa, uint64_t size,
 vhost_section(const char *name) "%s"
 vhost_reject_section(const char *name, int d) "%s:%d"
 vhost_iotlb_miss(void *dev, int step) "%p step %d"
+vhost_dev_cleanup(void *dev) "%p"
+vhost_dev_start(void *dev, const char *name) "%p:%s"
+vhost_dev_stop(void *dev, const char *name) "%p:%s"
+
 
 # vhost-user.c
 vhost_user_postcopy_end_entry(void) ""
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
@ 2022-10-10 17:29   ` Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Michael S. Tsirkin
                     ` (55 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs

From: Alex Bennée <alex.bennee@linaro.org>

All the boilerplate virtio code does the same thing (or should at
least) of checking to see if the VM is running before attempting to
start VirtIO. Push the logic up to the common function to avoid
getting a copy and paste wrong.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h   | 5 +++++
 hw/virtio/vhost-user-fs.c    | 6 +-----
 hw/virtio/vhost-user-i2c.c   | 6 +-----
 hw/virtio/vhost-user-rng.c   | 6 +-----
 hw/virtio/vhost-user-vsock.c | 6 +-----
 hw/virtio/vhost-vsock.c      | 6 +-----
 6 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 9bb2485415..74e7ad5a92 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -100,6 +100,7 @@ struct VirtIODevice
     VirtQueue *vq;
     MemoryListener listener;
     uint16_t device_id;
+    /* @vm_running: current VM running state via virtio_vmstate_change() */
     bool vm_running;
     bool broken; /* device in invalid state, needs reset */
     bool use_disabled_flag; /* allow use of 'disable' flag when needed */
@@ -376,6 +377,10 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
         return vdev->started;
     }
 
+    if (!vdev->vm_running) {
+        return false;
+    }
+
     return status & VIRTIO_CONFIG_S_DRIVER_OK;
 }
 
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index e513e4fdda..d2bebba785 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -122,11 +122,7 @@ static void vuf_stop(VirtIODevice *vdev)
 static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (fs->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
index 6020eee093..b930cf6d5e 100644
--- a/hw/virtio/vhost-user-i2c.c
+++ b/hw/virtio/vhost-user-i2c.c
@@ -93,11 +93,7 @@ static void vu_i2c_stop(VirtIODevice *vdev)
 static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (i2c->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
index 3a7bf8e32d..a9c1c4bc79 100644
--- a/hw/virtio/vhost-user-rng.c
+++ b/hw/virtio/vhost-user-rng.c
@@ -90,11 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
 static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserRNG *rng = VHOST_USER_RNG(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (rng->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
index 0f8ff99f85..22c1616ebd 100644
--- a/hw/virtio/vhost-user-vsock.c
+++ b/hw/virtio/vhost-user-vsock.c
@@ -55,11 +55,7 @@ const VhostDevConfigOps vsock_ops = {
 static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (vvc->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 0338de892f..8031c164a5 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start)
 static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
+    bool should_start = virtio_device_started(vdev, status);
     int ret;
 
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
-
     if (vvc->vhost_dev.started == should_start) {
         return;
     }
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [Virtio-fs] [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started
@ 2022-10-10 17:29   ` Michael S. Tsirkin
  0 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs

From: Alex Bennée <alex.bennee@linaro.org>

All the boilerplate virtio code does the same thing (or should at
least) of checking to see if the VM is running before attempting to
start VirtIO. Push the logic up to the common function to avoid
getting a copy and paste wrong.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h   | 5 +++++
 hw/virtio/vhost-user-fs.c    | 6 +-----
 hw/virtio/vhost-user-i2c.c   | 6 +-----
 hw/virtio/vhost-user-rng.c   | 6 +-----
 hw/virtio/vhost-user-vsock.c | 6 +-----
 hw/virtio/vhost-vsock.c      | 6 +-----
 6 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 9bb2485415..74e7ad5a92 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -100,6 +100,7 @@ struct VirtIODevice
     VirtQueue *vq;
     MemoryListener listener;
     uint16_t device_id;
+    /* @vm_running: current VM running state via virtio_vmstate_change() */
     bool vm_running;
     bool broken; /* device in invalid state, needs reset */
     bool use_disabled_flag; /* allow use of 'disable' flag when needed */
@@ -376,6 +377,10 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
         return vdev->started;
     }
 
+    if (!vdev->vm_running) {
+        return false;
+    }
+
     return status & VIRTIO_CONFIG_S_DRIVER_OK;
 }
 
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index e513e4fdda..d2bebba785 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -122,11 +122,7 @@ static void vuf_stop(VirtIODevice *vdev)
 static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (fs->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
index 6020eee093..b930cf6d5e 100644
--- a/hw/virtio/vhost-user-i2c.c
+++ b/hw/virtio/vhost-user-i2c.c
@@ -93,11 +93,7 @@ static void vu_i2c_stop(VirtIODevice *vdev)
 static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (i2c->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
index 3a7bf8e32d..a9c1c4bc79 100644
--- a/hw/virtio/vhost-user-rng.c
+++ b/hw/virtio/vhost-user-rng.c
@@ -90,11 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
 static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserRNG *rng = VHOST_USER_RNG(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (rng->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
index 0f8ff99f85..22c1616ebd 100644
--- a/hw/virtio/vhost-user-vsock.c
+++ b/hw/virtio/vhost-user-vsock.c
@@ -55,11 +55,7 @@ const VhostDevConfigOps vsock_ops = {
 static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
-
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
+    bool should_start = virtio_device_started(vdev, status);
 
     if (vvc->vhost_dev.started == should_start) {
         return;
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 0338de892f..8031c164a5 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start)
 static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
-    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
+    bool should_start = virtio_device_started(vdev, status);
     int ret;
 
-    if (!vdev->vm_running) {
-        should_start = false;
-    }
-
     if (vvc->vhost_dev.started == should_start) {
         return;
     }
-- 
MST


^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 08/55] hw/virtio: move vhd->started check into helper and add FIXME
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
@ 2022-10-10 17:29   ` Michael S. Tsirkin
  2022-10-10 17:28 ` [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Michael S. Tsirkin
                     ` (55 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Raphael Norwitz,
	Raphael Norwitz, Kevin Wolf, Hanna Reitz, Paolo Bonzini,
	Fam Zheng, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Mathieu Poirier, qemu-block, virtio-fs

From: Alex Bennée <alex.bennee@linaro.org>

The `started` field is manipulated internally within the vhost code
except for one place, vhost-user-blk via f5b22d06fb (vhost: recheck
dev state in the vhost_migration_log routine). Mark that as a FIXME
because it introduces a potential race. I think the referenced fix
should be tracking its state locally.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-12-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwittz@nutanix.com>
---
 include/hw/virtio/vhost.h      | 12 ++++++++++++
 hw/block/vhost-user-blk.c      | 10 ++++++++--
 hw/scsi/vhost-scsi.c           |  4 ++--
 hw/scsi/vhost-user-scsi.c      |  2 +-
 hw/virtio/vhost-user-fs.c      |  3 ++-
 hw/virtio/vhost-user-i2c.c     |  4 ++--
 hw/virtio/vhost-user-rng.c     |  4 ++--
 hw/virtio/vhost-user-vsock.c   |  2 +-
 hw/virtio/vhost-vsock-common.c |  3 ++-
 hw/virtio/vhost-vsock.c        |  2 +-
 10 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 586c5457e2..61b957e927 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -94,6 +94,7 @@ struct vhost_dev {
     uint64_t protocol_features;
     uint64_t max_queues;
     uint64_t backend_cap;
+    /* @started: is the vhost device started? */
     bool started;
     bool log_enabled;
     uint64_t log_size;
@@ -165,6 +166,17 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
  */
 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
 
+/**
+ * vhost_dev_is_started() - report status of vhost device
+ * @hdev: common vhost_dev structure
+ *
+ * Return the started status of the vhost device
+ */
+static inline bool vhost_dev_is_started(struct vhost_dev *hdev)
+{
+    return hdev->started;
+}
+
 /**
  * vhost_dev_start() - start the vhost device
  * @hdev: common vhost_dev structure
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 9117222456..2bba42478d 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -229,7 +229,7 @@ static void vhost_user_blk_set_status(VirtIODevice *vdev, uint8_t status)
         return;
     }
 
-    if (s->dev.started == should_start) {
+    if (vhost_dev_is_started(&s->dev) == should_start) {
         return;
     }
 
@@ -286,7 +286,7 @@ static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
         return;
     }
 
-    if (s->dev.started) {
+    if (vhost_dev_is_started(&s->dev)) {
         return;
     }
 
@@ -415,6 +415,12 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
              * the vhost migration code. If disconnect was caught there is an
              * option for the general vhost code to get the dev state without
              * knowing its type (in this case vhost-user).
+             *
+             * FIXME: this is sketchy to be reaching into vhost_dev
+             * now because we are forcing something that implies we
+             * have executed vhost_dev_stop() but that won't happen
+             * until vhost_user_blk_stop() gets called from the bh.
+             * Really this state check should be tracked locally.
              */
             s->dev.started = false;
         }
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 3059068175..bdf337a7a2 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -120,7 +120,7 @@ static void vhost_scsi_set_status(VirtIODevice *vdev, uint8_t val)
         start = false;
     }
 
-    if (vsc->dev.started == start) {
+    if (vhost_dev_is_started(&vsc->dev) == start) {
         return;
     }
 
@@ -147,7 +147,7 @@ static int vhost_scsi_pre_save(void *opaque)
 
     /* At this point, backend must be stopped, otherwise
      * it might keep writing to memory. */
-    assert(!vsc->dev.started);
+    assert(!vhost_dev_is_started(&vsc->dev));
 
     return 0;
 }
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index 1b2f7eed98..bc37317d55 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -49,7 +49,7 @@ static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status)
     VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
     bool start = (status & VIRTIO_CONFIG_S_DRIVER_OK) && vdev->vm_running;
 
-    if (vsc->dev.started == start) {
+    if (vhost_dev_is_started(&vsc->dev) == start) {
         return;
     }
 
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index d2bebba785..ad0f91c607 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -20,6 +20,7 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
 #include "qemu/error-report.h"
+#include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-user-fs.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
@@ -124,7 +125,7 @@ static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
     VHostUserFS *fs = VHOST_USER_FS(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (fs->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&fs->vhost_dev) == should_start) {
         return;
     }
 
diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
index b930cf6d5e..bc58b6c0d1 100644
--- a/hw/virtio/vhost-user-i2c.c
+++ b/hw/virtio/vhost-user-i2c.c
@@ -95,7 +95,7 @@ static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
     VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (i2c->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&i2c->vhost_dev) == should_start) {
         return;
     }
 
@@ -174,7 +174,7 @@ static void vu_i2c_disconnect(DeviceState *dev)
     }
     i2c->connected = false;
 
-    if (i2c->vhost_dev.started) {
+    if (vhost_dev_is_started(&i2c->vhost_dev)) {
         vu_i2c_stop(vdev);
     }
 }
diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
index a9c1c4bc79..bc1f36c5ac 100644
--- a/hw/virtio/vhost-user-rng.c
+++ b/hw/virtio/vhost-user-rng.c
@@ -92,7 +92,7 @@ static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
     VHostUserRNG *rng = VHOST_USER_RNG(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (rng->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&rng->vhost_dev) == should_start) {
         return;
     }
 
@@ -160,7 +160,7 @@ static void vu_rng_disconnect(DeviceState *dev)
 
     rng->connected = false;
 
-    if (rng->vhost_dev.started) {
+    if (vhost_dev_is_started(&rng->vhost_dev)) {
         vu_rng_stop(vdev);
     }
 }
diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
index 22c1616ebd..7b67e29d83 100644
--- a/hw/virtio/vhost-user-vsock.c
+++ b/hw/virtio/vhost-user-vsock.c
@@ -57,7 +57,7 @@ static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (vvc->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
         return;
     }
 
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index 7394818e00..29b9ab4f72 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -14,6 +14,7 @@
 #include "hw/virtio/virtio-access.h"
 #include "qemu/error-report.h"
 #include "hw/qdev-properties.h"
+#include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-vsock.h"
 #include "qemu/iov.h"
 #include "monitor/monitor.h"
@@ -199,7 +200,7 @@ int vhost_vsock_common_pre_save(void *opaque)
      * At this point, backend must be stopped, otherwise
      * it might keep writing to memory.
      */
-    assert(!vvc->vhost_dev.started);
+    assert(!vhost_dev_is_started(&vvc->vhost_dev));
 
     return 0;
 }
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 8031c164a5..7dc3c73931 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -73,7 +73,7 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
     bool should_start = virtio_device_started(vdev, status);
     int ret;
 
-    if (vvc->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
         return;
     }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [Virtio-fs] [PULL 08/55] hw/virtio: move vhd->started check into helper and add FIXME
@ 2022-10-10 17:29   ` Michael S. Tsirkin
  0 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Raphael Norwitz,
	Raphael Norwitz, Kevin Wolf, Hanna Reitz, Paolo Bonzini,
	Fam Zheng, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Mathieu Poirier, qemu-block, virtio-fs

From: Alex Bennée <alex.bennee@linaro.org>

The `started` field is manipulated internally within the vhost code
except for one place, vhost-user-blk via f5b22d06fb (vhost: recheck
dev state in the vhost_migration_log routine). Mark that as a FIXME
because it introduces a potential race. I think the referenced fix
should be tracking its state locally.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-12-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwittz@nutanix.com>
---
 include/hw/virtio/vhost.h      | 12 ++++++++++++
 hw/block/vhost-user-blk.c      | 10 ++++++++--
 hw/scsi/vhost-scsi.c           |  4 ++--
 hw/scsi/vhost-user-scsi.c      |  2 +-
 hw/virtio/vhost-user-fs.c      |  3 ++-
 hw/virtio/vhost-user-i2c.c     |  4 ++--
 hw/virtio/vhost-user-rng.c     |  4 ++--
 hw/virtio/vhost-user-vsock.c   |  2 +-
 hw/virtio/vhost-vsock-common.c |  3 ++-
 hw/virtio/vhost-vsock.c        |  2 +-
 10 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 586c5457e2..61b957e927 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -94,6 +94,7 @@ struct vhost_dev {
     uint64_t protocol_features;
     uint64_t max_queues;
     uint64_t backend_cap;
+    /* @started: is the vhost device started? */
     bool started;
     bool log_enabled;
     uint64_t log_size;
@@ -165,6 +166,17 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
  */
 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
 
+/**
+ * vhost_dev_is_started() - report status of vhost device
+ * @hdev: common vhost_dev structure
+ *
+ * Return the started status of the vhost device
+ */
+static inline bool vhost_dev_is_started(struct vhost_dev *hdev)
+{
+    return hdev->started;
+}
+
 /**
  * vhost_dev_start() - start the vhost device
  * @hdev: common vhost_dev structure
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 9117222456..2bba42478d 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -229,7 +229,7 @@ static void vhost_user_blk_set_status(VirtIODevice *vdev, uint8_t status)
         return;
     }
 
-    if (s->dev.started == should_start) {
+    if (vhost_dev_is_started(&s->dev) == should_start) {
         return;
     }
 
@@ -286,7 +286,7 @@ static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
         return;
     }
 
-    if (s->dev.started) {
+    if (vhost_dev_is_started(&s->dev)) {
         return;
     }
 
@@ -415,6 +415,12 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
              * the vhost migration code. If disconnect was caught there is an
              * option for the general vhost code to get the dev state without
              * knowing its type (in this case vhost-user).
+             *
+             * FIXME: this is sketchy to be reaching into vhost_dev
+             * now because we are forcing something that implies we
+             * have executed vhost_dev_stop() but that won't happen
+             * until vhost_user_blk_stop() gets called from the bh.
+             * Really this state check should be tracked locally.
              */
             s->dev.started = false;
         }
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 3059068175..bdf337a7a2 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -120,7 +120,7 @@ static void vhost_scsi_set_status(VirtIODevice *vdev, uint8_t val)
         start = false;
     }
 
-    if (vsc->dev.started == start) {
+    if (vhost_dev_is_started(&vsc->dev) == start) {
         return;
     }
 
@@ -147,7 +147,7 @@ static int vhost_scsi_pre_save(void *opaque)
 
     /* At this point, backend must be stopped, otherwise
      * it might keep writing to memory. */
-    assert(!vsc->dev.started);
+    assert(!vhost_dev_is_started(&vsc->dev));
 
     return 0;
 }
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index 1b2f7eed98..bc37317d55 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -49,7 +49,7 @@ static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status)
     VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
     bool start = (status & VIRTIO_CONFIG_S_DRIVER_OK) && vdev->vm_running;
 
-    if (vsc->dev.started == start) {
+    if (vhost_dev_is_started(&vsc->dev) == start) {
         return;
     }
 
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index d2bebba785..ad0f91c607 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -20,6 +20,7 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
 #include "qemu/error-report.h"
+#include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-user-fs.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
@@ -124,7 +125,7 @@ static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
     VHostUserFS *fs = VHOST_USER_FS(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (fs->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&fs->vhost_dev) == should_start) {
         return;
     }
 
diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
index b930cf6d5e..bc58b6c0d1 100644
--- a/hw/virtio/vhost-user-i2c.c
+++ b/hw/virtio/vhost-user-i2c.c
@@ -95,7 +95,7 @@ static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
     VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (i2c->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&i2c->vhost_dev) == should_start) {
         return;
     }
 
@@ -174,7 +174,7 @@ static void vu_i2c_disconnect(DeviceState *dev)
     }
     i2c->connected = false;
 
-    if (i2c->vhost_dev.started) {
+    if (vhost_dev_is_started(&i2c->vhost_dev)) {
         vu_i2c_stop(vdev);
     }
 }
diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
index a9c1c4bc79..bc1f36c5ac 100644
--- a/hw/virtio/vhost-user-rng.c
+++ b/hw/virtio/vhost-user-rng.c
@@ -92,7 +92,7 @@ static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
     VHostUserRNG *rng = VHOST_USER_RNG(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (rng->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&rng->vhost_dev) == should_start) {
         return;
     }
 
@@ -160,7 +160,7 @@ static void vu_rng_disconnect(DeviceState *dev)
 
     rng->connected = false;
 
-    if (rng->vhost_dev.started) {
+    if (vhost_dev_is_started(&rng->vhost_dev)) {
         vu_rng_stop(vdev);
     }
 }
diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
index 22c1616ebd..7b67e29d83 100644
--- a/hw/virtio/vhost-user-vsock.c
+++ b/hw/virtio/vhost-user-vsock.c
@@ -57,7 +57,7 @@ static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
     bool should_start = virtio_device_started(vdev, status);
 
-    if (vvc->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
         return;
     }
 
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index 7394818e00..29b9ab4f72 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -14,6 +14,7 @@
 #include "hw/virtio/virtio-access.h"
 #include "qemu/error-report.h"
 #include "hw/qdev-properties.h"
+#include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-vsock.h"
 #include "qemu/iov.h"
 #include "monitor/monitor.h"
@@ -199,7 +200,7 @@ int vhost_vsock_common_pre_save(void *opaque)
      * At this point, backend must be stopped, otherwise
      * it might keep writing to memory.
      */
-    assert(!vvc->vhost_dev.started);
+    assert(!vhost_dev_is_started(&vvc->vhost_dev));
 
     return 0;
 }
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 8031c164a5..7dc3c73931 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -73,7 +73,7 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
     bool should_start = virtio_device_started(vdev, status);
     int ret;
 
-    if (vvc->vhost_dev.started == should_start) {
+    if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
         return;
     }
 
-- 
MST


^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 09/55] hw/virtio: add boilerplate for vhost-user-gpio device
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (7 preceding siblings ...)
  2022-10-10 17:29   ` [Virtio-fs] " Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 10/55] hw/virtio: add vhost-user-gpio-pci boilerplate Michael S. Tsirkin
                   ` (47 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Viresh Kumar, Alex Bennée, Vincent Whitchurch

From: Viresh Kumar <viresh.kumar@linaro.org>

This creates the QEMU side of the vhost-user-gpio device which connects
to the remote daemon. It is based of vhost-user-i2c code.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <5390324a748194a21bc99b1538e19761a8c64092.1641987128.git.viresh.kumar@linaro.org>
[AJB: fixes for qtest, tweaks to feature bits]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>

Message-Id: <20220802095010.3330793-13-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/vhost-user-gpio.h |  35 +++
 hw/virtio/vhost-user-gpio.c         | 411 ++++++++++++++++++++++++++++
 MAINTAINERS                         |   7 +
 hw/virtio/Kconfig                   |   5 +
 hw/virtio/meson.build               |   1 +
 hw/virtio/trace-events              |   5 +
 6 files changed, 464 insertions(+)
 create mode 100644 include/hw/virtio/vhost-user-gpio.h
 create mode 100644 hw/virtio/vhost-user-gpio.c

diff --git a/include/hw/virtio/vhost-user-gpio.h b/include/hw/virtio/vhost-user-gpio.h
new file mode 100644
index 0000000000..4fe9aeecc0
--- /dev/null
+++ b/include/hw/virtio/vhost-user-gpio.h
@@ -0,0 +1,35 @@
+/*
+ * Vhost-user GPIO virtio device
+ *
+ * Copyright (c) 2021 Viresh Kumar <viresh.kumar@linaro.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef _QEMU_VHOST_USER_GPIO_H
+#define _QEMU_VHOST_USER_GPIO_H
+
+#include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
+#include "hw/virtio/vhost-user.h"
+#include "standard-headers/linux/virtio_gpio.h"
+#include "chardev/char-fe.h"
+
+#define TYPE_VHOST_USER_GPIO "vhost-user-gpio-device"
+OBJECT_DECLARE_SIMPLE_TYPE(VHostUserGPIO, VHOST_USER_GPIO);
+
+struct VHostUserGPIO {
+    /*< private >*/
+    VirtIODevice parent_obj;
+    CharBackend chardev;
+    struct virtio_gpio_config config;
+    struct vhost_virtqueue *vhost_vq;
+    struct vhost_dev vhost_dev;
+    VhostUserState vhost_user;
+    VirtQueue *command_vq;
+    VirtQueue *interrupt_vq;
+    bool connected;
+    /*< public >*/
+};
+
+#endif /* _QEMU_VHOST_USER_GPIO_H */
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
new file mode 100644
index 0000000000..8b40fe450c
--- /dev/null
+++ b/hw/virtio/vhost-user-gpio.c
@@ -0,0 +1,411 @@
+/*
+ * Vhost-user GPIO virtio device
+ *
+ * Copyright (c) 2022 Viresh Kumar <viresh.kumar@linaro.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/qdev-properties.h"
+#include "hw/virtio/virtio-bus.h"
+#include "hw/virtio/vhost-user-gpio.h"
+#include "qemu/error-report.h"
+#include "standard-headers/linux/virtio_ids.h"
+#include "trace.h"
+
+#define REALIZE_CONNECTION_RETRIES 3
+
+/* Features required from VirtIO */
+static const int feature_bits[] = {
+    VIRTIO_F_VERSION_1,
+    VIRTIO_F_NOTIFY_ON_EMPTY,
+    VIRTIO_RING_F_INDIRECT_DESC,
+    VIRTIO_RING_F_EVENT_IDX,
+    VIRTIO_GPIO_F_IRQ,
+    VHOST_INVALID_FEATURE_BIT
+};
+
+static void vu_gpio_get_config(VirtIODevice *vdev, uint8_t *config)
+{
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+
+    memcpy(config, &gpio->config, sizeof(gpio->config));
+}
+
+static int vu_gpio_config_notifier(struct vhost_dev *dev)
+{
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(dev->vdev);
+
+    memcpy(dev->vdev->config, &gpio->config, sizeof(gpio->config));
+    virtio_notify_config(dev->vdev);
+
+    return 0;
+}
+
+const VhostDevConfigOps gpio_ops = {
+    .vhost_dev_config_notifier = vu_gpio_config_notifier,
+};
+
+static int vu_gpio_start(VirtIODevice *vdev)
+{
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+    struct vhost_dev *vhost_dev = &gpio->vhost_dev;
+    int ret, i;
+
+    if (!k->set_guest_notifiers) {
+        error_report("binding does not support guest notifiers");
+        return -ENOSYS;
+    }
+
+    ret = vhost_dev_enable_notifiers(vhost_dev, vdev);
+    if (ret < 0) {
+        error_report("Error enabling host notifiers: %d", ret);
+        return ret;
+    }
+
+    ret = k->set_guest_notifiers(qbus->parent, vhost_dev->nvqs, true);
+    if (ret < 0) {
+        error_report("Error binding guest notifier: %d", ret);
+        goto err_host_notifiers;
+    }
+
+    /*
+     * Before we start up we need to ensure we have the final feature
+     * set needed for the vhost configuration. The backend may also
+     * apply backend_features when the feature set is sent.
+     */
+    vhost_ack_features(&gpio->vhost_dev, feature_bits, vdev->guest_features);
+
+    ret = vhost_dev_start(&gpio->vhost_dev, vdev);
+    if (ret < 0) {
+        error_report("Error starting vhost-user-gpio: %d", ret);
+        goto err_guest_notifiers;
+    }
+
+    /*
+     * guest_notifier_mask/pending not used yet, so just unmask
+     * everything here. virtio-pci will do the right thing by
+     * enabling/disabling irqfd.
+     */
+    for (i = 0; i < gpio->vhost_dev.nvqs; i++) {
+        vhost_virtqueue_mask(&gpio->vhost_dev, vdev, i, false);
+    }
+
+    /*
+     * As we must have VHOST_USER_F_PROTOCOL_FEATURES (because
+     * VHOST_USER_GET_CONFIG requires it) we need to explicitly enable
+     * the vrings.
+     */
+    g_assert(vhost_dev->vhost_ops &&
+             vhost_dev->vhost_ops->vhost_set_vring_enable);
+    ret = vhost_dev->vhost_ops->vhost_set_vring_enable(vhost_dev, true);
+    if (ret == 0) {
+        return 0;
+    }
+
+    error_report("Failed to start vrings for vhost-user-gpio: %d", ret);
+
+err_guest_notifiers:
+    k->set_guest_notifiers(qbus->parent, gpio->vhost_dev.nvqs, false);
+err_host_notifiers:
+    vhost_dev_disable_notifiers(&gpio->vhost_dev, vdev);
+
+    return ret;
+}
+
+static void vu_gpio_stop(VirtIODevice *vdev)
+{
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    struct vhost_dev *vhost_dev = &gpio->vhost_dev;
+    int ret;
+
+    if (!k->set_guest_notifiers) {
+        return;
+    }
+
+    /*
+     * We can call vu_gpio_stop multiple times, for example from
+     * vm_state_notify and the final object finalisation. Check we
+     * aren't already stopped before doing so.
+     */
+    if (!vhost_dev_is_started(vhost_dev)) {
+        return;
+    }
+
+    vhost_dev_stop(vhost_dev, vdev);
+
+    ret = k->set_guest_notifiers(qbus->parent, vhost_dev->nvqs, false);
+    if (ret < 0) {
+        error_report("vhost guest notifier cleanup failed: %d", ret);
+        return;
+    }
+
+    vhost_dev_disable_notifiers(vhost_dev, vdev);
+}
+
+static void vu_gpio_set_status(VirtIODevice *vdev, uint8_t status)
+{
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+    bool should_start = virtio_device_started(vdev, status);
+
+    trace_virtio_gpio_set_status(status);
+
+    if (!gpio->connected) {
+        return;
+    }
+
+    if (vhost_dev_is_started(&gpio->vhost_dev) == should_start) {
+        return;
+    }
+
+    if (should_start) {
+        if (vu_gpio_start(vdev)) {
+            qemu_chr_fe_disconnect(&gpio->chardev);
+        }
+    } else {
+        vu_gpio_stop(vdev);
+    }
+}
+
+static uint64_t vu_gpio_get_features(VirtIODevice *vdev, uint64_t features,
+                                     Error **errp)
+{
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+
+    return vhost_get_features(&gpio->vhost_dev, feature_bits, features);
+}
+
+static void vu_gpio_handle_output(VirtIODevice *vdev, VirtQueue *vq)
+{
+    /*
+     * Not normally called; it's the daemon that handles the queue;
+     * however virtio's cleanup path can call this.
+     */
+}
+
+static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
+{
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+
+    vhost_virtqueue_mask(&gpio->vhost_dev, vdev, idx, mask);
+}
+
+static void do_vhost_user_cleanup(VirtIODevice *vdev, VHostUserGPIO *gpio)
+{
+    virtio_delete_queue(gpio->command_vq);
+    virtio_delete_queue(gpio->interrupt_vq);
+    g_free(gpio->vhost_dev.vqs);
+    gpio->vhost_dev.vqs = NULL;
+    virtio_cleanup(vdev);
+    vhost_user_cleanup(&gpio->vhost_user);
+}
+
+static int vu_gpio_connect(DeviceState *dev, Error **errp)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+    struct vhost_dev *vhost_dev = &gpio->vhost_dev;
+    int ret;
+
+    if (gpio->connected) {
+        return 0;
+    }
+    gpio->connected = true;
+
+    vhost_dev_set_config_notifier(vhost_dev, &gpio_ops);
+    gpio->vhost_user.supports_config = true;
+
+    ret = vhost_dev_init(vhost_dev, &gpio->vhost_user,
+                         VHOST_BACKEND_TYPE_USER, 0, errp);
+    if (ret < 0) {
+        return ret;
+    }
+
+    /* restore vhost state */
+    if (virtio_device_started(vdev, vdev->status)) {
+        vu_gpio_start(vdev);
+    }
+
+    return 0;
+}
+
+static void vu_gpio_disconnect(DeviceState *dev)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+
+    if (!gpio->connected) {
+        return;
+    }
+    gpio->connected = false;
+
+    vu_gpio_stop(vdev);
+    vhost_dev_cleanup(&gpio->vhost_dev);
+}
+
+static void vu_gpio_event(void *opaque, QEMUChrEvent event)
+{
+    DeviceState *dev = opaque;
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+    Error *local_err = NULL;
+
+    switch (event) {
+    case CHR_EVENT_OPENED:
+        if (vu_gpio_connect(dev, &local_err) < 0) {
+            qemu_chr_fe_disconnect(&gpio->chardev);
+            return;
+        }
+        break;
+    case CHR_EVENT_CLOSED:
+        vu_gpio_disconnect(dev);
+        break;
+    case CHR_EVENT_BREAK:
+    case CHR_EVENT_MUX_IN:
+    case CHR_EVENT_MUX_OUT:
+        /* Ignore */
+        break;
+    }
+}
+
+static int vu_gpio_realize_connect(VHostUserGPIO *gpio, Error **errp)
+{
+    VirtIODevice *vdev = &gpio->parent_obj;
+    DeviceState *dev = &vdev->parent_obj;
+    struct vhost_dev *vhost_dev = &gpio->vhost_dev;
+    int ret;
+
+    ret = qemu_chr_fe_wait_connected(&gpio->chardev, errp);
+    if (ret < 0) {
+        return ret;
+    }
+
+    /*
+     * vu_gpio_connect() may have already connected (via the event
+     * callback) in which case it will just report success.
+     */
+    ret = vu_gpio_connect(dev, errp);
+    if (ret < 0) {
+        qemu_chr_fe_disconnect(&gpio->chardev);
+        return ret;
+    }
+    g_assert(gpio->connected);
+
+    ret = vhost_dev_get_config(vhost_dev, (uint8_t *)&gpio->config,
+                               sizeof(gpio->config), errp);
+
+    if (ret < 0) {
+        error_report("vhost-user-gpio: get config failed");
+
+        qemu_chr_fe_disconnect(&gpio->chardev);
+        vhost_dev_cleanup(vhost_dev);
+        return ret;
+    }
+
+    return 0;
+}
+
+static void vu_gpio_device_realize(DeviceState *dev, Error **errp)
+{
+    ERRP_GUARD();
+
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(dev);
+    int retries, ret;
+
+    if (!gpio->chardev.chr) {
+        error_setg(errp, "vhost-user-gpio: chardev is mandatory");
+        return;
+    }
+
+    if (!vhost_user_init(&gpio->vhost_user, &gpio->chardev, errp)) {
+        return;
+    }
+
+    virtio_init(vdev, VIRTIO_ID_GPIO, sizeof(gpio->config));
+
+    gpio->vhost_dev.nvqs = 2;
+    gpio->command_vq = virtio_add_queue(vdev, 256, vu_gpio_handle_output);
+    gpio->interrupt_vq = virtio_add_queue(vdev, 256, vu_gpio_handle_output);
+    gpio->vhost_dev.vqs = g_new0(struct vhost_virtqueue, gpio->vhost_dev.nvqs);
+
+    gpio->connected = false;
+
+    qemu_chr_fe_set_handlers(&gpio->chardev, NULL, NULL, vu_gpio_event, NULL,
+                             dev, NULL, true);
+
+    retries = REALIZE_CONNECTION_RETRIES;
+    g_assert(!*errp);
+    do {
+        if (*errp) {
+            error_prepend(errp, "Reconnecting after error: ");
+            error_report_err(*errp);
+            *errp = NULL;
+        }
+        ret = vu_gpio_realize_connect(gpio, errp);
+    } while (ret < 0 && retries--);
+
+    if (ret < 0) {
+        do_vhost_user_cleanup(vdev, gpio);
+    }
+
+    return;
+}
+
+static void vu_gpio_device_unrealize(DeviceState *dev)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserGPIO *gpio = VHOST_USER_GPIO(dev);
+
+    vu_gpio_set_status(vdev, 0);
+    qemu_chr_fe_set_handlers(&gpio->chardev, NULL, NULL, NULL, NULL, NULL, NULL,
+                             false);
+    vhost_dev_cleanup(&gpio->vhost_dev);
+    do_vhost_user_cleanup(vdev, gpio);
+}
+
+static const VMStateDescription vu_gpio_vmstate = {
+    .name = "vhost-user-gpio",
+    .unmigratable = 1,
+};
+
+static Property vu_gpio_properties[] = {
+    DEFINE_PROP_CHR("chardev", VHostUserGPIO, chardev),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void vu_gpio_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
+
+    device_class_set_props(dc, vu_gpio_properties);
+    dc->vmsd = &vu_gpio_vmstate;
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+    vdc->realize = vu_gpio_device_realize;
+    vdc->unrealize = vu_gpio_device_unrealize;
+    vdc->get_features = vu_gpio_get_features;
+    vdc->get_config = vu_gpio_get_config;
+    vdc->set_status = vu_gpio_set_status;
+    vdc->guest_notifier_mask = vu_gpio_guest_notifier_mask;
+}
+
+static const TypeInfo vu_gpio_info = {
+    .name = TYPE_VHOST_USER_GPIO,
+    .parent = TYPE_VIRTIO_DEVICE,
+    .instance_size = sizeof(VHostUserGPIO),
+    .class_init = vu_gpio_class_init,
+};
+
+static void vu_gpio_register_types(void)
+{
+    type_register_static(&vu_gpio_info);
+}
+
+type_init(vu_gpio_register_types)
diff --git a/MAINTAINERS b/MAINTAINERS
index e1530b51a2..66d519fe35 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2098,6 +2098,13 @@ F: hw/virtio/vhost-user-rng-pci.c
 F: include/hw/virtio/vhost-user-rng.h
 F: tools/vhost-user-rng/*
 
+vhost-user-gpio
+M: Alex Bennée <alex.bennee@linaro.org>
+R: Viresh Kumar <viresh.kumar@linaro.org>
+S: Maintained
+F: hw/virtio/vhost-user-gpio.c
+F: include/hw/virtio/vhost-user-gpio.h
+
 virtio-crypto
 M: Gonglei <arei.gonglei@huawei.com>
 S: Supported
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index e9ecae1f50..cbfd8c7173 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -80,3 +80,8 @@ config VHOST_USER_FS
     bool
     default y
     depends on VIRTIO && VHOST_USER
+
+config VHOST_USER_GPIO
+    bool
+    default y
+    depends on VIRTIO && VHOST_USER
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index 7e8877fd64..33c8e71fab 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -29,6 +29,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c'))
+virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c'))
 
 virtio_pci_ss = ss.source_set()
 virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'))
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 887ca7afa8..820dadc26c 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -144,3 +144,8 @@ virtio_mem_state_response(uint16_t state) "state=%" PRIu16
 virtio_pmem_flush_request(void) "flush request"
 virtio_pmem_response(void) "flush response"
 virtio_pmem_flush_done(int type) "fsync return=%d"
+
+# virtio-gpio.c
+virtio_gpio_start(void) "start"
+virtio_gpio_stop(void) "stop"
+virtio_gpio_set_status(uint8_t status) "0x%x"
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 10/55] hw/virtio: add vhost-user-gpio-pci boilerplate
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (8 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 09/55] hw/virtio: add boilerplate for vhost-user-gpio device Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 11/55] tests/qtest: pass stdout/stderr down to subtests Michael S. Tsirkin
                   ` (46 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Viresh Kumar, Alex Bennée

From: Viresh Kumar <viresh.kumar@linaro.org>

This allows is to instantiate a vhost-user-gpio device as part of a PCI
bus. It is mostly boilerplate which looks pretty similar to the
vhost-user-fs-pci device.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <5f560cab92d0d789b1c94295ec74b9952907d69d.1641987128.git.viresh.kumar@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20220802095010.3330793-14-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-user-gpio-pci.c | 69 +++++++++++++++++++++++++++++++++
 MAINTAINERS                     |  2 +-
 hw/virtio/meson.build           |  1 +
 3 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 hw/virtio/vhost-user-gpio-pci.c

diff --git a/hw/virtio/vhost-user-gpio-pci.c b/hw/virtio/vhost-user-gpio-pci.c
new file mode 100644
index 0000000000..b3028a24a1
--- /dev/null
+++ b/hw/virtio/vhost-user-gpio-pci.c
@@ -0,0 +1,69 @@
+/*
+ * Vhost-user gpio virtio device PCI glue
+ *
+ * Copyright (c) 2022 Viresh Kumar <viresh.kumar@linaro.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/qdev-properties.h"
+#include "hw/virtio/vhost-user-gpio.h"
+#include "hw/virtio/virtio-pci.h"
+
+struct VHostUserGPIOPCI {
+    VirtIOPCIProxy parent_obj;
+    VHostUserGPIO vdev;
+};
+
+typedef struct VHostUserGPIOPCI VHostUserGPIOPCI;
+
+#define TYPE_VHOST_USER_GPIO_PCI "vhost-user-gpio-pci-base"
+
+DECLARE_INSTANCE_CHECKER(VHostUserGPIOPCI, VHOST_USER_GPIO_PCI,
+                         TYPE_VHOST_USER_GPIO_PCI)
+
+static void vhost_user_gpio_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
+{
+    VHostUserGPIOPCI *dev = VHOST_USER_GPIO_PCI(vpci_dev);
+    DeviceState *vdev = DEVICE(&dev->vdev);
+
+    vpci_dev->nvectors = 1;
+    qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
+}
+
+static void vhost_user_gpio_pci_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
+    PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
+    k->realize = vhost_user_gpio_pci_realize;
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+    pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
+    pcidev_k->device_id = 0; /* Set by virtio-pci based on virtio id */
+    pcidev_k->revision = 0x00;
+    pcidev_k->class_id = PCI_CLASS_COMMUNICATION_OTHER;
+}
+
+static void vhost_user_gpio_pci_instance_init(Object *obj)
+{
+    VHostUserGPIOPCI *dev = VHOST_USER_GPIO_PCI(obj);
+
+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+                                TYPE_VHOST_USER_GPIO);
+}
+
+static const VirtioPCIDeviceTypeInfo vhost_user_gpio_pci_info = {
+    .base_name = TYPE_VHOST_USER_GPIO_PCI,
+    .non_transitional_name = "vhost-user-gpio-pci",
+    .instance_size = sizeof(VHostUserGPIOPCI),
+    .instance_init = vhost_user_gpio_pci_instance_init,
+    .class_init = vhost_user_gpio_pci_class_init,
+};
+
+static void vhost_user_gpio_pci_register(void)
+{
+    virtio_pci_types_register(&vhost_user_gpio_pci_info);
+}
+
+type_init(vhost_user_gpio_pci_register);
diff --git a/MAINTAINERS b/MAINTAINERS
index 66d519fe35..beccce4a7a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2102,7 +2102,7 @@ vhost-user-gpio
 M: Alex Bennée <alex.bennee@linaro.org>
 R: Viresh Kumar <viresh.kumar@linaro.org>
 S: Maintained
-F: hw/virtio/vhost-user-gpio.c
+F: hw/virtio/vhost-user-gpio*
 F: include/hw/virtio/vhost-user-gpio.h
 
 virtio-crypto
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index 33c8e71fab..c14e3db10a 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -30,6 +30,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c'))
+virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c'))
 
 virtio_pci_ss = ss.source_set()
 virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'))
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 11/55] tests/qtest: pass stdout/stderr down to subtests
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (9 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 10/55] hw/virtio: add vhost-user-gpio-pci boilerplate Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 12/55] tests/qtest: add a timeout for subprocess_run_one_test Michael S. Tsirkin
                   ` (45 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

When trying to work out what the virtio-net-tests where doing it was
hard because the g_test_trap_subprocess redirects all output to
/dev/null. Lift this restriction by using the appropriate flags so you
can see something similar to what the vhost-user-blk tests show when
running.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220407150042.2338562-1-alex.bennee@linaro.org>

Message-Id: <20220802095010.3330793-15-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/qos-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c
index 831db5cf2a..33cdada380 100644
--- a/tests/qtest/qos-test.c
+++ b/tests/qtest/qos-test.c
@@ -185,7 +185,9 @@ static void run_one_test(const void *arg)
 static void subprocess_run_one_test(const void *arg)
 {
     const gchar *path = arg;
-    g_test_trap_subprocess(path, 0, 0);
+    g_test_trap_subprocess(path, 0,
+                           G_TEST_SUBPROCESS_INHERIT_STDOUT |
+                           G_TEST_SUBPROCESS_INHERIT_STDERR);
     g_test_trap_assert_passed();
 }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 12/55] tests/qtest: add a timeout for subprocess_run_one_test
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (10 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 11/55] tests/qtest: pass stdout/stderr down to subtests Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 13/55] tests/qtest: use qos_printf instead of g_test_message Michael S. Tsirkin
                   ` (44 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Laurent Vivier, Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

Hangs have been observed in the tests and currently we don't timeout
if a subprocess hangs. Rectify that.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>

Message-Id: <20220802095010.3330793-16-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/qtest/qos-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c
index 33cdada380..566cb3b00b 100644
--- a/tests/qtest/qos-test.c
+++ b/tests/qtest/qos-test.c
@@ -185,7 +185,7 @@ static void run_one_test(const void *arg)
 static void subprocess_run_one_test(const void *arg)
 {
     const gchar *path = arg;
-    g_test_trap_subprocess(path, 0,
+    g_test_trap_subprocess(path, 180 * G_USEC_PER_SEC,
                            G_TEST_SUBPROCESS_INHERIT_STDOUT |
                            G_TEST_SUBPROCESS_INHERIT_STDERR);
     g_test_trap_assert_passed();
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 13/55] tests/qtest: use qos_printf instead of g_test_message
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (11 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 12/55] tests/qtest: add a timeout for subprocess_run_one_test Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 14/55] tests/qtest: catch unhandled vhost-user messages Michael S. Tsirkin
                   ` (43 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

The vhost-user tests respawn qos-test as a standalone process. As a
result the gtester framework squashes all messages coming out of it
which make it hard to debug. As the test does not care about asserting
certain messages just convert the tests to use the direct qos_printf.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-17-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/qos-test.c        |  5 +++++
 tests/qtest/vhost-user-test.c | 13 +++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c
index 566cb3b00b..5da4091ec3 100644
--- a/tests/qtest/qos-test.c
+++ b/tests/qtest/qos-test.c
@@ -321,6 +321,11 @@ static void walk_path(QOSGraphNode *orig_path, int len)
 int main(int argc, char **argv, char** envp)
 {
     g_test_init(&argc, &argv, NULL);
+
+    if (g_test_subprocess()) {
+        qos_printf("qos_test running single test in subprocess\n");
+    }
+
     if (g_test_verbose()) {
         qos_printf("ENVIRONMENT VARIABLES: {\n");
         for (char **env = envp; *env != 0; env++) {
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 84498941a6..99dc6080e5 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -26,6 +26,7 @@
 #include "libqos/virtio-pci.h"
 
 #include "libqos/malloc-pc.h"
+#include "libqos/qgraph_internal.h"
 #include "hw/virtio/virtio-net.h"
 
 #include "standard-headers/linux/vhost_types.h"
@@ -316,7 +317,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
     }
 
     if (size != VHOST_USER_HDR_SIZE) {
-        g_test_message("Wrong message size received %d", size);
+        qos_printf("%s: Wrong message size received %d\n", __func__, size);
         return;
     }
 
@@ -327,8 +328,8 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         p += VHOST_USER_HDR_SIZE;
         size = qemu_chr_fe_read_all(chr, p, msg.size);
         if (size != msg.size) {
-            g_test_message("Wrong message size received %d != %d",
-                           size, msg.size);
+            qos_printf("%s: Wrong message size received %d != %d\n",
+                       __func__, size, msg.size);
             return;
         }
     }
@@ -450,7 +451,7 @@ static const char *init_hugepagefs(void)
     }
 
     if (access(path, R_OK | W_OK | X_OK)) {
-        g_test_message("access on path (%s): %s", path, strerror(errno));
+        qos_printf("access on path (%s): %s", path, strerror(errno));
         g_test_fail();
         return NULL;
     }
@@ -460,13 +461,13 @@ static const char *init_hugepagefs(void)
     } while (ret != 0 && errno == EINTR);
 
     if (ret != 0) {
-        g_test_message("statfs on path (%s): %s", path, strerror(errno));
+        qos_printf("statfs on path (%s): %s", path, strerror(errno));
         g_test_fail();
         return NULL;
     }
 
     if (fs.f_type != HUGETLBFS_MAGIC) {
-        g_test_message("Warning: path not on HugeTLBFS: %s", path);
+        qos_printf("Warning: path not on HugeTLBFS: %s", path);
         g_test_fail();
         return NULL;
     }
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 14/55] tests/qtest: catch unhandled vhost-user messages
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (12 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 13/55] tests/qtest: use qos_printf instead of g_test_message Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 15/55] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES Michael S. Tsirkin
                   ` (42 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

We don't need to action every message but lets document the ones we
are expecting to consume so future tests don't get confused about
unhandled bits.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20220802095010.3330793-18-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/vhost-user-test.c | 43 +++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 99dc6080e5..8d2d4ba535 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -358,12 +358,44 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         }
         break;
 
+    case VHOST_USER_SET_OWNER:
+        /*
+         * We don't need to do anything here, the remote is just
+         * letting us know it is in charge. Just log it.
+         */
+        qos_printf("set_owner: start of session\n");
+        break;
+
     case VHOST_USER_GET_PROTOCOL_FEATURES:
         if (s->vu_ops->get_protocol_features) {
             s->vu_ops->get_protocol_features(s, chr, &msg);
         }
         break;
 
+    case VHOST_USER_SET_PROTOCOL_FEATURES:
+        /*
+         * We did set VHOST_USER_F_PROTOCOL_FEATURES so its valid for
+         * the remote end to send this. There is no handshake reply so
+         * just log the details for debugging.
+         */
+        qos_printf("set_protocol_features: 0x%"PRIx64 "\n", msg.payload.u64);
+        break;
+
+        /*
+         * A real vhost-user backend would actually set the size and
+         * address of the vrings but we can simply report them.
+         */
+    case VHOST_USER_SET_VRING_NUM:
+        qos_printf("set_vring_num: %d/%d\n",
+                   msg.payload.state.index, msg.payload.state.num);
+        break;
+    case VHOST_USER_SET_VRING_ADDR:
+        qos_printf("set_vring_addr: 0x%"PRIx64"/0x%"PRIx64"/0x%"PRIx64"\n",
+                   msg.payload.addr.avail_user_addr,
+                   msg.payload.addr.desc_user_addr,
+                   msg.payload.addr.used_user_addr);
+        break;
+
     case VHOST_USER_GET_VRING_BASE:
         /* send back vring base to qemu */
         msg.flags |= VHOST_USER_REPLY_MASK;
@@ -428,7 +460,18 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size);
         break;
 
+    case VHOST_USER_SET_VRING_ENABLE:
+        /*
+         * Another case we ignore as we don't need to respond. With a
+         * fully functioning vhost-user we would enable/disable the
+         * vring monitoring.
+         */
+        qos_printf("set_vring(%d)=%s\n", msg.payload.state.index,
+                   msg.payload.state.num ? "enabled" : "disabled");
+        break;
+
     default:
+        qos_printf("vhost-user: un-handled message: %d\n", msg.request);
         break;
     }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 15/55] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (13 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 14/55] tests/qtest: catch unhandled vhost-user messages Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 16/55] tests/qtest: add assert to catch bad features Michael S. Tsirkin
                   ` (41 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

checkpatch.pl warns that non-plain asserts should be avoided so
convert the check to a plain g_assert.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-19-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/vhost-user-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 8d2d4ba535..a99f55ed84 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -985,8 +985,7 @@ static void test_multiqueue(void *obj, void *arg, QGuestAllocator *alloc)
 static void vu_net_set_features(TestServer *s, CharBackend *chr,
         VhostUserMsg *msg)
 {
-    g_assert_cmpint(msg->payload.u64 &
-            (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=, 0ULL);
+    g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES));
     if (s->test_flags == TEST_FLAGS_DISCONNECT) {
         qemu_chr_fe_disconnect(chr);
         s->test_flags = TEST_FLAGS_BAD;
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 16/55] tests/qtest: add assert to catch bad features
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (14 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 15/55] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 17/55] tests/qtest: implement stub for VHOST_USER_GET_CONFIG Michael S. Tsirkin
                   ` (40 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

No device driver (which is what the qvirtio_ access functions
represent) should be setting UNUSED(30) in the feature space. Although
existing libqos users mask it out lets ensure nothing sneaks through.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-20-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/libqos/virtio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c
index 09ec09b655..03056e5187 100644
--- a/tests/qtest/libqos/virtio.c
+++ b/tests/qtest/libqos/virtio.c
@@ -101,6 +101,8 @@ uint64_t qvirtio_get_features(QVirtioDevice *d)
 
 void qvirtio_set_features(QVirtioDevice *d, uint64_t features)
 {
+    g_assert(!(features & QVIRTIO_F_BAD_FEATURE));
+
     d->features = features;
     d->bus->set_features(d, features);
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 17/55] tests/qtest: implement stub for VHOST_USER_GET_CONFIG
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (15 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 16/55] tests/qtest: add assert to catch bad features Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:29 ` [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test Michael S. Tsirkin
                   ` (39 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

We don't implement the full solution because frankly none of the tests
need to at the moment. We may end up re-implementing libvhostuser in
the end.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-21-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/vhost-user-test.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index a99f55ed84..3052386634 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -79,6 +79,8 @@ typedef enum VhostUserRequest {
     VHOST_USER_SET_PROTOCOL_FEATURES = 16,
     VHOST_USER_GET_QUEUE_NUM = 17,
     VHOST_USER_SET_VRING_ENABLE = 18,
+    VHOST_USER_GET_CONFIG = 24,
+    VHOST_USER_SET_CONFIG = 25,
     VHOST_USER_MAX
 } VhostUserRequest;
 
@@ -372,6 +374,17 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         }
         break;
 
+    case VHOST_USER_GET_CONFIG:
+        /*
+         * Treat GET_CONFIG as a NOP and just reply and let the guest
+         * consider we have updated its memory. Tests currently don't
+         * require working configs.
+         */
+        msg.flags |= VHOST_USER_REPLY_MASK;
+        p = (uint8_t *) &msg;
+        qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size);
+        break;
+
     case VHOST_USER_SET_PROTOCOL_FEATURES:
         /*
          * We did set VHOST_USER_F_PROTOCOL_FEATURES so its valid for
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (16 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 17/55] tests/qtest: implement stub for VHOST_USER_GET_CONFIG Michael S. Tsirkin
@ 2022-10-10 17:29 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 19/55] tests/qtest: enable tests for virtio-gpio Michael S. Tsirkin
                   ` (38 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Thomas Huth, Laurent Vivier,
	Paolo Bonzini

From: Alex Bennée <alex.bennee@linaro.org>

As we expand this test for more virtio devices we will need to support
different feature sets. Add a mandatory op field to fetch the list of
features needed for the test itself.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220802095010.3330793-22-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/vhost-user-test.c | 37 +++++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 3052386634..4f4fcc09f5 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -171,10 +171,11 @@ struct vhost_user_ops {
             const char *chr_opts);
 
     /* VHOST-USER commands. */
+    uint64_t (*get_features)(TestServer *s);
     void (*set_features)(TestServer *s, CharBackend *chr,
-            VhostUserMsg *msg);
+                         VhostUserMsg *msg);
     void (*get_protocol_features)(TestServer *s,
-            CharBackend *chr, VhostUserMsg *msg);
+                                  CharBackend *chr, VhostUserMsg *msg);
 };
 
 static const char *init_hugepagefs(void);
@@ -338,20 +339,22 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
 
     switch (msg.request) {
     case VHOST_USER_GET_FEATURES:
+        /* Mandatory for tests to define get_features */
+        g_assert(s->vu_ops->get_features);
+
         /* send back features to qemu */
         msg.flags |= VHOST_USER_REPLY_MASK;
         msg.size = sizeof(m.payload.u64);
-        msg.payload.u64 = 0x1ULL << VHOST_F_LOG_ALL |
-            0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
-        if (s->queues > 1) {
-            msg.payload.u64 |= 0x1ULL << VIRTIO_NET_F_MQ;
-        }
+
         if (s->test_flags >= TEST_FLAGS_BAD) {
             msg.payload.u64 = 0;
             s->test_flags = TEST_FLAGS_END;
+        } else {
+            msg.payload.u64 = s->vu_ops->get_features(s);
         }
-        p = (uint8_t *) &msg;
-        qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size);
+
+        qemu_chr_fe_write_all(chr, (uint8_t *) &msg,
+                              VHOST_USER_HDR_SIZE + msg.size);
         break;
 
     case VHOST_USER_SET_FEATURES:
@@ -995,8 +998,21 @@ static void test_multiqueue(void *obj, void *arg, QGuestAllocator *alloc)
     wait_for_rings_started(s, s->queues * 2);
 }
 
+
+static uint64_t vu_net_get_features(TestServer *s)
+{
+    uint64_t features = 0x1ULL << VHOST_F_LOG_ALL |
+        0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
+
+    if (s->queues > 1) {
+        features |= 0x1ULL << VIRTIO_NET_F_MQ;
+    }
+
+    return features;
+}
+
 static void vu_net_set_features(TestServer *s, CharBackend *chr,
-        VhostUserMsg *msg)
+                                VhostUserMsg *msg)
 {
     g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES));
     if (s->test_flags == TEST_FLAGS_DISCONNECT) {
@@ -1025,6 +1041,7 @@ static struct vhost_user_ops g_vu_net_ops = {
 
     .append_opts = append_vhost_net_opts,
 
+    .get_features = vu_net_get_features,
     .set_features = vu_net_set_features,
     .get_protocol_features = vu_net_get_protocol_features,
 };
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 19/55] tests/qtest: enable tests for virtio-gpio
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (17 preceding siblings ...)
  2022-10-10 17:29 ` [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 20/55] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size Michael S. Tsirkin
                   ` (37 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Viresh Kumar, Paolo Bonzini,
	Eric Auger, Thomas Huth, Laurent Vivier

From: Alex Bennée <alex.bennee@linaro.org>

We don't have a virtio-gpio implementation in QEMU and only
support a vhost-user backend. The QEMU side of the code is minimal so
it should be enough to instantiate the device and pass some vhost-user
messages over the control socket. To do this we hook into the existing
vhost-user-test code and just add the bits required for gpio.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Eric Auger <eric.auger@redhat.com>
Message-Id: <20220408155704.2777166-1-alex.bennee@linaro.org>

Message-Id: <20220802095010.3330793-23-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/libqos/virtio-gpio.h |  35 +++++++
 tests/qtest/libqos/virtio-gpio.c | 171 +++++++++++++++++++++++++++++++
 tests/qtest/libqos/virtio.c      |   2 +-
 tests/qtest/vhost-user-test.c    |  66 ++++++++++++
 MAINTAINERS                      |   1 +
 tests/qtest/libqos/meson.build   |   1 +
 6 files changed, 275 insertions(+), 1 deletion(-)
 create mode 100644 tests/qtest/libqos/virtio-gpio.h
 create mode 100644 tests/qtest/libqos/virtio-gpio.c

diff --git a/tests/qtest/libqos/virtio-gpio.h b/tests/qtest/libqos/virtio-gpio.h
new file mode 100644
index 0000000000..f11d41bd19
--- /dev/null
+++ b/tests/qtest/libqos/virtio-gpio.h
@@ -0,0 +1,35 @@
+/*
+ * virtio-gpio structures
+ *
+ * Copyright (c) 2022 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef TESTS_LIBQOS_VIRTIO_GPIO_H
+#define TESTS_LIBQOS_VIRTIO_GPIO_H
+
+#include "qgraph.h"
+#include "virtio.h"
+#include "virtio-pci.h"
+
+typedef struct QVhostUserGPIO QVhostUserGPIO;
+typedef struct QVhostUserGPIOPCI QVhostUserGPIOPCI;
+typedef struct QVhostUserGPIODevice QVhostUserGPIODevice;
+
+struct QVhostUserGPIO {
+    QVirtioDevice *vdev;
+    QVirtQueue **queues;
+};
+
+struct QVhostUserGPIOPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVhostUserGPIO gpio;
+};
+
+struct QVhostUserGPIODevice {
+    QOSGraphObject obj;
+    QVhostUserGPIO gpio;
+};
+
+#endif
diff --git a/tests/qtest/libqos/virtio-gpio.c b/tests/qtest/libqos/virtio-gpio.c
new file mode 100644
index 0000000000..762aa6695b
--- /dev/null
+++ b/tests/qtest/libqos/virtio-gpio.c
@@ -0,0 +1,171 @@
+/*
+ * virtio-gpio nodes for testing
+ *
+ * Copyright (c) 2022 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "standard-headers/linux/virtio_config.h"
+#include "../libqtest.h"
+#include "qemu/module.h"
+#include "qgraph.h"
+#include "virtio-gpio.h"
+
+static QGuestAllocator *alloc;
+
+static void virtio_gpio_cleanup(QVhostUserGPIO *gpio)
+{
+    QVirtioDevice *vdev = gpio->vdev;
+    int i;
+
+    for (i = 0; i < 2; i++) {
+        qvirtqueue_cleanup(vdev->bus, gpio->queues[i], alloc);
+    }
+    g_free(gpio->queues);
+}
+
+/*
+ * This handles the VirtIO setup from the point of view of the driver
+ * frontend and therefor doesn't present any vhost specific features
+ * and in fact masks of the re-used bit.
+ */
+static void virtio_gpio_setup(QVhostUserGPIO *gpio)
+{
+    QVirtioDevice *vdev = gpio->vdev;
+    uint64_t features;
+    int i;
+
+    features = qvirtio_get_features(vdev);
+    features &= ~QVIRTIO_F_BAD_FEATURE;
+    qvirtio_set_features(vdev, features);
+
+    gpio->queues = g_new(QVirtQueue *, 2);
+    for (i = 0; i < 2; i++) {
+        gpio->queues[i] = qvirtqueue_setup(vdev, alloc, i);
+    }
+    qvirtio_set_driver_ok(vdev);
+}
+
+static void *qvirtio_gpio_get_driver(QVhostUserGPIO *v_gpio,
+                                     const char *interface)
+{
+    if (!g_strcmp0(interface, "vhost-user-gpio")) {
+        return v_gpio;
+    }
+    if (!g_strcmp0(interface, "virtio")) {
+        return v_gpio->vdev;
+    }
+
+    g_assert_not_reached();
+}
+
+static void *qvirtio_gpio_device_get_driver(void *object,
+                                            const char *interface)
+{
+    QVhostUserGPIODevice *v_gpio = object;
+    return qvirtio_gpio_get_driver(&v_gpio->gpio, interface);
+}
+
+/* virtio-gpio (mmio) */
+static void qvirtio_gpio_device_destructor(QOSGraphObject *obj)
+{
+    QVhostUserGPIODevice *gpio_dev = (QVhostUserGPIODevice *) obj;
+    virtio_gpio_cleanup(&gpio_dev->gpio);
+}
+
+static void qvirtio_gpio_device_start_hw(QOSGraphObject *obj)
+{
+    QVhostUserGPIODevice *gpio_dev = (QVhostUserGPIODevice *) obj;
+    virtio_gpio_setup(&gpio_dev->gpio);
+}
+
+static void *virtio_gpio_device_create(void *virtio_dev,
+                                       QGuestAllocator *t_alloc,
+                                       void *addr)
+{
+    QVhostUserGPIODevice *virtio_device = g_new0(QVhostUserGPIODevice, 1);
+    QVhostUserGPIO *interface = &virtio_device->gpio;
+
+    interface->vdev = virtio_dev;
+    alloc = t_alloc;
+
+    virtio_device->obj.get_driver = qvirtio_gpio_device_get_driver;
+    virtio_device->obj.start_hw = qvirtio_gpio_device_start_hw;
+    virtio_device->obj.destructor = qvirtio_gpio_device_destructor;
+
+    return &virtio_device->obj;
+}
+
+/* virtio-gpio-pci */
+static void qvirtio_gpio_pci_destructor(QOSGraphObject *obj)
+{
+    QVhostUserGPIOPCI *gpio_pci = (QVhostUserGPIOPCI *) obj;
+    QOSGraphObject *pci_vobj =  &gpio_pci->pci_vdev.obj;
+
+    virtio_gpio_cleanup(&gpio_pci->gpio);
+    qvirtio_pci_destructor(pci_vobj);
+}
+
+static void qvirtio_gpio_pci_start_hw(QOSGraphObject *obj)
+{
+    QVhostUserGPIOPCI *gpio_pci = (QVhostUserGPIOPCI *) obj;
+    QOSGraphObject *pci_vobj =  &gpio_pci->pci_vdev.obj;
+
+    qvirtio_pci_start_hw(pci_vobj);
+    virtio_gpio_setup(&gpio_pci->gpio);
+}
+
+static void *qvirtio_gpio_pci_get_driver(void *object, const char *interface)
+{
+    QVhostUserGPIOPCI *v_gpio = object;
+
+    if (!g_strcmp0(interface, "pci-device")) {
+        return v_gpio->pci_vdev.pdev;
+    }
+    return qvirtio_gpio_get_driver(&v_gpio->gpio, interface);
+}
+
+static void *virtio_gpio_pci_create(void *pci_bus, QGuestAllocator *t_alloc,
+                                    void *addr)
+{
+    QVhostUserGPIOPCI *virtio_spci = g_new0(QVhostUserGPIOPCI, 1);
+    QVhostUserGPIO *interface = &virtio_spci->gpio;
+    QOSGraphObject *obj = &virtio_spci->pci_vdev.obj;
+
+    virtio_pci_init(&virtio_spci->pci_vdev, pci_bus, addr);
+    interface->vdev = &virtio_spci->pci_vdev.vdev;
+    alloc = t_alloc;
+
+    obj->get_driver = qvirtio_gpio_pci_get_driver;
+    obj->start_hw = qvirtio_gpio_pci_start_hw;
+    obj->destructor = qvirtio_gpio_pci_destructor;
+
+    return obj;
+}
+
+static void virtio_gpio_register_nodes(void)
+{
+    QPCIAddress addr = {
+        .devfn = QPCI_DEVFN(4, 0),
+    };
+
+    QOSGraphEdgeOptions edge_opts = { };
+
+    /* vhost-user-gpio-device */
+    edge_opts.extra_device_opts = "id=gpio0,chardev=chr-vhost-user-test";
+    qos_node_create_driver("vhost-user-gpio-device",
+                            virtio_gpio_device_create);
+    qos_node_consumes("vhost-user-gpio-device", "virtio-bus", &edge_opts);
+    qos_node_produces("vhost-user-gpio-device", "vhost-user-gpio");
+
+    /* virtio-gpio-pci */
+    edge_opts.extra_device_opts = "id=gpio0,addr=04.0,chardev=chr-vhost-user-test";
+    add_qpci_address(&edge_opts, &addr);
+    qos_node_create_driver("vhost-user-gpio-pci", virtio_gpio_pci_create);
+    qos_node_consumes("vhost-user-gpio-pci", "pci-bus", &edge_opts);
+    qos_node_produces("vhost-user-gpio-pci", "vhost-user-gpio");
+}
+
+libqos_init(virtio_gpio_register_nodes);
diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c
index 03056e5187..410513225f 100644
--- a/tests/qtest/libqos/virtio.c
+++ b/tests/qtest/libqos/virtio.c
@@ -110,7 +110,7 @@ void qvirtio_set_features(QVirtioDevice *d, uint64_t features)
      * This could be a separate function for drivers that want to access
      * configuration space before setting FEATURES_OK, but no existing users
      * need that and it's less code for callers if this is done implicitly.
-    */
+     */
     if (features & (1ull << VIRTIO_F_VERSION_1)) {
         uint8_t status = d->bus->get_status(d) |
                          VIRTIO_CONFIG_S_FEATURES_OK;
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 4f4fcc09f5..e8d2da7228 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -32,6 +32,7 @@
 #include "standard-headers/linux/vhost_types.h"
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_net.h"
+#include "standard-headers/linux/virtio_gpio.h"
 
 #ifdef CONFIG_LINUX
 #include <sys/vfs.h>
@@ -53,9 +54,12 @@
 #define VHOST_MAX_VIRTQUEUES    0x100
 
 #define VHOST_USER_F_PROTOCOL_FEATURES 30
+#define VIRTIO_F_VERSION_1 32
+
 #define VHOST_USER_PROTOCOL_F_MQ 0
 #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1
 #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN   6
+#define VHOST_USER_PROTOCOL_F_CONFIG 9
 
 #define VHOST_LOG_PAGE 0x1000
 
@@ -140,6 +144,7 @@ enum {
 
 enum {
     VHOST_USER_NET,
+    VHOST_USER_GPIO,
 };
 
 typedef struct TestServer {
@@ -198,6 +203,19 @@ static void append_vhost_net_opts(TestServer *s, GString *cmd_line,
                            chr_opts, s->chr_name);
 }
 
+/*
+ * For GPIO there are no other magic devices we need to add (like
+ * block or netdev) so all we need to worry about is the vhost-user
+ * chardev socket.
+ */
+static void append_vhost_gpio_opts(TestServer *s, GString *cmd_line,
+                             const char *chr_opts)
+{
+    g_string_append_printf(cmd_line, QEMU_CMD_CHR,
+                           s->chr_name, s->socket_path,
+                           chr_opts);
+}
+
 static void append_mem_opts(TestServer *server, GString *cmd_line,
                             int size, enum test_memfd memfd)
 {
@@ -1090,3 +1108,51 @@ static void register_vhost_user_test(void)
                  test_multiqueue, &opts);
 }
 libqos_init(register_vhost_user_test);
+
+static uint64_t vu_gpio_get_features(TestServer *s)
+{
+    return 0x1ULL << VIRTIO_F_VERSION_1 |
+        0x1ULL << VIRTIO_GPIO_F_IRQ |
+        0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
+}
+
+/*
+ * This stub can't handle all the message types but we should reply
+ * that we support VHOST_USER_PROTOCOL_F_CONFIG as gpio would use it
+ * talking to a read vhost-user daemon.
+ */
+static void vu_gpio_get_protocol_features(TestServer *s, CharBackend *chr,
+                                          VhostUserMsg *msg)
+{
+    /* send back features to qemu */
+    msg->flags |= VHOST_USER_REPLY_MASK;
+    msg->size = sizeof(m.payload.u64);
+    msg->payload.u64 = 1ULL << VHOST_USER_PROTOCOL_F_CONFIG;
+
+    qemu_chr_fe_write_all(chr, (uint8_t *)msg, VHOST_USER_HDR_SIZE + msg->size);
+}
+
+static struct vhost_user_ops g_vu_gpio_ops = {
+    .type = VHOST_USER_GPIO,
+
+    .append_opts = append_vhost_gpio_opts,
+
+    .get_features = vu_gpio_get_features,
+    .set_features = vu_net_set_features,
+    .get_protocol_features = vu_gpio_get_protocol_features,
+};
+
+static void register_vhost_gpio_test(void)
+{
+    QOSGraphTestOptions opts = {
+        .before = vhost_user_test_setup,
+        .subprocess = true,
+        .arg = &g_vu_gpio_ops,
+    };
+
+    qemu_add_opts(&qemu_chardev_opts);
+
+    qos_add_test("read-guest-mem/memfile",
+                 "vhost-user-gpio", test_read_guest_mem, &opts);
+}
+libqos_init(register_vhost_gpio_test);
diff --git a/MAINTAINERS b/MAINTAINERS
index beccce4a7a..d0c0c8a55b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2104,6 +2104,7 @@ R: Viresh Kumar <viresh.kumar@linaro.org>
 S: Maintained
 F: hw/virtio/vhost-user-gpio*
 F: include/hw/virtio/vhost-user-gpio.h
+F: tests/qtest/libqos/virtio-gpio.*
 
 virtio-crypto
 M: Gonglei <arei.gonglei@huawei.com>
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
index cff83c86d9..a5b6d5197a 100644
--- a/tests/qtest/libqos/meson.build
+++ b/tests/qtest/libqos/meson.build
@@ -45,6 +45,7 @@ libqos_srcs = files(
         'virtio-scsi.c',
         'virtio-serial.c',
         'virtio-iommu.c',
+        'virtio-gpio.c',
         'generic-pcihost.c',
 
         # qgraph machines:
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 20/55] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (18 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 19/55] tests/qtest: enable tests for virtio-gpio Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 21/55] virtio-blk: move config size params to virtio-blk-common Michael S. Tsirkin
                   ` (36 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniil Tatianin, Raphael Norwitz, Stefan Hajnoczi,
	Kevin Wolf, Hanna Reitz, Jason Wang, qemu-block

From: Daniil Tatianin <d-tatianin@yandex-team.ru>

This is the first step towards moving all device config size calculation
logic into the virtio core code. In particular, this adds a struct that
contains all the necessary information for common virtio code to be able
to calculate the final config size for a device. This is expected to be
used with the new virtio_get_config_size helper, which calculates the
final length based on the provided host features.

This builds on top of already existing code like VirtIOFeature and
virtio_feature_get_config_size(), but adds additional fields, as well as
sanity checking so that device-specifc code doesn't have to duplicate it.

An example usage would be:

    static const VirtIOFeature dev_features[] = {
        {.flags = 1ULL << FEATURE_1_BIT,
         .end = endof(struct virtio_dev_config, feature_1)},
        {.flags = 1ULL << FEATURE_2_BIT,
         .end = endof(struct virtio_dev_config, feature_2)},
        {}
    };

    static const VirtIOConfigSizeParams dev_cfg_size_params = {
        .min_size = DEV_BASE_CONFIG_SIZE,
        .max_size = sizeof(struct virtio_dev_config),
        .feature_sizes = dev_features
    };

    // code inside my_dev_device_realize()
    size_t config_size = virtio_get_config_size(&dev_cfg_size_params,
                                                host_features);
    virtio_init(vdev, VIRTIO_ID_MYDEV, config_size);

Currently every device is expected to write its own boilerplate from the
example above in device_realize(), however, the next step of this
transition is moving VirtIOConfigSizeParams into VirtioDeviceClass,
so that it can be done automatically by the virtio initialization code.

All of the users of virtio_feature_get_config_size have been converted
to use virtio_get_config_size so it's no longer needed and is removed
with this commit.

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Message-Id: <20220906073111.353245-2-d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h | 10 ++++++++--
 hw/block/virtio-blk.c      | 16 +++++++---------
 hw/net/virtio-net.c        |  9 +++++++--
 hw/virtio/virtio.c         | 10 ++++++----
 4 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 74e7ad5a92..cecfb7c552 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -49,8 +49,14 @@ typedef struct VirtIOFeature {
     size_t end;
 } VirtIOFeature;
 
-size_t virtio_feature_get_config_size(const VirtIOFeature *features,
-                                      uint64_t host_features);
+typedef struct VirtIOConfigSizeParams {
+    size_t min_size;
+    size_t max_size;
+    const VirtIOFeature *feature_sizes;
+} VirtIOConfigSizeParams;
+
+size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
+                              uint64_t host_features);
 
 typedef struct VirtQueue VirtQueue;
 
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index e9ba752f6b..10c47c2934 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -49,13 +49,11 @@ static const VirtIOFeature feature_sizes[] = {
     {}
 };
 
-static void virtio_blk_set_config_size(VirtIOBlock *s, uint64_t host_features)
-{
-    s->config_size = MAX(VIRTIO_BLK_CFG_SIZE,
-        virtio_feature_get_config_size(feature_sizes, host_features));
-
-    assert(s->config_size <= sizeof(struct virtio_blk_config));
-}
+static const VirtIOConfigSizeParams cfg_size_params = {
+    .min_size = VIRTIO_BLK_CFG_SIZE,
+    .max_size = sizeof(struct virtio_blk_config),
+    .feature_sizes = feature_sizes
+};
 
 static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
                                     VirtIOBlockReq *req)
@@ -1204,8 +1202,8 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    virtio_blk_set_config_size(s, s->host_features);
-
+    s->config_size = virtio_get_config_size(&cfg_size_params,
+                                            s->host_features);
     virtio_init(vdev, VIRTIO_ID_BLOCK, s->config_size);
 
     s->blk = conf->conf.blk;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 63a8332cd0..e9f696b4cf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -106,6 +106,12 @@ static const VirtIOFeature feature_sizes[] = {
     {}
 };
 
+static const VirtIOConfigSizeParams cfg_size_params = {
+    .min_size = endof(struct virtio_net_config, mac),
+    .max_size = sizeof(struct virtio_net_config),
+    .feature_sizes = feature_sizes
+};
+
 static VirtIONetQueue *virtio_net_get_subqueue(NetClientState *nc)
 {
     VirtIONet *n = qemu_get_nic_opaque(nc);
@@ -3241,8 +3247,7 @@ static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
 {
     virtio_add_feature(&host_features, VIRTIO_NET_F_MAC);
 
-    n->config_size = virtio_feature_get_config_size(feature_sizes,
-                                                    host_features);
+    n->config_size = virtio_get_config_size(&cfg_size_params, host_features);
 }
 
 void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 97a6307c0f..2cc1d7d24a 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3006,11 +3006,12 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
     return ret;
 }
 
-size_t virtio_feature_get_config_size(const VirtIOFeature *feature_sizes,
-                                      uint64_t host_features)
+size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
+                              uint64_t host_features)
 {
-    size_t config_size = 0;
-    int i;
+    size_t config_size = params->min_size;
+    const VirtIOFeature *feature_sizes = params->feature_sizes;
+    size_t i;
 
     for (i = 0; feature_sizes[i].flags != 0; i++) {
         if (host_features & feature_sizes[i].flags) {
@@ -3018,6 +3019,7 @@ size_t virtio_feature_get_config_size(const VirtIOFeature *feature_sizes,
         }
     }
 
+    assert(config_size <= params->max_size);
     return config_size;
 }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 21/55] virtio-blk: move config size params to virtio-blk-common
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (19 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 20/55] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 22/55] vhost-user-blk: make it possible to disable write-zeroes/discard Michael S. Tsirkin
                   ` (35 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniil Tatianin, Raphael Norwitz, Kevin Wolf,
	Hanna Reitz, Stefan Hajnoczi, qemu-block

From: Daniil Tatianin <d-tatianin@yandex-team.ru>

This way we can reuse it for other virtio-blk devices, e.g
vhost-user-blk, which currently does not control its config space size
dynamically.

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20220906073111.353245-3-d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio-blk-common.h | 20 ++++++++++++++
 hw/block/virtio-blk-common.c          | 39 +++++++++++++++++++++++++++
 hw/block/virtio-blk.c                 | 24 ++---------------
 MAINTAINERS                           |  2 ++
 hw/block/meson.build                  |  2 +-
 5 files changed, 64 insertions(+), 23 deletions(-)
 create mode 100644 include/hw/virtio/virtio-blk-common.h
 create mode 100644 hw/block/virtio-blk-common.c

diff --git a/include/hw/virtio/virtio-blk-common.h b/include/hw/virtio/virtio-blk-common.h
new file mode 100644
index 0000000000..31daada3e3
--- /dev/null
+++ b/include/hw/virtio/virtio-blk-common.h
@@ -0,0 +1,20 @@
+/*
+ * Virtio Block Device common helpers
+ *
+ * Copyright IBM, Corp. 2007
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef VIRTIO_BLK_COMMON_H
+#define VIRTIO_BLK_COMMON_H
+
+#include "hw/virtio/virtio.h"
+
+extern const VirtIOConfigSizeParams virtio_blk_cfg_size_params;
+
+#endif
diff --git a/hw/block/virtio-blk-common.c b/hw/block/virtio-blk-common.c
new file mode 100644
index 0000000000..ac52d7c176
--- /dev/null
+++ b/hw/block/virtio-blk-common.c
@@ -0,0 +1,39 @@
+/*
+ * Virtio Block Device common helpers
+ *
+ * Copyright IBM, Corp. 2007
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+
+#include "standard-headers/linux/virtio_blk.h"
+#include "hw/virtio/virtio.h"
+#include "hw/virtio/virtio-blk-common.h"
+
+/* Config size before the discard support (hide associated config fields) */
+#define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \
+                                     max_discard_sectors)
+
+/*
+ * Starting from the discard feature, we can use this array to properly
+ * set the config size depending on the features enabled.
+ */
+static const VirtIOFeature feature_sizes[] = {
+    {.flags = 1ULL << VIRTIO_BLK_F_DISCARD,
+     .end = endof(struct virtio_blk_config, discard_sector_alignment)},
+    {.flags = 1ULL << VIRTIO_BLK_F_WRITE_ZEROES,
+     .end = endof(struct virtio_blk_config, write_zeroes_may_unmap)},
+    {}
+};
+
+const VirtIOConfigSizeParams virtio_blk_cfg_size_params = {
+    .min_size = VIRTIO_BLK_CFG_SIZE,
+    .max_size = sizeof(struct virtio_blk_config),
+    .feature_sizes = feature_sizes
+};
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 10c47c2934..8131ec2dbc 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -32,29 +32,9 @@
 #include "hw/virtio/virtio-bus.h"
 #include "migration/qemu-file-types.h"
 #include "hw/virtio/virtio-access.h"
+#include "hw/virtio/virtio-blk-common.h"
 #include "qemu/coroutine.h"
 
-/* Config size before the discard support (hide associated config fields) */
-#define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \
-                                     max_discard_sectors)
-/*
- * Starting from the discard feature, we can use this array to properly
- * set the config size depending on the features enabled.
- */
-static const VirtIOFeature feature_sizes[] = {
-    {.flags = 1ULL << VIRTIO_BLK_F_DISCARD,
-     .end = endof(struct virtio_blk_config, discard_sector_alignment)},
-    {.flags = 1ULL << VIRTIO_BLK_F_WRITE_ZEROES,
-     .end = endof(struct virtio_blk_config, write_zeroes_may_unmap)},
-    {}
-};
-
-static const VirtIOConfigSizeParams cfg_size_params = {
-    .min_size = VIRTIO_BLK_CFG_SIZE,
-    .max_size = sizeof(struct virtio_blk_config),
-    .feature_sizes = feature_sizes
-};
-
 static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
                                     VirtIOBlockReq *req)
 {
@@ -1202,7 +1182,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    s->config_size = virtio_get_config_size(&cfg_size_params,
+    s->config_size = virtio_get_config_size(&virtio_blk_cfg_size_params,
                                             s->host_features);
     virtio_init(vdev, VIRTIO_ID_BLOCK, s->config_size);
 
diff --git a/MAINTAINERS b/MAINTAINERS
index d0c0c8a55b..05b75805eb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2030,8 +2030,10 @@ virtio-blk
 M: Stefan Hajnoczi <stefanha@redhat.com>
 L: qemu-block@nongnu.org
 S: Supported
+F: hw/block/virtio-blk-common.c
 F: hw/block/virtio-blk.c
 F: hw/block/dataplane/*
+F: include/hw/virtio/virtio-blk-common.h
 F: tests/qtest/virtio-blk-test.c
 T: git https://github.com/stefanha/qemu.git block
 
diff --git a/hw/block/meson.build b/hw/block/meson.build
index 2389326112..8ee1f1f850 100644
--- a/hw/block/meson.build
+++ b/hw/block/meson.build
@@ -16,7 +16,7 @@ softmmu_ss.add(when: 'CONFIG_SWIM', if_true: files('swim.c'))
 softmmu_ss.add(when: 'CONFIG_XEN', if_true: files('xen-block.c'))
 softmmu_ss.add(when: 'CONFIG_TC58128', if_true: files('tc58128.c'))
 
-specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c'))
+specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c', 'virtio-blk-common.c'))
 specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk.c'))
 
 subdir('dataplane')
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 22/55] vhost-user-blk: make it possible to disable write-zeroes/discard
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (20 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 21/55] virtio-blk: move config size params to virtio-blk-common Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 23/55] vhost-user-blk: make 'config_wce' part of 'host_features' Michael S. Tsirkin
                   ` (34 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniil Tatianin, Raphael Norwitz, Kevin Wolf,
	Hanna Reitz, qemu-block

From: Daniil Tatianin <d-tatianin@yandex-team.ru>

It is useful to have the ability to disable these features for
compatibility with older VMs that don't have these implemented.

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20220906073111.353245-4-d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/block/vhost-user-blk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 2bba42478d..92bfe56b45 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -259,8 +259,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
     virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
     virtio_add_feature(&features, VIRTIO_BLK_F_FLUSH);
     virtio_add_feature(&features, VIRTIO_BLK_F_RO);
-    virtio_add_feature(&features, VIRTIO_BLK_F_DISCARD);
-    virtio_add_feature(&features, VIRTIO_BLK_F_WRITE_ZEROES);
 
     if (s->config_wce) {
         virtio_add_feature(&features, VIRTIO_BLK_F_CONFIG_WCE);
@@ -598,6 +596,10 @@ static Property vhost_user_blk_properties[] = {
                        VHOST_USER_BLK_AUTO_NUM_QUEUES),
     DEFINE_PROP_UINT32("queue-size", VHostUserBlk, queue_size, 128),
     DEFINE_PROP_BIT("config-wce", VHostUserBlk, config_wce, 0, true),
+    DEFINE_PROP_BIT64("discard", VHostUserBlk, parent_obj.host_features,
+                      VIRTIO_BLK_F_DISCARD, true),
+    DEFINE_PROP_BIT64("write-zeroes", VHostUserBlk, parent_obj.host_features,
+                      VIRTIO_BLK_F_WRITE_ZEROES, true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 23/55] vhost-user-blk: make 'config_wce' part of 'host_features'
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (21 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 22/55] vhost-user-blk: make it possible to disable write-zeroes/discard Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 24/55] vhost-user-blk: dynamically resize config space based on features Michael S. Tsirkin
                   ` (33 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniil Tatianin, Raphael Norwitz, Kevin Wolf,
	Hanna Reitz, qemu-block

From: Daniil Tatianin <d-tatianin@yandex-team.ru>

No reason to have this be a separate field. This also makes it more akin
to what the virtio-blk device does.

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20220906073111.353245-5-d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/vhost-user-blk.h | 1 -
 hw/block/vhost-user-blk.c          | 6 ++----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-user-blk.h
index 7c91f15040..ea085ee1ed 100644
--- a/include/hw/virtio/vhost-user-blk.h
+++ b/include/hw/virtio/vhost-user-blk.h
@@ -34,7 +34,6 @@ struct VHostUserBlk {
     struct virtio_blk_config blkcfg;
     uint16_t num_queues;
     uint32_t queue_size;
-    uint32_t config_wce;
     struct vhost_dev dev;
     struct vhost_inflight *inflight;
     VhostUserState vhost_user;
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 92bfe56b45..aa4831f27a 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -260,9 +260,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
     virtio_add_feature(&features, VIRTIO_BLK_F_FLUSH);
     virtio_add_feature(&features, VIRTIO_BLK_F_RO);
 
-    if (s->config_wce) {
-        virtio_add_feature(&features, VIRTIO_BLK_F_CONFIG_WCE);
-    }
     if (s->num_queues > 1) {
         virtio_add_feature(&features, VIRTIO_BLK_F_MQ);
     }
@@ -595,7 +592,8 @@ static Property vhost_user_blk_properties[] = {
     DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues,
                        VHOST_USER_BLK_AUTO_NUM_QUEUES),
     DEFINE_PROP_UINT32("queue-size", VHostUserBlk, queue_size, 128),
-    DEFINE_PROP_BIT("config-wce", VHostUserBlk, config_wce, 0, true),
+    DEFINE_PROP_BIT64("config-wce", VHostUserBlk, parent_obj.host_features,
+                      VIRTIO_BLK_F_CONFIG_WCE, true),
     DEFINE_PROP_BIT64("discard", VHostUserBlk, parent_obj.host_features,
                       VIRTIO_BLK_F_DISCARD, true),
     DEFINE_PROP_BIT64("write-zeroes", VHostUserBlk, parent_obj.host_features,
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 24/55] vhost-user-blk: dynamically resize config space based on features
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (22 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 23/55] vhost-user-blk: make 'config_wce' part of 'host_features' Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 25/55] tests/acpi: virt: allow acpi GTDT changes Michael S. Tsirkin
                   ` (32 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniil Tatianin, Raphael Norwitz, Kevin Wolf,
	Hanna Reitz, qemu-block

From: Daniil Tatianin <d-tatianin@yandex-team.ru>

Make vhost-user-blk backwards compatible when migrating from older VMs
running with modern features turned off, the same way it was done for
virtio-blk in 20764be0421c ("virtio-blk: set config size depending on the features enabled")

It's currently impossible to migrate from an older VM with
vhost-user-blk (with disable-legacy=off) because of errors like this:

qemu-system-x86_64: get_pci_config_device: Bad config data: i=0x10 read: 41 device: 1 cmask: ff wmask: 80 w1cmask:0
qemu-system-x86_64: Failed to load PCIDevice:config
qemu-system-x86_64: Failed to load virtio-blk:virtio
qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:05.0:00.0:02.0/virtio-blk'
qemu-system-x86_64: load of migration failed: Invalid argument

This is caused by the newer (destination) VM requiring a bigger BAR0
alignment because it has to cover a bigger configuration space, which
isn't actually needed since those additional config fields are not
active (write-zeroes/discard).

Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20220906073111.353245-6-d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/block/vhost-user-blk.c | 17 ++++++++++-------
 MAINTAINERS               |  2 ++
 hw/block/meson.build      |  2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index aa4831f27a..84902dde17 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -23,6 +23,7 @@
 #include "hw/qdev-core.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
+#include "hw/virtio/virtio-blk-common.h"
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-user-blk.h"
 #include "hw/virtio/virtio.h"
@@ -63,7 +64,7 @@ static void vhost_user_blk_update_config(VirtIODevice *vdev, uint8_t *config)
     /* Our num_queues overrides the device backend */
     virtio_stw_p(vdev, &s->blkcfg.num_queues, s->num_queues);
 
-    memcpy(config, &s->blkcfg, sizeof(struct virtio_blk_config));
+    memcpy(config, &s->blkcfg, vdev->config_len);
 }
 
 static void vhost_user_blk_set_config(VirtIODevice *vdev, const uint8_t *config)
@@ -92,12 +93,12 @@ static int vhost_user_blk_handle_config_change(struct vhost_dev *dev)
 {
     int ret;
     struct virtio_blk_config blkcfg;
+    VirtIODevice *vdev = dev->vdev;
     VHostUserBlk *s = VHOST_USER_BLK(dev->vdev);
     Error *local_err = NULL;
 
     ret = vhost_dev_get_config(dev, (uint8_t *)&blkcfg,
-                               sizeof(struct virtio_blk_config),
-                               &local_err);
+                               vdev->config_len, &local_err);
     if (ret < 0) {
         error_report_err(local_err);
         return ret;
@@ -106,7 +107,7 @@ static int vhost_user_blk_handle_config_change(struct vhost_dev *dev)
     /* valid for resize only */
     if (blkcfg.capacity != s->blkcfg.capacity) {
         s->blkcfg.capacity = blkcfg.capacity;
-        memcpy(dev->vdev->config, &s->blkcfg, sizeof(struct virtio_blk_config));
+        memcpy(dev->vdev->config, &s->blkcfg, vdev->config_len);
         virtio_notify_config(dev->vdev);
     }
 
@@ -448,7 +449,7 @@ static int vhost_user_blk_realize_connect(VHostUserBlk *s, Error **errp)
     assert(s->connected);
 
     ret = vhost_dev_get_config(&s->dev, (uint8_t *)&s->blkcfg,
-                               sizeof(struct virtio_blk_config), errp);
+                               s->parent_obj.config_len, errp);
     if (ret < 0) {
         qemu_chr_fe_disconnect(&s->chardev);
         vhost_dev_cleanup(&s->dev);
@@ -463,6 +464,7 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
     ERRP_GUARD();
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VHostUserBlk *s = VHOST_USER_BLK(vdev);
+    size_t config_size;
     int retries;
     int i, ret;
 
@@ -493,8 +495,9 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    virtio_init(vdev, VIRTIO_ID_BLOCK,
-                sizeof(struct virtio_blk_config));
+    config_size = virtio_get_config_size(&virtio_blk_cfg_size_params,
+                                         vdev->host_features);
+    virtio_init(vdev, VIRTIO_ID_BLOCK, config_size);
 
     s->virtqs = g_new(VirtQueue *, s->num_queues);
     for (i = 0; i < s->num_queues; i++) {
diff --git a/MAINTAINERS b/MAINTAINERS
index 05b75805eb..8ae2e43c83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2281,11 +2281,13 @@ S: Maintained
 F: contrib/vhost-user-blk/
 F: contrib/vhost-user-scsi/
 F: hw/block/vhost-user-blk.c
+F: hw/block/virtio-blk-common.c
 F: hw/scsi/vhost-user-scsi.c
 F: hw/virtio/vhost-user-blk-pci.c
 F: hw/virtio/vhost-user-scsi-pci.c
 F: include/hw/virtio/vhost-user-blk.h
 F: include/hw/virtio/vhost-user-scsi.h
+F: include/hw/virtio/virtio-blk-common.h
 
 vhost-user-gpu
 M: Marc-André Lureau <marcandre.lureau@redhat.com>
diff --git a/hw/block/meson.build b/hw/block/meson.build
index 8ee1f1f850..1908abd45c 100644
--- a/hw/block/meson.build
+++ b/hw/block/meson.build
@@ -17,6 +17,6 @@ softmmu_ss.add(when: 'CONFIG_XEN', if_true: files('xen-block.c'))
 softmmu_ss.add(when: 'CONFIG_TC58128', if_true: files('tc58128.c'))
 
 specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c', 'virtio-blk-common.c'))
-specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk.c'))
+specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk.c', 'virtio-blk-common.c'))
 
 subdir('dataplane')
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 25/55] tests/acpi: virt: allow acpi GTDT changes
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (23 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 24/55] vhost-user-blk: dynamically resize config space based on features Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 26/55] acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses Michael S. Tsirkin
                   ` (31 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Miguel Luis, Ani Sinha, Igor Mammedov

From: Miguel Luis <miguel.luis@oracle.com>

Step 3 from bios-tables-test.c documented procedure.

Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
Message-Id: <20220920162137.75239-2-miguel.luis@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Ani Sinha <ani@anisinha.ca>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..957bd1b4f6 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,4 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/GTDT",
+"tests/data/acpi/virt/GTDT.memhp",
+"tests/data/acpi/virt/GTDT.numamem",
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 26/55] acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (24 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 25/55] tests/acpi: virt: allow acpi GTDT changes Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 27/55] tests/acpi: virt: update ACPI GTDT binaries Michael S. Tsirkin
                   ` (30 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Miguel Luis, Ani Sinha, Shannon Zhao,
	Igor Mammedov, qemu-arm

From: Miguel Luis <miguel.luis@oracle.com>

Per the ACPI 6.5 specification, on the GTDT Table Structure, the Counter Control
Block Address and Counter Read Block Address fields of the GTDT table should be
set to 0xFFFFFFFFFFFFFFFF if not provided, rather than 0x0.

Fixes: 41041e57085 ("acpi: arm/virt: build_gtdt: use acpi_table_begin()/acpi_table_end() instead of build_header()")

Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
Message-Id: <20220920162137.75239-3-miguel.luis@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
---
 hw/arm/virt-acpi-build.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 9b3aee01bf..13c6e3e468 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -592,8 +592,7 @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     acpi_table_begin(&table, table_data);
 
     /* CntControlBase Physical Address */
-    /* FIXME: invalid value, should be 0xFFFFFFFFFFFFFFFF if not impl. ? */
-    build_append_int_noprefix(table_data, 0, 8);
+    build_append_int_noprefix(table_data, 0xFFFFFFFFFFFFFFFF, 8);
     build_append_int_noprefix(table_data, 0, 4); /* Reserved */
     /*
      * FIXME: clarify comment:
@@ -618,7 +617,7 @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     /* Non-Secure EL2 timer Flags */
     build_append_int_noprefix(table_data, irqflags, 4);
     /* CntReadBase Physical address */
-    build_append_int_noprefix(table_data, 0, 8);
+    build_append_int_noprefix(table_data, 0xFFFFFFFFFFFFFFFF, 8);
     /* Platform Timer Count */
     build_append_int_noprefix(table_data, 0, 4);
     /* Platform Timer Offset */
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 27/55] tests/acpi: virt: update ACPI GTDT binaries
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (25 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 26/55] acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap Michael S. Tsirkin
                   ` (29 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Miguel Luis, Ani Sinha, Igor Mammedov

From: Miguel Luis <miguel.luis@oracle.com>

Step 6 & 7 of the bios-tables-test.c documented procedure.

Differences between disassembled ASL files for GTDT:

    @@ -13,14 +13,14 @@
     [000h 0000   4]                    Signature : "GTDT"    [Generic Timer Description Table]
     [004h 0004   4]                 Table Length : 00000060
     [008h 0008   1]                     Revision : 02
    -[009h 0009   1]                     Checksum : 8C
    +[009h 0009   1]                     Checksum : 9C
     [00Ah 0010   6]                       Oem ID : "BOCHS "
     [010h 0016   8]                 Oem Table ID : "BXPC    "
     [018h 0024   4]                 Oem Revision : 00000001
     [01Ch 0028   4]              Asl Compiler ID : "BXPC"
     [020h 0032   4]        Asl Compiler Revision : 00000001

    -[024h 0036   8]        Counter Block Address : 0000000000000000
    +[024h 0036   8]        Counter Block Address : FFFFFFFFFFFFFFFF
     [02Ch 0044   4]                     Reserved : 00000000

     [030h 0048   4]         Secure EL1 Interrupt : 0000001D
    @@ -46,16 +46,16 @@
                                     Trigger Mode : 0
                                         Polarity : 0
                                        Always On : 0
    -[050h 0080   8]   Counter Read Block Address : 0000000000000000
    +[050h 0080   8]   Counter Read Block Address : FFFFFFFFFFFFFFFF

     [058h 0088   4]         Platform Timer Count : 00000000
     [05Ch 0092   4]        Platform Timer Offset : 00000000

     Raw Table Data: Length 96 (0x60)

    -    0000: 47 54 44 54 60 00 00 00 02 8C 42 4F 43 48 53 20  // GTDT`.....BOCHS
    +    0000: 47 54 44 54 60 00 00 00 02 9C 42 4F 43 48 53 20  // GTDT`.....BOCHS
         0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
    -    0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
    +    0020: 01 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00  // ................
         0030: 1D 00 00 00 00 00 00 00 1E 00 00 00 04 00 00 00  // ................
         0040: 1B 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00  // ................
    -    0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  // ................
    +    0050: FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00  // ................

Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
Message-Id: <20220920162137.75239-4-miguel.luis@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Ani Sinha <ani@anisinha.ca>
---
 tests/qtest/bios-tables-test-allowed-diff.h |   3 ---
 tests/data/acpi/virt/GTDT                   | Bin 96 -> 96 bytes
 tests/data/acpi/virt/GTDT.memhp             | Bin 96 -> 96 bytes
 tests/data/acpi/virt/GTDT.numamem           | Bin 96 -> 96 bytes
 4 files changed, 3 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 957bd1b4f6..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,4 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/GTDT",
-"tests/data/acpi/virt/GTDT.memhp",
-"tests/data/acpi/virt/GTDT.numamem",
diff --git a/tests/data/acpi/virt/GTDT b/tests/data/acpi/virt/GTDT
index 9408b71b59c0e0f2991c0053562280155b47bc0b..6f8cb9b8f30b55f4c93fe515982621e3db50feb2 100644
GIT binary patch
delta 45
kcmYdD;BpUf2}xjJU|^avkxPo>KNL*VQ4xT#fs$YV0LH=;ng9R*

delta 45
jcmYdD;BpUf2}xjJU|{N*$R))AWPrg$9Tfo>8%6^Foy!E8

diff --git a/tests/data/acpi/virt/GTDT.memhp b/tests/data/acpi/virt/GTDT.memhp
index 9408b71b59c0e0f2991c0053562280155b47bc0b..6f8cb9b8f30b55f4c93fe515982621e3db50feb2 100644
GIT binary patch
delta 45
kcmYdD;BpUf2}xjJU|^avkxPo>KNL*VQ4xT#fs$YV0LH=;ng9R*

delta 45
jcmYdD;BpUf2}xjJU|{N*$R))AWPrg$9Tfo>8%6^Foy!E8

diff --git a/tests/data/acpi/virt/GTDT.numamem b/tests/data/acpi/virt/GTDT.numamem
index 9408b71b59c0e0f2991c0053562280155b47bc0b..6f8cb9b8f30b55f4c93fe515982621e3db50feb2 100644
GIT binary patch
delta 45
kcmYdD;BpUf2}xjJU|^avkxPo>KNL*VQ4xT#fs$YV0LH=;ng9R*

delta 45
jcmYdD;BpUf2}xjJU|{N*$R))AWPrg$9Tfo>8%6^Foy!E8

-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (26 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 27/55] tests/acpi: virt: update ACPI GTDT binaries Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks" Michael S. Tsirkin
                   ` (28 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Jonathan Cameron, Ben Widawsky, Ben Widawsky

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

The Device Serial Number Extended Capability PCI r6.0 sec 7.9.3
provides a standard way to provide a device serial number as
an IEEE defined 64-bit extended unique identifier EUI-64.

CXL 2.0 section 8.1.12.2 Memory Device PCIe Capabilities and
Extended Capabilities requires this to be used to uniquely
identify CXL memory devices.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20220923161835.9805-1-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ben Widawsky <bwidawsk@kernel.org>
---
 include/hw/cxl/cxl_device.h |  1 +
 hw/mem/cxl_type3.c          | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 1e141b6621..e4d221cdb3 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -237,6 +237,7 @@ struct CXLType3Dev {
     /* Properties */
     HostMemoryBackend *hostmem;
     HostMemoryBackend *lsa;
+    uint64_t sn;
 
     /* State */
     AddressSpace hostmem_as;
diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index ada2108fac..a71bf1afeb 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -14,6 +14,12 @@
 #include "sysemu/hostmem.h"
 #include "hw/cxl/cxl.h"
 
+/*
+ * Null value of all Fs suggested by IEEE RA guidelines for use of
+ * EU, OUI and CID
+ */
+#define UI64_NULL ~(0ULL)
+
 static void build_dvsecs(CXLType3Dev *ct3d)
 {
     CXLComponentState *cxl_cstate = &ct3d->cxl_cstate;
@@ -149,7 +155,12 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
     pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_CXL);
 
     pcie_endpoint_cap_init(pci_dev, 0x80);
-    cxl_cstate->dvsec_offset = 0x100;
+    if (ct3d->sn != UI64_NULL) {
+        pcie_dev_ser_num_init(pci_dev, 0x100, ct3d->sn);
+        cxl_cstate->dvsec_offset = 0x100 + 0x0c;
+    } else {
+        cxl_cstate->dvsec_offset = 0x100;
+    }
 
     ct3d->cxl_cstate.pdev = pci_dev;
     build_dvsecs(ct3d);
@@ -275,6 +286,7 @@ static Property ct3_props[] = {
                      HostMemoryBackend *),
     DEFINE_PROP_LINK("lsa", CXLType3Dev, lsa, TYPE_MEMORY_BACKEND,
                      HostMemoryBackend *),
+    DEFINE_PROP_UINT64("sn", CXLType3Dev, sn, UI64_NULL),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks"
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (27 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:39   ` David Woodhouse
  2022-10-10 17:30 ` [PULL 30/55] qmp: add QMP command x-query-virtio Michael S. Tsirkin
                   ` (27 subsequent siblings)
  56 siblings, 1 reply; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Peter Xu, David Woodhouse, Claudio Fontana,
	Igor Mammedov, Jason Wang, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

From: Peter Xu <peterx@redhat.com>

It's true that when vcpus<=255 we don't require the length of 32bit APIC
IDs.  However here since we already have EIM=ON it means the hypervisor
will declare the VM as x2apic supported (e.g. VT-d ECAP register will have
EIM bit 4 set), so the guest should assume the APIC IDs are 32bits width
even if vcpus<=255.  In short, commit 77250171bdc breaks any simple cmdline
that wants to boot a VM with >=9 but <=255 vcpus with:

  -device intel-iommu,intremap=on

For anyone who does not want to enable x2apic, we can use eim=off in the
intel-iommu parameters to skip enabling KVM x2apic.

This partly reverts commit 77250171bdc02aee106083fd2a068147befa1a38, while
keeping the valid bit on checking split irqchip, but revert the other change.

One thing to mention is that this patch may break migration compatibility
of such VM, however that's probably the best thing we can do, because the
old behavior was simply wrong and not working for >8 vcpus.  For <=8 vcpus,
there could be a light guest ABI change (by enabling KVM x2apic after this
patch), but logically it shouldn't affect the migration from working.

Also, this is not the 1st commit to change x2apic behavior.  Igor provided
a full history of how this evolved for the past few years:

https://lore.kernel.org/qemu-devel/20220922154617.57d1a1fb@redhat.com/

Relevant commits for reference:

  fb506e701e ("intel_iommu: reject broken EIM", 2016-10-17)
  c1bb5418e3 ("target/i386: Support up to 32768 CPUs without IRQ remapping", 2020-12-10)
  77250171bd ("intel_iommu: Fix irqchip / X2APIC configuration checks", 2022-05-16)
  dc89f32d92 ("target/i386: Fix sanity check on max APIC ID / X2APIC enablement", 2022-05-16)

We may want to have this for stable too (mostly for 7.1.0 only).  Adding a
fixes tag.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Claudio Fontana <cfontana@suse.de>
Cc: Igor Mammedov <imammedo@redhat.com>
Fixes: 77250171bd ("intel_iommu: Fix irqchip / X2APIC configuration checks")
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220926153206.10881-1-peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/intel_iommu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 05d53a1aa9..6524c2ee32 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3818,6 +3818,11 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp)
             error_setg(errp, "eim=on requires accel=kvm,kernel-irqchip=split");
             return false;
         }
+        if (!kvm_enable_x2apic()) {
+            error_setg(errp, "eim=on requires support on the KVM side"
+                             "(X2APIC_API, first shipped in v4.7)");
+            return false;
+        }
     }
 
     /* Currently only address widths supported are 39 and 48 bits */
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 30/55] qmp: add QMP command x-query-virtio
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (28 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks" Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:30 ` [PULL 31/55] qmp: add QMP command x-query-virtio-status Michael S. Tsirkin
                   ` (26 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laurent Vivier, Jonah Palmer, Markus Armbruster,
	Michael Roth, Eric Blake, Thomas Huth, Paolo Bonzini

From: Laurent Vivier <lvivier@redhat.com>

This new command lists all the instances of VirtIODevices with
their canonical QOM path and name.

[Jonah: @virtio_list duplicates information that already exists in
 the QOM composition tree. However, extracting necessary information
 from this tree seems to be a bit convoluted.

 Instead, we still create our own list of realized virtio devices
 but use @qmp_qom_get with the device's canonical QOM path to confirm
 that the device exists and is realized. If the device exists but
 is actually not realized, then we remove it from our list (for
 synchronicity to the QOM composition tree).

 Also, the QMP command @x-query-virtio is redundant as @qom-list
 and @qom-get are sufficient to search '/machine/' for realized
 virtio devices. However, @x-query-virtio is much more convenient
 in listing realized virtio devices.]

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Message-Id: <1660220684-24909-2-git-send-email-jonah.palmer@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 qapi/qapi-schema.json      |  1 +
 qapi/virtio.json           | 68 ++++++++++++++++++++++++++++++++++++++
 include/hw/virtio/virtio.h |  1 +
 hw/virtio/virtio-stub.c    | 14 ++++++++
 hw/virtio/virtio.c         | 44 ++++++++++++++++++++++++
 tests/qtest/qmp-cmd-test.c |  1 +
 hw/virtio/meson.build      |  2 ++
 qapi/meson.build           |  1 +
 8 files changed, 132 insertions(+)
 create mode 100644 qapi/virtio.json
 create mode 100644 hw/virtio/virtio-stub.c

diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 92d7ecc52c..f000b90744 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -94,3 +94,4 @@
 { 'include': 'acpi.json' }
 { 'include': 'pci.json' }
 { 'include': 'stats.json' }
+{ 'include': 'virtio.json' }
diff --git a/qapi/virtio.json b/qapi/virtio.json
new file mode 100644
index 0000000000..03896e423f
--- /dev/null
+++ b/qapi/virtio.json
@@ -0,0 +1,68 @@
+# -*- Mode: Python -*-
+# vim: filetype=python
+#
+
+##
+# = Virtio devices
+##
+
+##
+# @VirtioInfo:
+#
+# Basic information about a given VirtIODevice
+#
+# @path: The VirtIODevice's canonical QOM path
+#
+# @name: Name of the VirtIODevice
+#
+# Since: 7.1
+#
+##
+{ 'struct': 'VirtioInfo',
+  'data': { 'path': 'str',
+            'name': 'str' } }
+
+##
+# @x-query-virtio:
+#
+# Returns a list of all realized VirtIODevices
+#
+# Features:
+# @unstable: This command is meant for debugging.
+#
+# Returns: List of gathered VirtIODevices
+#
+# Since: 7.1
+#
+# Example:
+#
+# -> { "execute": "x-query-virtio" }
+# <- { "return": [
+#          {
+#              "name": "virtio-input",
+#              "path": "/machine/peripheral-anon/device[4]/virtio-backend"
+#          },
+#          {
+#              "name": "virtio-crypto",
+#              "path": "/machine/peripheral/crypto0/virtio-backend"
+#          },
+#          {
+#              "name": "virtio-scsi",
+#              "path": "/machine/peripheral-anon/device[2]/virtio-backend"
+#          },
+#          {
+#              "name": "virtio-net",
+#              "path": "/machine/peripheral-anon/device[1]/virtio-backend"
+#          },
+#          {
+#              "name": "virtio-serial",
+#              "path": "/machine/peripheral-anon/device[0]/virtio-backend"
+#          }
+#      ]
+#    }
+#
+##
+
+{ 'command': 'x-query-virtio',
+  'returns': [ 'VirtioInfo' ],
+  'features': [ 'unstable' ] }
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index cecfb7c552..9eeb958e39 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -122,6 +122,7 @@ struct VirtIODevice
     bool use_guest_notifier_mask;
     AddressSpace *dma_as;
     QLIST_HEAD(, VirtQueue) *vector_queues;
+    QTAILQ_ENTRY(VirtIODevice) next;
 };
 
 struct VirtioDeviceClass {
diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c
new file mode 100644
index 0000000000..05a81edc92
--- /dev/null
+++ b/hw/virtio/virtio-stub.c
@@ -0,0 +1,14 @@
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-virtio.h"
+
+static void *qmp_virtio_unsupported(Error **errp)
+{
+    error_setg(errp, "Virtio is disabled");
+    return NULL;
+}
+
+VirtioInfoList *qmp_x_query_virtio(Error **errp)
+{
+    return qmp_virtio_unsupported(errp);
+}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2cc1d7d24a..4fc7c80d3f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -13,12 +13,18 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qapi-commands-virtio.h"
+#include "qapi/qapi-commands-qom.h"
+#include "qapi/qapi-visit-virtio.h"
+#include "qapi/qmp/qjson.h"
 #include "cpu.h"
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "qemu/module.h"
+#include "qom/object_interfaces.h"
 #include "hw/virtio/virtio.h"
 #include "migration/qemu-file-types.h"
 #include "qemu/atomic.h"
@@ -29,6 +35,9 @@
 #include "sysemu/runstate.h"
 #include "standard-headers/linux/virtio_ids.h"
 
+/* QAPI list of realized VirtIODevices */
+static QTAILQ_HEAD(, VirtIODevice) virtio_list;
+
 /*
  * The alignment to use between consumer and producer parts of vring.
  * x86 pagesize again. This is the default, used by transports like PCI
@@ -3707,6 +3716,7 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)
     vdev->listener.commit = virtio_memory_listener_commit;
     vdev->listener.name = "virtio";
     memory_listener_register(&vdev->listener, vdev->dma_as);
+    QTAILQ_INSERT_TAIL(&virtio_list, vdev, next);
 }
 
 static void virtio_device_unrealize(DeviceState *dev)
@@ -3721,6 +3731,7 @@ static void virtio_device_unrealize(DeviceState *dev)
         vdc->unrealize(dev);
     }
 
+    QTAILQ_REMOVE(&virtio_list, vdev, next);
     g_free(vdev->bus_name);
     vdev->bus_name = NULL;
 }
@@ -3894,6 +3905,8 @@ static void virtio_device_class_init(ObjectClass *klass, void *data)
     vdc->stop_ioeventfd = virtio_device_stop_ioeventfd_impl;
 
     vdc->legacy_features |= VIRTIO_LEGACY_FEATURES;
+
+    QTAILQ_INIT(&virtio_list);
 }
 
 bool virtio_device_ioeventfd_enabled(VirtIODevice *vdev)
@@ -3904,6 +3917,37 @@ bool virtio_device_ioeventfd_enabled(VirtIODevice *vdev)
     return virtio_bus_ioeventfd_enabled(vbus);
 }
 
+VirtioInfoList *qmp_x_query_virtio(Error **errp)
+{
+    VirtioInfoList *list = NULL;
+    VirtioInfoList *node;
+    VirtIODevice *vdev;
+
+    QTAILQ_FOREACH(vdev, &virtio_list, next) {
+        DeviceState *dev = DEVICE(vdev);
+        Error *err = NULL;
+        QObject *obj = qmp_qom_get(dev->canonical_path, "realized", &err);
+
+        if (err == NULL) {
+            GString *is_realized = qobject_to_json_pretty(obj, true);
+            /* virtio device is NOT realized, remove it from list */
+            if (!strncmp(is_realized->str, "false", 4)) {
+                QTAILQ_REMOVE(&virtio_list, vdev, next);
+            } else {
+                node = g_new0(VirtioInfoList, 1);
+                node->value = g_new(VirtioInfo, 1);
+                node->value->path = g_strdup(dev->canonical_path);
+                node->value->name = g_strdup(vdev->name);
+                QAPI_LIST_PREPEND(list, node->value);
+            }
+           g_string_free(is_realized, true);
+        }
+        qobject_unref(obj);
+    }
+
+    return list;
+}
+
 static const TypeInfo virtio_device_info = {
     .name = TYPE_VIRTIO_DEVICE,
     .parent = TYPE_DEVICE,
diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
index af00712458..897e4e937b 100644
--- a/tests/qtest/qmp-cmd-test.c
+++ b/tests/qtest/qmp-cmd-test.c
@@ -103,6 +103,7 @@ static bool query_is_ignored(const char *cmd)
         "query-gic-capabilities", /* arm */
         /* Success depends on target-specific build configuration: */
         "query-pci",              /* CONFIG_PCI */
+        "x-query-virtio",         /* CONFIG_VIRTIO */
         /* Success depends on launching SEV guest */
         "query-sev-launch-measure",
         /* Success depends on Host or Hypervisor SEV support */
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index c14e3db10a..dfed1e7af5 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -62,4 +62,6 @@ virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
 specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss)
 softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
 softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
+softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c'))
 softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
+softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('virtio-stub.c'))
diff --git a/qapi/meson.build b/qapi/meson.build
index 840f1b0e19..9a36c15c04 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -49,6 +49,7 @@ qapi_all_modules = [
   'stats',
   'trace',
   'transaction',
+  'virtio',
   'yank',
 ]
 if have_system
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 31/55] qmp: add QMP command x-query-virtio-status
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (29 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 30/55] qmp: add QMP command x-query-virtio Michael S. Tsirkin
@ 2022-10-10 17:30 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 32/55] qmp: decode feature & status bits in virtio-status Michael S. Tsirkin
                   ` (25 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laurent Vivier, Jonah Palmer, Eric Blake,
	Markus Armbruster

From: Laurent Vivier <lvivier@redhat.com>

This new command shows the status of a VirtIODevice, including
its corresponding vhost device's status (if active).

Next patch will improve output by decoding feature bits, including
vhost device's feature bits (backend, protocol, acked, and features).
Also will decode status bits of a VirtIODevice.

[Jonah: From patch v12; added a check to @virtio_device_find to ensure
 synchronicity between @virtio_list and the devices in the QOM
 composition tree.]

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Message-Id: <1660220684-24909-3-git-send-email-jonah.palmer@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 qapi/virtio.json        | 222 ++++++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-stub.c |   5 +
 hw/virtio/virtio.c      | 104 +++++++++++++++++++
 3 files changed, 331 insertions(+)

diff --git a/qapi/virtio.json b/qapi/virtio.json
index 03896e423f..c86b3bc635 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -66,3 +66,225 @@
 { 'command': 'x-query-virtio',
   'returns': [ 'VirtioInfo' ],
   'features': [ 'unstable' ] }
+
+##
+# @VhostStatus:
+#
+# Information about a vhost device. This information will only be
+# displayed if the vhost device is active.
+#
+# @n-mem-sections: vhost_dev n_mem_sections
+#
+# @n-tmp-sections: vhost_dev n_tmp_sections
+#
+# @nvqs: vhost_dev nvqs (number of virtqueues being used)
+#
+# @vq-index: vhost_dev vq_index
+#
+# @features: vhost_dev features
+#
+# @acked-features: vhost_dev acked_features
+#
+# @backend-features: vhost_dev backend_features
+#
+# @protocol-features: vhost_dev protocol_features
+#
+# @max-queues: vhost_dev max_queues
+#
+# @backend-cap: vhost_dev backend_cap
+#
+# @log-enabled: vhost_dev log_enabled flag
+#
+# @log-size: vhost_dev log_size
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VhostStatus',
+  'data': { 'n-mem-sections': 'int',
+            'n-tmp-sections': 'int',
+            'nvqs': 'uint32',
+            'vq-index': 'int',
+            'features': 'uint64',
+            'acked-features': 'uint64',
+            'backend-features': 'uint64',
+            'protocol-features': 'uint64',
+            'max-queues': 'uint64',
+            'backend-cap': 'uint64',
+            'log-enabled': 'bool',
+            'log-size': 'uint64' } }
+
+##
+# @VirtioStatus:
+#
+# Full status of the virtio device with most VirtIODevice members.
+# Also includes the full status of the corresponding vhost device
+# if the vhost device is active.
+#
+# @name: VirtIODevice name
+#
+# @device-id: VirtIODevice ID
+#
+# @vhost-started: VirtIODevice vhost_started flag
+#
+# @guest-features: VirtIODevice guest_features
+#
+# @host-features: VirtIODevice host_features
+#
+# @backend-features: VirtIODevice backend_features
+#
+# @device-endian: VirtIODevice device_endian
+#
+# @num-vqs: VirtIODevice virtqueue count. This is the number of active
+#           virtqueues being used by the VirtIODevice.
+#
+# @status: VirtIODevice configuration status (VirtioDeviceStatus)
+#
+# @isr: VirtIODevice ISR
+#
+# @queue-sel: VirtIODevice queue_sel
+#
+# @vm-running: VirtIODevice vm_running flag
+#
+# @broken: VirtIODevice broken flag
+#
+# @disabled: VirtIODevice disabled flag
+#
+# @use-started: VirtIODevice use_started flag
+#
+# @started: VirtIODevice started flag
+#
+# @start-on-kick: VirtIODevice start_on_kick flag
+#
+# @disable-legacy-check: VirtIODevice disabled_legacy_check flag
+#
+# @bus-name: VirtIODevice bus_name
+#
+# @use-guest-notifier-mask: VirtIODevice use_guest_notifier_mask flag
+#
+# @vhost-dev: Corresponding vhost device info for a given VirtIODevice.
+#             Present if the given VirtIODevice has an active vhost
+#             device.
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtioStatus',
+  'data': { 'name': 'str',
+            'device-id': 'uint16',
+            'vhost-started': 'bool',
+            'device-endian': 'str',
+            'guest-features': 'uint64',
+            'host-features': 'uint64',
+            'backend-features': 'uint64',
+            'num-vqs': 'int',
+            'status': 'uint8',
+            'isr': 'uint8',
+            'queue-sel': 'uint16',
+            'vm-running': 'bool',
+            'broken': 'bool',
+            'disabled': 'bool',
+            'use-started': 'bool',
+            'started': 'bool',
+            'start-on-kick': 'bool',
+            'disable-legacy-check': 'bool',
+            'bus-name': 'str',
+            'use-guest-notifier-mask': 'bool',
+            '*vhost-dev': 'VhostStatus' } }
+
+##
+# @x-query-virtio-status:
+#
+# Poll for a comprehensive status of a given virtio device
+#
+# @path: Canonical QOM path of the VirtIODevice
+#
+# Features:
+# @unstable: This command is meant for debugging.
+#
+# Returns: VirtioStatus of the virtio device
+#
+# Since: 7.1
+#
+# Examples:
+#
+# 1. Poll for the status of virtio-crypto (no vhost-crypto active)
+#
+# -> { "execute": "x-query-virtio-status",
+#      "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend" }
+#    }
+# <- { "return": {
+#          "device-endian": "little",
+#          "bus-name": "",
+#          "disable-legacy-check": false,
+#          "name": "virtio-crypto",
+#          "started": true,
+#          "device-id": 20,
+#          "backend-features": 0,
+#          "start-on-kick": false,
+#          "isr": 1,
+#          "broken": false,
+#          "status": 15,
+#          "num-vqs": 2,
+#          "guest-features": 5100273664,
+#          "host-features": 6325010432,
+#          "use-guest-notifier-mask": true,
+#          "vm-running": true,
+#          "queue-sel": 1,
+#          "disabled": false,
+#          "vhost-started": false,
+#          "use-started": true
+#      }
+#    }
+#
+# 2. Poll for the status of virtio-net (vhost-net is active)
+#
+# -> { "execute": "x-query-virtio-status",
+#      "arguments": { "path": "/machine/peripheral-anon/device[1]/virtio-backend" }
+#    }
+# <- { "return": {
+#          "device-endian": "little",
+#          "bus-name": "",
+#          "disabled-legacy-check": false,
+#          "name": "virtio-net",
+#          "started": true,
+#          "device-id": 1,
+#          "vhost-dev": {
+#              "n-tmp-sections": 4,
+#              "n-mem-sections": 4,
+#              "max-queues": 1,
+#              "backend-cap": 2,
+#              "log-size": 0,
+#              "backend-features": 0,
+#              "nvqs": 2,
+#              "protocol-features": 0,
+#              "vq-index": 0,
+#              "log-enabled": false,
+#              "acked-features": 5100306432,
+#              "features": 13908344832
+#          },
+#          "backend-features": 6337593319,
+#          "start-on-kick": false,
+#          "isr": 1,
+#          "broken": false,
+#          "status": 15,
+#          "num-vqs": 3,
+#          "guest-features": 5111807911,
+#          "host-features": 6337593319,
+#          "use-guest-notifier-mask": true,
+#          "vm-running": true,
+#          "queue-sel": 2,
+#          "disabled": false,
+#          "vhost-started": true,
+#          "use-started": true
+#      }
+#    }
+#
+##
+
+{ 'command': 'x-query-virtio-status',
+  'data': { 'path': 'str' },
+  'returns': 'VirtioStatus',
+  'features': [ 'unstable' ] }
diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c
index 05a81edc92..0b432e8de7 100644
--- a/hw/virtio/virtio-stub.c
+++ b/hw/virtio/virtio-stub.c
@@ -12,3 +12,8 @@ VirtioInfoList *qmp_x_query_virtio(Error **errp)
 {
     return qmp_virtio_unsupported(errp);
 }
+
+VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
+{
+    return qmp_virtio_unsupported(errp);
+}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 4fc7c80d3f..696e19126a 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3948,6 +3948,110 @@ VirtioInfoList *qmp_x_query_virtio(Error **errp)
     return list;
 }
 
+static VirtIODevice *virtio_device_find(const char *path)
+{
+    VirtIODevice *vdev;
+
+    QTAILQ_FOREACH(vdev, &virtio_list, next) {
+        DeviceState *dev = DEVICE(vdev);
+
+        if (strcmp(dev->canonical_path, path) != 0) {
+            continue;
+        }
+
+        Error *err = NULL;
+        QObject *obj = qmp_qom_get(dev->canonical_path, "realized", &err);
+        if (err == NULL) {
+            GString *is_realized = qobject_to_json_pretty(obj, true);
+            /* virtio device is NOT realized, remove it from list */
+            if (!strncmp(is_realized->str, "false", 4)) {
+                g_string_free(is_realized, true);
+                qobject_unref(obj);
+                QTAILQ_REMOVE(&virtio_list, vdev, next);
+                return NULL;
+            }
+            g_string_free(is_realized, true);
+        } else {
+            /* virtio device doesn't exist in QOM tree */
+            QTAILQ_REMOVE(&virtio_list, vdev, next);
+            qobject_unref(obj);
+            return NULL;
+        }
+        /* device exists in QOM tree & is realized */
+        qobject_unref(obj);
+        return vdev;
+    }
+    return NULL;
+}
+
+VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
+{
+    VirtIODevice *vdev;
+    VirtioStatus *status;
+
+    vdev = virtio_device_find(path);
+    if (vdev == NULL) {
+        error_setg(errp, "Path %s is not a VirtIODevice", path);
+        return NULL;
+    }
+
+    status = g_new0(VirtioStatus, 1);
+    status->name = g_strdup(vdev->name);
+    status->device_id = vdev->device_id;
+    status->vhost_started = vdev->vhost_started;
+    status->guest_features = vdev->guest_features;
+    status->host_features = vdev->host_features;
+    status->backend_features = vdev->backend_features;
+
+    switch (vdev->device_endian) {
+    case VIRTIO_DEVICE_ENDIAN_LITTLE:
+        status->device_endian = g_strdup("little");
+        break;
+    case VIRTIO_DEVICE_ENDIAN_BIG:
+        status->device_endian = g_strdup("big");
+        break;
+    default:
+        status->device_endian = g_strdup("unknown");
+        break;
+    }
+
+    status->num_vqs = virtio_get_num_queues(vdev);
+    status->status = vdev->status;
+    status->isr = vdev->isr;
+    status->queue_sel = vdev->queue_sel;
+    status->vm_running = vdev->vm_running;
+    status->broken = vdev->broken;
+    status->disabled = vdev->disabled;
+    status->use_started = vdev->use_started;
+    status->started = vdev->started;
+    status->start_on_kick = vdev->start_on_kick;
+    status->disable_legacy_check = vdev->disable_legacy_check;
+    status->bus_name = g_strdup(vdev->bus_name);
+    status->use_guest_notifier_mask = vdev->use_guest_notifier_mask;
+    status->has_vhost_dev = vdev->vhost_started;
+
+    if (vdev->vhost_started) {
+        VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+        struct vhost_dev *hdev = vdc->get_vhost(vdev);
+
+        status->vhost_dev = g_new0(VhostStatus, 1);
+        status->vhost_dev->n_mem_sections = hdev->n_mem_sections;
+        status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections;
+        status->vhost_dev->nvqs = hdev->nvqs;
+        status->vhost_dev->vq_index = hdev->vq_index;
+        status->vhost_dev->features = hdev->features;
+        status->vhost_dev->acked_features = hdev->acked_features;
+        status->vhost_dev->backend_features = hdev->backend_features;
+        status->vhost_dev->protocol_features = hdev->protocol_features;
+        status->vhost_dev->max_queues = hdev->max_queues;
+        status->vhost_dev->backend_cap = hdev->backend_cap;
+        status->vhost_dev->log_enabled = hdev->log_enabled;
+        status->vhost_dev->log_size = hdev->log_size;
+    }
+
+    return status;
+}
+
 static const TypeInfo virtio_device_info = {
     .name = TYPE_VIRTIO_DEVICE,
     .parent = TYPE_DEVICE,
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 32/55] qmp: decode feature & status bits in virtio-status
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (30 preceding siblings ...)
  2022-10-10 17:30 ` [PULL 31/55] qmp: add QMP command x-query-virtio-status Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 33/55] qmp: add QMP commands for virtio/vhost queue-status Michael S. Tsirkin
                   ` (24 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laurent Vivier, Jonah Palmer, Eric Blake,
	Markus Armbruster

From: Laurent Vivier <lvivier@redhat.com>

Display feature names instead of bitmaps for host, guest, and
backend for VirtIODevices.

Display status names instead of bitmaps for VirtIODevices.

Display feature names instead of bitmaps for backend, protocol,
acked, and features (hdev->features) for vhost devices.

Decode features according to device ID. Decode statuses
according to configuration status bitmap (config_status_map).
Decode vhost user protocol features according to vhost user
protocol bitmap (vhost_user_protocol_map).

Transport features are on the first line. Undecoded bits (if
any) are stored in a separate field.

[Jonah: Several changes made to this patch from prev. version (v14):
 - Moved all device features mappings to hw/virtio/virtio.c
 - Renamed device features mappings (less generic)
 - Generalized @FEATURE_ENTRY macro for all device mappings
 - Virtio device feature map definitions include descriptions of
   feature bits
 - Moved @VHOST_USER_F_PROTOCOL_FEATURES feature bit from transport
   feature map to vhost-user-supported device feature mappings
   (blk, fs, i2c, rng, net, gpu, input, scsi, vsock)
 - New feature bit added for virtio-vsock: @VIRTIO_VSOCK_F_SEQPACKET
 - New feature bit added for virtio-iommu: @VIRTIO_IOMMU_F_BYPASS_CONFIG
 - New feature bit added for virtio-mem: @VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE
 - New virtio transport feature bit added: @VIRTIO_F_IN_ORDER
 - Added device feature map definition for virtio-rng
]

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Message-Id: <1660220684-24909-4-git-send-email-jonah.palmer@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 qapi/virtio.json           | 251 +++++++++++++--
 include/hw/virtio/vhost.h  |   3 +
 include/hw/virtio/virtio.h |   5 +
 hw/virtio/virtio.c         | 643 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 874 insertions(+), 28 deletions(-)

diff --git a/qapi/virtio.json b/qapi/virtio.json
index c86b3bc635..c9c8201e66 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -106,10 +106,10 @@
             'n-tmp-sections': 'int',
             'nvqs': 'uint32',
             'vq-index': 'int',
-            'features': 'uint64',
-            'acked-features': 'uint64',
-            'backend-features': 'uint64',
-            'protocol-features': 'uint64',
+            'features': 'VirtioDeviceFeatures',
+            'acked-features': 'VirtioDeviceFeatures',
+            'backend-features': 'VirtioDeviceFeatures',
+            'protocol-features': 'VhostDeviceProtocols',
             'max-queues': 'uint64',
             'backend-cap': 'uint64',
             'log-enabled': 'bool',
@@ -176,11 +176,11 @@
             'device-id': 'uint16',
             'vhost-started': 'bool',
             'device-endian': 'str',
-            'guest-features': 'uint64',
-            'host-features': 'uint64',
-            'backend-features': 'uint64',
+            'guest-features': 'VirtioDeviceFeatures',
+            'host-features': 'VirtioDeviceFeatures',
+            'backend-features': 'VirtioDeviceFeatures',
             'num-vqs': 'int',
-            'status': 'uint8',
+            'status': 'VirtioDeviceStatus',
             'isr': 'uint8',
             'queue-sel': 'uint16',
             'vm-running': 'bool',
@@ -222,14 +222,41 @@
 #          "name": "virtio-crypto",
 #          "started": true,
 #          "device-id": 20,
-#          "backend-features": 0,
+#          "backend-features": {
+#              "transports": [],
+#              "dev-features": []
+#          },
 #          "start-on-kick": false,
 #          "isr": 1,
 #          "broken": false,
-#          "status": 15,
+#          "status": {
+#              "statuses": [
+#                  "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found",
+#                  "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device",
+#                  "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete",
+#                  "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready"
+#              ]
+#          },
 #          "num-vqs": 2,
-#          "guest-features": 5100273664,
-#          "host-features": 6325010432,
+#          "guest-features": {
+#              "dev-features": [],
+#              "transports": [
+#                  "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                  "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                  "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"
+#              ]
+#          },
+#          "host-features": {
+#              "unknown-dev-features": 1073741824,
+#              "dev-features": [],
+#              "transports": [
+#                  "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                  "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                  "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
+#                  "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
+#                  "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
+#              ]
+#          },
 #          "use-guest-notifier-mask": true,
 #          "vm-running": true,
 #          "queue-sel": 1,
@@ -257,22 +284,147 @@
 #              "max-queues": 1,
 #              "backend-cap": 2,
 #              "log-size": 0,
-#              "backend-features": 0,
+#              "backend-features": {
+#                  "dev-features": [],
+#                  "transports": []
+#              },
 #              "nvqs": 2,
-#              "protocol-features": 0,
+#              "protocol-features": {
+#                  "protocols": []
+#              },
 #              "vq-index": 0,
 #              "log-enabled": false,
-#              "acked-features": 5100306432,
-#              "features": 13908344832
+#              "acked-features": {
+#                  "dev-features": [
+#                      "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers"
+#                  ],
+#                  "transports": [
+#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"
+#                  ]
+#              },
+#              "features": {
+#                  "dev-features": [
+#                      "VHOST_F_LOG_ALL: Logging write descriptors supported",
+#                      "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers"
+#                  ],
+#                  "transports": [
+#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                      "VIRTIO_F_IOMMU_PLATFORM: Device can be used on IOMMU platform",
+#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
+#                      "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
+#                      "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
+#                  ]
+#              }
+#          },
+#          "backend-features": {
+#              "dev-features": [
+#                  "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features negotation supported",
+#                  "VIRTIO_NET_F_GSO: Handling GSO-type packets supported",
+#                  "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel",
+#                  "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported",
+#                  "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported",
+#                  "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported",
+#                  "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported",
+#                  "VIRTIO_NET_F_CTRL_VQ: Control channel available",
+#                  "VIRTIO_NET_F_STATUS: Configuration status field available",
+#                  "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers",
+#                  "VIRTIO_NET_F_HOST_UFO: Device can receive UFO",
+#                  "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN",
+#                  "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6",
+#                  "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4",
+#                  "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO",
+#                  "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN",
+#                  "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6",
+#                  "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4",
+#                  "VIRTIO_NET_F_MAC: Device has given MAC address",
+#                  "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported",
+#                  "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported",
+#                  "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported"
+#              ],
+#              "transports": [
+#                  "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                  "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                  "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
+#                  "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
+#                  "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
+#              ]
 #          },
-#          "backend-features": 6337593319,
 #          "start-on-kick": false,
 #          "isr": 1,
 #          "broken": false,
-#          "status": 15,
+#          "status": {
+#              "statuses": [
+#                  "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found",
+#                  "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device",
+#                  "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete",
+#                  "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready"
+#              ]
+#          },
 #          "num-vqs": 3,
-#          "guest-features": 5111807911,
-#          "host-features": 6337593319,
+#          "guest-features": {
+#              "dev-features": [
+#                  "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel",
+#                  "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported",
+#                  "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported",
+#                  "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported",
+#                  "VIRTIO_NET_F_CTRL_VQ: Control channel available",
+#                  "VIRTIO_NET_F_STATUS: Configuration status field available",
+#                  "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers",
+#                  "VIRTIO_NET_F_HOST_UFO: Device can receive UFO",
+#                  "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN",
+#                  "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6",
+#                  "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4",
+#                  "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO",
+#                  "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN",
+#                  "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6",
+#                  "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4",
+#                  "VIRTIO_NET_F_MAC: Device has given MAC address",
+#                  "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported",
+#                  "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported",
+#                  "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported"
+#              ],
+#              "transports": [
+#                  "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                  "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                  "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"
+#             ]
+#          },
+#          "host-features": {
+#              "dev-features": [
+#                  "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features negotation supported",
+#                  "VIRTIO_NET_F_GSO: Handling GSO-type packets supported",
+#                  "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel",
+#                  "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported",
+#                  "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported",
+#                  "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported",
+#                  "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported",
+#                  "VIRTIO_NET_F_CTRL_VQ: Control channel available",
+#                  "VIRTIO_NET_F_STATUS: Configuration status field available",
+#                  "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers",
+#                  "VIRTIO_NET_F_HOST_UFO: Device can receive UFO",
+#                  "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN",
+#                  "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6",
+#                  "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4",
+#                  "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO",
+#                  "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN",
+#                  "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6",
+#                  "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4",
+#                  "VIRTIO_NET_F_MAC: Device has given MAC address",
+#                  "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported",
+#                  "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported",
+#                  "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported"
+#              ],
+#              "transports": [
+#                  "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
+#                  "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
+#                  "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
+#                  "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
+#                  "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
+#             ]
+#          },
 #          "use-guest-notifier-mask": true,
 #          "vm-running": true,
 #          "queue-sel": 2,
@@ -288,3 +440,62 @@
   'data': { 'path': 'str' },
   'returns': 'VirtioStatus',
   'features': [ 'unstable' ] }
+
+##
+# @VirtioDeviceStatus:
+#
+# A structure defined to list the configuration statuses of a virtio
+# device
+#
+# @statuses: List of decoded configuration statuses of the virtio
+#            device
+#
+# @unknown-statuses: Virtio device statuses bitmap that have not been decoded
+#
+# Since: 7.1
+##
+
+{ 'struct': 'VirtioDeviceStatus',
+  'data': { 'statuses': [ 'str' ],
+            '*unknown-statuses': 'uint8' } }
+
+##
+# @VhostDeviceProtocols:
+#
+# A structure defined to list the vhost user protocol features of a
+# Vhost User device
+#
+# @protocols: List of decoded vhost user protocol features of a vhost
+#             user device
+#
+# @unknown-protocols: Vhost user device protocol features bitmap that
+#                     have not been decoded
+#
+# Since: 7.1
+##
+
+{ 'struct': 'VhostDeviceProtocols',
+  'data': { 'protocols': [ 'str' ],
+            '*unknown-protocols': 'uint64' } }
+
+##
+# @VirtioDeviceFeatures:
+#
+# The common fields that apply to most Virtio devices. Some devices
+# may not have their own device-specific features (e.g. virtio-rng).
+#
+# @transports: List of transport features of the virtio device
+#
+# @dev-features: List of device-specific features (if the device has
+#                unique features)
+#
+# @unknown-dev-features: Virtio device features bitmap that have not
+#                        been decoded
+#
+# Since: 7.1
+##
+
+{ 'struct': 'VirtioDeviceFeatures',
+  'data': { 'transports': [ 'str' ],
+            '*dev-features': [ 'str' ],
+            '*unknown-dev-features': 'uint64' } }
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 61b957e927..d7eb557885 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -5,6 +5,9 @@
 #include "hw/virtio/virtio.h"
 #include "exec/memory.h"
 
+#define VHOST_F_DEVICE_IOTLB 63
+#define VHOST_USER_F_PROTOCOL_FEATURES 30
+
 /* Generic structures common for any vhost based device. */
 
 struct vhost_inflight {
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 9eeb958e39..f41b4a7e64 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -82,6 +82,11 @@ typedef struct VirtQueueElement
 #define TYPE_VIRTIO_DEVICE "virtio-device"
 OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
 
+typedef struct {
+    int virtio_bit;
+    const char *feature_desc;
+} qmp_virtio_feature_map_t;
+
 enum virtio_device_endian {
     VIRTIO_DEVICE_ENDIAN_UNKNOWN,
     VIRTIO_DEVICE_ENDIAN_LITTLE,
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 696e19126a..6c530567b0 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -34,10 +34,433 @@
 #include "sysemu/dma.h"
 #include "sysemu/runstate.h"
 #include "standard-headers/linux/virtio_ids.h"
+#include "standard-headers/linux/vhost_types.h"
+#include "standard-headers/linux/virtio_blk.h"
+#include "standard-headers/linux/virtio_console.h"
+#include "standard-headers/linux/virtio_gpu.h"
+#include "standard-headers/linux/virtio_net.h"
+#include "standard-headers/linux/virtio_scsi.h"
+#include "standard-headers/linux/virtio_i2c.h"
+#include "standard-headers/linux/virtio_balloon.h"
+#include "standard-headers/linux/virtio_iommu.h"
+#include "standard-headers/linux/virtio_mem.h"
+#include "standard-headers/linux/virtio_vsock.h"
+#include CONFIG_DEVICES
 
 /* QAPI list of realized VirtIODevices */
 static QTAILQ_HEAD(, VirtIODevice) virtio_list;
 
+/*
+ * Maximum size of virtio device config space
+ */
+#define VHOST_USER_MAX_CONFIG_SIZE 256
+
+#define FEATURE_ENTRY(name, desc) (qmp_virtio_feature_map_t) \
+    { .virtio_bit = name, .feature_desc = desc }
+
+enum VhostUserProtocolFeature {
+    VHOST_USER_PROTOCOL_F_MQ = 0,
+    VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
+    VHOST_USER_PROTOCOL_F_RARP = 2,
+    VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
+    VHOST_USER_PROTOCOL_F_NET_MTU = 4,
+    VHOST_USER_PROTOCOL_F_SLAVE_REQ = 5,
+    VHOST_USER_PROTOCOL_F_CROSS_ENDIAN = 6,
+    VHOST_USER_PROTOCOL_F_CRYPTO_SESSION = 7,
+    VHOST_USER_PROTOCOL_F_PAGEFAULT = 8,
+    VHOST_USER_PROTOCOL_F_CONFIG = 9,
+    VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD = 10,
+    VHOST_USER_PROTOCOL_F_HOST_NOTIFIER = 11,
+    VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD = 12,
+    VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
+    VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS = 14,
+    VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS = 15,
+    VHOST_USER_PROTOCOL_F_MAX
+};
+
+/* Virtio transport features mapping */
+static qmp_virtio_feature_map_t virtio_transport_map[] = {
+    /* Virtio device transport features */
+#ifndef VIRTIO_CONFIG_NO_LEGACY
+    FEATURE_ENTRY(VIRTIO_F_NOTIFY_ON_EMPTY, \
+            "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. "
+            "descs. on VQ"),
+    FEATURE_ENTRY(VIRTIO_F_ANY_LAYOUT, \
+            "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts"),
+#endif /* !VIRTIO_CONFIG_NO_LEGACY */
+    FEATURE_ENTRY(VIRTIO_F_VERSION_1, \
+            "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"),
+    FEATURE_ENTRY(VIRTIO_F_IOMMU_PLATFORM, \
+            "VIRTIO_F_IOMMU_PLATFORM: Device can be used on IOMMU platform"),
+    FEATURE_ENTRY(VIRTIO_F_RING_PACKED, \
+            "VIRTIO_F_RING_PACKED: Device supports packed VQ layout"),
+    FEATURE_ENTRY(VIRTIO_F_IN_ORDER, \
+            "VIRTIO_F_IN_ORDER: Device uses buffers in same order as made "
+            "available by driver"),
+    FEATURE_ENTRY(VIRTIO_F_ORDER_PLATFORM, \
+            "VIRTIO_F_ORDER_PLATFORM: Memory accesses ordered by platform"),
+    FEATURE_ENTRY(VIRTIO_F_SR_IOV, \
+            "VIRTIO_F_SR_IOV: Device supports single root I/O virtualization"),
+    /* Virtio ring transport features */
+    FEATURE_ENTRY(VIRTIO_RING_F_INDIRECT_DESC, \
+            "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported"),
+    FEATURE_ENTRY(VIRTIO_RING_F_EVENT_IDX, \
+            "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled"),
+    { -1, "" }
+};
+
+/* Vhost-user protocol features mapping */
+static qmp_virtio_feature_map_t vhost_user_protocol_map[] = {
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_MQ, \
+            "VHOST_USER_PROTOCOL_F_MQ: Multiqueue protocol supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_LOG_SHMFD, \
+            "VHOST_USER_PROTOCOL_F_LOG_SHMFD: Shared log memory fd supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_RARP, \
+            "VHOST_USER_PROTOCOL_F_RARP: Vhost-user back-end RARP broadcasting "
+            "supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_REPLY_ACK, \
+            "VHOST_USER_PROTOCOL_F_REPLY_ACK: Requested operation status ack. "
+            "supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_NET_MTU, \
+            "VHOST_USER_PROTOCOL_F_NET_MTU: Expose host MTU to guest supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_SLAVE_REQ, \
+            "VHOST_USER_PROTOCOL_F_SLAVE_REQ: Socket fd for back-end initiated "
+            "requests supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CROSS_ENDIAN, \
+            "VHOST_USER_PROTOCOL_F_CROSS_ENDIAN: Endianness of VQs for legacy "
+            "devices supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CRYPTO_SESSION, \
+            "VHOST_USER_PROTOCOL_F_CRYPTO_SESSION: Session creation for crypto "
+            "operations supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_PAGEFAULT, \
+            "VHOST_USER_PROTOCOL_F_PAGEFAULT: Request servicing on userfaultfd "
+            "for accessed pages supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CONFIG, \
+            "VHOST_USER_PROTOCOL_F_CONFIG: Vhost-user messaging for virtio "
+            "device configuration space supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD, \
+            "VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD: Slave fd communication "
+            "channel supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_HOST_NOTIFIER, \
+            "VHOST_USER_PROTOCOL_F_HOST_NOTIFIER: Host notifiers for specified "
+            "VQs supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD, \
+            "VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD: Shared inflight I/O buffers "
+            "supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_RESET_DEVICE, \
+            "VHOST_USER_PROTOCOL_F_RESET_DEVICE: Disabling all rings and "
+            "resetting internal device state supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS, \
+            "VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS: In-band messaging "
+            "supported"),
+    FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS, \
+            "VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS: Configuration for "
+            "memory slots supported"),
+    { -1, "" }
+};
+
+/* virtio device configuration statuses */
+static qmp_virtio_feature_map_t virtio_config_status_map[] = {
+    FEATURE_ENTRY(VIRTIO_CONFIG_S_DRIVER_OK, \
+            "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready"),
+    FEATURE_ENTRY(VIRTIO_CONFIG_S_FEATURES_OK, \
+            "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete"),
+    FEATURE_ENTRY(VIRTIO_CONFIG_S_DRIVER, \
+            "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device"),
+    FEATURE_ENTRY(VIRTIO_CONFIG_S_NEEDS_RESET, \
+            "VIRTIO_CONFIG_S_NEEDS_RESET: Irrecoverable error, device needs "
+            "reset"),
+    FEATURE_ENTRY(VIRTIO_CONFIG_S_FAILED, \
+            "VIRTIO_CONFIG_S_FAILED: Error in guest, device failed"),
+    FEATURE_ENTRY(VIRTIO_CONFIG_S_ACKNOWLEDGE, \
+            "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found"),
+    { -1, "" }
+};
+
+/* virtio-blk features mapping */
+qmp_virtio_feature_map_t virtio_blk_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_BLK_F_SIZE_MAX, \
+            "VIRTIO_BLK_F_SIZE_MAX: Max segment size is size_max"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_SEG_MAX, \
+            "VIRTIO_BLK_F_SEG_MAX: Max segments in a request is seg_max"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_GEOMETRY, \
+            "VIRTIO_BLK_F_GEOMETRY: Legacy geometry available"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_RO, \
+            "VIRTIO_BLK_F_RO: Device is read-only"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_BLK_SIZE, \
+            "VIRTIO_BLK_F_BLK_SIZE: Block size of disk available"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_TOPOLOGY, \
+            "VIRTIO_BLK_F_TOPOLOGY: Topology information available"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_MQ, \
+            "VIRTIO_BLK_F_MQ: Multiqueue supported"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_DISCARD, \
+            "VIRTIO_BLK_F_DISCARD: Discard command supported"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_WRITE_ZEROES, \
+            "VIRTIO_BLK_F_WRITE_ZEROES: Write zeroes command supported"),
+#ifndef VIRTIO_BLK_NO_LEGACY
+    FEATURE_ENTRY(VIRTIO_BLK_F_BARRIER, \
+            "VIRTIO_BLK_F_BARRIER: Request barriers supported"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_SCSI, \
+            "VIRTIO_BLK_F_SCSI: SCSI packet commands supported"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_FLUSH, \
+            "VIRTIO_BLK_F_FLUSH: Flush command supported"),
+    FEATURE_ENTRY(VIRTIO_BLK_F_CONFIG_WCE, \
+            "VIRTIO_BLK_F_CONFIG_WCE: Cache writeback and writethrough modes "
+            "supported"),
+#endif /* !VIRTIO_BLK_NO_LEGACY */
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio-serial features mapping */
+qmp_virtio_feature_map_t virtio_serial_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_CONSOLE_F_SIZE, \
+            "VIRTIO_CONSOLE_F_SIZE: Host providing console size"),
+    FEATURE_ENTRY(VIRTIO_CONSOLE_F_MULTIPORT, \
+            "VIRTIO_CONSOLE_F_MULTIPORT: Multiple ports for device supported"),
+    FEATURE_ENTRY(VIRTIO_CONSOLE_F_EMERG_WRITE, \
+            "VIRTIO_CONSOLE_F_EMERG_WRITE: Emergency write supported"),
+    { -1, "" }
+};
+
+/* virtio-gpu features mapping */
+qmp_virtio_feature_map_t virtio_gpu_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_GPU_F_VIRGL, \
+            "VIRTIO_GPU_F_VIRGL: Virgl 3D mode supported"),
+    FEATURE_ENTRY(VIRTIO_GPU_F_EDID, \
+            "VIRTIO_GPU_F_EDID: EDID metadata supported"),
+    FEATURE_ENTRY(VIRTIO_GPU_F_RESOURCE_UUID, \
+            "VIRTIO_GPU_F_RESOURCE_UUID: Resource UUID assigning supported"),
+    FEATURE_ENTRY(VIRTIO_GPU_F_RESOURCE_BLOB, \
+            "VIRTIO_GPU_F_RESOURCE_BLOB: Size-based blob resources supported"),
+    FEATURE_ENTRY(VIRTIO_GPU_F_CONTEXT_INIT, \
+            "VIRTIO_GPU_F_CONTEXT_INIT: Context types and synchronization "
+            "timelines supported"),
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio-input features mapping */
+qmp_virtio_feature_map_t virtio_input_feature_map[] = {
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio-net features mapping */
+qmp_virtio_feature_map_t virtio_net_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_NET_F_CSUM, \
+            "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum "
+            "supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_GUEST_CSUM, \
+            "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial "
+            "checksum supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \
+            "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading "
+            "reconfig. supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_MTU, \
+            "VIRTIO_NET_F_MTU: Device max MTU reporting supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_MAC, \
+            "VIRTIO_NET_F_MAC: Device has given MAC address"),
+    FEATURE_ENTRY(VIRTIO_NET_F_GUEST_TSO4, \
+            "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4"),
+    FEATURE_ENTRY(VIRTIO_NET_F_GUEST_TSO6, \
+            "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6"),
+    FEATURE_ENTRY(VIRTIO_NET_F_GUEST_ECN, \
+            "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN"),
+    FEATURE_ENTRY(VIRTIO_NET_F_GUEST_UFO, \
+            "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO"),
+    FEATURE_ENTRY(VIRTIO_NET_F_HOST_TSO4, \
+            "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4"),
+    FEATURE_ENTRY(VIRTIO_NET_F_HOST_TSO6, \
+            "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6"),
+    FEATURE_ENTRY(VIRTIO_NET_F_HOST_ECN, \
+            "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN"),
+    FEATURE_ENTRY(VIRTIO_NET_F_HOST_UFO, \
+            "VIRTIO_NET_F_HOST_UFO: Device can receive UFO"),
+    FEATURE_ENTRY(VIRTIO_NET_F_MRG_RXBUF, \
+            "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers"),
+    FEATURE_ENTRY(VIRTIO_NET_F_STATUS, \
+            "VIRTIO_NET_F_STATUS: Configuration status field available"),
+    FEATURE_ENTRY(VIRTIO_NET_F_CTRL_VQ, \
+            "VIRTIO_NET_F_CTRL_VQ: Control channel available"),
+    FEATURE_ENTRY(VIRTIO_NET_F_CTRL_RX, \
+            "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_CTRL_VLAN, \
+            "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_CTRL_RX_EXTRA, \
+            "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_GUEST_ANNOUNCE, \
+            "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets "
+            "supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_MQ, \
+            "VIRTIO_NET_F_MQ: Multiqueue with automatic receive steering "
+            "supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_CTRL_MAC_ADDR, \
+            "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control "
+            "channel"),
+    FEATURE_ENTRY(VIRTIO_NET_F_HASH_REPORT, \
+            "VIRTIO_NET_F_HASH_REPORT: Hash reporting supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_RSS, \
+            "VIRTIO_NET_F_RSS: RSS RX steering supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_RSC_EXT, \
+            "VIRTIO_NET_F_RSC_EXT: Extended coalescing info supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_STANDBY, \
+            "VIRTIO_NET_F_STANDBY: Device acting as standby for primary "
+            "device with same MAC addr. supported"),
+    FEATURE_ENTRY(VIRTIO_NET_F_SPEED_DUPLEX, \
+            "VIRTIO_NET_F_SPEED_DUPLEX: Device set linkspeed and duplex"),
+#ifndef VIRTIO_NET_NO_LEGACY
+    FEATURE_ENTRY(VIRTIO_NET_F_GSO, \
+            "VIRTIO_NET_F_GSO: Handling GSO-type packets supported"),
+#endif /* !VIRTIO_NET_NO_LEGACY */
+    FEATURE_ENTRY(VHOST_NET_F_VIRTIO_NET_HDR, \
+            "VHOST_NET_F_VIRTIO_NET_HDR: Virtio-net headers for RX and TX "
+            "packets supported"),
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio-scsi features mapping */
+qmp_virtio_feature_map_t virtio_scsi_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_SCSI_F_INOUT, \
+            "VIRTIO_SCSI_F_INOUT: Requests including read and writable data "
+            "buffers suppoted"),
+    FEATURE_ENTRY(VIRTIO_SCSI_F_HOTPLUG, \
+            "VIRTIO_SCSI_F_HOTPLUG: Reporting and handling hot-plug events "
+            "supported"),
+    FEATURE_ENTRY(VIRTIO_SCSI_F_CHANGE, \
+            "VIRTIO_SCSI_F_CHANGE: Reporting and handling LUN changes "
+            "supported"),
+    FEATURE_ENTRY(VIRTIO_SCSI_F_T10_PI, \
+            "VIRTIO_SCSI_F_T10_PI: T10 info included in request header"),
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio/vhost-user-fs features mapping */
+qmp_virtio_feature_map_t virtio_fs_feature_map[] = {
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio/vhost-user-i2c features mapping */
+qmp_virtio_feature_map_t virtio_i2c_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, \
+            "VIRTIO_I2C_F_ZERO_LEGNTH_REQUEST: Zero length requests supported"),
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio/vhost-vsock features mapping */
+qmp_virtio_feature_map_t virtio_vsock_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_VSOCK_F_SEQPACKET, \
+            "VIRTIO_VSOCK_F_SEQPACKET: SOCK_SEQPACKET supported"),
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
+/* virtio-balloon features mapping */
+qmp_virtio_feature_map_t virtio_balloon_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_BALLOON_F_MUST_TELL_HOST, \
+            "VIRTIO_BALLOON_F_MUST_TELL_HOST: Tell host before reclaiming "
+            "pages"),
+    FEATURE_ENTRY(VIRTIO_BALLOON_F_STATS_VQ, \
+            "VIRTIO_BALLOON_F_STATS_VQ: Guest memory stats VQ available"),
+    FEATURE_ENTRY(VIRTIO_BALLOON_F_DEFLATE_ON_OOM, \
+            "VIRTIO_BALLOON_F_DEFLATE_ON_OOM: Deflate balloon when guest OOM"),
+    FEATURE_ENTRY(VIRTIO_BALLOON_F_FREE_PAGE_HINT, \
+            "VIRTIO_BALLOON_F_FREE_PAGE_HINT: VQ reporting free pages enabled"),
+    FEATURE_ENTRY(VIRTIO_BALLOON_F_PAGE_POISON, \
+            "VIRTIO_BALLOON_F_PAGE_POISON: Guest page poisoning enabled"),
+    FEATURE_ENTRY(VIRTIO_BALLOON_F_REPORTING, \
+            "VIRTIO_BALLOON_F_REPORTING: Page reporting VQ enabled"),
+    { -1, "" }
+};
+
+/* virtio-crypto features mapping */
+qmp_virtio_feature_map_t virtio_crypto_feature_map[] = {
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    { -1, "" }
+};
+
+/* virtio-iommu features mapping */
+qmp_virtio_feature_map_t virtio_iommu_feature_map[] = {
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_INPUT_RANGE, \
+            "VIRTIO_IOMMU_F_INPUT_RANGE: Range of available virtual addrs. "
+            "available"),
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_DOMAIN_RANGE, \
+            "VIRTIO_IOMMU_F_DOMAIN_RANGE: Number of supported domains "
+            "available"),
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_MAP_UNMAP, \
+            "VIRTIO_IOMMU_F_MAP_UNMAP: Map and unmap requests available"),
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_BYPASS, \
+            "VIRTIO_IOMMU_F_BYPASS: Endpoints not attached to domains are in "
+            "bypass mode"),
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_PROBE, \
+            "VIRTIO_IOMMU_F_PROBE: Probe requests available"),
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_MMIO, \
+            "VIRTIO_IOMMU_F_MMIO: VIRTIO_IOMMU_MAP_F_MMIO flag available"),
+    FEATURE_ENTRY(VIRTIO_IOMMU_F_BYPASS_CONFIG, \
+            "VIRTIO_IOMMU_F_BYPASS_CONFIG: Bypass field of IOMMU config "
+            "available"),
+    { -1, "" }
+};
+
+/* virtio-mem features mapping */
+qmp_virtio_feature_map_t virtio_mem_feature_map[] = {
+#ifndef CONFIG_ACPI
+    FEATURE_ENTRY(VIRTIO_MEM_F_ACPI_PXM, \
+            "VIRTIO_MEM_F_ACPI_PXM: node_id is an ACPI PXM and is valid"),
+#endif /* !CONFIG_ACPI */
+    FEATURE_ENTRY(VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, \
+            "VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE: Unplugged memory cannot be "
+            "accessed"),
+    { -1, "" }
+};
+
+/* virtio-rng features mapping */
+qmp_virtio_feature_map_t virtio_rng_feature_map[] = {
+    FEATURE_ENTRY(VHOST_F_LOG_ALL, \
+            "VHOST_F_LOG_ALL: Logging write descriptors supported"),
+    FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
+            "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
+            "negotiation supported"),
+    { -1, "" }
+};
+
 /*
  * The alignment to use between consumer and producer parts of vring.
  * x86 pagesize again. This is the default, used by transports like PCI
@@ -3984,6 +4407,203 @@ static VirtIODevice *virtio_device_find(const char *path)
     return NULL;
 }
 
+#define CONVERT_FEATURES(type, map, is_status, bitmap)   \
+    ({                                                   \
+        type *list = NULL;                               \
+        type *node;                                      \
+        for (i = 0; map[i].virtio_bit != -1; i++) {      \
+            if (is_status) {                             \
+                bit = map[i].virtio_bit;                 \
+            }                                            \
+            else {                                       \
+                bit = 1ULL << map[i].virtio_bit;         \
+            }                                            \
+            if ((bitmap & bit) == 0) {                   \
+                continue;                                \
+            }                                            \
+            node = g_new0(type, 1);                      \
+            node->value = g_strdup(map[i].feature_desc); \
+            node->next = list;                           \
+            list = node;                                 \
+            bitmap ^= bit;                               \
+        }                                                \
+        list;                                            \
+    })
+
+static VirtioDeviceStatus *qmp_decode_status(uint8_t bitmap)
+{
+    VirtioDeviceStatus *status;
+    uint8_t bit;
+    int i;
+
+    status = g_new0(VirtioDeviceStatus, 1);
+    status->statuses = CONVERT_FEATURES(strList, virtio_config_status_map,
+                                        1, bitmap);
+    status->has_unknown_statuses = bitmap != 0;
+    if (status->has_unknown_statuses) {
+        status->unknown_statuses = bitmap;
+    }
+
+    return status;
+}
+
+static VhostDeviceProtocols *qmp_decode_protocols(uint64_t bitmap)
+{
+    VhostDeviceProtocols *vhu_protocols;
+    uint64_t bit;
+    int i;
+
+    vhu_protocols = g_new0(VhostDeviceProtocols, 1);
+    vhu_protocols->protocols =
+                    CONVERT_FEATURES(strList,
+                                     vhost_user_protocol_map, 0, bitmap);
+    vhu_protocols->has_unknown_protocols = bitmap != 0;
+    if (vhu_protocols->has_unknown_protocols) {
+        vhu_protocols->unknown_protocols = bitmap;
+    }
+
+    return vhu_protocols;
+}
+
+static VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id,
+                                                 uint64_t bitmap)
+{
+    VirtioDeviceFeatures *features;
+    uint64_t bit;
+    int i;
+
+    features = g_new0(VirtioDeviceFeatures, 1);
+    features->has_dev_features = true;
+
+    /* transport features */
+    features->transports = CONVERT_FEATURES(strList, virtio_transport_map, 0,
+                                            bitmap);
+
+    /* device features */
+    switch (device_id) {
+#ifdef CONFIG_VIRTIO_SERIAL
+    case VIRTIO_ID_CONSOLE:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_serial_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_BLK
+    case VIRTIO_ID_BLOCK:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_blk_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_GPU
+    case VIRTIO_ID_GPU:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_gpu_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_NET
+    case VIRTIO_ID_NET:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_net_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_SCSI
+    case VIRTIO_ID_SCSI:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_scsi_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_BALLOON
+    case VIRTIO_ID_BALLOON:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_balloon_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_IOMMU
+    case VIRTIO_ID_IOMMU:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_iommu_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_INPUT
+    case VIRTIO_ID_INPUT:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_input_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VHOST_USER_FS
+    case VIRTIO_ID_FS:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_fs_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VHOST_VSOCK
+    case VIRTIO_ID_VSOCK:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_vsock_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_CRYPTO
+    case VIRTIO_ID_CRYPTO:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_crypto_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_MEM
+    case VIRTIO_ID_MEM:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_mem_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_I2C_ADAPTER
+    case VIRTIO_ID_I2C_ADAPTER:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_i2c_feature_map, 0, bitmap);
+        break;
+#endif
+#ifdef CONFIG_VIRTIO_RNG
+    case VIRTIO_ID_RNG:
+        features->dev_features =
+            CONVERT_FEATURES(strList, virtio_rng_feature_map, 0, bitmap);
+        break;
+#endif
+    /* No features */
+    case VIRTIO_ID_9P:
+    case VIRTIO_ID_PMEM:
+    case VIRTIO_ID_IOMEM:
+    case VIRTIO_ID_RPMSG:
+    case VIRTIO_ID_CLOCK:
+    case VIRTIO_ID_MAC80211_WLAN:
+    case VIRTIO_ID_MAC80211_HWSIM:
+    case VIRTIO_ID_RPROC_SERIAL:
+    case VIRTIO_ID_MEMORY_BALLOON:
+    case VIRTIO_ID_CAIF:
+    case VIRTIO_ID_SIGNAL_DIST:
+    case VIRTIO_ID_PSTORE:
+    case VIRTIO_ID_SOUND:
+    case VIRTIO_ID_BT:
+    case VIRTIO_ID_RPMB:
+    case VIRTIO_ID_VIDEO_ENCODER:
+    case VIRTIO_ID_VIDEO_DECODER:
+    case VIRTIO_ID_SCMI:
+    case VIRTIO_ID_NITRO_SEC_MOD:
+    case VIRTIO_ID_WATCHDOG:
+    case VIRTIO_ID_CAN:
+    case VIRTIO_ID_DMABUF:
+    case VIRTIO_ID_PARAM_SERV:
+    case VIRTIO_ID_AUDIO_POLICY:
+    case VIRTIO_ID_GPIO:
+        break;
+    default:
+        g_assert_not_reached();
+    }
+
+    features->has_unknown_dev_features = bitmap != 0;
+    if (features->has_unknown_dev_features) {
+        features->unknown_dev_features = bitmap;
+    }
+
+    return features;
+}
+
 VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
 {
     VirtIODevice *vdev;
@@ -3999,9 +4619,12 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
     status->name = g_strdup(vdev->name);
     status->device_id = vdev->device_id;
     status->vhost_started = vdev->vhost_started;
-    status->guest_features = vdev->guest_features;
-    status->host_features = vdev->host_features;
-    status->backend_features = vdev->backend_features;
+    status->guest_features = qmp_decode_features(vdev->device_id,
+                                                 vdev->guest_features);
+    status->host_features = qmp_decode_features(vdev->device_id,
+                                                vdev->host_features);
+    status->backend_features = qmp_decode_features(vdev->device_id,
+                                                   vdev->backend_features);
 
     switch (vdev->device_endian) {
     case VIRTIO_DEVICE_ENDIAN_LITTLE:
@@ -4016,7 +4639,7 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
     }
 
     status->num_vqs = virtio_get_num_queues(vdev);
-    status->status = vdev->status;
+    status->status = qmp_decode_status(vdev->status);
     status->isr = vdev->isr;
     status->queue_sel = vdev->queue_sel;
     status->vm_running = vdev->vm_running;
@@ -4039,10 +4662,14 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
         status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections;
         status->vhost_dev->nvqs = hdev->nvqs;
         status->vhost_dev->vq_index = hdev->vq_index;
-        status->vhost_dev->features = hdev->features;
-        status->vhost_dev->acked_features = hdev->acked_features;
-        status->vhost_dev->backend_features = hdev->backend_features;
-        status->vhost_dev->protocol_features = hdev->protocol_features;
+        status->vhost_dev->features =
+            qmp_decode_features(vdev->device_id, hdev->features);
+        status->vhost_dev->acked_features =
+            qmp_decode_features(vdev->device_id, hdev->acked_features);
+        status->vhost_dev->backend_features =
+            qmp_decode_features(vdev->device_id, hdev->backend_features);
+        status->vhost_dev->protocol_features =
+            qmp_decode_protocols(hdev->protocol_features);
         status->vhost_dev->max_queues = hdev->max_queues;
         status->vhost_dev->backend_cap = hdev->backend_cap;
         status->vhost_dev->log_enabled = hdev->log_enabled;
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 33/55] qmp: add QMP commands for virtio/vhost queue-status
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (31 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 32/55] qmp: decode feature & status bits in virtio-status Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element Michael S. Tsirkin
                   ` (23 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laurent Vivier, Jonah Palmer, Eric Blake,
	Markus Armbruster

From: Laurent Vivier <lvivier@redhat.com>

These new commands show the internal status of a VirtIODevice's
VirtQueue and a vhost device's vhost_virtqueue (if active).

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Message-Id: <1660220684-24909-5-git-send-email-jonah.palmer@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 qapi/virtio.json        | 256 ++++++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-stub.c |  14 +++
 hw/virtio/virtio.c      | 103 ++++++++++++++++
 3 files changed, 373 insertions(+)

diff --git a/qapi/virtio.json b/qapi/virtio.json
index c9c8201e66..d9050f3584 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -499,3 +499,259 @@
   'data': { 'transports': [ 'str' ],
             '*dev-features': [ 'str' ],
             '*unknown-dev-features': 'uint64' } }
+
+##
+# @VirtQueueStatus:
+#
+# Information of a VirtIODevice VirtQueue, including most members of
+# the VirtQueue data structure.
+#
+# @name: Name of the VirtIODevice that uses this VirtQueue
+#
+# @queue-index: VirtQueue queue_index
+#
+# @inuse: VirtQueue inuse
+#
+# @vring-num: VirtQueue vring.num
+#
+# @vring-num-default: VirtQueue vring.num_default
+#
+# @vring-align: VirtQueue vring.align
+#
+# @vring-desc: VirtQueue vring.desc (descriptor area)
+#
+# @vring-avail: VirtQueue vring.avail (driver area)
+#
+# @vring-used: VirtQueue vring.used (device area)
+#
+# @last-avail-idx: VirtQueue last_avail_idx or return of vhost_dev
+#                  vhost_get_vring_base (if vhost active)
+#
+# @shadow-avail-idx: VirtQueue shadow_avail_idx
+#
+# @used-idx: VirtQueue used_idx
+#
+# @signalled-used: VirtQueue signalled_used
+#
+# @signalled-used-valid: VirtQueue signalled_used_valid flag
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtQueueStatus',
+  'data': { 'name': 'str',
+            'queue-index': 'uint16',
+            'inuse': 'uint32',
+            'vring-num': 'uint32',
+            'vring-num-default': 'uint32',
+            'vring-align': 'uint32',
+            'vring-desc': 'uint64',
+            'vring-avail': 'uint64',
+            'vring-used': 'uint64',
+            '*last-avail-idx': 'uint16',
+            '*shadow-avail-idx': 'uint16',
+            'used-idx': 'uint16',
+            'signalled-used': 'uint16',
+            'signalled-used-valid': 'bool' } }
+
+##
+# @x-query-virtio-queue-status:
+#
+# Return the status of a given VirtIODevice's VirtQueue
+#
+# @path: VirtIODevice canonical QOM path
+#
+# @queue: VirtQueue index to examine
+#
+# Features:
+# @unstable: This command is meant for debugging.
+#
+# Returns: VirtQueueStatus of the VirtQueue
+#
+# Notes: last_avail_idx will not be displayed in the case where
+#        the selected VirtIODevice has a running vhost device and
+#        the VirtIODevice VirtQueue index (queue) does not exist for
+#        the corresponding vhost device vhost_virtqueue. Also,
+#        shadow_avail_idx will not be displayed in the case where
+#        the selected VirtIODevice has a running vhost device.
+#
+# Since: 7.1
+#
+# Examples:
+#
+# 1. Get VirtQueueStatus for virtio-vsock (vhost-vsock running)
+#
+# -> { "execute": "x-query-virtio-queue-status",
+#      "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend",
+#                     "queue": 1 }
+#    }
+# <- { "return": {
+#          "signalled-used": 0,
+#          "inuse": 0,
+#          "name": "vhost-vsock",
+#          "vring-align": 4096,
+#          "vring-desc": 5217370112,
+#          "signalled-used-valid": false,
+#          "vring-num-default": 128,
+#          "vring-avail": 5217372160,
+#          "queue-index": 1,
+#          "last-avail-idx": 0,
+#          "vring-used": 5217372480,
+#          "used-idx": 0,
+#          "vring-num": 128
+#      }
+#    }
+#
+# 2. Get VirtQueueStatus for virtio-serial (no vhost)
+#
+# -> { "execute": "x-query-virtio-queue-status",
+#      "arguments": { "path": "/machine/peripheral-anon/device[0]/virtio-backend",
+#                     "queue": 20 }
+#    }
+# <- { "return": {
+#          "signalled-used": 0,
+#          "inuse": 0,
+#          "name": "virtio-serial",
+#          "vring-align": 4096,
+#          "vring-desc": 5182074880,
+#          "signalled-used-valid": false,
+#          "vring-num-default": 128,
+#          "vring-avail": 5182076928,
+#          "queue-index": 20,
+#          "last-avail-idx": 0,
+#          "vring-used": 5182077248,
+#          "used-idx": 0,
+#          "shadow-avail-idx": 0,
+#          "vring-num": 128
+#      }
+#    }
+#
+##
+
+{ 'command': 'x-query-virtio-queue-status',
+  'data': { 'path': 'str', 'queue': 'uint16' },
+  'returns': 'VirtQueueStatus',
+  'features': [ 'unstable' ] }
+
+##
+# @VirtVhostQueueStatus:
+#
+# Information of a vhost device's vhost_virtqueue, including most
+# members of the vhost_dev vhost_virtqueue data structure.
+#
+# @name: Name of the VirtIODevice that uses this vhost_virtqueue
+#
+# @kick: vhost_virtqueue kick
+#
+# @call: vhost_virtqueue call
+#
+# @desc: vhost_virtqueue desc
+#
+# @avail: vhost_virtqueue avail
+#
+# @used: vhost_virtqueue used
+#
+# @num: vhost_virtqueue num
+#
+# @desc-phys: vhost_virtqueue desc_phys (descriptor area phys. addr.)
+#
+# @desc-size: vhost_virtqueue desc_size
+#
+# @avail-phys: vhost_virtqueue avail_phys (driver area phys. addr.)
+#
+# @avail-size: vhost_virtqueue avail_size
+#
+# @used-phys: vhost_virtqueue used_phys (device area phys. addr.)
+#
+# @used-size: vhost_virtqueue used_size
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtVhostQueueStatus',
+  'data': { 'name': 'str',
+            'kick': 'int',
+            'call': 'int',
+            'desc': 'uint64',
+            'avail': 'uint64',
+            'used': 'uint64',
+            'num': 'int',
+            'desc-phys': 'uint64',
+            'desc-size': 'uint32',
+            'avail-phys': 'uint64',
+            'avail-size': 'uint32',
+            'used-phys': 'uint64',
+            'used-size': 'uint32' } }
+
+##
+# @x-query-virtio-vhost-queue-status:
+#
+# Return information of a given vhost device's vhost_virtqueue
+#
+# @path: VirtIODevice canonical QOM path
+#
+# @queue: vhost_virtqueue index to examine
+#
+# Features:
+# @unstable: This command is meant for debugging.
+#
+# Returns: VirtVhostQueueStatus of the vhost_virtqueue
+#
+# Since: 7.1
+#
+# Examples:
+#
+# 1. Get vhost_virtqueue status for vhost-crypto
+#
+# -> { "execute": "x-query-virtio-vhost-queue-status",
+#      "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend",
+#                     "queue": 0 }
+#    }
+# <- { "return": {
+#          "avail-phys": 5216124928,
+#          "name": "virtio-crypto",
+#          "used-phys": 5216127040,
+#          "avail-size": 2054,
+#          "desc-size": 16384,
+#          "used-size": 8198,
+#          "desc": 140141447430144,
+#          "num": 1024,
+#          "call": 0,
+#          "avail": 140141447446528,
+#          "desc-phys": 5216108544,
+#          "used": 140141447448640,
+#          "kick": 0
+#      }
+#    }
+#
+# 2. Get vhost_virtqueue status for vhost-vsock
+#
+# -> { "execute": "x-query-virtio-vhost-queue-status",
+#      "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend",
+#                     "queue": 0 }
+#    }
+# <- { "return": {
+#          "avail-phys": 5182261248,
+#          "name": "vhost-vsock",
+#          "used-phys": 5182261568,
+#          "avail-size": 262,
+#          "desc-size": 2048,
+#          "used-size": 1030,
+#          "desc": 140141413580800,
+#          "num": 128,
+#          "call": 0,
+#          "avail": 140141413582848,
+#          "desc-phys": 5182259200,
+#          "used": 140141413583168,
+#          "kick": 0
+#      }
+#    }
+#
+##
+
+{ 'command': 'x-query-virtio-vhost-queue-status',
+  'data': { 'path': 'str', 'queue': 'uint16' },
+  'returns': 'VirtVhostQueueStatus',
+  'features': [ 'unstable' ] }
diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c
index 0b432e8de7..13e5f93652 100644
--- a/hw/virtio/virtio-stub.c
+++ b/hw/virtio/virtio-stub.c
@@ -17,3 +17,17 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
 {
     return qmp_virtio_unsupported(errp);
 }
+
+VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *path,
+                                                            uint16_t queue,
+                                                            Error **errp)
+{
+    return qmp_virtio_unsupported(errp);
+}
+
+VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path,
+                                                 uint16_t queue,
+                                                 Error **errp)
+{
+    return qmp_virtio_unsupported(errp);
+}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6c530567b0..da869e7b51 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -4679,6 +4679,109 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
     return status;
 }
 
+VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *path,
+                                                            uint16_t queue,
+                                                            Error **errp)
+{
+    VirtIODevice *vdev;
+    VirtVhostQueueStatus *status;
+
+    vdev = virtio_device_find(path);
+    if (vdev == NULL) {
+        error_setg(errp, "Path %s is not a VirtIODevice", path);
+        return NULL;
+    }
+
+    if (!vdev->vhost_started) {
+        error_setg(errp, "Error: vhost device has not started yet");
+        return NULL;
+    }
+
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+    struct vhost_dev *hdev = vdc->get_vhost(vdev);
+
+    if (queue < hdev->vq_index || queue >= hdev->vq_index + hdev->nvqs) {
+        error_setg(errp, "Invalid vhost virtqueue number %d", queue);
+        return NULL;
+    }
+
+    status = g_new0(VirtVhostQueueStatus, 1);
+    status->name = g_strdup(vdev->name);
+    status->kick = hdev->vqs[queue].kick;
+    status->call = hdev->vqs[queue].call;
+    status->desc = (uintptr_t)hdev->vqs[queue].desc;
+    status->avail = (uintptr_t)hdev->vqs[queue].avail;
+    status->used = (uintptr_t)hdev->vqs[queue].used;
+    status->num = hdev->vqs[queue].num;
+    status->desc_phys = hdev->vqs[queue].desc_phys;
+    status->desc_size = hdev->vqs[queue].desc_size;
+    status->avail_phys = hdev->vqs[queue].avail_phys;
+    status->avail_size = hdev->vqs[queue].avail_size;
+    status->used_phys = hdev->vqs[queue].used_phys;
+    status->used_size = hdev->vqs[queue].used_size;
+
+    return status;
+}
+
+VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path,
+                                                 uint16_t queue,
+                                                 Error **errp)
+{
+    VirtIODevice *vdev;
+    VirtQueueStatus *status;
+
+    vdev = virtio_device_find(path);
+    if (vdev == NULL) {
+        error_setg(errp, "Path %s is not a VirtIODevice", path);
+        return NULL;
+    }
+
+    if (queue >= VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, queue)) {
+        error_setg(errp, "Invalid virtqueue number %d", queue);
+        return NULL;
+    }
+
+    status = g_new0(VirtQueueStatus, 1);
+    status->name = g_strdup(vdev->name);
+    status->queue_index = vdev->vq[queue].queue_index;
+    status->inuse = vdev->vq[queue].inuse;
+    status->vring_num = vdev->vq[queue].vring.num;
+    status->vring_num_default = vdev->vq[queue].vring.num_default;
+    status->vring_align = vdev->vq[queue].vring.align;
+    status->vring_desc = vdev->vq[queue].vring.desc;
+    status->vring_avail = vdev->vq[queue].vring.avail;
+    status->vring_used = vdev->vq[queue].vring.used;
+    status->used_idx = vdev->vq[queue].used_idx;
+    status->signalled_used = vdev->vq[queue].signalled_used;
+    status->signalled_used_valid = vdev->vq[queue].signalled_used_valid;
+
+    if (vdev->vhost_started) {
+        VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+        struct vhost_dev *hdev = vdc->get_vhost(vdev);
+
+        /* check if vq index exists for vhost as well  */
+        if (queue >= hdev->vq_index && queue < hdev->vq_index + hdev->nvqs) {
+            status->has_last_avail_idx = true;
+
+            int vhost_vq_index =
+                hdev->vhost_ops->vhost_get_vq_index(hdev, queue);
+            struct vhost_vring_state state = {
+                .index = vhost_vq_index,
+            };
+
+            status->last_avail_idx =
+                hdev->vhost_ops->vhost_get_vring_base(hdev, &state);
+        }
+    } else {
+        status->has_shadow_avail_idx = true;
+        status->has_last_avail_idx = true;
+        status->last_avail_idx = vdev->vq[queue].last_avail_idx;
+        status->shadow_avail_idx = vdev->vq[queue].shadow_avail_idx;
+    }
+
+    return status;
+}
+
 static const TypeInfo virtio_device_info = {
     .name = TYPE_VIRTIO_DEVICE,
     .parent = TYPE_DEVICE,
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (32 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 33/55] qmp: add QMP commands for virtio/vhost queue-status Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 35/55] hmp: add virtio commands Michael S. Tsirkin
                   ` (22 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laurent Vivier, Jonah Palmer, Eric Blake,
	Markus Armbruster

From: Laurent Vivier <lvivier@redhat.com>

This new command shows the information of a VirtQueue element.

[Note: Up until v10 of this patch series, virtio.json had many (15+)
 enums defined (e.g. decoded device features, statuses, etc.). In v10
 most of these enums were removed and replaced with string literals.
 By doing this we get (1) simpler schema, (2) smaller generated code,
 and (3) less maintenance burden for when new things are added (e.g.
 devices, device features, etc.).]

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Message-Id: <1660220684-24909-6-git-send-email-jonah.palmer@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 qapi/virtio.json        | 197 ++++++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-stub.c |   9 ++
 hw/virtio/virtio.c      | 154 +++++++++++++++++++++++++++++++
 3 files changed, 360 insertions(+)

diff --git a/qapi/virtio.json b/qapi/virtio.json
index d9050f3584..e47a8fb2e0 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -755,3 +755,200 @@
   'data': { 'path': 'str', 'queue': 'uint16' },
   'returns': 'VirtVhostQueueStatus',
   'features': [ 'unstable' ] }
+
+##
+# @VirtioRingDesc:
+#
+# Information regarding the vring descriptor area
+#
+# @addr: Guest physical address of the descriptor area
+#
+# @len: Length of the descriptor area
+#
+# @flags: List of descriptor flags
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtioRingDesc',
+  'data': { 'addr': 'uint64',
+            'len': 'uint32',
+            'flags': [ 'str' ] } }
+
+##
+# @VirtioRingAvail:
+#
+# Information regarding the avail vring (a.k.a. driver area)
+#
+# @flags: VRingAvail flags
+#
+# @idx: VRingAvail index
+#
+# @ring: VRingAvail ring[] entry at provided index
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtioRingAvail',
+  'data': { 'flags': 'uint16',
+            'idx': 'uint16',
+            'ring': 'uint16' } }
+
+##
+# @VirtioRingUsed:
+#
+# Information regarding the used vring (a.k.a. device area)
+#
+# @flags: VRingUsed flags
+#
+# @idx: VRingUsed index
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtioRingUsed',
+  'data': { 'flags': 'uint16',
+            'idx': 'uint16' } }
+
+##
+# @VirtioQueueElement:
+#
+# Information regarding a VirtQueue's VirtQueueElement including
+# descriptor, driver, and device areas
+#
+# @name: Name of the VirtIODevice that uses this VirtQueue
+#
+# @index: Index of the element in the queue
+#
+# @descs: List of descriptors (VirtioRingDesc)
+#
+# @avail: VRingAvail info
+#
+# @used: VRingUsed info
+#
+# Since: 7.1
+#
+##
+
+{ 'struct': 'VirtioQueueElement',
+  'data': { 'name': 'str',
+            'index': 'uint32',
+            'descs': [ 'VirtioRingDesc' ],
+            'avail': 'VirtioRingAvail',
+            'used': 'VirtioRingUsed' } }
+
+##
+# @x-query-virtio-queue-element:
+#
+# Return the information about a VirtQueue's VirtQueueElement
+#
+# @path: VirtIODevice canonical QOM path
+#
+# @queue: VirtQueue index to examine
+#
+# @index: Index of the element in the queue
+#         (default: head of the queue)
+#
+# Features:
+# @unstable: This command is meant for debugging.
+#
+# Returns: VirtioQueueElement information
+#
+# Since: 7.1
+#
+# Examples:
+#
+# 1. Introspect on virtio-net's VirtQueue 0 at index 5
+#
+# -> { "execute": "x-query-virtio-queue-element",
+#      "arguments": { "path": "/machine/peripheral-anon/device[1]/virtio-backend",
+#                     "queue": 0,
+#                     "index": 5 }
+#    }
+# <- { "return": {
+#          "index": 5,
+#          "name": "virtio-net",
+#          "descs": [
+#              {
+#                  "flags": ["write"],
+#                  "len": 1536,
+#                  "addr": 5257305600
+#              }
+#          ],
+#          "avail": {
+#              "idx": 256,
+#              "flags": 0,
+#              "ring": 5
+#          },
+#          "used": {
+#              "idx": 13,
+#              "flags": 0
+#          }
+#      }
+#    }
+#
+# 2. Introspect on virtio-crypto's VirtQueue 1 at head
+#
+# -> { "execute": "x-query-virtio-queue-element",
+#      "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend",
+#                     "queue": 1 }
+#    }
+# <- { "return": {
+#          "index": 0,
+#          "name": "virtio-crypto",
+#          "descs": [
+#              {
+#                  "flags": [],
+#                  "len": 0,
+#                  "addr": 8080268923184214134
+#              }
+#          ],
+#          "avail": {
+#              "idx": 280,
+#              "flags": 0,
+#              "ring": 0
+#          },
+#          "used": {
+#              "idx": 280,
+#              "flags": 0
+#          }
+#      }
+#    }
+#
+# 3. Introspect on virtio-scsi's VirtQueue 2 at head
+#
+# -> { "execute": "x-query-virtio-queue-element",
+#      "arguments": { "path": "/machine/peripheral-anon/device[2]/virtio-backend",
+#                     "queue": 2 }
+#    }
+# <- { "return": {
+#          "index": 19,
+#          "name": "virtio-scsi",
+#          "descs": [
+#              {
+#                  "flags": ["used", "indirect", "write"],
+#                  "len": 4099327944,
+#                  "addr": 12055409292258155293
+#              }
+#          ],
+#          "avail": {
+#              "idx": 1147,
+#              "flags": 0,
+#              "ring": 19
+#          },
+#          "used": {
+#              "idx": 280,
+#              "flags": 0
+#          }
+#      }
+#    }
+#
+##
+
+{ 'command': 'x-query-virtio-queue-element',
+  'data': { 'path': 'str', 'queue': 'uint16', '*index': 'uint16' },
+  'returns': 'VirtioQueueElement',
+  'features': [ 'unstable' ] }
diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c
index 13e5f93652..7ddb22cc5e 100644
--- a/hw/virtio/virtio-stub.c
+++ b/hw/virtio/virtio-stub.c
@@ -31,3 +31,12 @@ VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path,
 {
     return qmp_virtio_unsupported(errp);
 }
+
+VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path,
+                                                     uint16_t queue,
+                                                     bool has_index,
+                                                     uint16_t index,
+                                                     Error **errp)
+{
+    return qmp_virtio_unsupported(errp);
+}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index da869e7b51..808446b4c9 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -823,6 +823,19 @@ static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem,
     address_space_cache_invalidate(&caches->used, pa, sizeof(VRingUsedElem));
 }
 
+/* Called within rcu_read_lock(). */
+static inline uint16_t vring_used_flags(VirtQueue *vq)
+{
+    VRingMemoryRegionCaches *caches = vring_get_region_caches(vq);
+    hwaddr pa = offsetof(VRingUsed, flags);
+
+    if (!caches) {
+        return 0;
+    }
+
+    return virtio_lduw_phys_cached(vq->vdev, &caches->used, pa);
+}
+
 /* Called within rcu_read_lock().  */
 static uint16_t vring_used_idx(VirtQueue *vq)
 {
@@ -4782,6 +4795,147 @@ VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path,
     return status;
 }
 
+static strList *qmp_decode_vring_desc_flags(uint16_t flags)
+{
+    strList *list = NULL;
+    strList *node;
+    int i;
+
+    struct {
+        uint16_t flag;
+        const char *value;
+    } map[] = {
+        { VRING_DESC_F_NEXT, "next" },
+        { VRING_DESC_F_WRITE, "write" },
+        { VRING_DESC_F_INDIRECT, "indirect" },
+        { 1 << VRING_PACKED_DESC_F_AVAIL, "avail" },
+        { 1 << VRING_PACKED_DESC_F_USED, "used" },
+        { 0, "" }
+    };
+
+    for (i = 0; map[i].flag; i++) {
+        if ((map[i].flag & flags) == 0) {
+            continue;
+        }
+        node = g_malloc0(sizeof(strList));
+        node->value = g_strdup(map[i].value);
+        node->next = list;
+        list = node;
+    }
+
+    return list;
+}
+
+VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path,
+                                                     uint16_t queue,
+                                                     bool has_index,
+                                                     uint16_t index,
+                                                     Error **errp)
+{
+    VirtIODevice *vdev;
+    VirtQueue *vq;
+    VirtioQueueElement *element = NULL;
+
+    vdev = virtio_device_find(path);
+    if (vdev == NULL) {
+        error_setg(errp, "Path %s is not a VirtIO device", path);
+        return NULL;
+    }
+
+    if (queue >= VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, queue)) {
+        error_setg(errp, "Invalid virtqueue number %d", queue);
+        return NULL;
+    }
+    vq = &vdev->vq[queue];
+
+    if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) {
+        error_setg(errp, "Packed ring not supported");
+        return NULL;
+    } else {
+        unsigned int head, i, max;
+        VRingMemoryRegionCaches *caches;
+        MemoryRegionCache indirect_desc_cache = MEMORY_REGION_CACHE_INVALID;
+        MemoryRegionCache *desc_cache;
+        VRingDesc desc;
+        VirtioRingDescList *list = NULL;
+        VirtioRingDescList *node;
+        int rc; int ndescs;
+
+        RCU_READ_LOCK_GUARD();
+
+        max = vq->vring.num;
+
+        if (!has_index) {
+            head = vring_avail_ring(vq, vq->last_avail_idx % vq->vring.num);
+        } else {
+            head = vring_avail_ring(vq, index % vq->vring.num);
+        }
+        i = head;
+
+        caches = vring_get_region_caches(vq);
+        if (!caches) {
+            error_setg(errp, "Region caches not initialized");
+            return NULL;
+        }
+        if (caches->desc.len < max * sizeof(VRingDesc)) {
+            error_setg(errp, "Cannot map descriptor ring");
+            return NULL;
+        }
+
+        desc_cache = &caches->desc;
+        vring_split_desc_read(vdev, &desc, desc_cache, i);
+        if (desc.flags & VRING_DESC_F_INDIRECT) {
+            int64_t len;
+            len = address_space_cache_init(&indirect_desc_cache, vdev->dma_as,
+                                           desc.addr, desc.len, false);
+            desc_cache = &indirect_desc_cache;
+            if (len < desc.len) {
+                error_setg(errp, "Cannot map indirect buffer");
+                goto done;
+            }
+
+            max = desc.len / sizeof(VRingDesc);
+            i = 0;
+            vring_split_desc_read(vdev, &desc, desc_cache, i);
+        }
+
+        element = g_new0(VirtioQueueElement, 1);
+        element->avail = g_new0(VirtioRingAvail, 1);
+        element->used = g_new0(VirtioRingUsed, 1);
+        element->name = g_strdup(vdev->name);
+        element->index = head;
+        element->avail->flags = vring_avail_flags(vq);
+        element->avail->idx = vring_avail_idx(vq);
+        element->avail->ring = head;
+        element->used->flags = vring_used_flags(vq);
+        element->used->idx = vring_used_idx(vq);
+        ndescs = 0;
+
+        do {
+            /* A buggy driver may produce an infinite loop */
+            if (ndescs >= max) {
+                break;
+            }
+            node = g_new0(VirtioRingDescList, 1);
+            node->value = g_new0(VirtioRingDesc, 1);
+            node->value->addr = desc.addr;
+            node->value->len = desc.len;
+            node->value->flags = qmp_decode_vring_desc_flags(desc.flags);
+            node->next = list;
+            list = node;
+
+            ndescs++;
+            rc = virtqueue_split_read_next_desc(vdev, &desc, desc_cache,
+                                                max, &i);
+        } while (rc == VIRTQUEUE_READ_DESC_MORE);
+        element->descs = list;
+done:
+        address_space_cache_destroy(&indirect_desc_cache);
+    }
+
+    return element;
+}
+
 static const TypeInfo virtio_device_info = {
     .name = TYPE_VIRTIO_DEVICE,
     .parent = TYPE_DEVICE,
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 35/55] hmp: add virtio commands
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (33 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 36/55] pci: Remove unused pci_get_*_by_mask() functions Michael S. Tsirkin
                   ` (21 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laurent Vivier, Jonah Palmer, Dr. David Alan Gilbert

From: Laurent Vivier <lvivier@redhat.com>

This patch implements the HMP versions of the virtio QMP commands.

[Jonah: Adjusted hmp monitor output format for features / statuses
	with their descriptions.]

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Message-Id: <1660220684-24909-7-git-send-email-jonah.palmer@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/monitor/hmp.h |   5 +
 monitor/hmp-cmds.c    | 310 ++++++++++++++++++++++++++++++++++++++++++
 hmp-commands-info.hx  |  70 ++++++++++
 3 files changed, 385 insertions(+)

diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index a618eb1e4e..a9cf064ee8 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -95,6 +95,11 @@ void hmp_qom_list(Monitor *mon, const QDict *qdict);
 void hmp_qom_get(Monitor *mon, const QDict *qdict);
 void hmp_qom_set(Monitor *mon, const QDict *qdict);
 void hmp_info_qom_tree(Monitor *mon, const QDict *dict);
+void hmp_virtio_query(Monitor *mon, const QDict *qdict);
+void hmp_virtio_status(Monitor *mon, const QDict *qdict);
+void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict);
+void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict);
+void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict);
 void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
 void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
 void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index f90eea8d01..bab86c5537 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -43,6 +43,8 @@
 #include "qapi/qapi-commands-stats.h"
 #include "qapi/qapi-commands-tpm.h"
 #include "qapi/qapi-commands-ui.h"
+#include "qapi/qapi-commands-virtio.h"
+#include "qapi/qapi-visit-virtio.h"
 #include "qapi/qapi-visit-net.h"
 #include "qapi/qapi-visit-migration.h"
 #include "qapi/qmp/qdict.h"
@@ -2472,3 +2474,311 @@ exit:
 exit_no_print:
     error_free(err);
 }
+
+static void hmp_virtio_dump_protocols(Monitor *mon,
+                                      VhostDeviceProtocols *pcol)
+{
+    strList *pcol_list = pcol->protocols;
+    while (pcol_list) {
+        monitor_printf(mon, "\t%s", pcol_list->value);
+        pcol_list = pcol_list->next;
+        if (pcol_list != NULL) {
+            monitor_printf(mon, ",\n");
+        }
+    }
+    monitor_printf(mon, "\n");
+    if (pcol->has_unknown_protocols) {
+        monitor_printf(mon, "  unknown-protocols(0x%016"PRIx64")\n",
+                       pcol->unknown_protocols);
+    }
+}
+
+static void hmp_virtio_dump_status(Monitor *mon,
+                                   VirtioDeviceStatus *status)
+{
+    strList *status_list = status->statuses;
+    while (status_list) {
+        monitor_printf(mon, "\t%s", status_list->value);
+        status_list = status_list->next;
+        if (status_list != NULL) {
+            monitor_printf(mon, ",\n");
+        }
+    }
+    monitor_printf(mon, "\n");
+    if (status->has_unknown_statuses) {
+        monitor_printf(mon, "  unknown-statuses(0x%016"PRIx32")\n",
+                       status->unknown_statuses);
+    }
+}
+
+static void hmp_virtio_dump_features(Monitor *mon,
+                                     VirtioDeviceFeatures *features)
+{
+    strList *transport_list = features->transports;
+    while (transport_list) {
+        monitor_printf(mon, "\t%s", transport_list->value);
+        transport_list = transport_list->next;
+        if (transport_list != NULL) {
+            monitor_printf(mon, ",\n");
+        }
+    }
+
+    monitor_printf(mon, "\n");
+    strList *list = features->dev_features;
+    if (list) {
+        while (list) {
+            monitor_printf(mon, "\t%s", list->value);
+            list = list->next;
+            if (list != NULL) {
+                monitor_printf(mon, ",\n");
+            }
+        }
+        monitor_printf(mon, "\n");
+    }
+
+    if (features->has_unknown_dev_features) {
+        monitor_printf(mon, "  unknown-features(0x%016"PRIx64")\n",
+                       features->unknown_dev_features);
+    }
+}
+
+void hmp_virtio_query(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    VirtioInfoList *list = qmp_x_query_virtio(&err);
+    VirtioInfoList *node;
+
+    if (err != NULL) {
+        hmp_handle_error(mon, err);
+        return;
+    }
+
+    if (list == NULL) {
+        monitor_printf(mon, "No VirtIO devices\n");
+        return;
+    }
+
+    node = list;
+    while (node) {
+        monitor_printf(mon, "%s [%s]\n", node->value->path,
+                       node->value->name);
+        node = node->next;
+    }
+    qapi_free_VirtioInfoList(list);
+}
+
+void hmp_virtio_status(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    const char *path = qdict_get_try_str(qdict, "path");
+    VirtioStatus *s = qmp_x_query_virtio_status(path, &err);
+
+    if (err != NULL) {
+        hmp_handle_error(mon, err);
+        return;
+    }
+
+    monitor_printf(mon, "%s:\n", path);
+    monitor_printf(mon, "  device_name:             %s %s\n",
+                   s->name, s->has_vhost_dev ? "(vhost)" : "");
+    monitor_printf(mon, "  device_id:               %d\n", s->device_id);
+    monitor_printf(mon, "  vhost_started:           %s\n",
+                   s->vhost_started ? "true" : "false");
+    monitor_printf(mon, "  bus_name:                %s\n", s->bus_name);
+    monitor_printf(mon, "  broken:                  %s\n",
+                   s->broken ? "true" : "false");
+    monitor_printf(mon, "  disabled:                %s\n",
+                   s->disabled ? "true" : "false");
+    monitor_printf(mon, "  disable_legacy_check:    %s\n",
+                   s->disable_legacy_check ? "true" : "false");
+    monitor_printf(mon, "  started:                 %s\n",
+                   s->started ? "true" : "false");
+    monitor_printf(mon, "  use_started:             %s\n",
+                   s->use_started ? "true" : "false");
+    monitor_printf(mon, "  start_on_kick:           %s\n",
+                   s->start_on_kick ? "true" : "false");
+    monitor_printf(mon, "  use_guest_notifier_mask: %s\n",
+                   s->use_guest_notifier_mask ? "true" : "false");
+    monitor_printf(mon, "  vm_running:              %s\n",
+                   s->vm_running ? "true" : "false");
+    monitor_printf(mon, "  num_vqs:                 %"PRId64"\n", s->num_vqs);
+    monitor_printf(mon, "  queue_sel:               %d\n",
+                   s->queue_sel);
+    monitor_printf(mon, "  isr:                     %d\n", s->isr);
+    monitor_printf(mon, "  endianness:              %s\n",
+                   s->device_endian);
+    monitor_printf(mon, "  status:\n");
+    hmp_virtio_dump_status(mon, s->status);
+    monitor_printf(mon, "  Guest features:\n");
+    hmp_virtio_dump_features(mon, s->guest_features);
+    monitor_printf(mon, "  Host features:\n");
+    hmp_virtio_dump_features(mon, s->host_features);
+    monitor_printf(mon, "  Backend features:\n");
+    hmp_virtio_dump_features(mon, s->backend_features);
+
+    if (s->has_vhost_dev) {
+        monitor_printf(mon, "  VHost:\n");
+        monitor_printf(mon, "    nvqs:           %d\n",
+                       s->vhost_dev->nvqs);
+        monitor_printf(mon, "    vq_index:       %"PRId64"\n",
+                       s->vhost_dev->vq_index);
+        monitor_printf(mon, "    max_queues:     %"PRId64"\n",
+                       s->vhost_dev->max_queues);
+        monitor_printf(mon, "    n_mem_sections: %"PRId64"\n",
+                       s->vhost_dev->n_mem_sections);
+        monitor_printf(mon, "    n_tmp_sections: %"PRId64"\n",
+                       s->vhost_dev->n_tmp_sections);
+        monitor_printf(mon, "    backend_cap:    %"PRId64"\n",
+                       s->vhost_dev->backend_cap);
+        monitor_printf(mon, "    log_enabled:    %s\n",
+                       s->vhost_dev->log_enabled ? "true" : "false");
+        monitor_printf(mon, "    log_size:       %"PRId64"\n",
+                       s->vhost_dev->log_size);
+        monitor_printf(mon, "    Features:\n");
+        hmp_virtio_dump_features(mon, s->vhost_dev->features);
+        monitor_printf(mon, "    Acked features:\n");
+        hmp_virtio_dump_features(mon, s->vhost_dev->acked_features);
+        monitor_printf(mon, "    Backend features:\n");
+        hmp_virtio_dump_features(mon, s->vhost_dev->backend_features);
+        monitor_printf(mon, "    Protocol features:\n");
+        hmp_virtio_dump_protocols(mon, s->vhost_dev->protocol_features);
+    }
+
+    qapi_free_VirtioStatus(s);
+}
+
+void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    const char *path = qdict_get_try_str(qdict, "path");
+    int queue = qdict_get_int(qdict, "queue");
+    VirtVhostQueueStatus *s =
+        qmp_x_query_virtio_vhost_queue_status(path, queue, &err);
+
+    if (err != NULL) {
+        hmp_handle_error(mon, err);
+        return;
+    }
+
+    monitor_printf(mon, "%s:\n", path);
+    monitor_printf(mon, "  device_name:          %s (vhost)\n",
+                   s->name);
+    monitor_printf(mon, "  kick:                 %"PRId64"\n", s->kick);
+    monitor_printf(mon, "  call:                 %"PRId64"\n", s->call);
+    monitor_printf(mon, "  VRing:\n");
+    monitor_printf(mon, "    num:         %"PRId64"\n", s->num);
+    monitor_printf(mon, "    desc:        0x%016"PRIx64"\n", s->desc);
+    monitor_printf(mon, "    desc_phys:   0x%016"PRIx64"\n",
+                   s->desc_phys);
+    monitor_printf(mon, "    desc_size:   %"PRId32"\n", s->desc_size);
+    monitor_printf(mon, "    avail:       0x%016"PRIx64"\n", s->avail);
+    monitor_printf(mon, "    avail_phys:  0x%016"PRIx64"\n",
+                   s->avail_phys);
+    monitor_printf(mon, "    avail_size:  %"PRId32"\n", s->avail_size);
+    monitor_printf(mon, "    used:        0x%016"PRIx64"\n", s->used);
+    monitor_printf(mon, "    used_phys:   0x%016"PRIx64"\n",
+                   s->used_phys);
+    monitor_printf(mon, "    used_size:   %"PRId32"\n", s->used_size);
+
+    qapi_free_VirtVhostQueueStatus(s);
+}
+
+void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    const char *path = qdict_get_try_str(qdict, "path");
+    int queue = qdict_get_int(qdict, "queue");
+    VirtQueueStatus *s = qmp_x_query_virtio_queue_status(path, queue, &err);
+
+    if (err != NULL) {
+        hmp_handle_error(mon, err);
+        return;
+    }
+
+    monitor_printf(mon, "%s:\n", path);
+    monitor_printf(mon, "  device_name:          %s\n", s->name);
+    monitor_printf(mon, "  queue_index:          %d\n", s->queue_index);
+    monitor_printf(mon, "  inuse:                %d\n", s->inuse);
+    monitor_printf(mon, "  used_idx:             %d\n", s->used_idx);
+    monitor_printf(mon, "  signalled_used:       %d\n",
+                   s->signalled_used);
+    monitor_printf(mon, "  signalled_used_valid: %s\n",
+                   s->signalled_used_valid ? "true" : "false");
+    if (s->has_last_avail_idx) {
+        monitor_printf(mon, "  last_avail_idx:       %d\n",
+                       s->last_avail_idx);
+    }
+    if (s->has_shadow_avail_idx) {
+        monitor_printf(mon, "  shadow_avail_idx:     %d\n",
+                       s->shadow_avail_idx);
+    }
+    monitor_printf(mon, "  VRing:\n");
+    monitor_printf(mon, "    num:          %"PRId32"\n", s->vring_num);
+    monitor_printf(mon, "    num_default:  %"PRId32"\n",
+                   s->vring_num_default);
+    monitor_printf(mon, "    align:        %"PRId32"\n",
+                   s->vring_align);
+    monitor_printf(mon, "    desc:         0x%016"PRIx64"\n",
+                   s->vring_desc);
+    monitor_printf(mon, "    avail:        0x%016"PRIx64"\n",
+                   s->vring_avail);
+    monitor_printf(mon, "    used:         0x%016"PRIx64"\n",
+                   s->vring_used);
+
+    qapi_free_VirtQueueStatus(s);
+}
+
+void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    const char *path = qdict_get_try_str(qdict, "path");
+    int queue = qdict_get_int(qdict, "queue");
+    int index = qdict_get_try_int(qdict, "index", -1);
+    VirtioQueueElement *e;
+    VirtioRingDescList *list;
+
+    e = qmp_x_query_virtio_queue_element(path, queue, index != -1,
+                                         index, &err);
+    if (err != NULL) {
+        hmp_handle_error(mon, err);
+        return;
+    }
+
+    monitor_printf(mon, "%s:\n", path);
+    monitor_printf(mon, "  device_name: %s\n", e->name);
+    monitor_printf(mon, "  index:   %d\n", e->index);
+    monitor_printf(mon, "  desc:\n");
+    monitor_printf(mon, "    descs:\n");
+
+    list = e->descs;
+    while (list) {
+        monitor_printf(mon, "        addr 0x%"PRIx64" len %d",
+                       list->value->addr, list->value->len);
+        if (list->value->flags) {
+            strList *flag = list->value->flags;
+            monitor_printf(mon, " (");
+            while (flag) {
+                monitor_printf(mon, "%s", flag->value);
+                flag = flag->next;
+                if (flag) {
+                    monitor_printf(mon, ", ");
+                }
+            }
+            monitor_printf(mon, ")");
+        }
+        list = list->next;
+        if (list) {
+            monitor_printf(mon, ",\n");
+        }
+    }
+    monitor_printf(mon, "\n");
+    monitor_printf(mon, "  avail:\n");
+    monitor_printf(mon, "    flags: %d\n", e->avail->flags);
+    monitor_printf(mon, "    idx:   %d\n", e->avail->idx);
+    monitor_printf(mon, "    ring:  %d\n", e->avail->ring);
+    monitor_printf(mon, "  used:\n");
+    monitor_printf(mon, "    flags: %d\n", e->used->flags);
+    monitor_printf(mon, "    idx:   %d\n", e->used->idx);
+
+    qapi_free_VirtioQueueElement(e);
+}
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index e012035541..754b1e8408 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -923,3 +923,73 @@ SRST
   ``stats``
     Show runtime-collected statistics
 ERST
+
+    {
+        .name      = "virtio",
+        .args_type = "",
+        .params    = "",
+        .help      = "List all available virtio devices",
+        .cmd       = hmp_virtio_query,
+        .flags     = "p",
+    },
+
+SRST
+  ``info virtio``
+    List all available virtio devices
+ERST
+
+    {
+        .name      = "virtio-status",
+        .args_type = "path:s",
+        .params    = "path",
+        .help      = "Display status of a given virtio device",
+        .cmd       = hmp_virtio_status,
+        .flags     = "p",
+    },
+
+SRST
+  ``info virtio-status`` *path*
+    Display status of a given virtio device
+ERST
+
+    {
+        .name      = "virtio-queue-status",
+        .args_type = "path:s,queue:i",
+        .params    = "path queue",
+        .help      = "Display status of a given virtio queue",
+        .cmd       = hmp_virtio_queue_status,
+        .flags     = "p",
+    },
+
+SRST
+  ``info virtio-queue-status`` *path* *queue*
+    Display status of a given virtio queue
+ERST
+
+    {
+        .name      = "virtio-vhost-queue-status",
+        .args_type = "path:s,queue:i",
+        .params    = "path queue",
+        .help      = "Display status of a given vhost queue",
+        .cmd       = hmp_vhost_queue_status,
+        .flags     = "p",
+    },
+
+SRST
+  ``info virtio-vhost-queue-status`` *path* *queue*
+    Display status of a given vhost queue
+ERST
+
+    {
+        .name       = "virtio-queue-element",
+        .args_type  = "path:s,queue:i,index:i?",
+        .params     = "path queue [index]",
+        .help       = "Display element of a given virtio queue",
+        .cmd        = hmp_virtio_queue_element,
+        .flags      = "p",
+    },
+
+SRST
+  ``info virtio-queue-element`` *path* *queue* [*index*]
+    Display element of a given virtio queue
+ERST
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 36/55] pci: Remove unused pci_get_*_by_mask() functions
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (34 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 35/55] hmp: add virtio commands Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 37/55] pci: Sanity check mask argument to pci_set_*_by_mask() Michael S. Tsirkin
                   ` (20 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Richard Henderson, Paolo Bonzini, Marcel Apfelbaum

From: Peter Maydell <peter.maydell@linaro.org>

The helper functions pci_get_{byte,word,long,quad}_by_mask()
were added in 2012 in commit c9f50cea70a1596. In the decade
since we have never added a single use of them.

The helpers clearly aren't that helpful, so drop them
rather than carrying around dead code.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220818135421.2515257-2-peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/pci/pci.h | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index b54b6ef88f..c79144bc5e 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -692,13 +692,6 @@ pci_set_byte_by_mask(uint8_t *config, uint8_t mask, uint8_t reg)
     pci_set_byte(config, (~mask & val) | (mask & rval));
 }
 
-static inline uint8_t
-pci_get_byte_by_mask(uint8_t *config, uint8_t mask)
-{
-    uint8_t val = pci_get_byte(config);
-    return (val & mask) >> ctz32(mask);
-}
-
 static inline void
 pci_set_word_by_mask(uint8_t *config, uint16_t mask, uint16_t reg)
 {
@@ -707,13 +700,6 @@ pci_set_word_by_mask(uint8_t *config, uint16_t mask, uint16_t reg)
     pci_set_word(config, (~mask & val) | (mask & rval));
 }
 
-static inline uint16_t
-pci_get_word_by_mask(uint8_t *config, uint16_t mask)
-{
-    uint16_t val = pci_get_word(config);
-    return (val & mask) >> ctz32(mask);
-}
-
 static inline void
 pci_set_long_by_mask(uint8_t *config, uint32_t mask, uint32_t reg)
 {
@@ -722,13 +708,6 @@ pci_set_long_by_mask(uint8_t *config, uint32_t mask, uint32_t reg)
     pci_set_long(config, (~mask & val) | (mask & rval));
 }
 
-static inline uint32_t
-pci_get_long_by_mask(uint8_t *config, uint32_t mask)
-{
-    uint32_t val = pci_get_long(config);
-    return (val & mask) >> ctz32(mask);
-}
-
 static inline void
 pci_set_quad_by_mask(uint8_t *config, uint64_t mask, uint64_t reg)
 {
@@ -737,13 +716,6 @@ pci_set_quad_by_mask(uint8_t *config, uint64_t mask, uint64_t reg)
     pci_set_quad(config, (~mask & val) | (mask & rval));
 }
 
-static inline uint64_t
-pci_get_quad_by_mask(uint8_t *config, uint64_t mask)
-{
-    uint64_t val = pci_get_quad(config);
-    return (val & mask) >> ctz32(mask);
-}
-
 PCIDevice *pci_new_multifunction(int devfn, bool multifunction,
                                     const char *name);
 PCIDevice *pci_new(int devfn, const char *name);
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 37/55] pci: Sanity check mask argument to pci_set_*_by_mask()
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (35 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 36/55] pci: Remove unused pci_get_*_by_mask() functions Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 38/55] hw/smbios: support for type 8 (port connector) Michael S. Tsirkin
                   ` (19 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Richard Henderson, Paolo Bonzini, Marcel Apfelbaum

From: Peter Maydell <peter.maydell@linaro.org>

Coverity complains that in functions like pci_set_word_by_mask()
we might end up shifting by more than 31 bits. This is true,
but only if the caller passes in a zero mask. Help Coverity out
by asserting that the mask argument is valid.

Fixes: CID 1487168

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220818135421.2515257-3-peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/pci/pci.h | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c79144bc5e..97937cc922 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -688,7 +688,10 @@ static inline void
 pci_set_byte_by_mask(uint8_t *config, uint8_t mask, uint8_t reg)
 {
     uint8_t val = pci_get_byte(config);
-    uint8_t rval = reg << ctz32(mask);
+    uint8_t rval;
+
+    assert(mask);
+    rval = reg << ctz32(mask);
     pci_set_byte(config, (~mask & val) | (mask & rval));
 }
 
@@ -696,7 +699,10 @@ static inline void
 pci_set_word_by_mask(uint8_t *config, uint16_t mask, uint16_t reg)
 {
     uint16_t val = pci_get_word(config);
-    uint16_t rval = reg << ctz32(mask);
+    uint16_t rval;
+
+    assert(mask);
+    rval = reg << ctz32(mask);
     pci_set_word(config, (~mask & val) | (mask & rval));
 }
 
@@ -704,7 +710,10 @@ static inline void
 pci_set_long_by_mask(uint8_t *config, uint32_t mask, uint32_t reg)
 {
     uint32_t val = pci_get_long(config);
-    uint32_t rval = reg << ctz32(mask);
+    uint32_t rval;
+
+    assert(mask);
+    rval = reg << ctz32(mask);
     pci_set_long(config, (~mask & val) | (mask & rval));
 }
 
@@ -712,7 +721,10 @@ static inline void
 pci_set_quad_by_mask(uint8_t *config, uint64_t mask, uint64_t reg)
 {
     uint64_t val = pci_get_quad(config);
-    uint64_t rval = reg << ctz32(mask);
+    uint64_t rval;
+
+    assert(mask);
+    rval = reg << ctz32(mask);
     pci_set_quad(config, (~mask & val) | (mask & rval));
 }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 38/55] hw/smbios: support for type 8 (port connector)
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (36 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 37/55] pci: Sanity check mask argument to pci_set_*_by_mask() Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 39/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
                   ` (18 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Hal Martin, Igor Mammedov, Ani Sinha

From: Hal Martin <hal.martin@gmail.com>

PATCH v1: add support for SMBIOS type 8 to qemu
PATCH v2: incorporate patch v1 feedback and add smbios type=8 to qemu-options

internal_reference: internal reference designator
external_reference: external reference designator
connector_type: hex value for port connector type (see SMBIOS 7.9.2)
port_type: hex value for port type (see SMBIOS 7.9.3)

After studying various vendor implementationsi (Dell, Lenovo, MSI),
the value of internal connector type was hard-coded to 0x0 (None).

Example usage:
-smbios type=8,internal_reference=JUSB1,external_reference=USB1,connector_type=0x12,port_type=0x10 \
-smbios type=8,internal_reference=JAUD1,external_reference="Audio Jack",connector_type=0x1f,port_type=0x1d \
-smbios type=8,internal_reference=LAN,external_reference=Ethernet,connector_type=0x0b,port_type=0x1f \
-smbios type=8,internal_reference=PS2,external_reference=Mouse,connector_type=0x0f,port_type=0x0e \
-smbios type=8,internal_reference=PS2,external_reference=Keyboard,connector_type=0x0f,port_type=0x0d

Signed-off-by: Hal Martin <hal.martin@gmail.com>

Message-Id: <20220812135153.17859-1-hal.martin@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/firmware/smbios.h | 10 ++++++
 hw/smbios/smbios.c           | 63 ++++++++++++++++++++++++++++++++++++
 qemu-options.hx              |  2 ++
 3 files changed, 75 insertions(+)

diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index 4b7ad77a44..e7d386f7c8 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -189,6 +189,16 @@ struct smbios_type_4 {
     uint16_t processor_family2;
 } QEMU_PACKED;
 
+/* SMBIOS type 8 - Port Connector Information */
+struct smbios_type_8 {
+    struct smbios_structure_header header;
+    uint8_t internal_reference_str;
+    uint8_t internal_connector_type;
+    uint8_t external_reference_str;
+    uint8_t external_connector_type;
+    uint8_t port_type;
+} QEMU_PACKED;
+
 /* SMBIOS type 11 - OEM strings */
 struct smbios_type_11 {
     struct smbios_structure_header header;
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 4c9f664830..51437ca09f 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -111,6 +111,13 @@ static struct {
     .processor_id = 0,
 };
 
+struct type8_instance {
+    const char *internal_reference, *external_reference;
+    uint8_t connector_type, port_type;
+    QTAILQ_ENTRY(type8_instance) next;
+};
+static QTAILQ_HEAD(, type8_instance) type8 = QTAILQ_HEAD_INITIALIZER(type8);
+
 static struct {
     size_t nvalues;
     char **values;
@@ -337,6 +344,29 @@ static const QemuOptDesc qemu_smbios_type4_opts[] = {
     { /* end of list */ }
 };
 
+static const QemuOptDesc qemu_smbios_type8_opts[] = {
+    {
+        .name = "internal_reference",
+        .type = QEMU_OPT_STRING,
+        .help = "internal reference designator",
+    },
+    {
+        .name = "external_reference",
+        .type = QEMU_OPT_STRING,
+        .help = "external reference designator",
+    },
+    {
+        .name = "connector_type",
+        .type = QEMU_OPT_NUMBER,
+        .help = "connector type",
+    },
+    {
+        .name = "port_type",
+        .type = QEMU_OPT_NUMBER,
+        .help = "port type",
+    },
+};
+
 static const QemuOptDesc qemu_smbios_type11_opts[] = {
     {
         .name = "value",
@@ -718,6 +748,26 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     smbios_type4_count++;
 }
 
+static void smbios_build_type_8_table(void)
+{
+    unsigned instance = 0;
+    struct type8_instance *t8;
+
+    QTAILQ_FOREACH(t8, &type8, next) {
+        SMBIOS_BUILD_TABLE_PRE(8, T0_BASE + instance, true);
+
+        SMBIOS_TABLE_SET_STR(8, internal_reference_str, t8->internal_reference);
+        SMBIOS_TABLE_SET_STR(8, external_reference_str, t8->external_reference);
+        /* most vendors seem to set this to None */
+        t->internal_connector_type = 0x0;
+        t->external_connector_type = t8->connector_type;
+        t->port_type = t8->port_type;
+
+        SMBIOS_BUILD_TABLE_POST;
+        instance++;
+    }
+}
+
 static void smbios_build_type_11_table(void)
 {
     char count_str[128];
@@ -1030,6 +1080,7 @@ void smbios_get_tables(MachineState *ms,
             smbios_build_type_4_table(ms, i);
         }
 
+        smbios_build_type_8_table();
         smbios_build_type_11_table();
 
 #define MAX_DIMM_SZ (16 * GiB)
@@ -1348,6 +1399,18 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
                            UINT16_MAX);
             }
             return;
+        case 8:
+            if (!qemu_opts_validate(opts, qemu_smbios_type8_opts, errp)) {
+                return;
+            }
+            struct type8_instance *t;
+            t = g_new0(struct type8_instance, 1);
+            save_opt(&t->internal_reference, opts, "internal_reference");
+            save_opt(&t->external_reference, opts, "external_reference");
+            t->connector_type = qemu_opt_get_number(opts, "connector_type", 0);
+            t->port_type = qemu_opt_get_number(opts, "port_type", 0);
+            QTAILQ_INSERT_TAIL(&type8, t, next);
+            return;
         case 11:
             if (!qemu_opts_validate(opts, qemu_smbios_type11_opts, errp)) {
                 return;
diff --git a/qemu-options.hx b/qemu-options.hx
index 95b998a13b..c0bb74655c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2572,6 +2572,8 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
     "              [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n"
     "              [,processor-id=%d]\n"
     "                specify SMBIOS type 4 fields\n"
+    "-smbios type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]\n"
+    "                specify SMBIOS type 8 fields\n"
     "-smbios type=11[,value=str][,path=filename]\n"
     "                specify SMBIOS type 11 fields\n"
     "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n"
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 39/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (37 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 38/55] hw/smbios: support for type 8 (port connector) Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 40/55] acpi: x86: deduplicate HPET AML building Michael S. Tsirkin
                   ` (17 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-2-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 32 +++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..a7aa428fab 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,33 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/DSDT",
+"tests/data/acpi/pc/DSDT.acpierst",
+"tests/data/acpi/pc/DSDT.acpihmat",
+"tests/data/acpi/pc/DSDT.bridge",
+"tests/data/acpi/pc/DSDT.cphp",
+"tests/data/acpi/pc/DSDT.dimmpxm",
+"tests/data/acpi/pc/DSDT.hpbridge",
+"tests/data/acpi/pc/DSDT.hpbrroot",
+"tests/data/acpi/pc/DSDT.ipmikcs",
+"tests/data/acpi/pc/DSDT.memhp",
+"tests/data/acpi/pc/DSDT.numamem",
+"tests/data/acpi/pc/DSDT.roothp",
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.acpierst",
+"tests/data/acpi/q35/DSDT.acpihmat",
+"tests/data/acpi/q35/DSDT.applesmc",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.cxl",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.ipmismbus",
+"tests/data/acpi/q35/DSDT.ivrs",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.multi-bridge",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.pvpanic-isa",
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/DSDT.tis.tpm2",
+"tests/data/acpi/q35/DSDT.viot",
+"tests/data/acpi/q35/DSDT.xapic",
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 40/55] acpi: x86: deduplicate HPET AML building
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (38 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 39/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 41/55] tests: acpi: update expected blobs after HPET move Michael S. Tsirkin
                   ` (16 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost

From: Igor Mammedov <imammedo@redhat.com>

HPET AML doesn't depend on piix4 nor q35, move code buiding it
to common scope to avoid duplication.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 0355bd3dda..67b532f5a5 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1467,9 +1467,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
         aml_append(sb_scope, dev);
         aml_append(dsdt, sb_scope);
 
-        if (misc->has_hpet) {
-            build_hpet_aml(dsdt);
-        }
         build_piix4_isa_bridge(dsdt);
         if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
             build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
@@ -1515,9 +1512,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
 
         aml_append(dsdt, sb_scope);
 
-        if (misc->has_hpet) {
-            build_hpet_aml(dsdt);
-        }
         build_q35_isa_bridge(dsdt);
         if (pm->pcihp_bridge_en) {
             build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
@@ -1528,6 +1522,10 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
         }
     }
 
+    if (misc->has_hpet) {
+        build_hpet_aml(dsdt);
+    }
+
     if (vmbus_bridge) {
         sb_scope = aml_scope("_SB");
         aml_append(sb_scope, build_vmbus_device_aml(vmbus_bridge));
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 41/55] tests: acpi: update expected blobs after HPET move
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (39 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 40/55] acpi: x86: deduplicate HPET AML building Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 42/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
                   ` (15 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

HPET AML moved after PCI host bridge description (no functional change)

diff example for PC machine:

@@ -54,47 +54,6 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
         }
     }

-    Scope (_SB)
-    {
-        Device (HPET)
-        {
-            Name (_HID, EisaId ("PNP0103") /* HPET System Timer */)  // _HID: Hardware ID
-            Name (_UID, Zero)  // _UID: Unique ID
-            OperationRegion (HPTM, SystemMemory, 0xFED00000, 0x0400)
-            Field (HPTM, DWordAcc, Lock, Preserve)
-            {
-                VEND,   32,
-                PRD,    32
-            }
-
-            Method (_STA, 0, NotSerialized)  // _STA: Status
-            {
-                Local0 = VEND /* \_SB_.HPET.VEND */
-                Local1 = PRD /* \_SB_.HPET.PRD_ */
-                Local0 >>= 0x10
-                If (((Local0 == Zero) || (Local0 == 0xFFFF)))
-                {
-                    Return (Zero)
-                }
-
-                If (((Local1 == Zero) || (Local1 > 0x05F5E100)))
-                {
-                    Return (Zero)
-                }
-
-                Return (0x0F)
-            }
-
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-            {
-                Memory32Fixed (ReadOnly,
-                    0xFED00000,         // Address Base
-                    0x00000400,         // Address Length
-                    )
-            })
-        }
-    }
-
     Scope (_SB.PCI0)
     {
         Device (ISA)
@@ -529,6 +488,47 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
         }
     }

+    Scope (_SB)
+    {
+        Device (HPET)
+        {
+            Name (_HID, EisaId ("PNP0103") /* HPET System Timer */)  // _HID: Hardware ID
+            Name (_UID, Zero)  // _UID: Unique ID
+            OperationRegion (HPTM, SystemMemory, 0xFED00000, 0x0400)
+            Field (HPTM, DWordAcc, Lock, Preserve)
+            {
+                VEND,   32,
+                PRD,    32
+            }
+
+            Method (_STA, 0, NotSerialized)  // _STA: Status
+            {
+                Local0 = VEND /* \_SB_.HPET.VEND */
+                Local1 = PRD /* \_SB_.HPET.PRD_ */
+                Local0 >>= 0x10
+                If (((Local0 == Zero) || (Local0 == 0xFFFF)))
+                {
+                    Return (Zero)
+                }
+
+                If (((Local1 == Zero) || (Local1 > 0x05F5E100)))
+                {
+                    Return (Zero)
+                }
+
+                Return (0x0F)
+            }
+
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+            {
+                Memory32Fixed (ReadOnly,
+                    0xFED00000,         // Address Base
+                    0x00000400,         // Address Length
+                    )
+            })
+        }
+    }
+
     Scope (_SB)
     {
         Device (\_SB.PCI0.PRES)

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-4-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |  32 --------------------
 tests/data/acpi/pc/DSDT                     | Bin 5987 -> 5987 bytes
 tests/data/acpi/pc/DSDT.acpierst            | Bin 5954 -> 5954 bytes
 tests/data/acpi/pc/DSDT.acpihmat            | Bin 7312 -> 7312 bytes
 tests/data/acpi/pc/DSDT.bridge              | Bin 8653 -> 8653 bytes
 tests/data/acpi/pc/DSDT.cphp                | Bin 6451 -> 6451 bytes
 tests/data/acpi/pc/DSDT.dimmpxm             | Bin 7641 -> 7641 bytes
 tests/data/acpi/pc/DSDT.hpbridge            | Bin 5954 -> 5954 bytes
 tests/data/acpi/pc/DSDT.hpbrroot            | Bin 3069 -> 3069 bytes
 tests/data/acpi/pc/DSDT.ipmikcs             | Bin 6059 -> 6059 bytes
 tests/data/acpi/pc/DSDT.memhp               | Bin 7346 -> 7346 bytes
 tests/data/acpi/pc/DSDT.numamem             | Bin 5993 -> 5993 bytes
 tests/data/acpi/pc/DSDT.roothp              | Bin 6195 -> 6195 bytes
 tests/data/acpi/q35/DSDT                    | Bin 8274 -> 8274 bytes
 tests/data/acpi/q35/DSDT.acpierst           | Bin 8291 -> 8291 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9599 -> 9599 bytes
 tests/data/acpi/q35/DSDT.applesmc           | Bin 8320 -> 8320 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 10988 -> 10988 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8738 -> 8738 bytes
 tests/data/acpi/q35/DSDT.cxl                | Bin 9600 -> 9600 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9928 -> 9928 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 8349 -> 8349 bytes
 tests/data/acpi/q35/DSDT.ipmismbus          | Bin 8363 -> 8363 bytes
 tests/data/acpi/q35/DSDT.ivrs               | Bin 8291 -> 8291 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9633 -> 9633 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 9404 -> 9404 bytes
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 8568 -> 8568 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 8280 -> 8280 bytes
 tests/data/acpi/q35/DSDT.pvpanic-isa        | Bin 8375 -> 8375 bytes
 tests/data/acpi/q35/DSDT.tis.tpm12          | Bin 8880 -> 8880 bytes
 tests/data/acpi/q35/DSDT.tis.tpm2           | Bin 8906 -> 8906 bytes
 tests/data/acpi/q35/DSDT.viot               | Bin 9383 -> 9383 bytes
 tests/data/acpi/q35/DSDT.xapic              | Bin 35637 -> 35637 bytes
 33 files changed, 32 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index a7aa428fab..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,33 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/pc/DSDT",
-"tests/data/acpi/pc/DSDT.acpierst",
-"tests/data/acpi/pc/DSDT.acpihmat",
-"tests/data/acpi/pc/DSDT.bridge",
-"tests/data/acpi/pc/DSDT.cphp",
-"tests/data/acpi/pc/DSDT.dimmpxm",
-"tests/data/acpi/pc/DSDT.hpbridge",
-"tests/data/acpi/pc/DSDT.hpbrroot",
-"tests/data/acpi/pc/DSDT.ipmikcs",
-"tests/data/acpi/pc/DSDT.memhp",
-"tests/data/acpi/pc/DSDT.numamem",
-"tests/data/acpi/pc/DSDT.roothp",
-"tests/data/acpi/q35/DSDT",
-"tests/data/acpi/q35/DSDT.acpierst",
-"tests/data/acpi/q35/DSDT.acpihmat",
-"tests/data/acpi/q35/DSDT.applesmc",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.cphp",
-"tests/data/acpi/q35/DSDT.cxl",
-"tests/data/acpi/q35/DSDT.dimmpxm",
-"tests/data/acpi/q35/DSDT.ipmibt",
-"tests/data/acpi/q35/DSDT.ipmismbus",
-"tests/data/acpi/q35/DSDT.ivrs",
-"tests/data/acpi/q35/DSDT.memhp",
-"tests/data/acpi/q35/DSDT.mmio64",
-"tests/data/acpi/q35/DSDT.multi-bridge",
-"tests/data/acpi/q35/DSDT.numamem",
-"tests/data/acpi/q35/DSDT.pvpanic-isa",
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/DSDT.tis.tpm2",
-"tests/data/acpi/q35/DSDT.viot",
-"tests/data/acpi/q35/DSDT.xapic",
diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT
index e80bef30317b5ef3bf0d2fb7aaabd6def109adb6..2d543fbf94e42f03814019c146b49f94e76bf15d 100644
GIT binary patch
delta 19
bcmaE?_gHVjq|FM9s%#S{^=)=#mlFU0Q=bPS

delta 19
bcmaE?_gHVjq{-Xa`Zi8dW!vn^E++s0T|@`I

diff --git a/tests/data/acpi/pc/DSDT.acpierst b/tests/data/acpi/pc/DSDT.acpierst
index d5a2ca51652dfc3637a817bac4a02d6ff6dc8ac2..798349aa3f85e0803396471237e94604d00a1f90 100644
GIT binary patch
delta 19
bcmX@4cSvu-q|FM9s%#S{^=)=#|H}^mP`C%a

delta 19
bcmX@4cSvu-q{-Xa`Zi8dW!vn^{+AyBT3rZQ

diff --git a/tests/data/acpi/pc/DSDT.acpihmat b/tests/data/acpi/pc/DSDT.acpihmat
index f86c743c4d64041c7fbd9999cc700e88416770b7..2b0fd3433b586fd7665b9a0b5b2f8bb3fcc09b44 100644
GIT binary patch
delta 19
bcmbPWIl*$mq|FM9s%#S{^=)=#_Z9^JNyrAo

delta 19
bcmbPWIl*$mq{-Xa`Zi8dW!vn^?kx%cQ*8%e

diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge
index 14ed0d995a9f6540deae5a25a7853ed4493a6e06..56398fc0147c9ab9d59947e24cddb08380b6a13e 100644
GIT binary patch
delta 19
bcmX@>eAaowq|FM9s%#S{^=)=#?~nojR4)gV

delta 19
bcmX@>eAaowq{-Xa`Zi8dW!vn^-XR45UDOCL

diff --git a/tests/data/acpi/pc/DSDT.cphp b/tests/data/acpi/pc/DSDT.cphp
index c653302a84a42d063a74a22c6adf910beeba7c60..38cb47c675edb6d4797b008d2deae656739230ef 100644
GIT binary patch
delta 19
bcmdmNwApCFq|FM9s%#S{^=)=#e<uh4PY4H_

delta 19
bcmdmNwApCFq{-Xa`Zi8dW!vn^{!S18Sgi;*

diff --git a/tests/data/acpi/pc/DSDT.dimmpxm b/tests/data/acpi/pc/DSDT.dimmpxm
index 247a1796b1cf31c24b1a981e48937609f84fe2cb..06a7aa59465238bfbf715ae83540f68b1f2f3ea5 100644
GIT binary patch
delta 19
bcmca<ebaivq|FM9s%#S{^=)=#pCSeTRO1Jv

delta 19
bcmca<ebaivq{-Xa`Zi8dW!vn^K1B=wUWf=l

diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/pc/DSDT.hpbridge
index d5a2ca51652dfc3637a817bac4a02d6ff6dc8ac2..798349aa3f85e0803396471237e94604d00a1f90 100644
GIT binary patch
delta 19
bcmX@4cSvu-q|FM9s%#S{^=)=#|H}^mP`C%a

delta 19
bcmX@4cSvu-q{-Xa`Zi8dW!vn^{+AyBT3rZQ

diff --git a/tests/data/acpi/pc/DSDT.hpbrroot b/tests/data/acpi/pc/DSDT.hpbrroot
index ec99b1622934a0fd8bc316291c33231e4c57dce0..dd2c8c0c8c5bf9895eb524e094d5597515b4803e 100644
GIT binary patch
delta 19
bcmew>{#Sg$q|FM9Y^)O}^=(#TyUq##Q{o4f

delta 19
bcmew>{#Sg$q{%Z_`!-HuW8JLAcAXUfTxbXq

diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/pc/DSDT.ipmikcs
index f0d9e75841ea3d69fed9384e439bc4e94c7a4c4e..be7f22f1c29f25351bcb5620dcfe8f955bd083d7 100644
GIT binary patch
delta 19
bcmZ3jzgmC7q|FM9xoi_B^=<BDmlFU0PtgZN

delta 19
bcmZ3jzgmC7q{;u;`Zi9=W!v1#E++s0TmA?r

diff --git a/tests/data/acpi/pc/DSDT.memhp b/tests/data/acpi/pc/DSDT.memhp
index d0a7c462094fea9a457cbf537784735e74f7d7d5..b81e3dd8ecd89f4690d69a90096df095fe218425 100644
GIT binary patch
delta 19
bcmdmFxyf?Eq|FM9s%#S{^=)=#&lLp#PSgh~

delta 19
bcmdmFxyf?Eq{-Xa`Zi8dW!vn^o+}CfSa}D=

diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/pc/DSDT.numamem
index 2f512cfbe158f1739803c0c7009fe5e907bdec54..230aaae37169ec2f78ebeae735ccc905a112d284 100644
GIT binary patch
delta 19
bcmaE<_fl`dq|FM9s%#S{^=)=#R}laJRD%aJ

delta 19
bcmaE<_fl`dq{-Xa`Zi8dW!vn^t|9;cUML69

diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/pc/DSDT.roothp
index 46e03d39e00ea70e55d6a12333ca2b98c5e5bb53..7091ee019191d822869f9a9f35ebd635eea4a9eb 100644
GIT binary patch
delta 19
bcmdmNu-Rb3q|FM9s%#S{^=)=#e<uI{PQwS5

delta 19
bcmdmNu-Rb3q{-Xa`Zi8dW!vn^{!Rb@SZD|`

diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT
index 2cd8d5fc470fc3159fbc464af97e76c8de2136e3..a85c608022b9e0878bcedc785b9bdf27e50a760b 100644
GIT binary patch
delta 21
dcmccQaLHjqDC6eGjEoYKLmB%vKatF10{~?<2zCGf

delta 21
dcmccQaLHjqDC6WX$-d2@jEoYSpGfAh0RUn62mt^9

diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/q35/DSDT.acpierst
index 0bc5de80652ae7328fdc07ccda34afff39ade56f..f768380c1c2aa8fcd6ff6bc1048e0ccd2037eb2c 100644
GIT binary patch
delta 21
dcmaFt@YrEPDC6eGjEoYKLmB%vKas3w0|00M2&n)7

delta 21
dcmaFt@YrEPDC6WX$-d2@jEoYSpGelT0RUve2s8iy

diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat
index af10345e8806c78a0074b3a8819b5cfca4d70c01..51e79b3b0754224aa6cd1e1257b404182506f1d1 100644
GIT binary patch
delta 21
dcmezG_1|klDC6eGjEoYKLmB%vKarfx4FGN#2^IhV

delta 21
dcmezG_1|klDC6WX$-d2@jEoYSpGeN;1^{Z?2%!J~

diff --git a/tests/data/acpi/q35/DSDT.applesmc b/tests/data/acpi/q35/DSDT.applesmc
index 00092aacc6ce44dd8792b00a0fa183e5b06d33c6..33ca7ee26fee6718c72dd63374bea98e858066c2 100644
GIT binary patch
delta 21
ccmZp0Y;fEV%DDM4qrSxCP{zK^LQ;8b09Qc=F#rGn

delta 21
ccmZp0Y;fEV$~d`2vTt)JqrSvuA*nnz09By|>Hq)$

diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge
index d820098355e0b79dc69d714817fe906064852f4d..40457ec74d272f4ce971b66a1b19a397ed9af770 100644
GIT binary patch
delta 21
dcmaD8`X+QkDC6eGjEoYKLmB%vKau1R1ORKJ2zdYi

delta 21
dcmaD8`X+QkDC6WX$-d2@jEoYSpGa~D0sv@b2m}BC

diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp
index ac8456a43d54209d77917163b282954d7429b331..fe87e060d5cf41b20cf1a37928ed31ca9b15ed66 100644
GIT binary patch
delta 21
dcmZ4FvdCpaDC6eGjEoYKLmB%vKasTK003R^2k-y@

delta 21
dcmZ4FvdCpaDC6WX$-d2@jEoYSpGewq003ID2YUbj

diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/q35/DSDT.cxl
index 369ae90196113ec666a4acec7bb7a93be5b60e75..82d7563a73f6b7a4ead15ca0933d0e57ae8be48e 100644
GIT binary patch
delta 21
dcmZqhZt&g^%DDM4BcsIRP{zK^PbBAX0{~iS2pa$Z

delta 21
ccmZqhZt&g^$~ZYpvTt)JBcsITCz5lx0aq&rrT_o{

diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm
index bb0eadf869fe366fc139f8b0fd2ed811d3b16814..304c8229d81e333ed7564423cf50ad2b963b0a2e 100644
GIT binary patch
delta 21
dcmX@%d%|}^DC6eGjEoYKLmB%vKaqUG0{~`*2>1X1

delta 21
dcmX@%d%|}^DC6WX$-d2@jEoYSpGZF80RUr22!j9s

diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt
index bb258279506e78b50545f6f9030bd25afe433c29..b9a5ae240c62f29d952d94a280bc97d608b3c2e5 100644
GIT binary patch
delta 21
dcmbR1IM;DQDC6eGj6M>RLmB%v>r3Ua0RUZm2c-Z2

delta 21
dcmbR1IM;DQDC6XXl6{*)8GR%+>r3Ua0RUX#2YUbj

diff --git a/tests/data/acpi/q35/DSDT.ipmismbus b/tests/data/acpi/q35/DSDT.ipmismbus
index 15000c357fdabf1bceef6f860bd35e9a33024927..a0eeae95c07fe3708509c3e652c3aeff9c21ac82 100644
GIT binary patch
delta 21
dcmZ4OxY}_;DC6eGj8PJkLmB%v+e+oJ0RUir2i*Vw

delta 21
dcmZ4OxY}_;DC6Yyl6{*)8KWdN+e+oJ0RUiO2f+XU

diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs
index 0bc5de80652ae7328fdc07ccda34afff39ade56f..f768380c1c2aa8fcd6ff6bc1048e0ccd2037eb2c 100644
GIT binary patch
delta 21
dcmaFt@YrEPDC6eGjEoYKLmB%vKas3w0|00M2&n)7

delta 21
dcmaFt@YrEPDC6WX$-d2@jEoYSpGelT0RUve2s8iy

diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp
index 663456fc0d3c71a51b541f5ab952e05c9dac01e6..b4a9f5a0fe5cf3b44ebe7659a2bf3687e1073482 100644
GIT binary patch
delta 21
dcmZ4Jz0i9@DC6eGjEoYKLmB%vKat$a4FF%$2z~$n

delta 21
dcmZ4Jz0i9@DC6WX$-d2@jEoYSpGfZI1^`@@2nhfH

diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64
index 91afd01d598c7c2c733387dfb5140d0fcad54adb..3af5ef2ea473322d8697281d3a20f7282f3238ac 100644
GIT binary patch
delta 21
dcmdnvxyN%uDC6eGjEoYKLmB%vKasq_1ps682+9Be

delta 21
dcmdnvxyN%uDC6WX$-d2@jEoYSpGe-|0svsP2vq<8

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index afde339a181628ae9153251eee026b437ab685bc..238668b95f33e831d66e2e2fa5e952f00ea7260b 100644
GIT binary patch
delta 21
dcmez2^uuXGDC6eGjEoYKLmB%vKarfm4ghPv2<-p>

delta 21
dcmez2^uuXGDC6WX$-d2@jEoYSpGZz&2LNb+2zUSh

diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem
index e537669949a07adbaa4255021ea14bb4a9dc672f..37fa4c3a45b0d7db0d3d368df5e027e7e1acf9d2 100644
GIT binary patch
delta 21
dcmccNaKm9kDC6eGjEoYKLmB%vKanh90{~_+2#5dx

delta 21
dcmccNaKm9kDC6WX$-d2@jEoYSpGcOl0RUq32onGR

diff --git a/tests/data/acpi/q35/DSDT.pvpanic-isa b/tests/data/acpi/q35/DSDT.pvpanic-isa
index cc545b5d2505246d33f83d2482273968aa1be032..8705309748d1d7352c6623b32c28eab7fbbce2a4 100644
GIT binary patch
delta 21
dcmdn)xZQC>DC6eGjA;^+LmB%vdrIZ80RUqX2n_%L

delta 21
dcmdn)xZQC>DC6Yal6{*)8Pg;-drIZ80RUrR2mJs5

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12
index a97d884c50485f848054c6ac95ecfa055ff59e5b..7408f03e4b571c352f9fdf2afc8718aa7b37da06 100644
GIT binary patch
delta 21
dcmdnsy1{irDC6eGjKNZqLmB%vo5@tM0RUmA2k`&^

delta 21
dcmdnsy1{irDC6W6(tVpl8H1%Zo5@tM0RUlJ2hacj

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/q35/DSDT.tis.tpm2
index 1f5392919b5ea69696b49ff13aab5c37d0615919..134c2fbccacd0e9383df094f9b4deb03b4e46abb 100644
GIT binary patch
delta 21
dcmX@*ddhV}DC6eGjJZ;iLmB%w2g+2k0RU%32wDID

delta 21
dcmX@*ddhV}DC6Wq(*2vm7;~gH2gp>h0RU&{2vYz6

diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot
index e20e4ee5e92e11ccf890a18fbdd78181c43f3b5c..be4a254e93a9cb360f42a25121c5fcefbd47480f 100644
GIT binary patch
delta 21
dcmZ4Px!iL@DC6eGjEoYKLmB%vKao7l1pr`z2#Wv!

delta 21
dcmZ4Px!iL@DC6WX$-d2@jEoYSpGY3&0svh^2o?YU

diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/q35/DSDT.xapic
index 3cab5956eee60363251a6fab0cc981bbbda64443..2327152da1b7d777c1f3da358ae5ae1406384d11 100644
GIT binary patch
delta 23
fcmdlwjcMyNrVXKtn;$bWN=y!A?A!cAGO!Q;anuPq

delta 23
fcmdlwjcMyNrVXKtlfxwYHit4YN^E{28CVDaZk7ne

-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 42/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (40 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 41/55] tests: acpi: update expected blobs after HPET move Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 43/55] acpi: x86: refactor PDSM method to reduce nesting Michael S. Tsirkin
                   ` (14 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-5-imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 34 +++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..452145badd 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,35 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/DSDT",
+"tests/data/acpi/pc/DSDT.acpierst",
+"tests/data/acpi/pc/DSDT.acpihmat",
+"tests/data/acpi/pc/DSDT.bridge",
+"tests/data/acpi/pc/DSDT.cphp",
+"tests/data/acpi/pc/DSDT.dimmpxm",
+"tests/data/acpi/pc/DSDT.hpbridge",
+"tests/data/acpi/pc/DSDT.hpbrroot",
+"tests/data/acpi/pc/DSDT.ipmikcs",
+"tests/data/acpi/pc/DSDT.memhp",
+"tests/data/acpi/pc/DSDT.numamem",
+"tests/data/acpi/pc/DSDT.roothp",
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.acpierst",
+"tests/data/acpi/q35/DSDT.acpihmat",
+"tests/data/acpi/q35/DSDT.applesmc",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.cxl",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.ipmismbus",
+"tests/data/acpi/q35/DSDT.ivrs",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.multi-bridge",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.pvpanic-isa",
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/DSDT.tis.tpm2",
+"tests/data/acpi/q35/DSDT.viot",
+"tests/data/acpi/q35/DSDT.xapic",
+"tests/data/acpi/q35/DSDT.nohpet",
+"tests/data/acpi/pc/DSDT.nohpet",
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 43/55] acpi: x86: refactor PDSM method to reduce nesting
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (41 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 42/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:31 ` [PULL 44/55] x86: acpi: _DSM: use Package to pass parameters Michael S. Tsirkin
                   ` (13 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost

From: Igor Mammedov <imammedo@redhat.com>

.., it will help with code readability and make easier
to extend method in followup patches

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-6-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 139 ++++++++++++++++++++++++-------------------
 1 file changed, 77 insertions(+), 62 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 67b532f5a5..6d02eed12c 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -574,9 +574,12 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
 
 Aml *aml_pci_device_dsm(void)
 {
-    Aml *method, *UUID, *ifctx, *ifctx1, *ifctx2, *ifctx3, *elsectx;
-    Aml *acpi_index = aml_local(0);
+    Aml *method, *UUID, *ifctx, *ifctx1;
+    Aml *ret = aml_local(0);
+    Aml *caps = aml_local(1);
+    Aml *acpi_index = aml_local(2);
     Aml *zero = aml_int(0);
+    Aml *one = aml_int(1);
     Aml *bnum = aml_arg(4);
     Aml *func = aml_arg(2);
     Aml *rev = aml_arg(1);
@@ -584,73 +587,85 @@ Aml *aml_pci_device_dsm(void)
 
     method = aml_method("PDSM", 6, AML_SERIALIZED);
 
-    /*
-     * PCI Firmware Specification 3.1
-     * 4.6.  _DSM Definitions for PCI
-     */
-    UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
-    ifctx = aml_if(aml_equal(aml_arg(0), UUID));
+    /* get supported functions */
+    ifctx = aml_if(aml_equal(func, zero));
     {
-        aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_index));
-        ifctx1 = aml_if(aml_equal(func, zero));
+        uint8_t byte_list[1] = { 0 }; /* nothing supported yet */
+        aml_append(ifctx, aml_store(aml_buffer(1, byte_list), ret));
+        aml_append(ifctx, aml_store(zero, caps));
+
+       /*
+        * PCI Firmware Specification 3.1
+        * 4.6.  _DSM Definitions for PCI
+        */
+        UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
+        ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(0), UUID)));
         {
-            uint8_t byte_list[1];
+            /* call is for unsupported UUID, bail out */
+            aml_append(ifctx1, aml_return(ret));
+        }
+        aml_append(ifctx, ifctx1);
 
-            ifctx2 = aml_if(aml_equal(rev, aml_int(2)));
-            {
-                /*
-                 * advertise function 7 if device has acpi-index
-                 * acpi_index values:
-                 *            0: not present (default value)
-                 *     FFFFFFFF: not supported (old QEMU without PIDX reg)
-                 *        other: device's acpi-index
-                 */
-                ifctx3 = aml_if(aml_lnot(
-                    aml_or(aml_equal(acpi_index, zero),
-                           aml_equal(acpi_index, aml_int(0xFFFFFFFF)), NULL)
-                ));
-                {
-                    byte_list[0] =
-                        1 /* have supported functions */ |
-                        1 << 7 /* support for function 7 */
-                    ;
-                    aml_append(ifctx3, aml_return(aml_buffer(1, byte_list)));
-                }
-                aml_append(ifctx2, ifctx3);
-             }
-             aml_append(ifctx1, ifctx2);
+        ifctx1 = aml_if(aml_lless(rev, aml_int(2)));
+        {
+            /* call is for unsupported REV, bail out */
+            aml_append(ifctx1, aml_return(ret));
+        }
+        aml_append(ifctx, ifctx1);
 
-             byte_list[0] = 0; /* nothing supported */
-             aml_append(ifctx1, aml_return(aml_buffer(1, byte_list)));
-         }
-         aml_append(ifctx, ifctx1);
-         elsectx = aml_else();
-         /*
-          * PCI Firmware Specification 3.1
-          * 4.6.7. _DSM for Naming a PCI or PCI Express Device Under
-          *        Operating Systems
-          */
-         ifctx1 = aml_if(aml_equal(func, aml_int(7)));
-         {
-             Aml *pkg = aml_package(2);
-             Aml *ret = aml_local(1);
+        aml_append(ifctx,
+            aml_store(aml_call2("AIDX", bnum, sunum), acpi_index));
+        /*
+         * advertise function 7 if device has acpi-index
+         * acpi_index values:
+         *            0: not present (default value)
+         *     FFFFFFFF: not supported (old QEMU without PIDX reg)
+         *        other: device's acpi-index
+         */
+        ifctx1 = aml_if(aml_lnot(
+                     aml_or(aml_equal(acpi_index, zero),
+                            aml_equal(acpi_index, aml_int(0xFFFFFFFF)), NULL)
+                 ));
+        {
+            /* have supported functions */
+            aml_append(ifctx1, aml_or(caps, one, caps));
+            /* support for function 7 */
+            aml_append(ifctx1,
+                aml_or(caps, aml_shiftleft(one, aml_int(7)), caps));
+        }
+        aml_append(ifctx, ifctx1);
 
-             aml_append(pkg, zero);
-             /*
-              * optional, if not impl. should return null string
-              */
-             aml_append(pkg, aml_string("%s", ""));
-             aml_append(ifctx1, aml_store(pkg, ret));
-             /*
-              * update acpi-index to actual value
-              */
-             aml_append(ifctx1, aml_store(acpi_index, aml_index(ret, zero)));
-             aml_append(ifctx1, aml_return(ret));
-         }
-         aml_append(elsectx, ifctx1);
-         aml_append(ifctx, elsectx);
+        aml_append(ifctx, aml_store(caps, aml_index(ret, zero)));
+        aml_append(ifctx, aml_return(ret));
     }
     aml_append(method, ifctx);
+
+    /* handle specific functions requests */
+    /*
+     * PCI Firmware Specification 3.1
+     * 4.6.7. _DSM for Naming a PCI or PCI Express Device Under
+     *        Operating Systems
+     */
+    ifctx = aml_if(aml_equal(func, aml_int(7)));
+    {
+       Aml *pkg = aml_package(2);
+
+       aml_append(pkg, zero);
+       /*
+        * optional, if not impl. should return null string
+        */
+       aml_append(pkg, aml_string("%s", ""));
+       aml_append(ifctx, aml_store(pkg, ret));
+
+       aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_index));
+       /*
+        * update acpi-index to actual value
+        */
+       aml_append(ifctx, aml_store(acpi_index, aml_index(ret, zero)));
+    }
+
+    aml_append(method, ifctx);
+    aml_append(method, aml_return(ret));
     return method;
 }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 44/55] x86: acpi: _DSM: use Package to pass parameters
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (42 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 43/55] acpi: x86: refactor PDSM method to reduce nesting Michael S. Tsirkin
@ 2022-10-10 17:31 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 45/55] tests: acpi: update expected blobs Michael S. Tsirkin
                   ` (12 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Marcel Apfelbaum

From: Igor Mammedov <imammedo@redhat.com>

Numer of possible arguments to pass to a method is limited
in ACPI. The following patches will need to pass over more
parameters to PDSM method, will hit that limit.

Prepare for this by passing structure (Package) to method,
which let us workaround arguments limitation.
Pass to PDSM all standard arguments of _DSM as is, and
pack custom parameters into Package that is passed as
the last argument to PDSM.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-7-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 6d02eed12c..a19900c4e4 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -431,11 +431,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                 );
                 aml_append(dev, method);
                 method = aml_method("_DSM", 4, AML_SERIALIZED);
-                aml_append(method,
-                    aml_return(aml_call6("PDSM", aml_arg(0), aml_arg(1),
-                                         aml_arg(2), aml_arg(3),
-                                         aml_name("BSEL"), aml_name("_SUN")))
-                );
+                {
+                    Aml *params = aml_local(0);
+                    Aml *pkg = aml_package(2);
+                    aml_append(pkg, aml_name("BSEL"));
+                    aml_append(pkg, aml_name("_SUN"));
+                    aml_append(method, aml_store(pkg, params));
+                    aml_append(method,
+                        aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1),
+                                             aml_arg(2), aml_arg(3), params))
+                    );
+                }
                 aml_append(dev, method);
                 aml_append(parent_scope, dev);
 
@@ -480,10 +486,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
              */
             aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
             method = aml_method("_DSM", 4, AML_SERIALIZED);
-            aml_append(method, aml_return(
-                aml_call6("PDSM", aml_arg(0), aml_arg(1), aml_arg(2),
-                          aml_arg(3), aml_name("BSEL"), aml_name("ASUN"))
-            ));
+            {
+                Aml *params = aml_local(0);
+                Aml *pkg = aml_package(2);
+                aml_append(pkg, aml_name("BSEL"));
+                aml_append(pkg, aml_name("ASUN"));
+                aml_append(method, aml_store(pkg, params));
+                aml_append(method, aml_return(
+                    aml_call5("PDSM", aml_arg(0), aml_arg(1), aml_arg(2),
+                              aml_arg(3), params)
+                ));
+            }
             aml_append(dev, method);
         }
 
@@ -580,12 +593,13 @@ Aml *aml_pci_device_dsm(void)
     Aml *acpi_index = aml_local(2);
     Aml *zero = aml_int(0);
     Aml *one = aml_int(1);
-    Aml *bnum = aml_arg(4);
     Aml *func = aml_arg(2);
     Aml *rev = aml_arg(1);
-    Aml *sunum = aml_arg(5);
+    Aml *params = aml_arg(4);
+    Aml *bnum = aml_derefof(aml_index(params, aml_int(0)));
+    Aml *sunum = aml_derefof(aml_index(params, aml_int(1)));
 
-    method = aml_method("PDSM", 6, AML_SERIALIZED);
+    method = aml_method("PDSM", 5, AML_SERIALIZED);
 
     /* get supported functions */
     ifctx = aml_if(aml_equal(func, zero));
@@ -662,10 +676,10 @@ Aml *aml_pci_device_dsm(void)
         * update acpi-index to actual value
         */
        aml_append(ifctx, aml_store(acpi_index, aml_index(ret, zero)));
+       aml_append(ifctx, aml_return(ret));
     }
 
     aml_append(method, ifctx);
-    aml_append(method, aml_return(ret));
     return method;
 }
 
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 45/55] tests: acpi: update expected blobs
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (43 preceding siblings ...)
  2022-10-10 17:31 ` [PULL 44/55] x86: acpi: _DSM: use Package to pass parameters Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 46/55] tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN Michael S. Tsirkin
                   ` (11 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

An intermediate blobs update to keep changes (last 2 patches)
reviewable.

Includes refactored PDSM that uses Package argument for custom
parameters.

 ===== PDSM taking package as arguments

             Return (Local0)
         }

-        Method (PDSM, 6, Serialized)
+        Method (PDSM, 5, Serialized)
         {
-            If ((Arg0 == ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device Labeling Interface */))
+            If ((Arg2 == Zero))
             {
-                Local0 = AIDX (Arg4, Arg5)
-                If ((Arg2 == Zero))
-                {
-                    If ((Arg1 == 0x02))
+                Local0 = Buffer (One)
                     {
-                        If (!((Local0 == Zero) | (Local0 == 0xFFFFFFFF)))
-                        {
-                            Return (Buffer (One)
-                            {
-                                 0x81                                             // .
-                            })
-                        }
+                         0x00                                             // .
                     }
+                Local1 = Zero
+                If ((Arg0 != ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device Labeling Interface */))
+                {
+                    Return (Local0)
+                }

-                    Return (Buffer (One)
-                    {
-                         0x00                                             // .
-                    })
+                If ((Arg1 < 0x02))
+                {
+                    Return (Local0)
                 }
-                ElseIf ((Arg2 == 0x07))
+
+                Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One]
+                    ))
+                If (!((Local2 == Zero) | (Local2 == 0xFFFFFFFF)))
                 {
-                    Local1 = Package (0x02)
-                        {
-                            Zero,
-                            ""
-                        }
-                    Local1 [Zero] = Local0
-                    Return (Local1)
+                    Local1 |= One
+                    Local1 |= (One << 0x07)
                 }
+
+                Local0 [Zero] = Local1
+                Return (Local0)
+            }
+
+            If ((Arg2 == 0x07))
+            {
+                Local0 = Package (0x02)
+                    {
+                        Zero,
+                        ""
+                    }
+                Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One]
+                    ))
+                Local0 [Zero] = Local2
+                Return (Local0)
             }
         }
     }

 =====  PCI slot using Package to pass arguments to _DSM

                 Name (ASUN, Zero)
                 Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                 {
-                    Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, ASUN))
+                    Local0 = Package (0x02)
+                        {
+                            BSEL,
+                            ASUN
+                        }
+                    Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
                 }
             }

 ===== hotpluggable PCI slot using Package to pass arguments to _DSM

                 Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                 {
-                    Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
+                    Local0 = Package (0x02)
+                        {
+                            BSEL,
+                            _SUN
+                        }
+                    Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
                 }
             }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-8-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |  34 --------------------
 tests/data/acpi/pc/DSDT                     | Bin 5987 -> 6219 bytes
 tests/data/acpi/pc/DSDT.acpierst            | Bin 5954 -> 6186 bytes
 tests/data/acpi/pc/DSDT.acpihmat            | Bin 7312 -> 7544 bytes
 tests/data/acpi/pc/DSDT.bridge              | Bin 8653 -> 9078 bytes
 tests/data/acpi/pc/DSDT.cphp                | Bin 6451 -> 6683 bytes
 tests/data/acpi/pc/DSDT.dimmpxm             | Bin 7641 -> 7873 bytes
 tests/data/acpi/pc/DSDT.hpbridge            | Bin 5954 -> 6186 bytes
 tests/data/acpi/pc/DSDT.ipmikcs             | Bin 6059 -> 6291 bytes
 tests/data/acpi/pc/DSDT.memhp               | Bin 7346 -> 7578 bytes
 tests/data/acpi/pc/DSDT.nohpet              | Bin 5845 -> 6077 bytes
 tests/data/acpi/pc/DSDT.numamem             | Bin 5993 -> 6225 bytes
 tests/data/acpi/pc/DSDT.roothp              | Bin 6195 -> 6434 bytes
 tests/data/acpi/q35/DSDT                    | Bin 8274 -> 8320 bytes
 tests/data/acpi/q35/DSDT.acpierst           | Bin 8291 -> 8337 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9599 -> 9645 bytes
 tests/data/acpi/q35/DSDT.applesmc           | Bin 8320 -> 8366 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 10988 -> 11227 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8738 -> 8784 bytes
 tests/data/acpi/q35/DSDT.cxl                | Bin 9600 -> 9646 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9928 -> 9974 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 8349 -> 8395 bytes
 tests/data/acpi/q35/DSDT.ipmismbus          | Bin 8363 -> 8409 bytes
 tests/data/acpi/q35/DSDT.ivrs               | Bin 8291 -> 8337 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9633 -> 9679 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 9404 -> 9450 bytes
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 8568 -> 8628 bytes
 tests/data/acpi/q35/DSDT.nohpet             | Bin 8132 -> 8178 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 8280 -> 8326 bytes
 tests/data/acpi/q35/DSDT.pvpanic-isa        | Bin 8375 -> 8421 bytes
 tests/data/acpi/q35/DSDT.tis.tpm12          | Bin 8880 -> 8926 bytes
 tests/data/acpi/q35/DSDT.tis.tpm2           | Bin 8906 -> 8952 bytes
 tests/data/acpi/q35/DSDT.viot               | Bin 9383 -> 9429 bytes
 tests/data/acpi/q35/DSDT.xapic              | Bin 35637 -> 35683 bytes
 34 files changed, 34 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 452145badd..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,35 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/pc/DSDT",
-"tests/data/acpi/pc/DSDT.acpierst",
-"tests/data/acpi/pc/DSDT.acpihmat",
-"tests/data/acpi/pc/DSDT.bridge",
-"tests/data/acpi/pc/DSDT.cphp",
-"tests/data/acpi/pc/DSDT.dimmpxm",
-"tests/data/acpi/pc/DSDT.hpbridge",
-"tests/data/acpi/pc/DSDT.hpbrroot",
-"tests/data/acpi/pc/DSDT.ipmikcs",
-"tests/data/acpi/pc/DSDT.memhp",
-"tests/data/acpi/pc/DSDT.numamem",
-"tests/data/acpi/pc/DSDT.roothp",
-"tests/data/acpi/q35/DSDT",
-"tests/data/acpi/q35/DSDT.acpierst",
-"tests/data/acpi/q35/DSDT.acpihmat",
-"tests/data/acpi/q35/DSDT.applesmc",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.cphp",
-"tests/data/acpi/q35/DSDT.cxl",
-"tests/data/acpi/q35/DSDT.dimmpxm",
-"tests/data/acpi/q35/DSDT.ipmibt",
-"tests/data/acpi/q35/DSDT.ipmismbus",
-"tests/data/acpi/q35/DSDT.ivrs",
-"tests/data/acpi/q35/DSDT.memhp",
-"tests/data/acpi/q35/DSDT.mmio64",
-"tests/data/acpi/q35/DSDT.multi-bridge",
-"tests/data/acpi/q35/DSDT.numamem",
-"tests/data/acpi/q35/DSDT.pvpanic-isa",
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/DSDT.tis.tpm2",
-"tests/data/acpi/q35/DSDT.viot",
-"tests/data/acpi/q35/DSDT.xapic",
-"tests/data/acpi/q35/DSDT.nohpet",
-"tests/data/acpi/pc/DSDT.nohpet",
diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT
index 2d543fbf94e42f03814019c146b49f94e76bf15d..cb718f1a8a591b27ca841f70f40762562c15c837 100644
GIT binary patch
delta 1368
zcmaE?ciMo<CD<jzTY`asQEwxcJQI_T$YgD%9raF}0WQJ5ybD~|CTB4e2r@G=Bor_t
zE|8iuIYUsGOW=a}$)~}lRlXC&U-?QNcJ^J8uz-DPCKuC^gaSuTmx$($90mp;!N`yV
z)KWV+iD7aQ&wn6bs7+){tWB(B<YH$?EJ*A~U|;}hRh^v0#a<x9%EZ76v<75=Fp>!c
zNf2e5-I-aqJe}6Y#0NXY3wW&waP~Cda0+(yVTf+h4>mA}=ZJT731Z-I3=Z{U5Rr`s
zx}T>&h>HoN1SFQQ1mvZR%&hE$=q3l&$$h+HvUpWZ-pwn^=rQ>wua*L;x_ETcJSNNX
z5uqrN7)48oQS_1+MY{Y%xT%mBMO%qc^phAxwgN=BsgW2(M~P9yDM*BMzQib+NQ|PZ
z#3+&!BEn6v#3))wjH0K+DAE)r!cDovDB4JjqOZg#vJ@f0O|`@*I!KHnR#76X^Ay!W
OD>Kl_g3Vo`HyHuis-Nrt

delta 1204
zcmX?Y@K}$_CD<h-S)74^F@GbMJQI_j;ACy49rZ430WQJ5d<%S7Cuax>a|v89K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*2aaLWG;5h*30;7)6hWQKTkHgqyO6QM8U2MW2XKWF|(0
zo2rOWw2v4?OyWdX=SGa8E@Bj&BSw*s1QBiuBSz6IViesYMv;;v5pGH&M$sx_6ul!x
Wk&zS;ZYq<~lEqsVY~C()lMw*;SEL>Q

delta 1186
zcmexiHNle0CD<iof(!!#qs~Syc_t=5!O7Z8JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i2{CR@xe~<0^VE!&YlJ$E?n^eK_LtULQD+_
zn<p@f@jH7gi~%cfSO`+U;S}uZ!w}u18Ejw>&k^tF62!pa7#!-yAR-<QbSuvikc%@i
zv$8?zKoZeSUM!Q}3yGQHkQd>I4>ojRSi%5e7{M6EAVzeP(_{x>Eh#KI<H067P42=k
zeFeX?oCsdSGw@4q!Y};?zqFeuUb`pYm%fExT15=6;d%I_ci@+1631(}4}R%s_@y7<
zm)4TNYj+8L>3#U6IVABK9)w?d4u0up_@xb`@Y-F4U-}4sX+CMZhDS(iiQ~v)o99d4
GWCQ>bvvXkp

diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge
index 56398fc0147c9ab9d59947e24cddb08380b6a13e..e04b5b2035fb665b1e75075d4c47776a51fa77e2 100644
GIT binary patch
literal 9078
zcmeHL&2Jmm5ue8oY57P>OKNS&RvZ(ujW$hTla#-L0)@z3N}?rFYcA!aSfN~!3QD;K
zvT&jzvS5^^3r8_fpeduGhaMP%xmw2_TcD@j{3oP`UV2Q?*q26~+2x~TN>1cG^&kOS
z?aaLQo8QcPZ{DmlLo5I4902=oc1fK#65023HGw}20O+0m%K5+wm`yD^S7BjafSC`%
z&O1J`lJa9MyFADK*s%U!Ss#63v8oNVC-Qc!YCqhvYCwb5Yc}WfB2QI}Y{hI%>S{hI
zRp#?rB=d~>rAkICfmB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ui=sSr5EFuev4n)Tnw+>jrgTci)o4D$iSP0#08iDx-NI%

diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT
index a85c608022b9e0878bcedc785b9bdf27e50a760b..3870958969b1c0e29f9dd26a1256359e90897d3e 100644
GIT binary patch
delta 179
zcmccQ(BR1B66_MvpuoVu=(Le5o{7mvWO6psj(R7~0GD82-UTjfld~8K1eqBb5(*d+
z7f4N-oFOR8C2+y~<kMi&D&L9XuY4sBJNqt4Sin9tlZ$CdLV=^FOGI-=4g&*_U}Q)F
zYN?%^#4tID=RXiI)Fv_})+Sama<MZc79@5gFfahMs!q=0VlNP4Wn$n3S_3jb7|Dc!
MB#5%j?aZfT0OS!lX#fBK

delta 159
zcmZp0yyU>;66_KZq`<(ycx@wBJQI_j;N)zk9rZ430WQJ5d<%S7Cuax>a|v89KlwD+
zw90p)_$yz@!_K}1j-D<NIk^c7lqY8~ERdX>$;Grlcv9`;1cu28JpX}!VTm9!V<U)Q
zSSY?gbaECKdw~!u69X?pVnISjA_K#cM2-MYXEz2Bo_HY5SdanY3G_uW#s@paZ@$31
GK?VQ|Y%)&(

diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/q35/DSDT.acpierst
index f768380c1c2aa8fcd6ff6bc1048e0ccd2037eb2c..c9c18fa4e45288fb6c2182a793a8e6aff72b33d9 100644
GIT binary patch
delta 179
zcmaFtFwv3ACD<ioq5=a0<D-pS@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZfCwD0|0JNI!yoo

delta 159
zcmbQ}_}GEVCD<h-S%HCpv1}t(JQI_j;N)zk9rZ430WQJ5d<%S7Cuax>a|v89KlwD+
zw90p)_$yz@!_K}1j-D<NIk^c7lqY8~ERdX>$;Grlcv9`;1cu28JpX}!VTm9!V<U)Q
zSSY?gbaECKdw~!u69X?pVnISjA_K#cM2-MYXEz2Bo_HY5SdanY3G_uW#s@paZ@$2M
GPzC_>5i&CX

diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat
index 51e79b3b0754224aa6cd1e1257b404182506f1d1..a32e90b5d913d07bc9ed9aca521420305559f357 100644
GIT binary patch
delta 179
zcmezGwbq-<CD<iotttZp<Nu9Z@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZfE|X2ms6HI`{wp

delta 159
zcmZ4M{ojkrCD<jTUX_7?aq>p4cqS%4!O7W7JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i5vl*&Tb4MJn=x9u^<D)6X=U%j1P8--+Y1j
Gt|9<N?=s#1

diff --git a/tests/data/acpi/q35/DSDT.applesmc b/tests/data/acpi/q35/DSDT.applesmc
index 33ca7ee26fee6718c72dd63374bea98e858066c2..5507b6b8f5e6ae4fd4275601eb85caf29bddc352 100644
GIT binary patch
delta 179
zcmZp0T<6H;66_MPPJw}e(Rd?QFB6lG$mE$!JL;V{16+cAc^9~_P0nH{5M*X#NGM=P
zTp%@Ra)zKVm%s({lTU+9t9&Plzw(tl?CiTFVFCNpOfIG+2?dUxE)mTgISdRyf{`H!
zsHJvt62s&qp8r6=P@Bk@SesbM$i>c(SdiF}z`y|1syaD~i@iXIm5G5DXbs2!VI&g@
Nk|4@9Z)H9$0{|KaIqv`f

delta 159
zcmZ4I*x<<J66_MvpuoVuczh#QFB6lW;N+Q1JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i5vl*&Tb4MJn=x9u^<D)6X=U%j1P8--~5kx
GgA4#WaWd5a

diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge
index 40457ec74d272f4ce971b66a1b19a397ed9af770..d03e14b24d0841b4003e7954b70cd7601e571902 100644
GIT binary patch
delta 1390
zcmaD8dOMuUCD<k8wl)I;qufTWcqS$vk;&OiJL;V{16+cAc^9~_P0nH{5M*X#NGM=P
zTp%@Ra)zKVm%s({lTU+9t9&Plzw(tl?CiTFVFCNpOfIG+2?dUxE)mTgISdRyf{`H!
zsHJvt62s&qp8r6=P@Bk@SesbM$i>c(SdiF}z`y|1syaD~i@iXIm5G5DXbs2!VI&g@
zk|4@9w=>tuaCz>Ei4S&)7jWD)nNPu<$$!gae+4lnXO_un3MvY+@jyrO6bNxKIR(4=
z#0Q7^B`g8?BO@~_J0ZHseex0oO+t!1CO=ouBCJSTkqAZk#3<TKjH2(vD6&=}!cFzW
zC^}4xB6ejWtn(&DQ9m(?E)%0jT!jcXMH8cFJ~4_O6Qf97l?XRw6QgK7F^WDDqsUy1
w2sc#|qi8=dikQ`ju+E(rMcu?GI!}xuVGSbO6i$qy*&151c#EFRcQgc;0IdwHng9R*

delta 1193
zcmcZ|{w9>mCD<k8jTQp~<AaS{@k~s9f|IkEcGSDD1-JzJ@-6UTotz;k%q4Ka{N&SM
z(<<MI;;(!q4?Fu7IC{E7<m4tSP@bH{ut0KhCKuBJ;YqcV6Bs5Z@cah?h9!c`jEx|I
zVWIc}(aBj{>;*!sObomXi3JHAi3|)&5;+1qo!uBjc;bOHV?hRpC(swk7$58uzxe`l
zk_?x}x)=~gz+v5F8wGnwzZJoT2Jsy6jxIqw3=B*R98STmJ`B-KHj}3+s7Q&&10Bq>
z1mx_D%&csXTzqh-Uv!h><eLhbxTT#YD=BK>lg_~}y$!GQBqh9Nd*PR!f?xU`erXM5
zymlAim)?V4noR|-;Q{!iXW^HAf?rxs6|dbD_@xiwm*!E!Yj_xb=>_<uU*VTFQO9d{
p9e(K(_@#w3@ERV2UwRpS=@0m&tu*o4-J+=_jwAnWKCLOh1OP7veAWN}

diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp
index fe87e060d5cf41b20cf1a37928ed31ca9b15ed66..2d8cb603c9c937501247d32e6a5b2e79bb01eea3 100644
GIT binary patch
delta 179
zcmZ4Fa>0emCD<h-K#75YaoI+$cqS$vk;&OiJL;V{16+cAc^9~_P0nH{5M*X#NGM=P
zTp%@Ra)zKVm%s({lTU+9t9&Plzw(tl?CiTFVFCNpOfIG+2?dUxE)mTgISdRyf{`H!
zsHJvt62s&qp8r6=P@Bk@SesbM$i>c(SdiF}z`y|1syaD~i@iXIm5G5DXbs2!VI&g@
Nk|4@9w=>U{0{|dEIhX(d

delta 159
zcmccMvdD$YCD<iINr{1h(P|@CJQI_j;N)zk9rZ430WQJ5d<%S7Cuax>a|v89KlwD+
zw90p)_$yz@!_K}1j-D<NIk^c7lqY8~ERdX>$;Grlcv9`;1cu28JpX}!VTm9!V<U)Q
zSSY?gbaECKdw~!u69X?pVnISjA_K#cM2-MYXEz2Bo_HY5SdanY3G_uW#s@paZ@$3X
GAO`@jH!*$y

diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/q35/DSDT.cxl
index 82d7563a73f6b7a4ead15ca0933d0e57ae8be48e..20d0fb64ea52b2f4979105c934aadb6f416e2b71 100644
GIT binary patch
delta 179
zcmZqhUgyo_66_MPPL+Xy(Q6}DJQI_T$mDFM9raF}0WQJ5ybD~|CTB4e2r@G=Bor_t
zE|8iuIYUsGOW=a}$)~}lRlXC&U-?QNcJ^J8uz-DPCKuC^gaSuTmx$($90mp;!N`yV
z)KWV+iD7aQ&wn6bs7+){tWB(B<YH$?EJ*A~U|;}hRh^v0#a<x9%EZ76v<75=Fp>!c
NNf2e5+nIkV0ssJjImiG2

delta 159
zcmZ4I-QdmT66_Mvpvu6&cyA+DJQI_j;N)zk9rZ430WQJ5d<%S7Cuax>a|v89KlwD+
zw90p)_$yz@!_K}1j-D<NIk^c7lqY8~ERdX>$;Grlcv9`;1cu28JpX}!VTm9!V<U)Q
zSSY?gbaECKdw~!u69X?pVnISjA_K#cM2-MYXEz2Bo_HY5SdanY3G_uW#s@paZ@$2M
GPZ0nmS~9Kx

diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm
index 304c8229d81e333ed7564423cf50ad2b963b0a2e..b23339513af3be457c1974e0288fc4c6720690d8 100644
GIT binary patch
delta 179
zcmX@%`^}fjCD<k8n;HWH<AjY|@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZfAB>1^~m2IyC?Q

delta 159
zcmez7d%~B?CD<k8gc<__qsm6EcqS%4!O7W7JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i5vl*&Tb4MJn=x9u^<D)6X=U%j1P8--+X~t
GO&I_{t1=q^

diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt
index b9a5ae240c62f29d952d94a280bc97d608b3c2e5..8af2695edeeadbde2a1e8f04ab567f5c00b76945 100644
GIT binary patch
delta 179
zcmbR1c-oQ6CD<k8v;qSIWBNv}RZL7iB9pf<?WlL+3~&kd<z3*yHaUx-K#-Y{A)$aF
zae>sN$r*yeTml!&Pd*Jct@52H{>oSKu(R)ygazzVGr5?SBosJ$x<oX0<S;M*2}Xt_
zpqARnNeq*dc>V(cLv12sVr^n2BNsbEVnJd@0s{k3tLo$|F7^T;Rwf2spfw-^gpo`r
NNP;Nae2MwA3;>&(I?(_C

delta 131
zcmX@@IM<QOCD<iot^xxC<L`}JtC*Pl1SfA}+L7YI7T^->%eTOXb#jKFFqgmu^OH}5
zO{;t-iof!eJnZaS;OOZRk&~OSKzVW&!ve|4nOsZ@geTQbPGFdv!1Esn7?ub!Gd6+<
ihK1q_L?>r)u@?xjGBNNnBo-ueBr-58N!-M8S_S}whAYtk

diff --git a/tests/data/acpi/q35/DSDT.ipmismbus b/tests/data/acpi/q35/DSDT.ipmismbus
index a0eeae95c07fe3708509c3e652c3aeff9c21ac82..479df48cd37af888317d63eac8f565f370201490 100644
GIT binary patch
delta 179
zcmZ4Oc+-)~CD<k8rUC;4<H3zw@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZf91J1pt!1InDq8

delta 159
zcmccVxZ07+CD<iowE_bJW9UY%cqS%4!O7W7JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i5vl*&Tb4MJn=x9u^<D)6X=U%j1P8--+Y0Y
GQx*UfEHShI

diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs
index f768380c1c2aa8fcd6ff6bc1048e0ccd2037eb2c..c9c18fa4e45288fb6c2182a793a8e6aff72b33d9 100644
GIT binary patch
delta 179
zcmaFtFwv3ACD<ioq5=a0<D-pS@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZfCwD0|0JNI!yoo

delta 159
zcmbQ}_}GEVCD<h-S%HCpv1}t(JQI_j;N)zk9rZ430WQJ5d<%S7Cuax>a|v89KlwD+
zw90p)_$yz@!_K}1j-D<NIk^c7lqY8~ERdX>$;Grlcv9`;1cu28JpX}!VTm9!V<U)Q
zSSY?gbaECKdw~!u69X?pVnISjA_K#cM2-MYXEz2Bo_HY5SdanY3G_uW#s@paZ@$2M
GPzC_>5i&CX

diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp
index b4a9f5a0fe5cf3b44ebe7659a2bf3687e1073482..a5730b8ab8abb2602334633cd6c760f79915e564 100644
GIT binary patch
delta 179
zcmZ4JecqePCD<k8yeb0&qsd0DcqS$vk;&OiJL;V{16+cAc^9~_P0nH{5M*X#NGM=P
zTp%@Ra)zKVm%s({lTU+9t9&Plzw(tl?CiTFVFCNpOfIG+2?dUxE)mTgISdRyf{`H!
zsHJvt62s&qp8r6=P@Bk@SesbM$i>c(SdiF}z`y|1syaD~i@iXIm5G5DXbs2!VI&g@
Nk|4@9w=+vA0RS{(IX3_R

delta 159
zcmX@_z0jM>CD<iop(+Cd<B5%2@k~s9f|IkEcGSDD1-JzJ@-6UTotz;k%q4Ka{N&SM
z(<<MI;;(!q4?Fu7IC{E7<m4tSP@bH{ut0KhCKuBJ;YqcV6Bs5Z@cah?h9!c`jEx|I
zVWIc}(aBj{>;*!sObomXi3JHAi3|)&5;+1qo!uBjc;bOHV?hRpC(swk7$58uzxe|5
Ge?<UQI5Qjo

diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64
index 3af5ef2ea473322d8697281d3a20f7282f3238ac..a4293c20fed04d1ccfc4f4fc1ccf46ca81453854 100644
GIT binary patch
delta 179
zcmdnv`O1^aCD<k8l?np`<A;r0@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZf7=C1OVaDI#~b!

delta 159
zcmaFmxyO^sCD<ioj|u|=W6MUacqS%4!O7W7JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i5vl*&Tb4MJn=x9u^<D)6X=U%j1P8--+X~t
GN)Z5C2QohZ

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index 238668b95f33e831d66e2e2fa5e952f00ea7260b..ae47b004e39f9f78f3c98093727fb92a0c6c74cb 100644
GIT binary patch
delta 310
zcmez2w8fdrCD<ioiy{L9<G+nu@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
zBtevIZfCBQ;c}9Qi4S&)7w{6F%%@<_=r`F<L7d5%W%7Fk6<OJMpqqILgt(ZTf?a*$
zgG2oimVmsGk(rg9FnOVZsgxf_u%Tr<N4%p;5Dy~*GXn=mAwzT%kp@Ulc2zV60C7HE
A8UO$Q

delta 290
zcmdnu{KJXMCD<jTLXm-iF>51NJQI_j;N)zk9rZ430WQJ5d<%S7Cuax>a|v89KlwD+
zw90p)_$yz@!_K}1j-D<NIk^c7lqY8~ERdX>$;Grlcv9`;1cu28JpX}!VTm9!V<U)Q
zSSY?gbaECKdw~!u69X?pVnISjA_K#cM2-MYXEz2Bo_HY5SdanY3G_uW#s@paZ@$2s
zB*Wz*9s}YC_=rumQLvYE=Lj}5i06oRbP3{NU|?e4a0+(yVT^9FnLJfNMO-`{=wO~D
lAZKS}W@Urq;)6r|CSOx91?#kg>SSbKhUjD<q%%#?4*)MbRNw#r

diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/q35/DSDT.nohpet
index 0fb09121cf8f6ad8810587c8b77df9552dd31f42..6feed2ee106087d24d51f468df1b4d44e65143f0 100644
GIT binary patch
delta 179
zcmX?N|H+=qCD<k8lRN_hBhN;zcqS$vk;&OiJL;V{16+cAc^9~_P0nH{5M*X#NGM=P
zTp%@Ra)zKVm%s({lTU+9t9&Plzw(tl?CiTFVFCNpOfIG+2?dUxE)mTgISdRyf{`H!
zsHJvt62s&qp8r6=P@Bk@SesbM$i>c(SdiF}z`y|1syaD~i@iXIm5G5DXbs2!VI&g@
Nk|4@9w=>(y002%mId=d6

delta 159
zcmexlf5e{4CD<k8h&%%W<ARM`@k~s9f|IkEcGSDD1-JzJ@-6UTotz;k%q4Ka{N&SM
z(<<MI;;(!q4?Fu7IC{E7<m4tSP@bH{ut0KhCKuBJ;YqcV6Bs5Z@cah?h9!c`jEx|I
zVWIc}(aBj{>;*!sObomXi3JHAi3|)&5;+1qo!uBjc;bOHV?hRpC(swk7$58uzxe{Q
Gk_-T9Q8HZs

diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem
index 37fa4c3a45b0d7db0d3d368df5e027e7e1acf9d2..414b8af67bdf79238915de0d609ce45e150eb958 100644
GIT binary patch
delta 179
zcmccN(B{bH66_Mvroh0!_+}$lJQI_T$mDFM9raF}0WQJ5ybD~|CTB4e2r@G=Bor_t
zE|8iuIYUsGOW=a}$)~}lRlXC&U-?QNcJ^J8uz-DPCKuC^gaSuTmx$($90mp;!N`yV
z)KWV+iD7aQ&wn6bs7+){tWB(B<YH$?EJ*A~U|;}hRh^v0#a<x9%EZ76v<75=Fp>!c
NNf2e5+nF!Q003SRIx7GG

delta 159
zcmZp3yy3v*66_KZp}@ev*szf+o{7m%aB?=&j(Qii0GD82z6Cz4lQRT`xdbklpL`l@
zTID-Y{FSfdVQ1e0M^BfCoZN&3%9FDg7D!Ic<YHPNJgIha0>k74p8r6=utboVu@OWt
zEEHcLIysAry+DYSiGi0Pu^^!%k%3`JB1eFyvm1j5Pdt!jEXV-y1o|Qw<Aa^zH(y}h
GCIbNFpE3~u

diff --git a/tests/data/acpi/q35/DSDT.pvpanic-isa b/tests/data/acpi/q35/DSDT.pvpanic-isa
index 8705309748d1d7352c6623b32c28eab7fbbce2a4..7277a0105035f984dc0a0f09747d441c21e62d1c 100644
GIT binary patch
delta 179
zcmdn)_|%chCD<k8sR9E7<HwC$N0^v=L?&Ng+EMSs8Q>D^%e%mZZE_Yvfgm#@LqY*V
z;sU8jlQRT`xdbklpL`l@TID-Y{FSfdVQ1eZ2@BY#W^yqtNhomibcty0$YEdr5{wK<
zKrOYClNcr^@%#q@hT25N#M;D4MlN=S#Dc_*1O^76R@KQ_T<irxtV|5NKx;q-2qT$L
NkOWb-`3>`F830PWJNEzp

delta 115
zcmaFrxZRP<CD<ioy8;6PW9vq)BTP(wf|D;W?cj1@3vdbc<y+vxI(Z?pm`j19r%Oam
zZo&fP$yp2wBqwKbF)a|DR699=VR8b`e;{C3BFN0x2qG93iZ2kIoW;dnAjHbVz{`+W
RkkFCHz_287vlPo|832BhB&PrX

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12
index 7408f03e4b571c352f9fdf2afc8718aa7b37da06..253a66e65818d1df67b13d4b70f68add78adff98 100644
GIT binary patch
delta 161
zcmdnsde4>1CD<k8o)QBC<E)Kb8(ElqL?-WL*&*q~8Q>D^%e%mZZE_Yvfgm#@LqY*V
z;sU8jlj~W<l9wbbV4s@F#k3@$z|qqsqPZi7fdNP`G9&?2)J{%fn4HA(9|#y~6B!e0
s6Dt|H*clQF5<3zY7=T(;Cuec77YMO3G4KLSMKhov38HHAP1fr&08&;n{Qv*}

delta 115
zcmccTy1|vpCD<iogAxM+quxfYjVw%lf|K{M?BH@?3vdbc<y+vxI=PQk%%#B5(<LG&
zH(`PD<Sd2-l9MyJm=*|6s-2v`FgbzeKM*i15oBg;1Q84i#TST9&f;P(5MpIw;AKcG
RNa#ppU|5p4nVs#r3;;!mBn<!n

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/q35/DSDT.tis.tpm2
index 134c2fbccacd0e9383df094f9b4deb03b4e46abb..76bd4661e6655d2a8f246f4bf38490df14da82ad 100644
GIT binary patch
delta 179
zcmX@*`oopWCD<k8hY|w=qvJ-d(=1FrB9pJP?5KC*3~&kd<z3*yHaUx-K#-Y{A)$aF
zae>sN$r*yeTml!&Pd*Jct@52H{>oSKu(R)ygazzVGr5?SBosJ$x<oX0<S;M*2}Xt_
zpqARnNeq*dc>V(cLv12sVr^n2BNsbEVnJd@0s{k3tLo$|F7^T;Rwf2spfw-^gpo`r
NNP;Na{F(K-3;+_8JFx%&

delta 132
zcmez2ddii{CD<k8loA62<JFB^r&*Z%1Sel-*^%PH7T^->%eTOXb#jKFFqgmu^OH}5
zO{;t-iof!eJnZaS;OOZRk&~OSKzVW&!ve|4nOsZ@geTQbPGFdv!1Esn7?ub!Gd6+<
jhK1q_L?>r)u@?xjGBNNnBo-ueBr-58N!+Z+c3lPl1?w!b

diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot
index be4a254e93a9cb360f42a25121c5fcefbd47480f..3f14b57f0797ab13fc4c90dd2949cf4bd6c30896 100644
GIT binary patch
delta 179
zcmZ4PdDWB4CD<k8stN-G<NJ+V@k~rUB9pV3cGNp@2Dk+K@-A>;o1Dc^Ajr(fkWj#o
zxIk*s<P1S!E`bZ?C!YqJR{2g8f8{HA*x7eU!UFcGnOsau5(*qWT_T!0au^tZ1S3Nd
zP)qIPB!<aJJpX}!p*E2*u{N=ik&B%nu^_P{fq?<2RdsR}7khyaD-#1R&>D~d!bm0*
NBtevIZf90d1OT<%Is^a!

delta 159
zcmccWx!jY>CD<ioxe5aVWAjF?cqS%4!O7W7JL+B70$hT9`4;%FPR<Y%<`TGIe)4Is
zX_fCp@mIc*hn;;396enka&i+EC{NB}SRgq$lZ$DA@TA(w2@I1Hc>V(c!xBMe#zqjq
zuuyz~=;SOe_5vYRCI()H#Dav5L<WW>i5vl*&Tb4MJn=x9u^<D)6X=U%j1P8--+Y0Y
GRS^I*5;5uk

diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/q35/DSDT.xapic
index 2327152da1b7d777c1f3da358ae5ae1406384d11..baa88f6f219a2a47fe20ee0c08b92371cc7e2aa7 100644
GIT binary patch
delta 181
zcmdlwjp^|;CN7s?myqOc1_s6-8@b|{n0!PgXEW`ncj63i3HIe(;KDXJi=jY}nUNu(
zfFW^#)TGH7g2G$^7tBvS4K}UvohbgwSMsp4?~;TC>{Bzjn3g0IIC{E7G<W1MFaQZg
zh9sbt+Q~@_laqM<0|7&AB4c80VkILNJ40eYVn+f415m5#<SZ`s0wGo=240{wAOnPv
POejc#DBIl5ysjMpI!-&V

delta 161
zcmaDnjcMyNCN7s?mk`r#1_s8Sja>0eOn!osvzd0(yRZeg1pD$W@L`>tAt=lxaKZfK
z(_qso--+U{d?gP%`xZEQx<usUCM-~%oW-y}a&jgY(*og1wUZMVCMWRx2LgsAg3OGK
zAcA3`_yW<%SzPP|Laa;-ybOs22_1<H3`-I@0z94F7({sDfiz=528bun7s(hO>=eKG
I0`uf{0IEYXmH+?%

-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 46/55] tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (44 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 45/55] tests: acpi: update expected blobs Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication Michael S. Tsirkin
                   ` (10 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-9-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..1983fa596b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,15 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/DSDT",
+"tests/data/acpi/pc/DSDT.acpierst",
+"tests/data/acpi/pc/DSDT.acpihmat",
+"tests/data/acpi/pc/DSDT.bridge",
+"tests/data/acpi/pc/DSDT.cphp",
+"tests/data/acpi/pc/DSDT.dimmpxm",
+"tests/data/acpi/pc/DSDT.hpbridge",
+"tests/data/acpi/pc/DSDT.ipmikcs",
+"tests/data/acpi/pc/DSDT.memhp",
+"tests/data/acpi/pc/DSDT.nohpet",
+"tests/data/acpi/pc/DSDT.numamem",
+"tests/data/acpi/pc/DSDT.roothp",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.multi-bridge",
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (45 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 46/55] tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 48/55] tests: acpi: update expected blobs Michael S. Tsirkin
                   ` (9 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Marcel Apfelbaum

From: Igor Mammedov <imammedo@redhat.com>

add ASUN variable to hotpluggable slots and use it
instead of _SUN which has the same value to reuse
_DMS code on both branches (hot- and non-hotpluggable).
No functional change.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-10-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 56 +++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 29 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a19900c4e4..eb92b05197 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -374,6 +374,25 @@ build_facs(GArray *table_data)
     g_array_append_vals(table_data, reserved, 40); /* Reserved */
 }
 
+Aml *aml_pci_device_dsm(void)
+{
+    Aml *method;
+
+    method = aml_method("_DSM", 4, AML_SERIALIZED);
+    {
+        Aml *params = aml_local(0);
+        Aml *pkg = aml_package(2);
+        aml_append(pkg, aml_name("BSEL"));
+        aml_append(pkg, aml_name("ASUN"));
+        aml_append(method, aml_store(pkg, params));
+        aml_append(method,
+            aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1),
+                                 aml_arg(2), aml_arg(3), params))
+        );
+    }
+    return method;
+}
+
 static void build_append_pcihp_notify_entry(Aml *method, int slot)
 {
     Aml *if_ctx;
@@ -423,26 +442,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                     break;
                 }
                 dev = aml_device("S%.02X", devfn);
-                aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
+                aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
                 aml_append(dev, aml_name_decl("_ADR", aml_int(adr)));
+                aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
                 method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
                 aml_append(method,
                     aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
                 );
                 aml_append(dev, method);
-                method = aml_method("_DSM", 4, AML_SERIALIZED);
-                {
-                    Aml *params = aml_local(0);
-                    Aml *pkg = aml_package(2);
-                    aml_append(pkg, aml_name("BSEL"));
-                    aml_append(pkg, aml_name("_SUN"));
-                    aml_append(method, aml_store(pkg, params));
-                    aml_append(method,
-                        aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1),
-                                             aml_arg(2), aml_arg(3), params))
-                    );
-                }
-                aml_append(dev, method);
+
+                aml_append(dev, aml_pci_device_dsm());
+
                 aml_append(parent_scope, dev);
 
                 build_append_pcihp_notify_entry(notify_method, slot);
@@ -485,19 +495,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
              * enumeration order in linux kernel, so use another variable for it
              */
             aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
-            method = aml_method("_DSM", 4, AML_SERIALIZED);
-            {
-                Aml *params = aml_local(0);
-                Aml *pkg = aml_package(2);
-                aml_append(pkg, aml_name("BSEL"));
-                aml_append(pkg, aml_name("ASUN"));
-                aml_append(method, aml_store(pkg, params));
-                aml_append(method, aml_return(
-                    aml_call5("PDSM", aml_arg(0), aml_arg(1), aml_arg(2),
-                              aml_arg(3), params)
-                ));
-            }
-            aml_append(dev, method);
+            aml_append(dev, aml_pci_device_dsm());
         }
 
         if (pc->class_id == PCI_CLASS_DISPLAY_VGA) {
@@ -585,7 +583,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
     qobject_unref(bsel);
 }
 
-Aml *aml_pci_device_dsm(void)
+static Aml *aml_pci_pdsm(void)
 {
     Aml *method, *UUID, *ifctx, *ifctx1;
     Aml *ret = aml_local(0);
@@ -1368,7 +1366,7 @@ static void build_x86_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr)
     aml_append(method, aml_return(aml_local(0)));
     aml_append(scope, method);
 
-    aml_append(scope, aml_pci_device_dsm());
+    aml_append(scope, aml_pci_pdsm());
 
     aml_append(table, scope);
 }
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 48/55] tests: acpi: update expected blobs
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (46 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 49/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
                   ` (8 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

It's expected that hotpluggable slots will, get ASUN variable
and use that instead of _SUN with its _DSM method.

For example:

  @@ -979,8 +979,9 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)

               Device (S18)
               {
  -                Name (_SUN, 0x03)  // _SUN: Slot User Number
  +                Name (ASUN, 0x03)
                   Name (_ADR, 0x00030000)  // _ADR: Address
  +                Name (_SUN, 0x03)  // _SUN: Slot User Number
                   Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device
                   {
                       PCEJ (BSEL, _SUN)
  @@ -991,7 +992,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
                       Local0 = Package (0x02)
                           {
                               BSEL,
  -                            _SUN
  +                            ASUN
                           }
                       Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
                   }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-11-imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |  14 --------------
 tests/data/acpi/pc/DSDT                     | Bin 6219 -> 6422 bytes
 tests/data/acpi/pc/DSDT.acpierst            | Bin 6186 -> 6382 bytes
 tests/data/acpi/pc/DSDT.acpihmat            | Bin 7544 -> 7747 bytes
 tests/data/acpi/pc/DSDT.bridge              | Bin 9078 -> 9496 bytes
 tests/data/acpi/pc/DSDT.cphp                | Bin 6683 -> 6886 bytes
 tests/data/acpi/pc/DSDT.dimmpxm             | Bin 7873 -> 8076 bytes
 tests/data/acpi/pc/DSDT.hpbridge            | Bin 6186 -> 6382 bytes
 tests/data/acpi/pc/DSDT.ipmikcs             | Bin 6291 -> 6494 bytes
 tests/data/acpi/pc/DSDT.memhp               | Bin 7578 -> 7781 bytes
 tests/data/acpi/pc/DSDT.nohpet              | Bin 6077 -> 6280 bytes
 tests/data/acpi/pc/DSDT.numamem             | Bin 6225 -> 6428 bytes
 tests/data/acpi/pc/DSDT.roothp              | Bin 6434 -> 6656 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11227 -> 11449 bytes
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 8628 -> 8640 bytes
 15 files changed, 14 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 1983fa596b..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,15 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/pc/DSDT",
-"tests/data/acpi/pc/DSDT.acpierst",
-"tests/data/acpi/pc/DSDT.acpihmat",
-"tests/data/acpi/pc/DSDT.bridge",
-"tests/data/acpi/pc/DSDT.cphp",
-"tests/data/acpi/pc/DSDT.dimmpxm",
-"tests/data/acpi/pc/DSDT.hpbridge",
-"tests/data/acpi/pc/DSDT.ipmikcs",
-"tests/data/acpi/pc/DSDT.memhp",
-"tests/data/acpi/pc/DSDT.nohpet",
-"tests/data/acpi/pc/DSDT.numamem",
-"tests/data/acpi/pc/DSDT.roothp",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.multi-bridge",
diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT
index cb718f1a8a591b27ca841f70f40762562c15c837..8282d449ceaefd914b419f507a13f3fb7b318aaf 100644
GIT binary patch
delta 1170
zcmY++OHRU207l^w3Y0==%cD>pC2<9aFC2o!nHsImOu7UUx8MRCkhlsHV;r#tSKw}p
z=0C~3(~~dfd-1mP^CG`bQpc&hfBH{>f3<%si%l7A_q&(iHM?<(!&T|6i-&8!>XqyK
zuI)Hg$1DHC?lwHweFX6zTQ0<0m@DR5j9U#>6RVl*h+7?27pq&0TLab*Ynbeqn+Nm6
zJd1H_!kS`Dlbvw$VZNAeF>WnbORQzGQ*LcoTdZv{ZUHP13ru##tpn?bbu7j$goR?E
z$yVGVSR@u%j9Uzg#bT44bL+yoVqJ@I>%n?rJ(I1u^<jOnzQwo=U<0v%$u`^)SR$5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hpbridge b/tests/data/acpi/pc/DSDT.hpbridge
index aebb29c2a4ae67b732bef3eb8e72c5665bb3a7b3..9520f3b7303a43091e8c77b64d1f76407e85f1f4 100644
GIT binary patch
delta 1131
zcmY++OG?8~07l^y`bck+Cg~$hUn#hP`mV#))R_uKXJVG%B3wdu;Y38x6*zO^M!E(;
z{sZ?;4<F}sxj!^TS={e4&#Ud<&2wnBUyoI}sp9L;-AnkL-`2~cW#zBShZ|G(t95Y~
zcwXJ}tN*b3jShBiVe-#bVhvbBtYNcbZcSKItm!arEm%veWwR4*KFk;M9mcH<Ym2pQ
zcFN7bjF@p4w+^f$*0I?cw*VH11rFmD!a}joX6M|xu&!9wVca5EBo^6h#Vv-#VzI-x
zC9p&+vDpQ;9;_$Ua~QWitS{EL*_zt`HV_*)jN1@46dT%X!!3oSVyVNpjbJ0Ok<Bi-
zWw1;va~QWVY%DgmS;1`rn}|&u#%&6licM{{<u-%O#AXiTHiyl{<~F<Hmcw$f++o}n
Ou!Yz{Ec$p#e`<d~%mMfS

delta 1284
zcmaLPJx;=K7=ZCMDNsra6bdchiIZ_cMa8jLjSd=Pb<*U|C^~otJpxy7!pV3BFX83|
zJcGgbjPJWX`Q`c9UX8sh&#t!;%d#i$-c#VEZ+9l2nflpk`4W7_r%t{zHm=EUE<DFI
zX?EpXmSZiy!;Q^#oWEXX`T70g;c<TZyvEaiTmTnjyvw-=E-ILF30#u#gtH5F70kH|
zF3Wh2vj_GR%(()t$atT#5B3$zIRFPTKHyvhR~5{;2Cm6?%DE1%E0}W#4rP4ExdCn{
zm~#`{lyS;A0!Iqw+yb{`JmcI3w-wAe2FEf!;+%jJ1#|9zJ2K8Vcfnl+bMAqAGCt<q
e2lo}sc>o^B_=NKiJXA2}5qR{6ZSxVuU-mC@|70cr

diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/pc/DSDT.ipmikcs
index a7b4760817e07cb36e13c835d04abd7bedcabe7a..59a6d5860887b511b7ce5f17d7044a08c14f0f60 100644
GIT binary patch
delta 1226
zcmZ9^O-{mK6h`3^3Y3rjQA(lw6ypMnASw>Q;!I7fjx=@+Zov&O=t_(OLtKIzaO7Gv
z=6whEPEVekYW}k@d6C~gr<PS)zL^itT<@RCVpE3Oef8z-vRk{DuS#cKJlvSNQ?Bzn
z*RtxCQ~rnQ#Xqc${NUj6^$#wN0c}DX&{mMg24MrRA>j#+O~NK%Q$ZeEge}09gi9VB
zLI==MkjFM*8?Y_mDUXKG02&2(>=1SUI})Dp=n}esu7W&zgdU(L;W>{!p%3UQ$YVel
z00t7Scnk?cz)(RRyM$f9u7npnMuZVyq#%zy!X98x!ZnXEVGI~6$YY<d57?J*!(&32
z0456ZI3OGV4kWzfaY#4>94g3TN|*ws66QRP2uFY;1$i73jseFKZh4##P5>tg@;D`&
c0!}5o;xQx405b)7oDt3dXMo}RXYyV91&d7xh5!Hn

delta 1329
zcmaLPIZnd>6aZ0MaT3R|6FZxoU815SVGCu9K?n&17%GsQGQa`oxd4T)KnVpxf<tfz
zTCTw&ru@GhJ<aDdpEyaHoad2Ym~Su6yXVBuS6Lco{^3*p;XQ;0Ryvtwc9vcoI|VzN
zCugo<6pZ{dSXupzi^r2BJz8Gh+%7KffADneA6sBc!JLcWqKwx$m%t?jb1s9+GTz{9
zgKY(Ku7E2t-sJ3n9R+i)f~zv#;_QN51#|Ymo{YCS*T6LebFPEyGM;hv!M=hy2jD=)
zJDeNfhJraa!A%*@Ik&(q1#@nL+cJ(hcfcJ5a}L3wjCVOl;7GxoyWp;j6V5$wPr;n~
k;J%FaI1j)B1#=#Phce#hJOYmt%y|qR|6wzGy$iq0Z?SP<$p8QV

diff --git a/tests/data/acpi/pc/DSDT.memhp b/tests/data/acpi/pc/DSDT.memhp
index 63fdfe8c025f8b2f19411792817cd21b506fa984..47d63dec8f997417d7512a694a4825fee874d995 100644
GIT binary patch
delta 1170
zcmY++Jx;=40Eh7s3zSlzE#<RN5>Mc_7+t{PrY2T5lTMz;fz82q1>?kG;uYL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-w
z(F1ydo&`D9fHlFI36D7XKwr?eAjdkeE?76=F~<NH2nH797y?7V(1a%(8^DHO!-5<m
zU?dosaKSMK#)7d0IW~b!!KMjMIktc;!IlL%wt;QIwh5OUJHU=$$ATQYz^-7|ge#5-
zFcC~F$gv0P3HD5Q#<36V3-&F@aR3|$4osMF90G@eLkn^o0Y`!(6RtU?z*I1`AjdIq
cEI2mdImZcbA~>-i$0=|sI2DXPpOWv=FViF<kpKVy

delta 1329
zcmaLPyH3IY7(n4R6ey*ImRrj`adJcy#gST#G0~{iNs}_7&c1+~lLM=xqYlI;aq|s)
z4KMMG|G%DmInU#dk&~p!#aUz+=I6?}_ni3cI!oisKYCq0dQah@m2ONkJ4-K5oSdD_
zl5^KEa>jBMtgZjX`O9gN9xrZg@8(wzKX^R)#}?R9Fy}ltFXK(l1#m&ZoQvS1jJG)3
zU|YeQOW=}>C!8IyqhQWua9PINoL#W1V9p-clkpDc3b>+R&Q)+###7Ed*jF&;03678
zmvaqVQ!wW`xGv)v=LWc;V9rf&Q^qmp7PzHg&LKFI@gC<094VM{8{C$0!np(PD425>
k+?DY@=N`DHV9tGTU&aTV2jGE%IS;|ZKWt|2lkm&@27uLTz5oCK

diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/pc/DSDT.roothp
index bba1612c972948911ca5f5b301b10a380b8d83b7..f9a5164e0cba7c209bd3e52020cb855e8688f682 100644
GIT binary patch
delta 1703
zcmZ|JO-{l<7{>8wDNu%%md`?glIT{$hp4zR#iB70F;-WYl%*dFuVC;9+`xDN;|<*C
zar6eZ@;)o`ZYGnN`Mv*n89WVT5C&Jm6++p1laHo6`MQb1ab(XvSI_2Qclr_bN0A=+
z!KEQYO6cQoawg`>Q!VWEBHa(K&&A(uyvF<0x3#&Q94=ljf^d3!cmJ@MFQ@V2ct~=t
zV3e{3%Ie43=>8KkE$q{Hse-6$B30f{MW$flA1D8kDb@_o(O@((8gI}^!=%ZiS+j#q
z1|~x$!y9z6Fj+EL)(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Gejo?A)OJ5
FF#zFGBxwKu

delta 142
zcmX@$yv3QzCD<ioiy{L9<G+nu8VX!a5;5_?PVoX>;*)I@>^1#3f(;GgIpQ5%f_NAh
zm>4*mf?a(Wqnn&rf(=08!J&Q(VA;tIipq@flg}wQgY{TK^)NCpL-a7<)1x`LSJ4;%
D?2jW;

-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 49/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (47 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 48/55] tests: acpi: update expected blobs Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 50/55] x86: pci: acpi: reorder Device's _ADR and _SUN fields Michael S. Tsirkin
                   ` (7 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-12-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..1983fa596b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,15 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/DSDT",
+"tests/data/acpi/pc/DSDT.acpierst",
+"tests/data/acpi/pc/DSDT.acpihmat",
+"tests/data/acpi/pc/DSDT.bridge",
+"tests/data/acpi/pc/DSDT.cphp",
+"tests/data/acpi/pc/DSDT.dimmpxm",
+"tests/data/acpi/pc/DSDT.hpbridge",
+"tests/data/acpi/pc/DSDT.ipmikcs",
+"tests/data/acpi/pc/DSDT.memhp",
+"tests/data/acpi/pc/DSDT.nohpet",
+"tests/data/acpi/pc/DSDT.numamem",
+"tests/data/acpi/pc/DSDT.roothp",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.multi-bridge",
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 50/55] x86: pci: acpi: reorder Device's _ADR and _SUN fields
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (48 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 49/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 51/55] tests: acpi: update expected blobs Michael S. Tsirkin
                   ` (6 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost

From: Igor Mammedov <imammedo@redhat.com>

no functional change, align order of fields in empty slot
descriptor with a populated slot ordering.
Expected diff:
  -                Name (_SUN, 0x0X)  // _SUN: Slot User Number
                   Name (_ADR, 0xY)  // _ADR: Address
  ...
  +                Name (_SUN, 0xX)  // _SUN: Slot User Number

that will eliminate contextual changes (causing test failures)
when follow up patches merge code generating populated and empty
slots descriptors.

Put mandatory _ADR as the 1st field, then ASUN as it can be
present for both pupulated and empty slots and only then _SUN
which is present only when slot is hotpluggable.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-13-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index eb92b05197..6342467af4 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -442,8 +442,8 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                     break;
                 }
                 dev = aml_device("S%.02X", devfn);
-                aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
                 aml_append(dev, aml_name_decl("_ADR", aml_int(adr)));
+                aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
                 aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
                 method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
                 aml_append(method,
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 51/55] tests: acpi: update expected blobs
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (49 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 50/55] x86: pci: acpi: reorder Device's _ADR and _SUN fields Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 52/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
                   ` (5 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

Expected change:
  -                Name (_SUN, 0x0X)  // _SUN: Slot User Number
                   Name (_ADR, 0xY)  // _ADR: Address
  ...
  +                Name (_SUN, 0xX)  // _SUN: Slot User Number

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-14-imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |  14 --------------
 tests/data/acpi/pc/DSDT                     | Bin 6422 -> 6422 bytes
 tests/data/acpi/pc/DSDT.acpierst            | Bin 6382 -> 6382 bytes
 tests/data/acpi/pc/DSDT.acpihmat            | Bin 7747 -> 7747 bytes
 tests/data/acpi/pc/DSDT.bridge              | Bin 9496 -> 9496 bytes
 tests/data/acpi/pc/DSDT.cphp                | Bin 6886 -> 6886 bytes
 tests/data/acpi/pc/DSDT.dimmpxm             | Bin 8076 -> 8076 bytes
 tests/data/acpi/pc/DSDT.hpbridge            | Bin 6382 -> 6382 bytes
 tests/data/acpi/pc/DSDT.ipmikcs             | Bin 6494 -> 6494 bytes
 tests/data/acpi/pc/DSDT.memhp               | Bin 7781 -> 7781 bytes
 tests/data/acpi/pc/DSDT.nohpet              | Bin 6280 -> 6280 bytes
 tests/data/acpi/pc/DSDT.numamem             | Bin 6428 -> 6428 bytes
 tests/data/acpi/pc/DSDT.roothp              | Bin 6656 -> 6656 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11449 -> 11449 bytes
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 8640 -> 8640 bytes
 15 files changed, 14 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 1983fa596b..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,15 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/pc/DSDT",
-"tests/data/acpi/pc/DSDT.acpierst",
-"tests/data/acpi/pc/DSDT.acpihmat",
-"tests/data/acpi/pc/DSDT.bridge",
-"tests/data/acpi/pc/DSDT.cphp",
-"tests/data/acpi/pc/DSDT.dimmpxm",
-"tests/data/acpi/pc/DSDT.hpbridge",
-"tests/data/acpi/pc/DSDT.ipmikcs",
-"tests/data/acpi/pc/DSDT.memhp",
-"tests/data/acpi/pc/DSDT.nohpet",
-"tests/data/acpi/pc/DSDT.numamem",
-"tests/data/acpi/pc/DSDT.roothp",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.multi-bridge",
diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT
index 8282d449ceaefd914b419f507a13f3fb7b318aaf..fd79a602a2aaac0f7d91d2ee2b1af8f2e6cdd4b3 100644
GIT binary patch
delta 758
zcmYk(y-LGi6vpvN(>6`>{pO=-zHY!lJG6Ch2&kij;v8>4a26a~os<Key#&Qwa2DLf
zo3YJ#`W~mi|CeVt$$Gw?zh-XQHYXQ$uh;LH&E?g()i>MjK@aXy9keFc02_4YHa_A2
zaX?=ZhloQeJpJYfaYQ!~O+=GEB#sfs<oSATAzE}Tae_FZH^14PVI$gnhP^pskuO&I
z4hQbAJ6orxz}W3wxXbQ#`=#tXxX12wzLM|c!+mz2UG@PyU=KP!l6?pd*+X{OE4X4;
z^sN5>rU)F-qtah5MvUoKVuF~^ex%<_5mUOCI7OV&x5NxFqdL~}8RCp?CFY1Zea8AX
s6^I3&QFLdX%9$m+WG}Z)FNyw56})1vy8W5#Yk19GZ~XB6IQ`lC1Mb_IlmGw#

delta 758
zcmYMxJ5Iw;5QX7EaT3R|uOHWsIDTz_0#YQQps)m#6d-D|0VHZ93R)`ANU2!@h#rX=
zi5{^TlIuC5{Xd^#d^d~D;x$)UdwF&44D7Bwxp0XFWOpX;gIei>&Ngg;E#f=X1||*>
zhs0lqBg7GL>C2a6#4+&=qK#-1e;`f}C&Ydra|h8OzDArPPKn=wwm-u~bma_pd&aU@
zuH_C7?umOl=cmx>_X@7WmD#Vb_u;;{Z+wma6u<-Vpm*#;cqkqkKf*qON8(ZM*lV~J
z*Zi#ipD6~%#E)A3UV@kq|01S{De-<RUuK9I@jc=UaYp=&m?P%IO(OF-;+*&vu|O<{
vKNEST60wvsN^|BZ&aB{-c(rqWN#&Vpcr9L={TcQRyb*7<e)xWz{p|e#W3`!-

diff --git a/tests/data/acpi/pc/DSDT.acpierst b/tests/data/acpi/pc/DSDT.acpierst
index 9520f3b7303a43091e8c77b64d1f76407e85f1f4..bcaebed6837b0ffafe1128e1f8c2e55d4c66679c 100644
GIT binary patch
delta 772
zcmYMx%T2>T6ouh{ocR5o_-&_vY={I2TZ@n-NFdfOfd=T}HWG;jXn+P-!Init3CMF#
ze7FCnGt$hQHmA+;F^GnK|K!bP#?0!UUmhHThM+&kIpUm-5*LUIx(NFma}&|DhVc}W
ze&TI?eKlBc3vRJnqtkb2ocA`|X1DeJM)nTeVRzVXr}JI7%kFC5%HD%}>>j)9eYnr=
zYv0K}fCucs=xQhX5FXN3JUw587|}YJVvHEmo5Tb$p-+h^VoF^)%@v}eSBXo+C4ETD
z5HpI^^iMfr&iBamJ@4e61-xJ{MyEeD{Zk1q*-O3O%f5nF>=nDbQw^`#Ywh>4Z{Q7k
e!!G+4-m<sa53=vz9eX#rI>>$nU%mfk#^pcHH={rR

delta 772
zcmXxhyG;W@6ougnT6^E`@xFImfD<f%O}fH31PMgECC~s}+(s<X01eOp5u^kbC7_+T
zC;dO2k!I$+J#SBsQ8GTiJb0Efjfbaz$ReJi(ZmJfg7}2EL|hVI#AB)FHlj_=G@obl
zPr7TbuO>&k19!xo+4(!R%-)5&;;!D`VDG^_anJazobSVZabNom`v4w@2gb1v;h}h_
zeUE(vkHn+d)gJp89ut41@_Y$mLcGZ&ridx=8)Al-5q~1)h&l0)%UmHU;#b5K;)?hK
zu|O<{QzidYB9?NGQs46q_pIQRcr`o!Dfy=wUW?ayf55(hH{y+Pyi*Hr#ar$7*mv+w
fyfcn{5AVf$?MLhf_#i&au8!ER;cI&TEv(CbKs2L3

diff --git a/tests/data/acpi/pc/DSDT.acpihmat b/tests/data/acpi/pc/DSDT.acpihmat
index 33169838bed50710495d45e0d9486ac59b4e504c..973320cb25120818a45ddb3d8e3b3211f0c00adc 100644
GIT binary patch
delta 760
zcmYMxy-LGS7{>8PlQvC1@^z9lP1;<79|frpkQ8we2gSL&SK$o^!n+9$u1*Cnp;yq+
zMQ|3p0T<1ApPqLL{C{}}=VV)N>&<1Ht(%LRp=EU}x4FH$_B!rbKj>AR7AHq*7jDCC
zcAI@^+<`mnj`oG@yYMc1w{^9UeGlHFXVnDwsEg>*x5PeTpX$WC=^=XbC~<%|pihZI
z#33D~W<Ek3(SyV>;+S@6v%e=F(dTpc`kYHSX8;e_gVt%2+53G657|S#Ka+g~kJux2
zxu+N&v&Y&S*(<nWSM0J+;0b%8eI@%8p0cN{tCj3Cct&rzxxNYFgnlLFh&f$N&6`ui
tDZNN65DWT|SR$5mUYPj|aYj!P=ZJIqD$IYX5Gy`M^?#1z_xtkW;13f0o_hcQ

delta 760
zcmXxhy-LGi6vpu*P0}<?o3A%X^U>xKsurX|KvKj>92Dp5UWGRx2xk)<T%8JDLa(5s
zi{LDH11>dh&a?i1c_`=YuHMz#t0-;m?r)rd-8PrEF42JORtJ7lXT|ApYil>)hPcuD
zTHJ)2;->Z$_7>a{w>noV?1%6n@r!DF{i8ObP5gs6LL3p-v3%(uI>b+iW5hA>7ov;k
z5-$^(PY@@>kBC#mDe*pO`gigWJ-Nfvcdl`#5BJ6W&Uu>}{XT#P;(^|uV;{mp@vwKi
zQv{F1Bkc|L3a-Re@7TxiSUlFg!9IZ};z{RfgMA85iQhAMz8T_-_zy8d%!sdZ`7%e$
uiC+;5#De%2u|zD1FAAB@5$D9uhzrC8@pmErQ-xT`9o7FGCm#>x=g|R&$ew!u

diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge
index 407066e1ac46922751969b823000e4fdfa542662..9583da4e4f558cb0bf6912733fbe8db7c1ad255f 100644
GIT binary patch
delta 1438
zcmeIyOG?8~6vpu+O`9}*B~6>8P1;zT3T;t*fQX@v3OcX|&bkFRAkGExaVEu?I}o}8
zHy}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<wnG@}{fjQ9z0jyNa&LbMTWVlS2X0&zinkLVye#P5hp#3j9DvUbs2;_FP0XL^X9
zoZ*=>PjRLX_r?9ed7WG1K7a?}f!S}d58<JBI69swf=A+!@iXjWcq|@|j(q}8#1rEh
zdj(hGYH+2oPvI%?Q6VptA!fuch&f_T{DZhcToE^=%nQVV_!+T8EQ!AnE5wR8tYlsz
p*2E8${8NM2$Q_Nj^AdNq@K(GXoX>0drw-nUcmIC;`C9)T`~k~;lsNzZ

diff --git a/tests/data/acpi/pc/DSDT.nohpet b/tests/data/acpi/pc/DSDT.nohpet
index 47e4bf62ebe742304783e76984045d7322c3a421..46827e285421d4fb38160f6c15dc9134d7da5446 100644
GIT binary patch
delta 770
zcmYMxO-{m46o%m%3Y7l;(LxJ!3osCvnAilJ=|JPeNp%Nq!5N8(i8(_PH{d`LSL4VH
zn79E4(tAGcnZ8fIruTNc*e-TYUf9%|E7veOhE-qRT-qIa_3A@35l#A$*hTEpiLamR
zA@=B5Vjr<j-x4iEi{^oz4-g0R7}PmF$wsuTru{OT?&D>7ylyPG19#Y+*6A)Z4|^Bx
zvb$=(l)VS{*gfT|xqiP7_t|}R*$41|Jy5=ueFzWPLw4Cm@Q6Ly`zn!n436nG))$o^
zCiE^bMNH{W;t+927m1!{h#9>}%n@_?l{i8i(P^sZW5hANr201%hy@>`P{-WJF-v&K
vUbapTL;ag3@Co}w?ayRCg-_Y1%FpGVX7CyNj9vB>ykf8RzWDsezK;F@Q0JT}

delta 770
zcmXxhOG?8~6vpu*P1`i@ciKF+&<t!l5e!skI#8TAiSEEHI4cN(oT1<b99VEQj@*FY
z1{~PjoNxO7<qNqtyJpwypKPzazPU6;de?5RETR$dtKAM!L)3_W5XXpP;uA-noFGn!
zpAn~sQ{rz#9Z@G<x-y?3&WIn~HdUWwAR451{WltXAFT4@O{Xh2;ikCRJKuTQu(#lr
zxTW?h>}|L$ZYy6e<^2xa5qAd1-i5p3uJR4`9^4c62FKoq`{Mq=*CFNsI3T_a<f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/acpi/q35/DSDT.multi-bridge
index df91b798f79d4564b049e8a7dbeaa5bb99abe635..e9b67e9ebe1e3b4de513b68129f719018ebeeb2f 100644
GIT binary patch
delta 41
lcmX@$e873bECsH3N0%T54#(h7zsXjL!IQr$SfUEG0RSXw4F>=K

delta 41
lcmX@$e873bECnvd;7~sXj(A6xpvhK>!IQr$SfUEG0RSX+4F>=K

-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 52/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (50 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 51/55] tests: acpi: update expected blobs Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 53/55] x86: pci: acpi: reorder Device's _DSM method Michael S. Tsirkin
                   ` (4 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-15-imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..1983fa596b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,15 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/DSDT",
+"tests/data/acpi/pc/DSDT.acpierst",
+"tests/data/acpi/pc/DSDT.acpihmat",
+"tests/data/acpi/pc/DSDT.bridge",
+"tests/data/acpi/pc/DSDT.cphp",
+"tests/data/acpi/pc/DSDT.dimmpxm",
+"tests/data/acpi/pc/DSDT.hpbridge",
+"tests/data/acpi/pc/DSDT.ipmikcs",
+"tests/data/acpi/pc/DSDT.memhp",
+"tests/data/acpi/pc/DSDT.nohpet",
+"tests/data/acpi/pc/DSDT.numamem",
+"tests/data/acpi/pc/DSDT.roothp",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.multi-bridge",
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 53/55] x86: pci: acpi: reorder Device's _DSM method
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (51 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 52/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 54/55] tests: acpi: update expected blobs Michael S. Tsirkin
                   ` (3 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Marcel Apfelbaum

From: Igor Mammedov <imammedo@redhat.com>

align _DSM method in empty slot descriptor with
a populated slot position.
Expected change:
  +            Device (SE8)
  +            {
  +                Name (_ADR, 0x001D0000)  // _ADR: Address
  +                Name (ASUN, 0x1D)
                   Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                   {
                       Local0 = Package (0x02)
                           {
                               BSEL,
                               ASUN
                           }
                       Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
                   }
  -            }

  -            Device (SE8)
  -            {
  -                Name (_ADR, 0x001D0000)  // _ADR: Address
  -                Name (ASUN, 0x1D)
                   Name (_SUN, 0x1D)  // _SUN: Slot User Number
                   Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device
                   {
                       PCEJ (BSEL, _SUN)
                   }
  +            }

i.e. put _DSM right after ASUN, with _SUN/_EJ0 following it.

that will eliminate contextual changes (causing test failures)
when follow up patches merge code generating populated and empty
slots descriptors.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-16-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 6342467af4..fc23cb08c3 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -444,15 +444,13 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                 dev = aml_device("S%.02X", devfn);
                 aml_append(dev, aml_name_decl("_ADR", aml_int(adr)));
                 aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
+                aml_append(dev, aml_pci_device_dsm());
                 aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
                 method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
                 aml_append(method,
                     aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
                 );
                 aml_append(dev, method);
-
-                aml_append(dev, aml_pci_device_dsm());
-
                 aml_append(parent_scope, dev);
 
                 build_append_pcihp_notify_entry(notify_method, slot);
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 54/55] tests: acpi: update expected blobs
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (52 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 53/55] x86: pci: acpi: reorder Device's _DSM method Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-10 17:32 ` [PULL 55/55] x86: pci: acpi: consolidate PCI slots creation Michael S. Tsirkin
                   ` (2 subsequent siblings)
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov, Ani Sinha

From: Igor Mammedov <imammedo@redhat.com>

    Expected change:
      +            Device (SE8)
      +            {
      +                Name (_ADR, 0x001D0000)  // _ADR: Address
      +                Name (ASUN, 0x1D)
                       Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                       {
                           Local0 = Package (0x02)
                               {
                                   BSEL,
                                   ASUN
                               }
                           Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
                       }
      -            }

      -            Device (SE8)
      -            {
      -                Name (_ADR, 0x001D0000)  // _ADR: Address
      -                Name (ASUN, 0x1D)
                       Name (_SUN, 0x1D)  // _SUN: Slot User Number
                       Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device
                       {
                           PCEJ (BSEL, _SUN)
                       }
      +            }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-17-imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |  14 --------------
 tests/data/acpi/pc/DSDT                     | Bin 6422 -> 6422 bytes
 tests/data/acpi/pc/DSDT.acpierst            | Bin 6382 -> 6382 bytes
 tests/data/acpi/pc/DSDT.acpihmat            | Bin 7747 -> 7747 bytes
 tests/data/acpi/pc/DSDT.bridge              | Bin 9496 -> 9496 bytes
 tests/data/acpi/pc/DSDT.cphp                | Bin 6886 -> 6886 bytes
 tests/data/acpi/pc/DSDT.dimmpxm             | Bin 8076 -> 8076 bytes
 tests/data/acpi/pc/DSDT.hpbridge            | Bin 6382 -> 6382 bytes
 tests/data/acpi/pc/DSDT.ipmikcs             | Bin 6494 -> 6494 bytes
 tests/data/acpi/pc/DSDT.memhp               | Bin 7781 -> 7781 bytes
 tests/data/acpi/pc/DSDT.nohpet              | Bin 6280 -> 6280 bytes
 tests/data/acpi/pc/DSDT.numamem             | Bin 6428 -> 6428 bytes
 tests/data/acpi/pc/DSDT.roothp              | Bin 6656 -> 6656 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11449 -> 11449 bytes
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 8640 -> 8640 bytes
 15 files changed, 14 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 1983fa596b..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,15 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/pc/DSDT",
-"tests/data/acpi/pc/DSDT.acpierst",
-"tests/data/acpi/pc/DSDT.acpihmat",
-"tests/data/acpi/pc/DSDT.bridge",
-"tests/data/acpi/pc/DSDT.cphp",
-"tests/data/acpi/pc/DSDT.dimmpxm",
-"tests/data/acpi/pc/DSDT.hpbridge",
-"tests/data/acpi/pc/DSDT.ipmikcs",
-"tests/data/acpi/pc/DSDT.memhp",
-"tests/data/acpi/pc/DSDT.nohpet",
-"tests/data/acpi/pc/DSDT.numamem",
-"tests/data/acpi/pc/DSDT.roothp",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.multi-bridge",
diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT
index fd79a602a2aaac0f7d91d2ee2b1af8f2e6cdd4b3..da2a3e5c0551ac2d1d8a0a40b92d3235d5757475 100644
GIT binary patch
delta 864
zcmY+?y-LGS90l-*wn@``wE1k(q;(Y(B-P?1MB7!t;^Yv006|wlL088>7hl5SE;tLi
z3i=2>gx-Ho@=w;o@1A=($vl}S&l^U*um-Y{%}$Th)%@PD^9v&oS$<=L!P&#{+AP`2
zlq{W`Xp+>BlvKzDiT6T`woB23Xp)Fbbd0z|hLA~I7Gj4x6bOaHYbm&+1<@j5c5urs
zcc>65iStr$M;oF|Vo``OcW4lr5ZFi)8!dMkbC(XOSENpBK6YtMoHi)?sbwZ*TUOO|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pi/pc/DSDT.nohpet b/tests/data/acpi/pc/DSDT.nohpet
index 46827e285421d4fb38160f6c15dc9134d7da5446..b413d9f31d483eca02f45ad09af2f556581ec381 100644
GIT binary patch
delta 842
zcmY+>PfEi;6bA4JX_F>R+cbaLBwDY~Y74p$jLp^x7B?0Qu02IvbtOoag?a#86x@0c
zcV0ly11M;|yyVSnKYsJgym_n9YP4Nj+0q_lYby*E_ZRB?V3_J@oLn{)MOE~8el;^x
zh|fwKRiZ|s2657&jzjLKlc+;HRDwG+5*oxuDaPEPlh7fCZMtR59Ssr<h-E1z++mO~
za-r#IK9`Z*cAaAC33r(!O+lKu%od$M$ePGrq|8G0D`hQYGg~~{M)o9S9c159W+RKc
zIGbH}Y4T%!twXPMF!^&SVxHV3;X?dWf;&7C9>lprx14c@Pr`@TRDwHtBzh2ErI>O@
zpF|(x)TLXd+!2r{rhP0$!W|)rFz=u(hWQ^ATTHksA{hxX!f)Pr;wE;Hy-C>~GRqg;
R0NIU{?f+-)>(+nY`2!^e#-IQI

delta 839
zcmY+>Pfo%>6bA4b3oV8IW7<NCqDK(LM3<vo*C=t-gdTuX=!&&(>4FQ8K;o8*cndB-
zLZENnn{L1S=9`)KmXqaV`|DbEHTx`_O9(vyU;a2Pzu(N+{as~OGXLlqhH2RHBusF;
zOcPHeS}0mj>f(Vr+9=wvZV2wMP*`x##gsd26gCvT_KqocbWn6)rHe=Ia8Nj~ZwT(_
zqUeGQ&bL4rq&TCVnh~rib16Ge=22FJ>a0)Min4&RJ!K(fvaineRd##c%`?AN;A=&_
zMA3wjKOP~BY8WY4Z(DL>j4+0U(5C#tRSAj&b`8ND0~7;rBdz0=JBBERFmDL%NKvG)
x(M8T38H(&D)-K7pVuWA>@3nwMtVVjJ1^_$Ct|@a9<;IlFDZ5eG-zNFLI09ThzxDtC

diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/pc/DSDT.numamem
index ebdccc880def932fcba0cef8a7cf47ff7cc67f53..9e701b2983f9ec45af9c26d801545c2b5d112a10 100644
GIT binary patch
delta 800
zcmY+>O-_SA7{>9MP{0<;H%P1P5o+i{Tq#ZC%CFeCGKQ-dPoQC2P2ASRXk2=V?%a9-
zJ%A>fd3fQS+5Yq6VHg(aB7GV6%9S%L$Gv`Xd2_1G)1AUB^4Yo7YH2MqpI@AGG>Gd)
zWQ}N(XhW=OG2soJgf4_(7Gh5?UtPa?+l03al7=J=A<HK_k(!D2tF(2rV@Gx!v<Ibi
z(Y}>tp&hvLvm0o4RV$Y+-OVna)~3_i`0}4xWc=k02?yfHqm7I=ToNwCeJ%EQ!z1BA
zd^LhMd=fsyzE5w-c_SbZK-@NhH$oC2#Ahw0yb+OzgrL6|i94$P;*_^ylCdOX+~#{A
z-|!}y70N9^yHZ*o?OAC9v_GY7p`AtY-Zt8!(uSf{r#|FUkLc7R+(0)Tyv^c|wSNky
B%^&~(

delta 790
zcmY+B&rZTX5Ql40Xu;a;|5{Y)8)(YGa-(Rxp+w@zklwxd3cdlED<R=*LP$LF6drvF
zUcdx`J3F&nzkK_f-_Fd7d9l86VdQq;$L(fspU>u`xUKEFdU$aR!!+z_^7_;^VR2-X
zWHiudz*aYUoY6$12?L=`>2ZdIh6OWez?aA@yFN^|;UfqS-QbT{i`d9hUYpp0*eS6s
zF^AZ|S8vaV&4{^*UH|Xoj@t@sD`Y{TM7g|@KklLE!F!;6yyPe!4IehT(dUc+jR2fb
z%jk1Ph(-ug-KaPtLL-9Jk--@;8Zqp2W5^i^8VQUet;divQZ!OnN&_~LTJX8r5je48
t8L=s`4zU%n3t~HBm&C@2%DW=AB-T|-9`TXe=GZouN6eM@eV_iG>;Xco#{2*P

diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/pc/DSDT.roothp
index f9aacee095bbb62251fc8231532f0d6e9f555a58..8c3956c9ecc63133cc800f1d2d07a1392a35d548 100644
GIT binary patch
delta 937
zcmY+>O-{l<7{+lv3X}>h^pjRaFJJ<QiNt79WoN`h;)(@l-~tBOlIW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Ai4zeSHA)<a1Mvnl&KgZzb?Y^_IGH#x
z=>=%?0`Ok6Pv7?KS^xQ+rzfZ5;duD^-0)9Yc19iz&W<F1+bR2#MupQ9(t5KRq%4$@
zLc0~(G}@QY(r9)od3FZvN@y9h520nzbO&dB*D<Q+569`jjyIA=-QKAxNjXXG{@+>2
z1vm3=BC)#_3x$LN@fi!=$dkxJSWEPkJ>F1Bs1TR2;Ee)_0>pbHI=oRNQH0Qz=_?)H
zD3K^ZTtvd-4UL2r2>K6N@J8Xgc)X>P)Du$2YwoWk|HLfXlhDd&ze1Zs+gweaokzPD
z+5*~-&=%2}?c~`?(860E@U5$K>+pX+w&{&}`~n6E18+2m1#g%nOo)v&+BoEm8i^Xj
lT`YLRB4I&%N21RgHVGS|;nG+7yiq4nhq!jlw->jR`UCcd%hdn?

delta 891
zcmY+By-LGS6o6x`ZIY%xvHmnkleX4Wtxz1)779W!b`caT9g0KI7w`pyf^)&)tga4j
zf>SqNK<ES57Z4nL12sAKoSXIIJKsI`-q~n2dVQ{@)bU_=p}<eQ2sge5pVd-?mI&?F
ztaNDU31auemWh23OA_<8#Ow;OJ7Otf@5Iu?%(|FW1*={^TqXyHov}LZ1y_cmXo}kV
z+h5nB1vMdBp?GvaqK={tUv>Ncrf6^~gGL6r+mdn24Fe4WrZIyXSv0b+kc~Dsa%kkB
z<x8iuxsgXB4-?twaHD`m0p>A-8zvei)EeO_&~1pvTorEwQ({G83u0@;T03HPo!Erf
z2C+G@O=7iOF<TNW`ovS-*1~PA=o78D81Thy6zxc~g&6&1z(of|2hR7TS3cuZ8I3YL
n#SCt^Xt?k#8+~qgXn1haluqe$qk={S9-9u_`tI9Hvyk`&Hv`}D

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index e9b67e9ebe1e3b4de513b68129f719018ebeeb2f..88bf47ab1805e4ef1dd8039933c5aa8144da37ac 100644
GIT binary patch
delta 35
icmX@$e873bQiaL;6yzpbD@skis}P68mYUqFXbb=f{tdVQ

delta 79
zcmX@$e873bQUytl_~1}K1`(lnS1$v`0B2V(r(jnfkl18vMY+j$6ygc0ke=MDXbb?Y
Cnio<4

-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [PULL 55/55] x86: pci: acpi: consolidate PCI slots creation
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (53 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 54/55] tests: acpi: update expected blobs Michael S. Tsirkin
@ 2022-10-10 17:32 ` Michael S. Tsirkin
  2022-10-12 20:04 ` [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Stefan Hajnoczi
  2022-10-12 21:25 ` Stefan Hajnoczi
  56 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-10 17:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Igor Mammedov, Ani Sinha, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Marcel Apfelbaum

From: Igor Mammedov <imammedo@redhat.com>

No functional changes nor AML bytecode changes.
Consolidate code that generates empty and populated slot
descriptors. Besides eliminating duplication,
it helps consolidate conditions for generating
parts of Device{} desriptor in one place, which makes
code more compact and easier to read.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-18-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 111 +++++++++++++++++++++----------------------
 1 file changed, 54 insertions(+), 57 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index fc23cb08c3..4f54b61904 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -427,13 +427,41 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
         int func = PCI_FUNC(devfn);
         /* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */
         int adr = slot << 16 | func;
-        bool hotplug_enabled_dev;
-        bool bridge_in_acpi;
-        bool cold_plugged_bridge;
+        bool hotpluggbale_slot = false;
+        bool bridge_in_acpi = false;
+        bool cold_plugged_bridge = false;
+        bool is_vga = false;
+
+        if (pdev) {
+            pc = PCI_DEVICE_GET_CLASS(pdev);
+            dc = DEVICE_GET_CLASS(pdev);
+
+            if (pc->class_id == PCI_CLASS_BRIDGE_ISA) {
+                continue;
+            }
+
+            is_vga = pc->class_id == PCI_CLASS_DISPLAY_VGA;
 
-        if (!pdev) {
             /*
-             * add hotplug slots for non present devices.
+             * Cold plugged bridges aren't themselves hot-pluggable.
+             * Hotplugged bridges *are* hot-pluggable.
+             */
+            cold_plugged_bridge = pc->is_bridge && !DEVICE(pdev)->hotplugged;
+            bridge_in_acpi =  cold_plugged_bridge && pcihp_bridge_en;
+
+            hotpluggbale_slot = bsel && dc->hotpluggable &&
+                                !cold_plugged_bridge;
+
+            /*
+             * allow describing coldplugged bridges in ACPI even if they are not
+             * on function 0, as they are not unpluggable, for all other devices
+             * generate description only for function 0 per slot
+             */
+            if (func && !bridge_in_acpi) {
+                continue;
+            }
+        } else {
+            /*
              * hotplug is supported only for non-multifunction device
              * so generate device description only for function 0
              */
@@ -441,46 +469,11 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                 if (pci_bus_is_express(bus) && slot > 0) {
                     break;
                 }
-                dev = aml_device("S%.02X", devfn);
-                aml_append(dev, aml_name_decl("_ADR", aml_int(adr)));
-                aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
-                aml_append(dev, aml_pci_device_dsm());
-                aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
-                method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
-                aml_append(method,
-                    aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
-                );
-                aml_append(dev, method);
-                aml_append(parent_scope, dev);
-
-                build_append_pcihp_notify_entry(notify_method, slot);
+                /* mark it as empty hotpluggable slot */
+                hotpluggbale_slot = true;
+            } else {
+                continue;
             }
-            continue;
-        }
-
-        pc = PCI_DEVICE_GET_CLASS(pdev);
-        dc = DEVICE_GET_CLASS(pdev);
-
-        /*
-         * Cold plugged bridges aren't themselves hot-pluggable.
-         * Hotplugged bridges *are* hot-pluggable.
-         */
-        cold_plugged_bridge = pc->is_bridge && !DEVICE(pdev)->hotplugged;
-        bridge_in_acpi =  cold_plugged_bridge && pcihp_bridge_en;
-
-        hotplug_enabled_dev = bsel && dc->hotpluggable && !cold_plugged_bridge;
-
-        if (pc->class_id == PCI_CLASS_BRIDGE_ISA) {
-            continue;
-        }
-
-        /*
-         * allow describing coldplugged bridges in ACPI even if they are not
-         * on function 0, as they are not unpluggable, for all other devices
-         * generate description only for function 0 per slot
-         */
-        if (func && !bridge_in_acpi) {
-            continue;
         }
 
         /* start to compose PCI device descriptor */
@@ -496,7 +489,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
             aml_append(dev, aml_pci_device_dsm());
         }
 
-        if (pc->class_id == PCI_CLASS_DISPLAY_VGA) {
+        if (is_vga) {
             /* add VGA specific AML methods */
             int s3d;
 
@@ -517,19 +510,10 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
             method = aml_method("_S3D", 0, AML_NOTSERIALIZED);
             aml_append(method, aml_return(aml_int(s3d)));
             aml_append(dev, method);
-        } else if (hotplug_enabled_dev) {
-            aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
-            /* add _EJ0 to make slot hotpluggable  */
-            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
-            aml_append(method,
-                aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
-            );
-            aml_append(dev, method);
+        }
 
-            if (bsel) {
-                build_append_pcihp_notify_entry(notify_method, slot);
-            }
-        } else if (bridge_in_acpi) {
+        bridge_in_acpi =  cold_plugged_bridge && pcihp_bridge_en;
+        if (bridge_in_acpi) {
             /*
              * device is coldplugged bridge,
              * add child device descriptions into its scope
@@ -538,6 +522,19 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
 
             build_append_pci_bus_devices(dev, sec_bus, pcihp_bridge_en);
         }
+
+        if (hotpluggbale_slot) {
+            aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
+            /* add _EJ0 to make slot hotpluggable  */
+            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
+            aml_append(method,
+                aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
+            );
+            aml_append(dev, method);
+
+            build_append_pcihp_notify_entry(notify_method, slot);
+        }
+
         /* device descriptor has been composed, add it into parent context */
         aml_append(parent_scope, dev);
     }
-- 
MST



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* Re: [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks"
  2022-10-10 17:30 ` [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks" Michael S. Tsirkin
@ 2022-10-10 17:39   ` David Woodhouse
  2022-10-10 19:08     ` Peter Xu
  0 siblings, 1 reply; 82+ messages in thread
From: David Woodhouse @ 2022-10-10 17:39 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Peter Xu, Claudio Fontana, Igor Mammedov,
	Jason Wang, Marcel Apfelbaum, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

On Mon, 2022-10-10 at 13:30 -0400, Michael S. Tsirkin wrote:
> From: Peter Xu <
> peterx@redhat.com
> >
> 
> It's true that when vcpus<=255 we don't require the length of 32bit APIC
> IDs.  However here since we already have EIM=ON it means the hypervisor
> will declare the VM as x2apic supported (e.g. VT-d ECAP register will have
> EIM bit 4 set), so the guest should assume the APIC IDs are 32bits width
> even if vcpus<=255.  In short, commit 77250171bdc breaks any simple cmdline
> that wants to boot a VM with >=9 but <=255 vcpus with:

I find that paragraph really hard to parse. What does it even mean that
"guest should assume the APIC IDs are 32bits"? 

In practice, all the EIM bit does is *allow* 32 bits of APIC ID in the
tables. Which is perfectly fine if there are only 254 CPUs anyway, and
we never need to use a higher value.

I *think* the actual problem here is when logical addressing is used,
which puts the APIC cluster ID into higher bits? But it's kind of weird
that the message doesn't mention that at all?

That's fixable by just setting the X2APIC_PHYSICAL bit in the ACPI
FADT, isn't it? Then the only values that a guest may put into those
fields — 32-bit fields or not — are lower than 0xff anyway.


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks"
  2022-10-10 17:39   ` David Woodhouse
@ 2022-10-10 19:08     ` Peter Xu
  2022-10-10 23:16       ` David Woodhouse
  0 siblings, 1 reply; 82+ messages in thread
From: Peter Xu @ 2022-10-10 19:08 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell, Claudio Fontana,
	Igor Mammedov, Jason Wang, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

On Mon, Oct 10, 2022 at 10:39:52AM -0700, David Woodhouse wrote:
> On Mon, 2022-10-10 at 13:30 -0400, Michael S. Tsirkin wrote:
> > From: Peter Xu <
> > peterx@redhat.com
> > >
> > 
> > It's true that when vcpus<=255 we don't require the length of 32bit APIC
> > IDs.  However here since we already have EIM=ON it means the hypervisor
> > will declare the VM as x2apic supported (e.g. VT-d ECAP register will have
> > EIM bit 4 set), so the guest should assume the APIC IDs are 32bits width
> > even if vcpus<=255.  In short, commit 77250171bdc breaks any simple cmdline
> > that wants to boot a VM with >=9 but <=255 vcpus with:
> 
> I find that paragraph really hard to parse. What does it even mean that
> "guest should assume the APIC IDs are 32bits"? 

Quotting EIM definition:

 0: On Intel® 64 platforms, hardware supports only 8-bit APIC-IDs (xAPIC
    Mode).

 1: On Intel® 64 platforms, hardware supports 32-bit APIC- IDs (x2APIC
    mode).  Hardware implementation reporting Interrupt Remapping support
    (IR) field as Clear also report this field as Clear.

I hope the statement was matching the spec.  Please let me know if you have
better way to reword it.

> 
> In practice, all the EIM bit does is *allow* 32 bits of APIC ID in the
> tables. Which is perfectly fine if there are only 254 CPUs anyway, and
> we never need to use a higher value.
> 
> I *think* the actual problem here is when logical addressing is used,
> which puts the APIC cluster ID into higher bits? But it's kind of weird
> that the message doesn't mention that at all?

The commit message actually doesn't even need to contain a lot of
information in this case, IMO.

Literally it can be seen as a revert of a commit which breaks guest with
>8vcpu from boot.  I kept the other lines because that still make sense, or
it can be a full revert with "something broke with commit xxx, revert it to
fix" and anything else could be reworked.  AFAICT that's how it normally
works with QEMU or Linux.

I am not 100% familiar with the original purpose of the patch, would
eim=off work for you even after patch applied?  Anything severely wrong
with this patch?

> 
> That's fixable by just setting the X2APIC_PHYSICAL bit in the ACPI
> FADT, isn't it? Then the only values that a guest may put into those
> fields — 32-bit fields or not — are lower than 0xff anyway.

It's still not clear to me why we need to make it inconsistent between the
EIM we declare to the guest and the KVM behavior on understanding EIM bit.
Even if enforced physical mode will work we loose the possibility of
cluster mode, and I also don't see what's the major benefit since EIM=off
will just work, afaiu, meanwhile make everything aligned.

Are you fine if we proceed with this pull request first and revisit later?
Follow up patches will always be fine, and we're unbreaking something.  I
have copied you since the 1st patch I posted and the small patch was there
for weeks, it'll be appreciated if either you could comment earlier next
time, or even propose a better fix then we can discuss what's the best way
to fix.  Thanks.

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks"
  2022-10-10 19:08     ` Peter Xu
@ 2022-10-10 23:16       ` David Woodhouse
  2022-10-11  0:04         ` Peter Xu
  0 siblings, 1 reply; 82+ messages in thread
From: David Woodhouse @ 2022-10-10 23:16 UTC (permalink / raw)
  To: Peter Xu
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell, Claudio Fontana,
	Igor Mammedov, Jason Wang, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

[-- Attachment #1: Type: text/plain, Size: 3973 bytes --]

On Mon, 2022-10-10 at 15:08 -0400, Peter Xu wrote:
> On Mon, Oct 10, 2022 at 10:39:52AM -0700, David Woodhouse wrote:
> > On Mon, 2022-10-10 at 13:30 -0400, Michael S. Tsirkin wrote:
> > > From: Peter Xu <
> > > peterx@redhat.com
> > > 
> > > 
> > > It's true that when vcpus<=255 we don't require the length of 32bit APIC
> > > IDs.  However here since we already have EIM=ON it means the hypervisor
> > > will declare the VM as x2apic supported (e.g. VT-d ECAP register will have
> > > EIM bit 4 set), so the guest should assume the APIC IDs are 32bits width
> > > even if vcpus<=255.  In short, commit 77250171bdc breaks any simple cmdline
> > > that wants to boot a VM with >=9 but <=255 vcpus with:
> > 
> > I find that paragraph really hard to parse. What does it even mean that
> > "guest should assume the APIC IDs are 32bits"? 
> 
> Quotting EIM definition:
> 
>  0: On Intel® 64 platforms, hardware supports only 8-bit APIC-IDs (xAPIC
>     Mode).
> 
>  1: On Intel® 64 platforms, hardware supports 32-bit APIC- IDs (x2APIC
>     mode).  Hardware implementation reporting Interrupt Remapping support
>     (IR) field as Clear also report this field as Clear.
> 
> I hope the statement was matching the spec.  Please let me know if you have
> better way to reword it.

It needs to mention logical mode addressing. Because that, I presume,
is why it broke only when you had more than 8 vCPUs. Because that's
when the *logical* destination ID grew past 0xFF.

> > In practice, all the EIM bit does is *allow* 32 bits of APIC ID in the
> > tables. Which is perfectly fine if there are only 254 CPUs anyway, and
> > we never need to use a higher value.
> > 
> > I *think* the actual problem here is when logical addressing is used,
> > which puts the APIC cluster ID into higher bits? But it's kind of weird
> > that the message doesn't mention that at all?
> 
> The commit message actually doesn't even need to contain a lot of
> information in this case, IMO.

Well, it would be kind of useful if it said what the actual problem
was, no?

> Literally it can be seen as a revert of a commit which breaks guest with
> > 8vcpu from boot.  I kept the other lines because that still make sense, or
> 
> it can be a full revert with "something broke with commit xxx, revert it to
> fix" and anything else could be reworked.  AFAICT that's how it normally
> works with QEMU or Linux.
> 
> I am not 100% familiar with the original purpose of the patch, would
> eim=off work for you even after patch applied?  Anything severely wrong
> with this patch?

I think the patch itself is fine; I'd just like the commit message to
be clearer about what the problem was.

> > That's fixable by just setting the X2APIC_PHYSICAL bit in the ACPI
> > FADT, isn't it? Then the only values that a guest may put into those
> > fields — 32-bit fields or not — are lower than 0xff anyway.
> 
> It's still not clear to me why we need to make it inconsistent between the
> EIM we declare to the guest and the KVM behavior on understanding EIM bit.
> Even if enforced physical mode will work we loose the possibility of
> cluster mode, and I also don't see what's the major benefit since EIM=off
> will just work, afaiu, meanwhile make everything aligned.

Yeah, I think turning EIM off is absolutely fine.

> Are you fine if we proceed with this pull request first and revisit later?
> Follow up patches will always be fine, and we're unbreaking something.  I
> have copied you since the 1st patch I posted and the small patch was there
> for weeks, it'll be appreciated if either you could comment earlier next
> time, or even propose a better fix then we can discuss what's the best way
> to fix.  Thanks.

Yeah, sorry for the delay. But that was partly because the commit
message was confusing me and it took me a while to work out what was
actually going on... which is really all I'm heckling now.


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks"
  2022-10-10 23:16       ` David Woodhouse
@ 2022-10-11  0:04         ` Peter Xu
  0 siblings, 0 replies; 82+ messages in thread
From: Peter Xu @ 2022-10-11  0:04 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell, Claudio Fontana,
	Igor Mammedov, Jason Wang, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

On Mon, Oct 10, 2022 at 04:16:33PM -0700, David Woodhouse wrote:
> On Mon, 2022-10-10 at 15:08 -0400, Peter Xu wrote:
> > On Mon, Oct 10, 2022 at 10:39:52AM -0700, David Woodhouse wrote:
> > > On Mon, 2022-10-10 at 13:30 -0400, Michael S. Tsirkin wrote:
> > > > From: Peter Xu <
> > > > peterx@redhat.com
> > > > 
> > > > 
> > > > It's true that when vcpus<=255 we don't require the length of 32bit APIC
> > > > IDs.  However here since we already have EIM=ON it means the hypervisor
> > > > will declare the VM as x2apic supported (e.g. VT-d ECAP register will have
> > > > EIM bit 4 set), so the guest should assume the APIC IDs are 32bits width
> > > > even if vcpus<=255.  In short, commit 77250171bdc breaks any simple cmdline
> > > > that wants to boot a VM with >=9 but <=255 vcpus with:
> > > 
> > > I find that paragraph really hard to parse. What does it even mean that
> > > "guest should assume the APIC IDs are 32bits"? 
> > 
> > Quotting EIM definition:
> > 
> >  0: On Intel® 64 platforms, hardware supports only 8-bit APIC-IDs (xAPIC
> >     Mode).
> > 
> >  1: On Intel® 64 platforms, hardware supports 32-bit APIC- IDs (x2APIC
> >     mode).  Hardware implementation reporting Interrupt Remapping support
> >     (IR) field as Clear also report this field as Clear.
> > 
> > I hope the statement was matching the spec.  Please let me know if you have
> > better way to reword it.
> 
> It needs to mention logical mode addressing. Because that, I presume,
> is why it broke only when you had more than 8 vCPUs. Because that's
> when the *logical* destination ID grew past 0xFF.

Agree.

> 
> > > In practice, all the EIM bit does is *allow* 32 bits of APIC ID in the
> > > tables. Which is perfectly fine if there are only 254 CPUs anyway, and
> > > we never need to use a higher value.
> > > 
> > > I *think* the actual problem here is when logical addressing is used,
> > > which puts the APIC cluster ID into higher bits? But it's kind of weird
> > > that the message doesn't mention that at all?
> > 
> > The commit message actually doesn't even need to contain a lot of
> > information in this case, IMO.
> 
> Well, it would be kind of useful if it said what the actual problem
> was, no?

Yes it'll be nice to have.

> 
> > Literally it can be seen as a revert of a commit which breaks guest with
> > > 8vcpu from boot.  I kept the other lines because that still make sense, or
> > 
> > it can be a full revert with "something broke with commit xxx, revert it to
> > fix" and anything else could be reworked.  AFAICT that's how it normally
> > works with QEMU or Linux.
> > 
> > I am not 100% familiar with the original purpose of the patch, would
> > eim=off work for you even after patch applied?  Anything severely wrong
> > with this patch?
> 
> I think the patch itself is fine; I'd just like the commit message to
> be clearer about what the problem was.

Thanks for confirming.

> 
> > > That's fixable by just setting the X2APIC_PHYSICAL bit in the ACPI
> > > FADT, isn't it? Then the only values that a guest may put into those
> > > fields — 32-bit fields or not — are lower than 0xff anyway.
> > 
> > It's still not clear to me why we need to make it inconsistent between the
> > EIM we declare to the guest and the KVM behavior on understanding EIM bit.
> > Even if enforced physical mode will work we loose the possibility of
> > cluster mode, and I also don't see what's the major benefit since EIM=off
> > will just work, afaiu, meanwhile make everything aligned.
> 
> Yeah, I think turning EIM off is absolutely fine.
> 
> > Are you fine if we proceed with this pull request first and revisit later?
> > Follow up patches will always be fine, and we're unbreaking something.  I
> > have copied you since the 1st patch I posted and the small patch was there
> > for weeks, it'll be appreciated if either you could comment earlier next
> > time, or even propose a better fix then we can discuss what's the best way
> > to fix.  Thanks.
> 
> Yeah, sorry for the delay. But that was partly because the commit
> message was confusing me and it took me a while to work out what was
> actually going on... which is really all I'm heckling now.

I see, that was totally fine, and it'll be definitely also fine to comment
anything even on the pull req.  It's just that as I tried to argue for this
specific case IMHO we should move on and revisit later so we shrink the
regression window, rather than redo a pull and let this fix wait for
another one.  It seems we reached a consensus on this, thanks for that.

In all cases (irrelevant of the pull req), feel free to post any patch
either based on this one or as replacement.  I'll be happy to read and
rethink.  So far it still doesn't make sense to me to not enable kvm x2apic
with eim=on, but maybe I'm wrong, and I'd be happy to be corrected in that
case.

Thanks,

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 00/55] pc,virtio: features, tests, fixes, cleanups
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (54 preceding siblings ...)
  2022-10-10 17:32 ` [PULL 55/55] x86: pci: acpi: consolidate PCI slots creation Michael S. Tsirkin
@ 2022-10-12 20:04 ` Stefan Hajnoczi
  2022-10-12 20:59   ` Michael S. Tsirkin
  2022-10-12 21:25 ` Stefan Hajnoczi
  56 siblings, 1 reply; 82+ messages in thread
From: Stefan Hajnoczi @ 2022-10-12 20:04 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, Peter Maydell

On Mon, 10 Oct 2022 at 13:46, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> The following changes since commit f1d33f55c47dfdaf8daacd618588ad3ae4c452d1:
>
>   Merge tag 'pull-testing-gdbstub-plugins-gitdm-061022-3' of https://github.com/stsquad/qemu into staging (2022-10-06 07:11:56 -0400)
>
> are available in the Git repository at:
>
>   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

Hi Michael,
Please update your .git/config with the https URL for future pull requests:

  https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git

The pull request is signed with your GPG, so modifications should be
detected when verifying the signature. It still seems like a good idea
to use https:// when possible instead of unencrypted git://.

Stefan


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 00/55] pc,virtio: features, tests, fixes, cleanups
  2022-10-12 20:04 ` [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Stefan Hajnoczi
@ 2022-10-12 20:59   ` Michael S. Tsirkin
  2022-10-12 21:01     ` Stefan Hajnoczi
  0 siblings, 1 reply; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-10-12 20:59 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, Peter Maydell

On Wed, Oct 12, 2022 at 04:04:31PM -0400, Stefan Hajnoczi wrote:
> On Mon, 10 Oct 2022 at 13:46, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > The following changes since commit f1d33f55c47dfdaf8daacd618588ad3ae4c452d1:
> >
> >   Merge tag 'pull-testing-gdbstub-plugins-gitdm-061022-3' of https://github.com/stsquad/qemu into staging (2022-10-06 07:11:56 -0400)
> >
> > are available in the Git repository at:
> >
> >   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> 
> Hi Michael,
> Please update your .git/config with the https URL for future pull requests:
> 
>   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git
> 
> The pull request is signed with your GPG, so modifications should be
> detected when verifying the signature. It still seems like a good idea
> to use https:// when possible instead of unencrypted git://.
> 
> Stefan

I don't think this is from .git/config, this is just a parameter
to request-pull. OK, I will switch to that.

-- 
MST



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 00/55] pc,virtio: features, tests, fixes, cleanups
  2022-10-12 20:59   ` Michael S. Tsirkin
@ 2022-10-12 21:01     ` Stefan Hajnoczi
  0 siblings, 0 replies; 82+ messages in thread
From: Stefan Hajnoczi @ 2022-10-12 21:01 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, Peter Maydell

On Wed, 12 Oct 2022 at 17:00, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Wed, Oct 12, 2022 at 04:04:31PM -0400, Stefan Hajnoczi wrote:
> > On Mon, 10 Oct 2022 at 13:46, Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > The following changes since commit f1d33f55c47dfdaf8daacd618588ad3ae4c452d1:
> > >
> > >   Merge tag 'pull-testing-gdbstub-plugins-gitdm-061022-3' of https://github.com/stsquad/qemu into staging (2022-10-06 07:11:56 -0400)
> > >
> > > are available in the Git repository at:
> > >
> > >   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> >
> > Hi Michael,
> > Please update your .git/config with the https URL for future pull requests:
> >
> >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git
> >
> > The pull request is signed with your GPG, so modifications should be
> > detected when verifying the signature. It still seems like a good idea
> > to use https:// when possible instead of unencrypted git://.
> >
> > Stefan
>
> I don't think this is from .git/config, this is just a parameter
> to request-pull. OK, I will switch to that.

You're right. For some reason I thought the URL was pulled from the
remote's configuration in .git/config.

Stefan


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 00/55] pc,virtio: features, tests, fixes, cleanups
  2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
                   ` (55 preceding siblings ...)
  2022-10-12 20:04 ` [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Stefan Hajnoczi
@ 2022-10-12 21:25 ` Stefan Hajnoczi
  56 siblings, 0 replies; 82+ messages in thread
From: Stefan Hajnoczi @ 2022-10-12 21:25 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
  2022-10-10 17:29   ` [Virtio-fs] " Michael S. Tsirkin
@ 2022-10-14  7:30     ` Christian Borntraeger
  -1 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14  7:30 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs

Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
> From: Alex Bennée <alex.bennee@linaro.org>
> 
> All the boilerplate virtio code does the same thing (or should at
> least) of checking to see if the VM is running before attempting to
> start VirtIO. Push the logic up to the common function to avoid
> getting a copy and paste wrong.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

This results in a regression for our s390x CI when doing save/restore of guests with vsock:


                 #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
                 #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
                 #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
                 #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
                 #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
                 #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
                 #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
                 #8  0x000002aa2d570ba4 qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x + 0x270ba4)
                 #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
                 #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
                 #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
                 #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
                 #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)



^ permalink raw reply	[flat|nested] 82+ messages in thread

* [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
@ 2022-10-14  7:30     ` Christian Borntraeger
  0 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14  7:30 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs

Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
> From: Alex Bennée <alex.bennee@linaro.org>
> 
> All the boilerplate virtio code does the same thing (or should at
> least) of checking to see if the VM is running before attempting to
> start VirtIO. Push the logic up to the common function to avoid
> getting a copy and paste wrong.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

This results in a regression for our s390x CI when doing save/restore of guests with vsock:


                 #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
                 #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
                 #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
                 #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
                 #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
                 #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
                 #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
                 #8  0x000002aa2d570ba4 qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x + 0x270ba4)
                 #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
                 #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
                 #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
                 #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
                 #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
  2022-10-14  7:30     ` [Virtio-fs] " Christian Borntraeger
@ 2022-10-14  8:31       ` Christian Borntraeger
  -1 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14  8:31 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs

Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>> From: Alex Bennée <alex.bennee@linaro.org>
>>
>> All the boilerplate virtio code does the same thing (or should at
>> least) of checking to see if the VM is running before attempting to
>> start VirtIO. Push the logic up to the common function to avoid
>> getting a copy and paste wrong.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> This results in a regression for our s390x CI when doing save/restore of guests with vsock:
> 
> 
>                  #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>                  #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>                  #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>                  #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>                  #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>                  #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>                  #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>                  #8  0x000002aa2d570ba4 qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x + 0x270ba4)
>                  #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>                  #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>                  #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>                  #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>                  #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
> 


Something like
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 7dc3c7393122..b4d056ae6f01 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
      bool should_start = virtio_device_started(vdev, status);
      int ret;
  
+    if (!vdev->vm_running) {
+        should_start = false;
+    }
+
      if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
          return;
      }

helps.

The problem seems to be that virtio_device_started does ignore vm_running when use_start is set.


^ permalink raw reply related	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
@ 2022-10-14  8:31       ` Christian Borntraeger
  0 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14  8:31 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs

Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>> From: Alex Bennée <alex.bennee@linaro.org>
>>
>> All the boilerplate virtio code does the same thing (or should at
>> least) of checking to see if the VM is running before attempting to
>> start VirtIO. Push the logic up to the common function to avoid
>> getting a copy and paste wrong.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> This results in a regression for our s390x CI when doing save/restore of guests with vsock:
> 
> 
>                  #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>                  #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>                  #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>                  #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>                  #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>                  #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>                  #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>                  #8  0x000002aa2d570ba4 qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x + 0x270ba4)
>                  #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>                  #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>                  #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>                  #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>                  #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
> 


Something like
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 7dc3c7393122..b4d056ae6f01 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
      bool should_start = virtio_device_started(vdev, status);
      int ret;
  
+    if (!vdev->vm_running) {
+        should_start = false;
+    }
+
      if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
          return;
      }

helps.

The problem seems to be that virtio_device_started does ignore vm_running when use_start is set.

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* Re: Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
  2022-10-14  7:30     ` [Virtio-fs] " Christian Borntraeger
@ 2022-10-14  8:37       ` Alex Bennée
  -1 siblings, 0 replies; 82+ messages in thread
From: Alex Bennée @ 2022-10-14  8:37 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs


Christian Borntraeger <borntraeger@linux.ibm.com> writes:

> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> All the boilerplate virtio code does the same thing (or should at
>> least) of checking to see if the VM is running before attempting to
>> start VirtIO. Push the logic up to the common function to avoid
>> getting a copy and paste wrong.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> This results in a regression for our s390x CI when doing save/restore of guests with vsock:
>
>
>                 #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>                 #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>                 #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>                 #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>                 #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>                 #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>                 #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>                 #8 0x000002aa2d570ba4
> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
> 0x270ba4)
>                 #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>                 #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>                 #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>                 #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>                 #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)

Which test does this break?

Looking at the change the only thing I can think of is there is a subtle
change in the order of checks because if the device is set as
use_started we return the result regardless of vm or config state:

    if (vdev->use_started) {
        return vdev->started;
    }

Could some printfs confirm that?

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
@ 2022-10-14  8:37       ` Alex Bennée
  0 siblings, 0 replies; 82+ messages in thread
From: Alex Bennée @ 2022-10-14  8:37 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs


Christian Borntraeger <borntraeger@linux.ibm.com> writes:

> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> All the boilerplate virtio code does the same thing (or should at
>> least) of checking to see if the VM is running before attempting to
>> start VirtIO. Push the logic up to the common function to avoid
>> getting a copy and paste wrong.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> This results in a regression for our s390x CI when doing save/restore of guests with vsock:
>
>
>                 #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>                 #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>                 #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>                 #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>                 #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>                 #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>                 #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>                 #8 0x000002aa2d570ba4
> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
> 0x270ba4)
>                 #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>                 #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>                 #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>                 #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>                 #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)

Which test does this break?

Looking at the change the only thing I can think of is there is a subtle
change in the order of checks because if the device is set as
use_started we return the result regardless of vm or config state:

    if (vdev->use_started) {
        return vdev->started;
    }

Could some printfs confirm that?

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
  2022-10-14  8:37       ` [Virtio-fs] " Alex Bennée
@ 2022-10-14  8:44         ` Christian Borntraeger
  -1 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14  8:44 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs


Am 14.10.22 um 10:37 schrieb Alex Bennée:
> 
> Christian Borntraeger <borntraeger@linux.ibm.com> writes:
> 
>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>> All the boilerplate virtio code does the same thing (or should at
>>> least) of checking to see if the VM is running before attempting to
>>> start VirtIO. Push the logic up to the common function to avoid
>>> getting a copy and paste wrong.
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>
>> This results in a regression for our s390x CI when doing save/restore of guests with vsock:
>>
>>
>>                  #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>>                  #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>>                  #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>>                  #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>>                  #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>>                  #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>>                  #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>>                  #8 0x000002aa2d570ba4
>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>> 0x270ba4)
>>                  #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>>                  #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>>                  #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>>                  #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>>                  #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
> 
> Which test does this break?

migrate to file and restore.

> 
> Looking at the change the only thing I can think of is there is a subtle
> change in the order of checks because if the device is set as
> use_started we return the result regardless of vm or config state:
> 
>      if (vdev->use_started) {
>          return vdev->started;
>      }
> 
> Could some printfs confirm that?

Right. The problem is we now ignore the vm state and thus run into the assertion in vhost_vsock_common_pre_save.
Removing the asserting then results in virtio errors, which really indicates that the device must not be started.


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
@ 2022-10-14  8:44         ` Christian Borntraeger
  0 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14  8:44 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs


Am 14.10.22 um 10:37 schrieb Alex Bennée:
> 
> Christian Borntraeger <borntraeger@linux.ibm.com> writes:
> 
>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>> All the boilerplate virtio code does the same thing (or should at
>>> least) of checking to see if the VM is running before attempting to
>>> start VirtIO. Push the logic up to the common function to avoid
>>> getting a copy and paste wrong.
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>
>> This results in a regression for our s390x CI when doing save/restore of guests with vsock:
>>
>>
>>                  #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>>                  #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>>                  #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>>                  #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>>                  #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>>                  #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>>                  #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>>                  #8 0x000002aa2d570ba4
>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>> 0x270ba4)
>>                  #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>>                  #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>>                  #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>>                  #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>>                  #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
> 
> Which test does this break?

migrate to file and restore.

> 
> Looking at the change the only thing I can think of is there is a subtle
> change in the order of checks because if the device is set as
> use_started we return the result regardless of vm or config state:
> 
>      if (vdev->use_started) {
>          return vdev->started;
>      }
> 
> Could some printfs confirm that?

Right. The problem is we now ignore the vm state and thus run into the assertion in vhost_vsock_common_pre_save.
Removing the asserting then results in virtio errors, which really indicates that the device must not be started.


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
  2022-10-14  8:31       ` [Virtio-fs] " Christian Borntraeger
@ 2022-10-14 11:07         ` Alex Bennée
  -1 siblings, 0 replies; 82+ messages in thread
From: Alex Bennée @ 2022-10-14 11:07 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs


Christian Borntraeger <borntraeger@linux.ibm.com> writes:

> Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>
>>> All the boilerplate virtio code does the same thing (or should at
>>> least) of checking to see if the VM is running before attempting to
>>> start VirtIO. Push the logic up to the common function to avoid
>>> getting a copy and paste wrong.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> This results in a regression for our s390x CI when doing
>> save/restore of guests with vsock:
>>                  #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>>                  #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>>                  #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>>                  #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>>                  #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>>                  #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>>                  #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>>                  #8  0x000002aa2d570ba4
>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>> 0x270ba4)
>>                  #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>>                  #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>>                  #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>>                  #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>>                  #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
>> 
>
>
> Something like
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 7dc3c7393122..b4d056ae6f01 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>      bool should_start = virtio_device_started(vdev, status);
>      int ret;
>  +    if (!vdev->vm_running) {
> +        should_start = false;
> +    }
> +
>      if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
>          return;
>      }
>
> helps.
>
> The problem seems to be that virtio_device_started does ignore
> vm_running when use_start is set.

Wouldn't it make more sense to re-order the check there, something like:

  static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
  {
      if (!vdev->vm_running) {
          return false;
      }

      if (vdev->use_started) {
          return vdev->started;
      }

      return status & VIRTIO_CONFIG_S_DRIVER_OK;
  }

Is the problem that vdev->started gets filled during the migration but
because the VM isn't running yet we can never actually run?

-- 
Alex Bennée

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
@ 2022-10-14 11:07         ` Alex Bennée
  0 siblings, 0 replies; 82+ messages in thread
From: Alex Bennée @ 2022-10-14 11:07 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs


Christian Borntraeger <borntraeger@linux.ibm.com> writes:

> Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>
>>> All the boilerplate virtio code does the same thing (or should at
>>> least) of checking to see if the VM is running before attempting to
>>> start VirtIO. Push the logic up to the common function to avoid
>>> getting a copy and paste wrong.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> This results in a regression for our s390x CI when doing
>> save/restore of guests with vsock:
>>                  #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>>                  #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>>                  #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>>                  #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>>                  #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>>                  #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>>                  #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>>                  #8  0x000002aa2d570ba4
>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>> 0x270ba4)
>>                  #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>>                  #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>>                  #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>>                  #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>>                  #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
>> 
>
>
> Something like
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 7dc3c7393122..b4d056ae6f01 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>      bool should_start = virtio_device_started(vdev, status);
>      int ret;
>  +    if (!vdev->vm_running) {
> +        should_start = false;
> +    }
> +
>      if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
>          return;
>      }
>
> helps.
>
> The problem seems to be that virtio_device_started does ignore
> vm_running when use_start is set.

Wouldn't it make more sense to re-order the check there, something like:

  static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
  {
      if (!vdev->vm_running) {
          return false;
      }

      if (vdev->use_started) {
          return vdev->started;
      }

      return status & VIRTIO_CONFIG_S_DRIVER_OK;
  }

Is the problem that vdev->started gets filled during the migration but
because the VM isn't running yet we can never actually run?

-- 
Alex Bennée

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
  2022-10-14 11:07         ` [Virtio-fs] " Alex Bennée
@ 2022-10-14 11:58           ` Christian Borntraeger
  -1 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14 11:58 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs



Am 14.10.22 um 13:07 schrieb Alex Bennée:
> 
> Christian Borntraeger <borntraeger@linux.ibm.com> writes:
> 
>> Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
>>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>>
>>>> All the boilerplate virtio code does the same thing (or should at
>>>> least) of checking to see if the VM is running before attempting to
>>>> start VirtIO. Push the logic up to the common function to avoid
>>>> getting a copy and paste wrong.
>>>>
>>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>> This results in a regression for our s390x CI when doing
>>> save/restore of guests with vsock:
>>>                   #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>>>                   #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>>>                   #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>>>                   #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>>>                   #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>>>                   #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>>>                   #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>>>                   #8  0x000002aa2d570ba4
>>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>>> 0x270ba4)
>>>                   #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>>>                   #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>>>                   #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>>>                   #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>>>                   #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
>>>
>>
>>
>> Something like
>> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
>> index 7dc3c7393122..b4d056ae6f01 100644
>> --- a/hw/virtio/vhost-vsock.c
>> +++ b/hw/virtio/vhost-vsock.c
>> @@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>>       bool should_start = virtio_device_started(vdev, status);
>>       int ret;
>>   +    if (!vdev->vm_running) {
>> +        should_start = false;
>> +    }
>> +
>>       if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
>>           return;
>>       }
>>
>> helps.
>>
>> The problem seems to be that virtio_device_started does ignore
>> vm_running when use_start is set.
> 
> Wouldn't it make more sense to re-order the check there, something like:
> 
>    static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
>    {
>        if (!vdev->vm_running) {
>            return false;
>        }
> 
>        if (vdev->use_started) {
>            return vdev->started;
>        }
> 
>        return status & VIRTIO_CONFIG_S_DRIVER_OK;
>    }

That does work as well. (and it restores the original ordering so that makes sense).

> 
> Is the problem that vdev->started gets filled during the migration but
> because the VM isn't running yet we can never actually run?

I dont know.


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
@ 2022-10-14 11:58           ` Christian Borntraeger
  0 siblings, 0 replies; 82+ messages in thread
From: Christian Borntraeger @ 2022-10-14 11:58 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Michael S. Tsirkin, qemu-devel, Peter Maydell,
	Dr. David Alan Gilbert, Stefan Hajnoczi, Mathieu Poirier,
	virtio-fs



Am 14.10.22 um 13:07 schrieb Alex Bennée:
> 
> Christian Borntraeger <borntraeger@linux.ibm.com> writes:
> 
>> Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
>>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>>
>>>> All the boilerplate virtio code does the same thing (or should at
>>>> least) of checking to see if the VM is running before attempting to
>>>> start VirtIO. Push the logic up to the common function to avoid
>>>> getting a copy and paste wrong.
>>>>
>>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>> This results in a regression for our s390x CI when doing
>>> save/restore of guests with vsock:
>>>                   #1  0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>>>                   #2  0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>>>                   #3  0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>>>                   #4  0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>>>                   #5  0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>>>                   #6  0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>>>                   #7  0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>>>                   #8  0x000002aa2d570ba4
>>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>>> 0x270ba4)
>>>                   #9  0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>>>                   #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>>>                   #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>>>                   #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>>>                   #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
>>>
>>
>>
>> Something like
>> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
>> index 7dc3c7393122..b4d056ae6f01 100644
>> --- a/hw/virtio/vhost-vsock.c
>> +++ b/hw/virtio/vhost-vsock.c
>> @@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>>       bool should_start = virtio_device_started(vdev, status);
>>       int ret;
>>   +    if (!vdev->vm_running) {
>> +        should_start = false;
>> +    }
>> +
>>       if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
>>           return;
>>       }
>>
>> helps.
>>
>> The problem seems to be that virtio_device_started does ignore
>> vm_running when use_start is set.
> 
> Wouldn't it make more sense to re-order the check there, something like:
> 
>    static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
>    {
>        if (!vdev->vm_running) {
>            return false;
>        }
> 
>        if (vdev->use_started) {
>            return vdev->started;
>        }
> 
>        return status & VIRTIO_CONFIG_S_DRIVER_OK;
>    }

That does work as well. (and it restores the original ordering so that makes sense).

> 
> Is the problem that vdev->started gets filled during the migration but
> because the VM isn't running yet we can never actually run?

I dont know.


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started
  2022-10-10 17:29   ` [Virtio-fs] " Michael S. Tsirkin
@ 2022-11-05 16:45     ` Michael S. Tsirkin
  -1 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-11-05 16:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs, Viresh Kumar

On Mon, Oct 10, 2022 at 01:29:10PM -0400, Michael S. Tsirkin wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
> 
> All the boilerplate virtio code does the same thing (or should at
> least) of checking to see if the VM is running before attempting to
> start VirtIO. Push the logic up to the common function to avoid
> getting a copy and paste wrong.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

So, looking at the resulting code, I missed the fact that this function
is also used in virtio core.  So this patch does not do what it's saying
it does (just refactor code).
Instead it completely changes the meaning for virtio core.
I thunk we should revert upstream, however, gpio has grown a
dependency on this since then.
Alex, could you take a look please?

> ---
>  include/hw/virtio/virtio.h   | 5 +++++
>  hw/virtio/vhost-user-fs.c    | 6 +-----
>  hw/virtio/vhost-user-i2c.c   | 6 +-----
>  hw/virtio/vhost-user-rng.c   | 6 +-----
>  hw/virtio/vhost-user-vsock.c | 6 +-----
>  hw/virtio/vhost-vsock.c      | 6 +-----
>  6 files changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 9bb2485415..74e7ad5a92 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -100,6 +100,7 @@ struct VirtIODevice
>      VirtQueue *vq;
>      MemoryListener listener;
>      uint16_t device_id;
> +    /* @vm_running: current VM running state via virtio_vmstate_change() */
>      bool vm_running;
>      bool broken; /* device in invalid state, needs reset */
>      bool use_disabled_flag; /* allow use of 'disable' flag when needed */
> @@ -376,6 +377,10 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
>          return vdev->started;
>      }
>  
> +    if (!vdev->vm_running) {
> +        return false;
> +    }
> +
>      return status & VIRTIO_CONFIG_S_DRIVER_OK;
>  }
>  
> diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
> index e513e4fdda..d2bebba785 100644
> --- a/hw/virtio/vhost-user-fs.c
> +++ b/hw/virtio/vhost-user-fs.c
> @@ -122,11 +122,7 @@ static void vuf_stop(VirtIODevice *vdev)
>  static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostUserFS *fs = VHOST_USER_FS(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (fs->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
> index 6020eee093..b930cf6d5e 100644
> --- a/hw/virtio/vhost-user-i2c.c
> +++ b/hw/virtio/vhost-user-i2c.c
> @@ -93,11 +93,7 @@ static void vu_i2c_stop(VirtIODevice *vdev)
>  static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (i2c->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
> index 3a7bf8e32d..a9c1c4bc79 100644
> --- a/hw/virtio/vhost-user-rng.c
> +++ b/hw/virtio/vhost-user-rng.c
> @@ -90,11 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
>  static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostUserRNG *rng = VHOST_USER_RNG(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (rng->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
> index 0f8ff99f85..22c1616ebd 100644
> --- a/hw/virtio/vhost-user-vsock.c
> +++ b/hw/virtio/vhost-user-vsock.c
> @@ -55,11 +55,7 @@ const VhostDevConfigOps vsock_ops = {
>  static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (vvc->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 0338de892f..8031c164a5 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start)
>  static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> +    bool should_start = virtio_device_started(vdev, status);
>      int ret;
>  
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> -
>      if (vvc->vhost_dev.started == should_start) {
>          return;
>      }
> -- 
> MST
> 



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started
@ 2022-11-05 16:45     ` Michael S. Tsirkin
  0 siblings, 0 replies; 82+ messages in thread
From: Michael S. Tsirkin @ 2022-11-05 16:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs, Viresh Kumar

On Mon, Oct 10, 2022 at 01:29:10PM -0400, Michael S. Tsirkin wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
> 
> All the boilerplate virtio code does the same thing (or should at
> least) of checking to see if the VM is running before attempting to
> start VirtIO. Push the logic up to the common function to avoid
> getting a copy and paste wrong.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

So, looking at the resulting code, I missed the fact that this function
is also used in virtio core.  So this patch does not do what it's saying
it does (just refactor code).
Instead it completely changes the meaning for virtio core.
I thunk we should revert upstream, however, gpio has grown a
dependency on this since then.
Alex, could you take a look please?

> ---
>  include/hw/virtio/virtio.h   | 5 +++++
>  hw/virtio/vhost-user-fs.c    | 6 +-----
>  hw/virtio/vhost-user-i2c.c   | 6 +-----
>  hw/virtio/vhost-user-rng.c   | 6 +-----
>  hw/virtio/vhost-user-vsock.c | 6 +-----
>  hw/virtio/vhost-vsock.c      | 6 +-----
>  6 files changed, 10 insertions(+), 25 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 9bb2485415..74e7ad5a92 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -100,6 +100,7 @@ struct VirtIODevice
>      VirtQueue *vq;
>      MemoryListener listener;
>      uint16_t device_id;
> +    /* @vm_running: current VM running state via virtio_vmstate_change() */
>      bool vm_running;
>      bool broken; /* device in invalid state, needs reset */
>      bool use_disabled_flag; /* allow use of 'disable' flag when needed */
> @@ -376,6 +377,10 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
>          return vdev->started;
>      }
>  
> +    if (!vdev->vm_running) {
> +        return false;
> +    }
> +
>      return status & VIRTIO_CONFIG_S_DRIVER_OK;
>  }
>  
> diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
> index e513e4fdda..d2bebba785 100644
> --- a/hw/virtio/vhost-user-fs.c
> +++ b/hw/virtio/vhost-user-fs.c
> @@ -122,11 +122,7 @@ static void vuf_stop(VirtIODevice *vdev)
>  static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostUserFS *fs = VHOST_USER_FS(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (fs->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
> index 6020eee093..b930cf6d5e 100644
> --- a/hw/virtio/vhost-user-i2c.c
> +++ b/hw/virtio/vhost-user-i2c.c
> @@ -93,11 +93,7 @@ static void vu_i2c_stop(VirtIODevice *vdev)
>  static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (i2c->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
> index 3a7bf8e32d..a9c1c4bc79 100644
> --- a/hw/virtio/vhost-user-rng.c
> +++ b/hw/virtio/vhost-user-rng.c
> @@ -90,11 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
>  static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostUserRNG *rng = VHOST_USER_RNG(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (rng->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
> index 0f8ff99f85..22c1616ebd 100644
> --- a/hw/virtio/vhost-user-vsock.c
> +++ b/hw/virtio/vhost-user-vsock.c
> @@ -55,11 +55,7 @@ const VhostDevConfigOps vsock_ops = {
>  static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> -
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> +    bool should_start = virtio_device_started(vdev, status);
>  
>      if (vvc->vhost_dev.started == should_start) {
>          return;
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 0338de892f..8031c164a5 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start)
>  static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>  {
>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
> +    bool should_start = virtio_device_started(vdev, status);
>      int ret;
>  
> -    if (!vdev->vm_running) {
> -        should_start = false;
> -    }
> -
>      if (vvc->vhost_dev.started == should_start) {
>          return;
>      }
> -- 
> MST
> 


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started
  2022-11-05 16:45     ` [Virtio-fs] " Michael S. Tsirkin
@ 2022-11-07  9:21       ` Alex Bennée
  -1 siblings, 0 replies; 82+ messages in thread
From: Alex Bennée @ 2022-11-07  9:21 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Peter Maydell, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs, Viresh Kumar


"Michael S. Tsirkin" <mst@redhat.com> writes:

> On Mon, Oct 10, 2022 at 01:29:10PM -0400, Michael S. Tsirkin wrote:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> 
>> All the boilerplate virtio code does the same thing (or should at
>> least) of checking to see if the VM is running before attempting to
>> start VirtIO. Push the logic up to the common function to avoid
>> getting a copy and paste wrong.
>> 
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> So, looking at the resulting code, I missed the fact that this function
> is also used in virtio core.  So this patch does not do what it's saying
> it does (just refactor code).
> Instead it completely changes the meaning for virtio core.
> I thunk we should revert upstream, however, gpio has grown a
> dependency on this since then.
> Alex, could you take a look please?

So I guess we have three choices:

  new function for use by backends
  new function for use by core
  parameterise virtio_device_started to ignore vm state

I'll add some usage doc comments whichever way.

Do you have a preference?

>
>> ---
>>  include/hw/virtio/virtio.h   | 5 +++++
>>  hw/virtio/vhost-user-fs.c    | 6 +-----
>>  hw/virtio/vhost-user-i2c.c   | 6 +-----
>>  hw/virtio/vhost-user-rng.c   | 6 +-----
>>  hw/virtio/vhost-user-vsock.c | 6 +-----
>>  hw/virtio/vhost-vsock.c      | 6 +-----
>>  6 files changed, 10 insertions(+), 25 deletions(-)
>> 
>> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
>> index 9bb2485415..74e7ad5a92 100644
>> --- a/include/hw/virtio/virtio.h
>> +++ b/include/hw/virtio/virtio.h
>> @@ -100,6 +100,7 @@ struct VirtIODevice
>>      VirtQueue *vq;
>>      MemoryListener listener;
>>      uint16_t device_id;
>> +    /* @vm_running: current VM running state via virtio_vmstate_change() */
>>      bool vm_running;
>>      bool broken; /* device in invalid state, needs reset */
>>      bool use_disabled_flag; /* allow use of 'disable' flag when needed */
>> @@ -376,6 +377,10 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
>>          return vdev->started;
>>      }
>>  
>> +    if (!vdev->vm_running) {
>> +        return false;
>> +    }
>> +
>>      return status & VIRTIO_CONFIG_S_DRIVER_OK;
>>  }
>>  
>> diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
>> index e513e4fdda..d2bebba785 100644
>> --- a/hw/virtio/vhost-user-fs.c
>> +++ b/hw/virtio/vhost-user-fs.c
>> @@ -122,11 +122,7 @@ static void vuf_stop(VirtIODevice *vdev)
>>  static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostUserFS *fs = VHOST_USER_FS(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (fs->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
>> index 6020eee093..b930cf6d5e 100644
>> --- a/hw/virtio/vhost-user-i2c.c
>> +++ b/hw/virtio/vhost-user-i2c.c
>> @@ -93,11 +93,7 @@ static void vu_i2c_stop(VirtIODevice *vdev)
>>  static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (i2c->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
>> index 3a7bf8e32d..a9c1c4bc79 100644
>> --- a/hw/virtio/vhost-user-rng.c
>> +++ b/hw/virtio/vhost-user-rng.c
>> @@ -90,11 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
>>  static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostUserRNG *rng = VHOST_USER_RNG(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (rng->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
>> index 0f8ff99f85..22c1616ebd 100644
>> --- a/hw/virtio/vhost-user-vsock.c
>> +++ b/hw/virtio/vhost-user-vsock.c
>> @@ -55,11 +55,7 @@ const VhostDevConfigOps vsock_ops = {
>>  static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (vvc->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
>> index 0338de892f..8031c164a5 100644
>> --- a/hw/virtio/vhost-vsock.c
>> +++ b/hw/virtio/vhost-vsock.c
>> @@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start)
>>  static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> +    bool should_start = virtio_device_started(vdev, status);
>>      int ret;
>>  
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> -
>>      if (vvc->vhost_dev.started == should_start) {
>>          return;
>>      }
>> -- 
>> MST
>> 


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [Virtio-fs] [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started
@ 2022-11-07  9:21       ` Alex Bennée
  0 siblings, 0 replies; 82+ messages in thread
From: Alex Bennée @ 2022-11-07  9:21 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Peter Maydell, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Mathieu Poirier, virtio-fs, Viresh Kumar


"Michael S. Tsirkin" <mst@redhat.com> writes:

> On Mon, Oct 10, 2022 at 01:29:10PM -0400, Michael S. Tsirkin wrote:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> 
>> All the boilerplate virtio code does the same thing (or should at
>> least) of checking to see if the VM is running before attempting to
>> start VirtIO. Push the logic up to the common function to avoid
>> getting a copy and paste wrong.
>> 
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> So, looking at the resulting code, I missed the fact that this function
> is also used in virtio core.  So this patch does not do what it's saying
> it does (just refactor code).
> Instead it completely changes the meaning for virtio core.
> I thunk we should revert upstream, however, gpio has grown a
> dependency on this since then.
> Alex, could you take a look please?

So I guess we have three choices:

  new function for use by backends
  new function for use by core
  parameterise virtio_device_started to ignore vm state

I'll add some usage doc comments whichever way.

Do you have a preference?

>
>> ---
>>  include/hw/virtio/virtio.h   | 5 +++++
>>  hw/virtio/vhost-user-fs.c    | 6 +-----
>>  hw/virtio/vhost-user-i2c.c   | 6 +-----
>>  hw/virtio/vhost-user-rng.c   | 6 +-----
>>  hw/virtio/vhost-user-vsock.c | 6 +-----
>>  hw/virtio/vhost-vsock.c      | 6 +-----
>>  6 files changed, 10 insertions(+), 25 deletions(-)
>> 
>> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
>> index 9bb2485415..74e7ad5a92 100644
>> --- a/include/hw/virtio/virtio.h
>> +++ b/include/hw/virtio/virtio.h
>> @@ -100,6 +100,7 @@ struct VirtIODevice
>>      VirtQueue *vq;
>>      MemoryListener listener;
>>      uint16_t device_id;
>> +    /* @vm_running: current VM running state via virtio_vmstate_change() */
>>      bool vm_running;
>>      bool broken; /* device in invalid state, needs reset */
>>      bool use_disabled_flag; /* allow use of 'disable' flag when needed */
>> @@ -376,6 +377,10 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
>>          return vdev->started;
>>      }
>>  
>> +    if (!vdev->vm_running) {
>> +        return false;
>> +    }
>> +
>>      return status & VIRTIO_CONFIG_S_DRIVER_OK;
>>  }
>>  
>> diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
>> index e513e4fdda..d2bebba785 100644
>> --- a/hw/virtio/vhost-user-fs.c
>> +++ b/hw/virtio/vhost-user-fs.c
>> @@ -122,11 +122,7 @@ static void vuf_stop(VirtIODevice *vdev)
>>  static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostUserFS *fs = VHOST_USER_FS(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (fs->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c
>> index 6020eee093..b930cf6d5e 100644
>> --- a/hw/virtio/vhost-user-i2c.c
>> +++ b/hw/virtio/vhost-user-i2c.c
>> @@ -93,11 +93,7 @@ static void vu_i2c_stop(VirtIODevice *vdev)
>>  static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostUserI2C *i2c = VHOST_USER_I2C(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (i2c->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
>> index 3a7bf8e32d..a9c1c4bc79 100644
>> --- a/hw/virtio/vhost-user-rng.c
>> +++ b/hw/virtio/vhost-user-rng.c
>> @@ -90,11 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
>>  static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostUserRNG *rng = VHOST_USER_RNG(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (rng->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c
>> index 0f8ff99f85..22c1616ebd 100644
>> --- a/hw/virtio/vhost-user-vsock.c
>> +++ b/hw/virtio/vhost-user-vsock.c
>> @@ -55,11 +55,7 @@ const VhostDevConfigOps vsock_ops = {
>>  static void vuv_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> -
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> +    bool should_start = virtio_device_started(vdev, status);
>>  
>>      if (vvc->vhost_dev.started == should_start) {
>>          return;
>> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
>> index 0338de892f..8031c164a5 100644
>> --- a/hw/virtio/vhost-vsock.c
>> +++ b/hw/virtio/vhost-vsock.c
>> @@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start)
>>  static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>>  {
>>      VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
>> -    bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK;
>> +    bool should_start = virtio_device_started(vdev, status);
>>      int ret;
>>  
>> -    if (!vdev->vm_running) {
>> -        should_start = false;
>> -    }
>> -
>>      if (vvc->vhost_dev.started == should_start) {
>>          return;
>>      }
>> -- 
>> MST
>> 


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2022-11-07  9:24 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 01/55] hw/virtio: incorporate backend features in features Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 03/55] include/hw: document vhost_dev feature life-cycle Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 04/55] hw/virtio: fix some coding style issues Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 05/55] hw/virtio: log potentially buggy guest drivers Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 06/55] hw/virtio: add some vhost-user trace events Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started Michael S. Tsirkin
2022-10-10 17:29   ` [Virtio-fs] " Michael S. Tsirkin
2022-10-14  7:30   ` Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started) Christian Borntraeger
2022-10-14  7:30     ` [Virtio-fs] " Christian Borntraeger
2022-10-14  8:31     ` Christian Borntraeger
2022-10-14  8:31       ` [Virtio-fs] " Christian Borntraeger
2022-10-14 11:07       ` Alex Bennée
2022-10-14 11:07         ` [Virtio-fs] " Alex Bennée
2022-10-14 11:58         ` Christian Borntraeger
2022-10-14 11:58           ` [Virtio-fs] " Christian Borntraeger
2022-10-14  8:37     ` Alex Bennée
2022-10-14  8:37       ` [Virtio-fs] " Alex Bennée
2022-10-14  8:44       ` Christian Borntraeger
2022-10-14  8:44         ` [Virtio-fs] " Christian Borntraeger
2022-11-05 16:45   ` [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started Michael S. Tsirkin
2022-11-05 16:45     ` [Virtio-fs] " Michael S. Tsirkin
2022-11-07  9:21     ` Alex Bennée
2022-11-07  9:21       ` [Virtio-fs] " Alex Bennée
2022-10-10 17:29 ` [PULL 08/55] hw/virtio: move vhd->started check into helper and add FIXME Michael S. Tsirkin
2022-10-10 17:29   ` [Virtio-fs] " Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 09/55] hw/virtio: add boilerplate for vhost-user-gpio device Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 10/55] hw/virtio: add vhost-user-gpio-pci boilerplate Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 11/55] tests/qtest: pass stdout/stderr down to subtests Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 12/55] tests/qtest: add a timeout for subprocess_run_one_test Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 13/55] tests/qtest: use qos_printf instead of g_test_message Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 14/55] tests/qtest: catch unhandled vhost-user messages Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 15/55] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 16/55] tests/qtest: add assert to catch bad features Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 17/55] tests/qtest: implement stub for VHOST_USER_GET_CONFIG Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 19/55] tests/qtest: enable tests for virtio-gpio Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 20/55] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 21/55] virtio-blk: move config size params to virtio-blk-common Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 22/55] vhost-user-blk: make it possible to disable write-zeroes/discard Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 23/55] vhost-user-blk: make 'config_wce' part of 'host_features' Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 24/55] vhost-user-blk: dynamically resize config space based on features Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 25/55] tests/acpi: virt: allow acpi GTDT changes Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 26/55] acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 27/55] tests/acpi: virt: update ACPI GTDT binaries Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks" Michael S. Tsirkin
2022-10-10 17:39   ` David Woodhouse
2022-10-10 19:08     ` Peter Xu
2022-10-10 23:16       ` David Woodhouse
2022-10-11  0:04         ` Peter Xu
2022-10-10 17:30 ` [PULL 30/55] qmp: add QMP command x-query-virtio Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 31/55] qmp: add QMP command x-query-virtio-status Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 32/55] qmp: decode feature & status bits in virtio-status Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 33/55] qmp: add QMP commands for virtio/vhost queue-status Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 35/55] hmp: add virtio commands Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 36/55] pci: Remove unused pci_get_*_by_mask() functions Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 37/55] pci: Sanity check mask argument to pci_set_*_by_mask() Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 38/55] hw/smbios: support for type 8 (port connector) Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 39/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 40/55] acpi: x86: deduplicate HPET AML building Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 41/55] tests: acpi: update expected blobs after HPET move Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 42/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 43/55] acpi: x86: refactor PDSM method to reduce nesting Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 44/55] x86: acpi: _DSM: use Package to pass parameters Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 45/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 46/55] tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 48/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 49/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 50/55] x86: pci: acpi: reorder Device's _ADR and _SUN fields Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 51/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 52/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 53/55] x86: pci: acpi: reorder Device's _DSM method Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 54/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 55/55] x86: pci: acpi: consolidate PCI slots creation Michael S. Tsirkin
2022-10-12 20:04 ` [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Stefan Hajnoczi
2022-10-12 20:59   ` Michael S. Tsirkin
2022-10-12 21:01     ` Stefan Hajnoczi
2022-10-12 21:25 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.