qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/29] pc,pci,virtio: features, fixes
@ 2021-10-19 11:19 ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 01/29] tests: acpi: dump table with failed checksum Michael S. Tsirkin
                     ` (31 more replies)
  0 siblings, 32 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:

  Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)

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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:

  failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)

----------------------------------------------------------------
pc,pci,virtio: features, fixes

vhost user rng
Fixes, cleanups all over the place.

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

----------------------------------------------------------------
Ani Sinha (3):
      tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
      tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
      tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test

David Hildenbrand (1):
      libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr

Eric Auger (2):
      virtio-iommu: Remove the non transitional name
      virtio-iommu: Drop base_name and change generic_name

Eugenio Pérez (3):
      vdpa: Skip protected ram IOMMU mappings
      vdpa: Add vhost_vdpa_section_end
      vdpa: Check for iova range at mappings changes

Igor Mammedov (15):
      tests: acpi: dump table with failed checksum
      tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
      tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
      tests: acpi: q35: test for x2APIC entries in SRAT
      tests: acpi: update expected tables blobs
      tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
      tests: acpi: add testcase for intel_iommu (DMAR table)
      tests: acpi: add expected blob for DMAR table
      tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
      tests: acpi: add testcase for amd-iommu (IVRS table)
      tests: acpi: update expected blobs
      tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
      tests: arm-cpu-features: use qtest_has_kvm() API
      tests: migration-test: use qtest_has_accel() API
      tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests

Laurent Vivier (1):
      failover: fix a regression introduced by JSON'ification of -device

Mathieu Poirier (3):
      vhost-user-rng: Add vhost-user-rng implementation
      vhost-user-rng-pci: Add vhost-user-rng-pci implementation
      docs: Add documentation for vhost based RNG implementation

Xueming Li (1):
      vhost-user: fix duplicated notifier MR init

 include/hw/virtio/vhost-user-rng.h        |  33 ++++
 include/hw/virtio/vhost-vdpa.h            |   2 +
 include/hw/virtio/virtio-iommu.h          |   2 +-
 tests/qtest/libqos/libqtest.h             |   8 +
 hw/net/virtio-net.c                       |  24 ++-
 hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
 hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
 hw/virtio/vhost-user.c                    |   5 +-
 hw/virtio/vhost-vdpa.c                    |  81 ++++++---
 hw/virtio/virtio-iommu-pci.c              |   4 +-
 subprojects/libvhost-user/libvhost-user.c |   1 +
 tests/qtest/acpi-utils.c                  |  14 ++
 tests/qtest/arm-cpu-features.c            |  29 +--
 tests/qtest/bios-tables-test.c            |  90 ++++++++--
 tests/qtest/libqtest.c                    |  27 +++
 tests/qtest/migration-test.c              |  15 +-
 docs/system/device-emulation.rst          |   1 +
 docs/system/devices/vhost-user-rng.rst    |  39 ++++
 hw/virtio/Kconfig                         |   5 +
 hw/virtio/meson.build                     |   2 +
 hw/virtio/trace-events                    |   1 +
 meson.build                               |   6 +
 tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
 tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
 tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
 tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
 tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
 tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
 tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
 tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
 30 files changed, 672 insertions(+), 85 deletions(-)
 create mode 100644 include/hw/virtio/vhost-user-rng.h
 create mode 100644 hw/virtio/vhost-user-rng-pci.c
 create mode 100644 hw/virtio/vhost-user-rng.c
 create mode 100644 docs/system/devices/vhost-user-rng.rst
 create mode 100644 tests/data/acpi/q35/APIC.xapic
 create mode 100644 tests/data/acpi/q35/DMAR.dmar
 create mode 100644 tests/data/acpi/q35/DSDT.ivrs
 create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
 create mode 100644 tests/data/acpi/q35/DSDT.xapic
 create mode 100644 tests/data/acpi/q35/FACP.xapic
 create mode 100644 tests/data/acpi/q35/IVRS.ivrs
 create mode 100644 tests/data/acpi/q35/SRAT.xapic



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

* [PULL 01/29] tests: acpi: dump table with failed checksum
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 02/29] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator Michael S. Tsirkin
                     ` (30 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, Thomas Huth, Igor Mammedov,
	Ani Sinha, Paolo Bonzini

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-2-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/acpi-utils.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/qtest/acpi-utils.c b/tests/qtest/acpi-utils.c
index d2a202efca..766c48e3a6 100644
--- a/tests/qtest/acpi-utils.c
+++ b/tests/qtest/acpi-utils.c
@@ -98,6 +98,20 @@ void acpi_fetch_table(QTestState *qts, uint8_t **aml, uint32_t *aml_len,
         ACPI_ASSERT_CMP(**aml, sig);
     }
     if (verify_checksum) {
+        if (acpi_calc_checksum(*aml, *aml_len)) {
+            gint fd, ret;
+            char *fname = NULL;
+            GError *error = NULL;
+
+            fprintf(stderr, "Invalid '%.4s'(%d)\n", *aml, *aml_len);
+            fd = g_file_open_tmp("malformed-XXXXXX.dat", &fname, &error);
+            g_assert_no_error(error);
+            fprintf(stderr, "Dumping invalid table into '%s'\n", fname);
+            ret = qemu_write_full(fd, *aml, *aml_len);
+            g_assert(ret == *aml_len);
+            close(fd);
+            g_free(fname);
+        }
         g_assert(!acpi_calc_checksum(*aml, *aml_len));
     }
 }
-- 
MST



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

* [PULL 02/29] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 01/29] tests: acpi: dump table with failed checksum Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 03/29] tests: acpi: whitelist expected tables for acpi/q35/xapic testcase Michael S. Tsirkin
                     ` (29 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, Thomas Huth, Paolo Bonzini, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Currently it is not possible to create tests that have KVM as a hard
requirement on a host that doesn't support KVM for tested target
binary (modulo going through the trouble of compiling out
the offending test case).

Following scenario makes test fail when it's run on non x86 host:
  qemu-system-x86_64 -enable-kvm -M q35,kernel-irqchip=on -smp 1,maxcpus=288

This patch introduces qtest_has_accel() to let users check if accel is
available in advance and avoid executing non run-able test-cases.

It implements detection of TCG and KVM only, the rest could be
added later on, when we actually start testing them in qtest.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/libqos/libqtest.h |  8 ++++++++
 tests/qtest/libqtest.c        | 27 +++++++++++++++++++++++++++
 meson.build                   |  6 ++++++
 3 files changed, 41 insertions(+)

diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
index a68dcd79d4..59e9271195 100644
--- a/tests/qtest/libqos/libqtest.h
+++ b/tests/qtest/libqos/libqtest.h
@@ -588,6 +588,14 @@ bool qtest_big_endian(QTestState *s);
  */
 const char *qtest_get_arch(void);
 
+/**
+ * qtest_has_accel:
+ * @accel_name: Accelerator name to check for.
+ *
+ * Returns: true if the accelerator is built in.
+ */
+bool qtest_has_accel(const char *accel_name);
+
 /**
  * qtest_add_func:
  * @str: Test case path.
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 73f6b977a6..25aeea385b 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -922,6 +922,33 @@ const char *qtest_get_arch(void)
     return end + 1;
 }
 
+bool qtest_has_accel(const char *accel_name)
+{
+    if (g_str_equal(accel_name, "tcg")) {
+#if defined(CONFIG_TCG)
+        return true;
+#else
+        return false;
+#endif
+    } else if (g_str_equal(accel_name, "kvm")) {
+        int i;
+        const char *arch = qtest_get_arch();
+        const char *targets[] = { CONFIG_KVM_TARGETS };
+
+        for (i = 0; i < ARRAY_SIZE(targets); i++) {
+            if (!strncmp(targets[i], arch, strlen(arch))) {
+                if (!access("/dev/kvm", R_OK | W_OK)) {
+                    return true;
+                }
+            }
+        }
+    } else {
+        /* not implemented */
+        g_assert_not_reached();
+    }
+    return false;
+}
+
 bool qtest_get_irq(QTestState *s, int num)
 {
     /* dummy operation in order to make sure irq is up to date */
diff --git a/meson.build b/meson.build
index 6b7487b725..266b94644b 100644
--- a/meson.build
+++ b/meson.build
@@ -72,6 +72,12 @@ else
   kvm_targets = []
 endif
 
+kvm_targets_c = ''
+if not get_option('kvm').disabled() and targetos == 'linux'
+  kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
+endif
+config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
+
 accelerator_targets = { 'CONFIG_KVM': kvm_targets }
 
 if cpu in ['aarch64']
-- 
MST



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

* [PULL 03/29] tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 01/29] tests: acpi: dump table with failed checksum Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 02/29] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 04/29] tests: acpi: q35: test for x2APIC entries in SRAT Michael S. Tsirkin
                     ` (28 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-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 | 4 ++++
 tests/data/acpi/q35/APIC.xapic              | 0
 tests/data/acpi/q35/DSDT.xapic              | 0
 tests/data/acpi/q35/FACP.xapic              | 0
 tests/data/acpi/q35/SRAT.xapic              | 0
 5 files changed, 4 insertions(+)
 create mode 100644 tests/data/acpi/q35/APIC.xapic
 create mode 100644 tests/data/acpi/q35/DSDT.xapic
 create mode 100644 tests/data/acpi/q35/FACP.xapic
 create mode 100644 tests/data/acpi/q35/SRAT.xapic

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..344eee3acc 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,5 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.xapic",
+"tests/data/acpi/q35/SRAT.xapic",
+"tests/data/acpi/q35/FACP.xapic",
+"tests/data/acpi/q35/APIC.xapic",
diff --git a/tests/data/acpi/q35/APIC.xapic b/tests/data/acpi/q35/APIC.xapic
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/q35/DSDT.xapic
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/FACP.xapic b/tests/data/acpi/q35/FACP.xapic
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/SRAT.xapic b/tests/data/acpi/q35/SRAT.xapic
new file mode 100644
index 0000000000..e69de29bb2
-- 
MST



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

* [PULL 04/29] tests: acpi: q35: test for x2APIC entries in SRAT
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (2 preceding siblings ...)
  2021-10-19 11:19   ` [PULL 03/29] tests: acpi: whitelist expected tables for acpi/q35/xapic testcase Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 05/29] tests: acpi: update expected tables blobs Michael S. Tsirkin
                     ` (27 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Set -smp 1,maxcpus=288 to test for ACPI code that
deal with CPUs with large APIC ID (>255).

PS:
Test requires KVM and in-kernel irqchip support,
so skip test if KVM is not available.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-5-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.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 4f11d03055..87a94a59fa 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1033,6 +1033,19 @@ static void test_acpi_q35_tcg_numamem(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_kvm_xapic(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".xapic";
+    test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M"
+                  " -numa node -numa node,memdev=ram0"
+                  " -machine kernel-irqchip=on -smp 1,maxcpus=288", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_nosmm(void)
 {
     test_data data;
@@ -1509,6 +1522,7 @@ static void test_acpi_oem_fields_virt(void)
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
+    const bool has_kvm = qtest_has_accel("kvm");
     int ret;
 
     g_test_init(&argc, &argv, NULL);
@@ -1567,6 +1581,9 @@ int main(int argc, char *argv[])
         if (strcmp(arch, "x86_64") == 0) {
             qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
         }
+        if (has_kvm) {
+            qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
+        }
     } else if (strcmp(arch, "aarch64") == 0) {
         qtest_add_func("acpi/virt", test_acpi_virt_tcg);
         qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
-- 
MST



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

* [PULL 05/29] tests: acpi: update expected tables blobs
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (3 preceding siblings ...)
  2021-10-19 11:19   ` [PULL 04/29] tests: acpi: q35: test for x2APIC entries in SRAT Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 06/29] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar Michael S. Tsirkin
                     ` (26 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Update adds CPU entries to MADT/SRAT/FACP and DSDT to cover 288 CPUs.
Notable changes are that CPUs with APIC ID 255 and higher
use 'Processor Local x2APIC Affinity' structure in SRAT and
"Device" element in DSDT.

FACP:
-                 Use APIC Cluster Model (V4) : 0
+                 Use APIC Cluster Model (V4) : 1

SRAT:
...
+[1010h 4112   1]                Subtable Type : 00 [Processor Local APIC/SAPIC Affinity]
+[1011h 4113   1]                       Length : 10
+
+[1012h 4114   1]      Proximity Domain Low(8) : 00
+[1013h 4115   1]                      Apic ID : FE
+[1014h 4116   4]        Flags (decoded below) : 00000001
+                                     Enabled : 1
+[1018h 4120   1]              Local Sapic EID : 00
+[1019h 4121   3]    Proximity Domain High(24) : 000000
+[101Ch 4124   4]                 Clock Domain : 00000000
+
+[1020h 4128   1]                Subtable Type : 02 [Processor Local x2APIC Affinity]
+[1021h 4129   1]                       Length : 18
+
+[1022h 4130   2]                    Reserved1 : 0000
+[1024h 4132   4]             Proximity Domain : 00000001
+[1028h 4136   4]                      Apic ID : 000000FF
+[102Ch 4140   4]        Flags (decoded below) : 00000001
+                                     Enabled : 1
+[1030h 4144   4]                 Clock Domain : 00000000
+[1034h 4148   4]                    Reserved2 : 00000000

...

+[1320h 4896   1]                Subtable Type : 02 [Processor Local x2APIC Affinity]
+[1321h 4897   1]                       Length : 18
+
+[1322h 4898   2]                    Reserved1 : 0000
+[1324h 4900   4]             Proximity Domain : 00000001
+[1328h 4904   4]                      Apic ID : 0000011F
+[132Ch 4908   4]        Flags (decoded below) : 00000001
+                                     Enabled : 1
+[1330h 4912   4]                 Clock Domain : 00000000
+[1334h 4916   4]                    Reserved2 : 00000000

DSDT:

...
+            Processor (C0FE, 0xFE, 0x00000000, 0x00)
+            {
...
+            }
+
+            Device (C0FF)
+            {
+                Name (_HID, "ACPI0007" /* Processor Device */)  // _HID: Hardware ID
+                Name (_UID, 0xFF)  // _UID: Unique ID
...
+            }

+            Device (C11F)
+            {
+                Name (_HID, "ACPI0007" /* Processor Device */)  // _HID: Hardware ID
+                Name (_UID, 0x011F)  // _UID: Unique ID
...
+            }

APIC:
+[034h 0052   1]                Subtable Type : 00 [Processor Local APIC]
+[035h 0053   1]                       Length : 08
+[036h 0054   1]                 Processor ID : 01
+[037h 0055   1]                Local Apic ID : 01
+[038h 0056   4]        Flags (decoded below) : 00000000
+                           Processor Enabled : 0

...

+[81Ch 2076   1]                Subtable Type : 00 [Processor Local APIC]
+[81Dh 2077   1]                       Length : 08
+[81Eh 2078   1]                 Processor ID : FE
+[81Fh 2079   1]                Local Apic ID : FE
+[820h 2080   4]        Flags (decoded below) : 00000000
+                           Processor Enabled : 0
+
+[824h 2084   1]                Subtable Type : 09 [Processor Local x2APIC]
+[825h 2085   1]                       Length : 10
+[826h 2086   2]                     Reserved : 0000
+[828h 2088   4]          Processor x2Apic ID : 000000FF
+[82Ch 2092   4]        Flags (decoded below) : 00000000
+                           Processor Enabled : 0
+[830h 2096   4]                Processor UID : 000000FF

...

+[A24h 2596   1]                Subtable Type : 09 [Processor Local x2APIC]
+[A25h 2597   1]                       Length : 10
+[A26h 2598   2]                     Reserved : 0000
+[A28h 2600   4]          Processor x2Apic ID : 0000011F
+[A2Ch 2604   4]        Flags (decoded below) : 00000000
+                           Processor Enabled : 0
+[A30h 2608   4]                Processor UID : 0000011F
+
+[A34h 2612   1]                Subtable Type : 01 [I/O APIC]
+[A35h 2613   1]                       Length : 0C
+[A36h 2614   1]                  I/O Apic ID : 00
+[A37h 2615   1]                     Reserved : 00
+[A38h 2616   4]                      Address : FEC00000
+[A3Ch 2620   4]                    Interrupt : 00000000
+
+[A40h 2624   1]                Subtable Type : 02 [Interrupt Source Override]
+[A41h 2625   1]                       Length : 0A
+[A42h 2626   1]                          Bus : 00
+[A43h 2627   1]                       Source : 00
+[A44h 2628   4]                    Interrupt : 00000002
+[A48h 2632   2]        Flags (decoded below) : 0000
                                     Polarity : 0
                                 Trigger Mode : 0

-[04Ah 0074   1]                Subtable Type : 02 [Interrupt Source Override]
-[04Bh 0075   1]                       Length : 0A
-[04Ch 0076   1]                          Bus : 00
-[04Dh 0077   1]                       Source : 05
-[04Eh 0078   4]                    Interrupt : 00000005
-[052h 0082   2]        Flags (decoded below) : 000D
+[A4Ah 2634   1]                Subtable Type : 02 [Interrupt Source Override]
+[A4Bh 2635   1]                       Length : 0A
+[A4Ch 2636   1]                          Bus : 00
+[A4Dh 2637   1]                       Source : 05
+[A4Eh 2638   4]                    Interrupt : 00000005
+[A52h 2642   2]        Flags (decoded below) : 000D
                                     Polarity : 1
                                 Trigger Mode : 3

-[054h 0084   1]                Subtable Type : 02 [Interrupt Source Override]
-[055h 0085   1]                       Length : 0A
-[056h 0086   1]                          Bus : 00
-[057h 0087   1]                       Source : 09
-[058h 0088   4]                    Interrupt : 00000009
-[05Ch 0092   2]        Flags (decoded below) : 000D
+[A54h 2644   1]                Subtable Type : 02 [Interrupt Source Override]
+[A55h 2645   1]                       Length : 0A
+[A56h 2646   1]                          Bus : 00
+[A57h 2647   1]                       Source : 09
+[A58h 2648   4]                    Interrupt : 00000009
+[A5Ch 2652   2]        Flags (decoded below) : 000D
                                     Polarity : 1
                                 Trigger Mode : 3

-[05Eh 0094   1]                Subtable Type : 02 [Interrupt Source Override]
-[05Fh 0095   1]                       Length : 0A
-[060h 0096   1]                          Bus : 00
-[061h 0097   1]                       Source : 0A
-[062h 0098   4]                    Interrupt : 0000000A
-[066h 0102   2]        Flags (decoded below) : 000D
+[A5Eh 2654   1]                Subtable Type : 02 [Interrupt Source Override]
+[A5Fh 2655   1]                       Length : 0A
+[A60h 2656   1]                          Bus : 00
+[A61h 2657   1]                       Source : 0A
+[A62h 2658   4]                    Interrupt : 0000000A
+[A66h 2662   2]        Flags (decoded below) : 000D
                                     Polarity : 1
                                 Trigger Mode : 3

-[068h 0104   1]                Subtable Type : 02 [Interrupt Source Override]
-[069h 0105   1]                       Length : 0A
-[06Ah 0106   1]                          Bus : 00
-[06Bh 0107   1]                       Source : 0B
-[06Ch 0108   4]                    Interrupt : 0000000B
-[070h 0112   2]        Flags (decoded below) : 000D
+[A68h 2664   1]                Subtable Type : 02 [Interrupt Source Override]
+[A69h 2665   1]                       Length : 0A
+[A6Ah 2666   1]                          Bus : 00
+[A6Bh 2667   1]                       Source : 0B
+[A6Ch 2668   4]                    Interrupt : 0000000B
+[A70h 2672   2]        Flags (decoded below) : 000D
                                     Polarity : 1
                                 Trigger Mode : 3

-[072h 0114   1]                Subtable Type : 04 [Local APIC NMI]
-[073h 0115   1]                       Length : 06
-[074h 0116   1]                 Processor ID : FF
-[075h 0117   2]        Flags (decoded below) : 0000
+[A72h 2674   1]                Subtable Type : 0A [Local x2APIC NMI]
+[A73h 2675   1]                       Length : 0C
+[A74h 2676   2]        Flags (decoded below) : 0000
                                     Polarity : 0
                                 Trigger Mode : 0
-[077h 0119   1]         Interrupt Input LINT : 01
+[A76h 2678   4]                Processor UID : FFFFFFFF
+[A7Ah 2682   1]         Interrupt Input LINT : 01
+[A7Bh 2683   3]                     Reserved : 000000

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-6-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 |   4 ----
 tests/data/acpi/q35/APIC.xapic              | Bin 0 -> 2686 bytes
 tests/data/acpi/q35/DSDT.xapic              | Bin 0 -> 35652 bytes
 tests/data/acpi/q35/FACP.xapic              | Bin 0 -> 244 bytes
 tests/data/acpi/q35/SRAT.xapic              | Bin 0 -> 5080 bytes
 5 files changed, 4 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 344eee3acc..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,5 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.xapic",
-"tests/data/acpi/q35/SRAT.xapic",
-"tests/data/acpi/q35/FACP.xapic",
-"tests/data/acpi/q35/APIC.xapic",
diff --git a/tests/data/acpi/q35/APIC.xapic b/tests/data/acpi/q35/APIC.xapic
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c1969c35aa12b61d25e0134bbb8d2187ba42d663 100644
GIT binary patch
literal 2686
zcmXZeQ+OOv7=Yo~aI?wAcAeU0vPDuQZHm;k?bNny+g57ZPHkIh=b!JKoA-S43@*-G
z{Lu+<wq%Q@nWAFiZLx`wF-ZxwNPU?!O_RN-X{l+3X8k@%vx&=QJ3C3uY;TVa4(RBJ
zPEP3TjAs1}`ZBw?phf?(w5uz+xuMmH?(XQ}fu5e|<%Qnf=;MRFzUb$N{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binary patch
literal 244
zcmZ>BbPo8!z`($~)yd!4BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC
z$X0-fGcm9T0LA|E|L2FOWMD7?GM2WmFfej3F#P0!h{7ddihwku0+2v57svwxMxcSn
X_QAxFX+{NzJ3wNL4G8yu_%Hwf>QN2>

literal 0
HcmV?d00001

diff --git a/tests/data/acpi/q35/SRAT.xapic b/tests/data/acpi/q35/SRAT.xapic
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1a91cfa65fdbebe1756d63d80022c2af767e5d3f 100644
GIT binary patch
literal 5080
zcmaLbd6bS-9KiAS9m_Bb!whB^ODQIzkhDk{WhpVupdq1%l!~-aq1~F4H7%5Avt?^h
zSz6I1OVggM&?eD}ni*#ppIrBx=iKM>{oOzBdCz;Etjy*eauOqv=+gA|Em~*QNYBn_
zQ6qOnBauknd)}V+99jwgbCh`uE`p2VVz@Yt#U*e_9EVHc(l{QM!DVp*E{DtGM4W^x
z;EK2sPR1#?GOmJCaaCLmSI7BxqtJagj`{JpCO!e5h-=~6I1QhK>)^WhWLyu|$EV;^
zaRb~CH^Qgk#`tvH1fPM=#Ao5NaZ`K_Zidgr=i%l!9q0ds6uK|xGrs`0#I0~^+y-BW
zFT!o{#kd`Ak2CNkI1^{#4!9%kgfGR}xHIm8FT-8&<+vN}j(gxM@RhhH?uD<yy>TCW
zHSUYA!Pnw`_&R(&z5(~g1MrP_AifFTjBmlW;z4*Yz75}w@4!RwP&^FZiSNR9<9qPE
z_&$6;9*#%gk$4myjmO{z@L2pH9)};o599H80-lH`;mLRkegsd&kK)Jh<M;_Y4Nu2U
z;-~No{4}14XW?h?v-mmuJbnSs#&hsoJP*&uFX9DwAzp+R<0bed{4#z8zlxXQ*YNB3
z4ZI95$1Ctk{3d=2zm4C)@8b9HD!dx6!SCY_@Q3&#{4rjOKf&wpdb|N|#Gm3E{2Bfn
ze}TWmU*WIuH~3q;32(+*@K(GHe}})v+wl&(6aRpJ#6RJm@h^B6{uS@Wzu`T2Fa90>
zf&avR;lJ@ecpu)64-|Gx^1*-Z|K@H->v{2LJsRjSfnFrgiw1hJKrbHXv4LJ9&`Sn-
zT%eZ<^wNPIALwNQy=<T-1bVqZFCXZMfu0oT6#~6tpjQg?<Umge^vZ!=CD2m?y=tIW
q3-s#rXj*PKV#OU&;mP51xgXB**RI%tgGZh#sK?%;X~&)yO#cIBSDyg@

literal 0
HcmV?d00001

-- 
MST



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

* [PULL 06/29] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (4 preceding siblings ...)
  2021-10-19 11:19   ` [PULL 05/29] tests: acpi: update expected tables blobs Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:19   ` [PULL 07/29] tests: acpi: add testcase for intel_iommu (DMAR table) Michael S. Tsirkin
                     ` (25 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-7-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 | 1 +
 tests/data/acpi/q35/DMAR.dmar               | 0
 2 files changed, 1 insertion(+)
 create mode 100644 tests/data/acpi/q35/DMAR.dmar

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..a2843335c8 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DMAR.dmar",
diff --git a/tests/data/acpi/q35/DMAR.dmar b/tests/data/acpi/q35/DMAR.dmar
new file mode 100644
index 0000000000..e69de29bb2
-- 
MST



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

* [PULL 07/29] tests: acpi: add testcase for intel_iommu (DMAR table)
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (5 preceding siblings ...)
  2021-10-19 11:19   ` [PULL 06/29] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar Michael S. Tsirkin
@ 2021-10-19 11:19   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 08/29] tests: acpi: add expected blob for DMAR table Michael S. Tsirkin
                     ` (24 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-8-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.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 87a94a59fa..0361c84c5e 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1090,6 +1090,18 @@ static void test_acpi_q35_tcg_nohpet(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_kvm_dmar(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".dmar";
+    test_acpi_one("-machine kernel-irqchip=split -accel kvm"
+                  " -device intel-iommu,intremap=on,device-iotlb=on", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_piix4_tcg_numamem(void)
 {
     test_data data;
@@ -1583,6 +1595,7 @@ int main(int argc, char *argv[])
         }
         if (has_kvm) {
             qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
+            qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
         }
     } else if (strcmp(arch, "aarch64") == 0) {
         qtest_add_func("acpi/virt", test_acpi_virt_tcg);
-- 
MST



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

* [PULL 08/29] tests: acpi: add expected blob for DMAR table
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (6 preceding siblings ...)
  2021-10-19 11:19   ` [PULL 07/29] tests: acpi: add testcase for intel_iommu (DMAR table) Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 09/29] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase Michael S. Tsirkin
                     ` (23 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

[000h 0000   4]                    Signature : "DMAR"    [DMA Remapping table]
[004h 0004   4]                 Table Length : 00000078
[008h 0008   1]                     Revision : 01
[009h 0009   1]                     Checksum : 15
[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   1]           Host Address Width : 26
[025h 0037   1]                        Flags : 01
[026h 0038  10]                     Reserved : 00 00 00 00 00 00 00 00 00 00

[030h 0048   2]                Subtable Type : 0000 [Hardware Unit Definition]
[032h 0050   2]                       Length : 0040

[034h 0052   1]                        Flags : 00
[035h 0053   1]                     Reserved : 00
[036h 0054   2]           PCI Segment Number : 0000
[038h 0056   8]        Register Base Address : 00000000FED90000

[040h 0064   1]            Device Scope Type : 03 [IOAPIC Device]
[041h 0065   1]                 Entry Length : 08
[042h 0066   2]                     Reserved : 0000
[044h 0068   1]               Enumeration ID : 00
[045h 0069   1]               PCI Bus Number : FF

[046h 0070   2]                     PCI Path : 00,00

[048h 0072   1]            Device Scope Type : 01 [PCI Endpoint Device]
[049h 0073   1]                 Entry Length : 08
[04Ah 0074   2]                     Reserved : 0000
[04Ch 0076   1]               Enumeration ID : 00
[04Dh 0077   1]               PCI Bus Number : 00

[04Eh 0078   2]                     PCI Path : 00,00

[050h 0080   1]            Device Scope Type : 01 [PCI Endpoint Device]
[051h 0081   1]                 Entry Length : 08
[052h 0082   2]                     Reserved : 0000
[054h 0084   1]               Enumeration ID : 00
[055h 0085   1]               PCI Bus Number : 00

[056h 0086   2]                     PCI Path : 01,00

[058h 0088   1]            Device Scope Type : 01 [PCI Endpoint Device]
[059h 0089   1]                 Entry Length : 08
[05Ah 0090   2]                     Reserved : 0000
[05Ch 0092   1]               Enumeration ID : 00
[05Dh 0093   1]               PCI Bus Number : 00

[05Eh 0094   2]                     PCI Path : 1F,00

[060h 0096   1]            Device Scope Type : 01 [PCI Endpoint Device]
[061h 0097   1]                 Entry Length : 08
[062h 0098   2]                     Reserved : 0000
[064h 0100   1]               Enumeration ID : 00
[065h 0101   1]               PCI Bus Number : 00

[066h 0102   2]                     PCI Path : 1F,02

[068h 0104   1]            Device Scope Type : 01 [PCI Endpoint Device]
[069h 0105   1]                 Entry Length : 08
[06Ah 0106   2]                     Reserved : 0000
[06Ch 0108   1]               Enumeration ID : 00
[06Dh 0109   1]               PCI Bus Number : 00

[06Eh 0110   2]                     PCI Path : 1F,03

[070h 0112   2]                Subtable Type : 0002 [Root Port ATS Capability]
[072h 0114   2]                       Length : 0008

[074h 0116   1]                        Flags : 01
[075h 0117   1]                     Reserved : 00
[076h 0118   2]           PCI Segment Number : 0000

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-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 |   1 -
 tests/data/acpi/q35/DMAR.dmar               | Bin 0 -> 120 bytes
 2 files changed, 1 deletion(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index a2843335c8..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DMAR.dmar",
diff --git a/tests/data/acpi/q35/DMAR.dmar b/tests/data/acpi/q35/DMAR.dmar
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0dca6e68ad8a8ca5b981bcfbc745385a63e9f216 100644
GIT binary patch
literal 120
zcmZ?qbquOtU|?Vrb@F%i2v%^42yj*a0!E-1hz+9EKm;5(Kv_5cff&pjK;l18KZphb
W2+atk<zX}vL|mSkiGhOwWE=ohp9%p0

literal 0
HcmV?d00001

-- 
MST



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

* [PULL 09/29] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (7 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 08/29] tests: acpi: add expected blob for DMAR table Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 10/29] tests: acpi: add testcase for amd-iommu (IVRS table) Michael S. Tsirkin
                     ` (22 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-10-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 | 2 ++
 tests/data/acpi/q35/DSDT.ivrs               | 0
 tests/data/acpi/q35/IVRS.ivrs               | 0
 3 files changed, 2 insertions(+)
 create mode 100644 tests/data/acpi/q35/DSDT.ivrs
 create mode 100644 tests/data/acpi/q35/IVRS.ivrs

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..4fe8e8272a 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,3 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.ivrs",
+"tests/data/acpi/q35/IVRS.ivrs",
diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/IVRS.ivrs b/tests/data/acpi/q35/IVRS.ivrs
new file mode 100644
index 0000000000..e69de29bb2
-- 
MST



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

* [PULL 10/29] tests: acpi: add testcase for amd-iommu (IVRS table)
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (8 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 09/29] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 11/29] tests: acpi: update expected blobs Michael S. Tsirkin
                     ` (21 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-11-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.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 0361c84c5e..ef28bb41f3 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1102,6 +1102,18 @@ static void test_acpi_q35_kvm_dmar(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_ivrs(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".ivrs";
+    data.tcg_only = true,
+    test_acpi_one(" -device amd-iommu", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_piix4_tcg_numamem(void)
 {
     test_data data;
@@ -1581,6 +1593,7 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/q35/smm-compat-nosmm",
                        test_acpi_q35_tcg_smm_compat_nosmm);
         qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
+        qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs);
         qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
         qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
         qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
-- 
MST



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

* [PULL 11/29] tests: acpi: update expected blobs
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (9 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 10/29] tests: acpi: add testcase for amd-iommu (IVRS table) Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 12/29] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg() Michael S. Tsirkin
                     ` (20 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

DSDT:
+            Device (S10)
+            {
+                Name (_ADR, 0x00020000)  // _ADR: Address
+            }

New IVRS table:

[000h 0000   4]                    Signature : "IVRS"    [I/O Virtualization Reporting Structure]
[004h 0004   4]                 Table Length : 00000068
[008h 0008   1]                     Revision : 01
[009h 0009   1]                     Checksum : 43
[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   4]          Virtualization Info : 00002800
[028h 0040   8]                     Reserved : 0000000000000000

[030h 0048   1]                Subtable Type : 10 [Hardware Definition Block]
[031h 0049   1]                        Flags : D1
[032h 0050   2]                       Length : 0038
[034h 0052   2]                     DeviceId : 0010

[036h 0054   2]            Capability Offset : 0040
[038h 0056   8]                 Base Address : 00000000FED80000
[040h 0064   2]            PCI Segment Group : 0000
[042h 0066   2]          Virtualization Info : 0000
[044h 0068   4]                     Reserved : 00000044

[048h 0072   1]                   Entry Type : 02
[049h 0073   2]                    Device ID : 0000
[04Bh 0075   1]                 Data Setting : 00

[04Ch 0076   1]                   Entry Type : 02
[04Dh 0077   2]                    Device ID : 0008
[04Fh 0079   1]                 Data Setting : 00

[050h 0080   1]                   Entry Type : 02
[051h 0081   2]                    Device ID : 0010
[053h 0083   1]                 Data Setting : 00

[054h 0084   1]                   Entry Type : 02
[055h 0085   2]                    Device ID : 00F8
[057h 0087   1]                 Data Setting : 00

[058h 0088   1]                   Entry Type : 02
[059h 0089   2]                    Device ID : 00FA
[05Bh 0091   1]                 Data Setting : 00

[05Ch 0092   1]                   Entry Type : 02
[05Dh 0093   2]                    Device ID : 00FB
[05Fh 0095   1]                 Data Setting : 00

[060h 0096   1]                   Entry Type : 48
[061h 0097   2]                    Device ID : 0000
[063h 0099   1]                 Data Setting : 00
[064h 0100   1]                       Handle : 00
[065h 0101   2]        Source Used Device ID : 00A0
[067h 0103   1]                      Variety : 01

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-12-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 |   2 --
 tests/data/acpi/q35/DSDT.ivrs               | Bin 0 -> 8306 bytes
 tests/data/acpi/q35/IVRS.ivrs               | Bin 0 -> 104 bytes
 3 files changed, 2 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 4fe8e8272a..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,3 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.ivrs",
-"tests/data/acpi/q35/IVRS.ivrs",
diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b0eafe90e5832935557ec5e6802c0147c88f379c 100644
GIT binary patch
literal 8306
zcmb7JOKcm*8J^`sS}m8-lA<iX5)n?)SBiwP^J<F*C3pF<L~6yQ;si9nmF2XulOl^G
z2J%1vSpgEqhoTAVpuN$70`%6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MXcsa&G*C3Ng3<
b8B8F|0mK48`~!%80r77J1`m*;1q_S;Any(V

literal 0
HcmV?d00001

-- 
MST



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

* [PULL 12/29] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (10 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 11/29] tests: acpi: update expected blobs Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 13/29] tests: arm-cpu-features: use qtest_has_kvm() API Michael S. Tsirkin
                     ` (19 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

follow up call with smbios options generates the same ACPI tables,
so there is no need to run smbios-less variant at all.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-13-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.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index ef28bb41f3..873eb9c037 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1430,9 +1430,6 @@ static void test_acpi_virt_tcg(void)
         .scan_len = 128ULL * 1024 * 1024,
     };
 
-    test_acpi_one("-cpu cortex-a57", &data);
-    free_test_data(&data);
-
     data.smbios_cpu_max_speed = 2900;
     data.smbios_cpu_curr_speed = 2700;
     test_acpi_one("-cpu cortex-a57 "
-- 
MST



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

* [PULL 13/29] tests: arm-cpu-features: use qtest_has_kvm() API
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (11 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 12/29] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg() Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 14/29] tests: migration-test: use qtest_has_accel() API Michael S. Tsirkin
                     ` (18 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, Thomas Huth, qemu-arm,
	Igor Mammedov, Paolo Bonzini

From: Igor Mammedov <imammedo@redhat.com>

and drop custom function that were doing the job

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-14-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/arm-cpu-features.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
index 90a87f0ea9..f76652143a 100644
--- a/tests/qtest/arm-cpu-features.c
+++ b/tests/qtest/arm-cpu-features.c
@@ -26,21 +26,6 @@
                     "  'arguments': { 'type': 'full', "
 #define QUERY_TAIL  "}}"
 
-static bool kvm_enabled(QTestState *qts)
-{
-    QDict *resp, *qdict;
-    bool enabled;
-
-    resp = qtest_qmp(qts, "{ 'execute': 'query-kvm' }");
-    g_assert(qdict_haskey(resp, "return"));
-    qdict = qdict_get_qdict(resp, "return");
-    g_assert(qdict_haskey(qdict, "enabled"));
-    enabled = qdict_get_bool(qdict, "enabled");
-    qobject_unref(resp);
-
-    return enabled;
-}
-
 static QDict *do_query_no_props(QTestState *qts, const char *cpu_type)
 {
     return qtest_qmp(qts, QUERY_HEAD "'model': { 'name': %s }"
@@ -506,14 +491,6 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
 
     qts = qtest_init(MACHINE_KVM "-cpu max");
 
-    /*
-     * These tests target the 'host' CPU type, so KVM must be enabled.
-     */
-    if (!kvm_enabled(qts)) {
-        qtest_quit(qts);
-        return;
-    }
-
     /* Enabling and disabling kvm-no-adjvtime should always work. */
     assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime");
     assert_set_feature(qts, "host", "kvm-no-adjvtime", true);
@@ -637,7 +614,11 @@ int main(int argc, char **argv)
      * order avoid attempting to run an AArch32 QEMU with KVM on
      * AArch64 hosts. That won't work and isn't easy to detect.
      */
-    if (g_str_equal(qtest_get_arch(), "aarch64")) {
+    if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
+        /*
+         * This tests target the 'host' CPU type, so register it only if
+         * KVM is available.
+         */
         qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
                             NULL, test_query_cpu_model_expansion_kvm);
     }
-- 
MST



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

* [PULL 14/29] tests: migration-test: use qtest_has_accel() API
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (12 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 13/29] tests: arm-cpu-features: use qtest_has_kvm() API Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 15/29] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests Michael S. Tsirkin
                     ` (17 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, Thomas Huth, Juan Quintela,
	Dr. David Alan Gilbert, Paolo Bonzini, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210902113551.461632-15-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/migration-test.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index cc5e83d98a..7b42f6fd90 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1420,6 +1420,7 @@ static bool kvm_dirty_ring_supported(void)
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
+    const bool has_kvm = qtest_has_accel("kvm");
     int ret;
 
     g_test_init(&argc, &argv, NULL);
@@ -1434,8 +1435,7 @@ int main(int argc, char **argv)
      * some reason)
      */
     if (g_str_equal(qtest_get_arch(), "ppc64") &&
-        (access("/sys/module/kvm_hv", F_OK) ||
-         access("/dev/kvm", R_OK | W_OK))) {
+        (!has_kvm || access("/sys/module/kvm_hv", F_OK))) {
         g_test_message("Skipping test: kvm_hv not available");
         return g_test_run();
     }
@@ -1444,16 +1444,9 @@ int main(int argc, char **argv)
      * Similar to ppc64, s390x seems to be touchy with TCG, so disable it
      * there until the problems are resolved
      */
-    if (g_str_equal(qtest_get_arch(), "s390x")) {
-#if defined(HOST_S390X)
-        if (access("/dev/kvm", R_OK | W_OK)) {
-            g_test_message("Skipping test: kvm not available");
-            return g_test_run();
-        }
-#else
-        g_test_message("Skipping test: Need s390x host to work properly");
+    if (g_str_equal(qtest_get_arch(), "s390x") && !has_kvm) {
+        g_test_message("Skipping test: s390x host with KVM is required");
         return g_test_run();
-#endif
     }
 
     tmpfs = mkdtemp(template);
-- 
MST



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

* [PULL 15/29] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (13 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 14/29] tests: migration-test: use qtest_has_accel() API Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 16/29] vdpa: Skip protected ram IOMMU mappings Michael S. Tsirkin
                     ` (16 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

 .. only if TCG is available

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20210902113551.461632-16-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.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 873eb9c037..6e21a650d2 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -722,13 +722,6 @@ static void test_acpi_one(const char *params, test_data *data)
     char *args;
     bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
 
-#ifndef CONFIG_TCG
-    if (data->tcg_only) {
-        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
-        return;
-    }
-#endif /* CONFIG_TCG */
-
     args = test_acpi_create_args(data, params, use_uefi);
     data->qts = qtest_init(args);
     test_acpi_load_tables(data, use_uefi);
@@ -1544,6 +1537,7 @@ int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
     const bool has_kvm = qtest_has_accel("kvm");
+    const bool has_tcg = qtest_has_accel("tcg");
     int ret;
 
     g_test_init(&argc, &argv, NULL);
@@ -1590,7 +1584,6 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/q35/smm-compat-nosmm",
                        test_acpi_q35_tcg_smm_compat_nosmm);
         qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
-        qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs);
         qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
         qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
         qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
@@ -1600,19 +1593,24 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
         qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
         qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
-        if (strcmp(arch, "x86_64") == 0) {
-            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+        if (has_tcg) {
+            qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs);
+            if (strcmp(arch, "x86_64") == 0) {
+                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+            }
         }
         if (has_kvm) {
             qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
             qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
         }
     } else if (strcmp(arch, "aarch64") == 0) {
-        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
-        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
-        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
-        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
-        qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
+        if (has_tcg) {
+            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
+            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
+            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
+            qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
+        }
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
-- 
MST



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

* [PULL 16/29] vdpa: Skip protected ram IOMMU mappings
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (14 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 15/29] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 17/29] vdpa: Add vhost_vdpa_section_end Michael S. Tsirkin
                     ` (15 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jason Wang, Stefano Garzarella, Eugenio Pérez

From: Eugenio Pérez <eperezma@redhat.com>

Following the logic of commit 56918a126ae ("memory: Add RAM_PROTECTED
flag to skip IOMMU mappings") with VFIO, skip memory sections
inaccessible via normal mechanisms, including DMA.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20211014141236.923287-2-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 47d7a5a23d..ea1aa71ad8 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -28,6 +28,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section)
 {
     return (!memory_region_is_ram(section->mr) &&
             !memory_region_is_iommu(section->mr)) ||
+            memory_region_is_protected(section->mr) ||
            /* vhost-vDPA doesn't allow MMIO to be mapped  */
             memory_region_is_ram_device(section->mr) ||
            /*
-- 
MST



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

* [PULL 17/29] vdpa: Add vhost_vdpa_section_end
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (15 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 16/29] vdpa: Skip protected ram IOMMU mappings Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 18/29] vdpa: Check for iova range at mappings changes Michael S. Tsirkin
                     ` (14 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jason Wang, Stefano Garzarella, Eugenio Pérez

From: Eugenio Pérez <eperezma@redhat.com>

Abstract this operation, that will be reused when validating the region
against the iova range that the device supports.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20211014141236.923287-3-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index ea1aa71ad8..be7c63b4ba 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -24,6 +24,19 @@
 #include "trace.h"
 #include "qemu-common.h"
 
+/*
+ * Return one past the end of the end of section. Be careful with uint64_t
+ * conversions!
+ */
+static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section)
+{
+    Int128 llend = int128_make64(section->offset_within_address_space);
+    llend = int128_add(llend, section->size);
+    llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK));
+
+    return llend;
+}
+
 static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section)
 {
     return (!memory_region_is_ram(section->mr) &&
@@ -160,10 +173,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,
     }
 
     iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
-    llend = int128_make64(section->offset_within_address_space);
-    llend = int128_add(llend, section->size);
-    llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK));
-
+    llend = vhost_vdpa_section_end(section);
     if (int128_ge(int128_make64(iova), llend)) {
         return;
     }
@@ -221,9 +231,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
     }
 
     iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
-    llend = int128_make64(section->offset_within_address_space);
-    llend = int128_add(llend, section->size);
-    llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK));
+    llend = vhost_vdpa_section_end(section);
 
     trace_vhost_vdpa_listener_region_del(v, iova, int128_get64(llend));
 
-- 
MST



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

* [PULL 18/29] vdpa: Check for iova range at mappings changes
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (16 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 17/29] vdpa: Add vhost_vdpa_section_end Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 19/29] virtio-iommu: Remove the non transitional name Michael S. Tsirkin
                     ` (13 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jason Wang, Stefano Garzarella, Eugenio Pérez

From: Eugenio Pérez <eperezma@redhat.com>

Check vdpa device range before updating memory regions so we don't add
any outside of it, and report the invalid change if any.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20211014141236.923287-4-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 include/hw/virtio/vhost-vdpa.h |  2 ++
 hw/virtio/vhost-vdpa.c         | 60 +++++++++++++++++++++++++---------
 hw/virtio/trace-events         |  1 +
 3 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index a8963da2d9..c288cf7ecb 100644
--- a/include/hw/virtio/vhost-vdpa.h
+++ b/include/hw/virtio/vhost-vdpa.h
@@ -13,6 +13,7 @@
 #define HW_VIRTIO_VHOST_VDPA_H
 
 #include "hw/virtio/virtio.h"
+#include "standard-headers/linux/vhost_types.h"
 
 typedef struct VhostVDPAHostNotifier {
     MemoryRegion mr;
@@ -24,6 +25,7 @@ typedef struct vhost_vdpa {
     uint32_t msg_type;
     bool iotlb_batch_begin_sent;
     MemoryListener listener;
+    struct vhost_vdpa_iova_range iova_range;
     struct vhost_dev *dev;
     VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX];
 } VhostVDPA;
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index be7c63b4ba..7691e904ac 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -37,20 +37,34 @@ static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section)
     return llend;
 }
 
-static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section)
+static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section,
+                                                uint64_t iova_min,
+                                                uint64_t iova_max)
 {
-    return (!memory_region_is_ram(section->mr) &&
-            !memory_region_is_iommu(section->mr)) ||
-            memory_region_is_protected(section->mr) ||
-           /* vhost-vDPA doesn't allow MMIO to be mapped  */
-            memory_region_is_ram_device(section->mr) ||
-           /*
-            * Sizing an enabled 64-bit BAR can cause spurious mappings to
-            * addresses in the upper part of the 64-bit address space.  These
-            * are never accessed by the CPU and beyond the address width of
-            * some IOMMU hardware.  TODO: VDPA should tell us the IOMMU width.
-            */
-           section->offset_within_address_space & (1ULL << 63);
+    Int128 llend;
+
+    if ((!memory_region_is_ram(section->mr) &&
+         !memory_region_is_iommu(section->mr)) ||
+        memory_region_is_protected(section->mr) ||
+        /* vhost-vDPA doesn't allow MMIO to be mapped  */
+        memory_region_is_ram_device(section->mr)) {
+        return true;
+    }
+
+    if (section->offset_within_address_space < iova_min) {
+        error_report("RAM section out of device range (min=%lu, addr=%lu)",
+                     iova_min, section->offset_within_address_space);
+        return true;
+    }
+
+    llend = vhost_vdpa_section_end(section);
+    if (int128_gt(llend, int128_make64(iova_max))) {
+        error_report("RAM section out of device range (max=%lu, end addr=%lu)",
+                     iova_max, int128_get64(llend));
+        return true;
+    }
+
+    return false;
 }
 
 static int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwaddr iova, hwaddr size,
@@ -162,7 +176,8 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,
     void *vaddr;
     int ret;
 
-    if (vhost_vdpa_listener_skipped_section(section)) {
+    if (vhost_vdpa_listener_skipped_section(section, v->iova_range.first,
+                                            v->iova_range.last)) {
         return;
     }
 
@@ -220,7 +235,8 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
     Int128 llend, llsize;
     int ret;
 
-    if (vhost_vdpa_listener_skipped_section(section)) {
+    if (vhost_vdpa_listener_skipped_section(section, v->iova_range.first,
+                                            v->iova_range.last)) {
         return;
     }
 
@@ -288,6 +304,19 @@ static void vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status)
     vhost_vdpa_call(dev, VHOST_VDPA_SET_STATUS, &s);
 }
 
+static void vhost_vdpa_get_iova_range(struct vhost_vdpa *v)
+{
+    int ret = vhost_vdpa_call(v->dev, VHOST_VDPA_GET_IOVA_RANGE,
+                              &v->iova_range);
+    if (ret != 0) {
+        v->iova_range.first = 0;
+        v->iova_range.last = UINT64_MAX;
+    }
+
+    trace_vhost_vdpa_get_iova_range(v->dev, v->iova_range.first,
+                                    v->iova_range.last);
+}
+
 static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
 {
     struct vhost_vdpa *v;
@@ -300,6 +329,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
     v->listener = vhost_vdpa_memory_listener;
     v->msg_type = VHOST_IOTLB_MSG_V2;
 
+    vhost_vdpa_get_iova_range(v);
     vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE |
                                VIRTIO_CONFIG_S_DRIVER);
 
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 8ed19e9d0c..650e521e35 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -52,6 +52,7 @@ vhost_vdpa_set_vring_call(void *dev, unsigned int index, int fd) "dev: %p index:
 vhost_vdpa_get_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRIx64
 vhost_vdpa_set_owner(void *dev) "dev: %p"
 vhost_vdpa_vq_get_addr(void *dev, void *vq, uint64_t desc_user_addr, uint64_t avail_user_addr, uint64_t used_user_addr) "dev: %p vq: %p desc_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64
+vhost_vdpa_get_iova_range(void *dev, uint64_t first, uint64_t last) "dev: %p first: 0x%"PRIx64" last: 0x%"PRIx64
 
 # virtio.c
 virtqueue_alloc_element(void *elem, size_t sz, unsigned in_num, unsigned out_num) "elem %p size %zd in_num %u out_num %u"
-- 
MST



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

* [PULL 19/29] virtio-iommu: Remove the non transitional name
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (17 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 18/29] vdpa: Check for iova range at mappings changes Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 20/29] virtio-iommu: Drop base_name and change generic_name Michael S. Tsirkin
                     ` (12 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jean-Philippe Brucker, Cornelia Huck,
	Andrea Bolognani, Eric Auger

From: Eric Auger <eric.auger@redhat.com>

Remove the non transitional name for virtio iommu. Like other
devices introduced after 1.0 spec, the virtio-iommu does
not need it.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20211013191755.767468-2-eric.auger@redhat.com>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio-iommu-pci.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
index 770c286be7..86fa4e6c28 100644
--- a/hw/virtio/virtio-iommu-pci.c
+++ b/hw/virtio/virtio-iommu-pci.c
@@ -100,7 +100,6 @@ static void virtio_iommu_pci_instance_init(Object *obj)
 static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = {
     .base_name             = TYPE_VIRTIO_IOMMU_PCI,
     .generic_name          = "virtio-iommu-pci",
-    .non_transitional_name = "virtio-iommu-pci-non-transitional",
     .instance_size = sizeof(VirtIOIOMMUPCI),
     .instance_init = virtio_iommu_pci_instance_init,
     .class_init    = virtio_iommu_pci_class_init,
-- 
MST



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

* [PULL 20/29] virtio-iommu: Drop base_name and change generic_name
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (18 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 19/29] virtio-iommu: Remove the non transitional name Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 21/29] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr Michael S. Tsirkin
                     ` (11 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jean-Philippe Brucker, Cornelia Huck, Eric Auger

From: Eric Auger <eric.auger@redhat.com>

Drop base_name and turn generic_name into
"virtio-iommu-pci". This is more in line with
other modern-only devices.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Suggested-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20211013191755.767468-3-eric.auger@redhat.com>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio-iommu.h | 2 +-
 hw/virtio/virtio-iommu-pci.c     | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-iommu.h
index 273e35c04b..e2339e5b72 100644
--- a/include/hw/virtio/virtio-iommu.h
+++ b/include/hw/virtio/virtio-iommu.h
@@ -26,7 +26,7 @@
 #include "qom/object.h"
 
 #define TYPE_VIRTIO_IOMMU "virtio-iommu-device"
-#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-device-base"
+#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-pci"
 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOIOMMU, VIRTIO_IOMMU)
 
 #define TYPE_VIRTIO_IOMMU_MEMORY_REGION "virtio-iommu-memory-region"
diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
index 86fa4e6c28..a160ae6b41 100644
--- a/hw/virtio/virtio-iommu-pci.c
+++ b/hw/virtio/virtio-iommu-pci.c
@@ -98,8 +98,7 @@ static void virtio_iommu_pci_instance_init(Object *obj)
 }
 
 static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = {
-    .base_name             = TYPE_VIRTIO_IOMMU_PCI,
-    .generic_name          = "virtio-iommu-pci",
+    .generic_name          = TYPE_VIRTIO_IOMMU_PCI,
     .instance_size = sizeof(VirtIOIOMMUPCI),
     .instance_init = virtio_iommu_pci_instance_init,
     .class_init    = virtio_iommu_pci_class_init,
-- 
MST



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

* [PULL 21/29] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (19 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 20/29] virtio-iommu: Drop base_name and change generic_name Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 22/29] vhost-user-rng: Add vhost-user-rng implementation Michael S. Tsirkin
                     ` (10 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, David Hildenbrand, qemu-stable, Coiby Xu,
	Raphael Norwitz, Stefan Hajnoczi, Paolo Bonzini,
	Marc-André Lureau

From: David Hildenbrand <david@redhat.com>

We end up not copying the mmap_addr of all existing regions, resulting
in a SEGFAULT once we actually try to map/access anything within our
memory regions.

Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user")
Cc: qemu-stable@nongnu.org
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Coiby Xu <coiby.xu@gmail.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20211011201047.62587-1-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 subprojects/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index bf09693255..787f4d2d4f 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
             shadow_regions[j].gpa = dev->regions[i].gpa;
             shadow_regions[j].size = dev->regions[i].size;
             shadow_regions[j].qva = dev->regions[i].qva;
+            shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr;
             shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset;
             j++;
         } else {
-- 
MST



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

* [PULL 22/29] vhost-user-rng: Add vhost-user-rng implementation
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (20 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 21/29] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 23/29] vhost-user-rng-pci: Add vhost-user-rng-pci implementation Michael S. Tsirkin
                     ` (9 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennée, Mathieu Poirier

From: Mathieu Poirier <mathieu.poirier@linaro.org>

Introduce a random number generator (RNG) backend that communicates
with a vhost-user server to retrieve entropy.  That way other VMM
that comply with the vhost user protocl can use the same vhost-user
daemon without having to write yet another RNG driver.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Message-Id: <20211012205904.4106769-2-mathieu.poirier@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/vhost-user-rng.h |  33 ++++
 hw/virtio/vhost-user-rng.c         | 289 +++++++++++++++++++++++++++++
 hw/virtio/Kconfig                  |   5 +
 hw/virtio/meson.build              |   1 +
 4 files changed, 328 insertions(+)
 create mode 100644 include/hw/virtio/vhost-user-rng.h
 create mode 100644 hw/virtio/vhost-user-rng.c

diff --git a/include/hw/virtio/vhost-user-rng.h b/include/hw/virtio/vhost-user-rng.h
new file mode 100644
index 0000000000..071539996d
--- /dev/null
+++ b/include/hw/virtio/vhost-user-rng.h
@@ -0,0 +1,33 @@
+/*
+ * Vhost-user RNG virtio device
+ *
+ * Copyright (c) 2021 Mathieu Poirier <mathieu.poirier@linaro.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef _QEMU_VHOST_USER_RNG_H
+#define _QEMU_VHOST_USER_RNG_H
+
+#include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
+#include "hw/virtio/vhost-user.h"
+#include "chardev/char-fe.h"
+
+#define TYPE_VHOST_USER_RNG "vhost-user-rng"
+OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRNG, VHOST_USER_RNG)
+
+struct VHostUserRNG {
+    /*< private >*/
+    VirtIODevice parent;
+    CharBackend chardev;
+    struct vhost_virtqueue *vhost_vq;
+    struct vhost_dev vhost_dev;
+    VhostUserState vhost_user;
+    VirtQueue *req_vq;
+    bool connected;
+
+    /*< public >*/
+};
+
+#endif /* _QEMU_VHOST_USER_RNG_H */
diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c
new file mode 100644
index 0000000000..209ee5bf9a
--- /dev/null
+++ b/hw/virtio/vhost-user-rng.c
@@ -0,0 +1,289 @@
+/*
+ * Vhost-user RNG virtio device
+ *
+ * Copyright (c) 2021 Mathieu Poirier <mathieu.poirier@linaro.org>
+ *
+ * Implementation seriously tailored on vhost-user-i2c.c
+ *
+ * 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-rng.h"
+#include "qemu/error-report.h"
+#include "standard-headers/linux/virtio_ids.h"
+
+static void vu_rng_start(VirtIODevice *vdev)
+{
+    VHostUserRNG *rng = VHOST_USER_RNG(vdev);
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    int ret;
+    int i;
+
+    if (!k->set_guest_notifiers) {
+        error_report("binding does not support guest notifiers");
+        return;
+    }
+
+    ret = vhost_dev_enable_notifiers(&rng->vhost_dev, vdev);
+    if (ret < 0) {
+        error_report("Error enabling host notifiers: %d", -ret);
+        return;
+    }
+
+    ret = k->set_guest_notifiers(qbus->parent, rng->vhost_dev.nvqs, true);
+    if (ret < 0) {
+        error_report("Error binding guest notifier: %d", -ret);
+        goto err_host_notifiers;
+    }
+
+    rng->vhost_dev.acked_features = vdev->guest_features;
+    ret = vhost_dev_start(&rng->vhost_dev, vdev);
+    if (ret < 0) {
+        error_report("Error starting vhost-user-rng: %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 < rng->vhost_dev.nvqs; i++) {
+        vhost_virtqueue_mask(&rng->vhost_dev, vdev, i, false);
+    }
+
+    return;
+
+err_guest_notifiers:
+    k->set_guest_notifiers(qbus->parent, rng->vhost_dev.nvqs, false);
+err_host_notifiers:
+    vhost_dev_disable_notifiers(&rng->vhost_dev, vdev);
+}
+
+static void vu_rng_stop(VirtIODevice *vdev)
+{
+    VHostUserRNG *rng = VHOST_USER_RNG(vdev);
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    int ret;
+
+    if (!k->set_guest_notifiers) {
+        return;
+    }
+
+    vhost_dev_stop(&rng->vhost_dev, vdev);
+
+    ret = k->set_guest_notifiers(qbus->parent, rng->vhost_dev.nvqs, false);
+    if (ret < 0) {
+        error_report("vhost guest notifier cleanup failed: %d", ret);
+        return;
+    }
+
+    vhost_dev_disable_notifiers(&rng->vhost_dev, 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;
+    }
+
+    if (rng->vhost_dev.started == should_start) {
+        return;
+    }
+
+    if (should_start) {
+        vu_rng_start(vdev);
+    } else {
+        vu_rng_stop(vdev);
+    }
+}
+
+static uint64_t vu_rng_get_features(VirtIODevice *vdev,
+                                    uint64_t requested_features, Error **errp)
+{
+    /* No feature bits used yet */
+    return requested_features;
+}
+
+static void vu_rng_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_rng_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
+{
+    VHostUserRNG *rng = VHOST_USER_RNG(vdev);
+
+    vhost_virtqueue_mask(&rng->vhost_dev, vdev, idx, mask);
+}
+
+static bool vu_rng_guest_notifier_pending(VirtIODevice *vdev, int idx)
+{
+    VHostUserRNG *rng = VHOST_USER_RNG(vdev);
+
+    return vhost_virtqueue_pending(&rng->vhost_dev, idx);
+}
+
+static void vu_rng_connect(DeviceState *dev)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserRNG *rng = VHOST_USER_RNG(vdev);
+
+    if (rng->connected) {
+        return;
+    }
+
+    rng->connected = true;
+
+    /* restore vhost state */
+    if (virtio_device_started(vdev, vdev->status)) {
+        vu_rng_start(vdev);
+    }
+}
+
+static void vu_rng_disconnect(DeviceState *dev)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserRNG *rng = VHOST_USER_RNG(vdev);
+
+    if (!rng->connected) {
+        return;
+    }
+
+    rng->connected = false;
+
+    if (rng->vhost_dev.started) {
+        vu_rng_stop(vdev);
+    }
+}
+
+static void vu_rng_event(void *opaque, QEMUChrEvent event)
+{
+    DeviceState *dev = opaque;
+
+    switch (event) {
+    case CHR_EVENT_OPENED:
+        vu_rng_connect(dev);
+        break;
+    case CHR_EVENT_CLOSED:
+        vu_rng_disconnect(dev);
+        break;
+    case CHR_EVENT_BREAK:
+    case CHR_EVENT_MUX_IN:
+    case CHR_EVENT_MUX_OUT:
+        /* Ignore */
+        break;
+    }
+}
+
+static void vu_rng_device_realize(DeviceState *dev, Error **errp)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserRNG *rng = VHOST_USER_RNG(dev);
+    int ret;
+
+    if (!rng->chardev.chr) {
+        error_setg(errp, "missing chardev");
+        return;
+    }
+
+    if (!vhost_user_init(&rng->vhost_user, &rng->chardev, errp)) {
+        return;
+    }
+
+    virtio_init(vdev, "vhost-user-rng", VIRTIO_ID_RNG, 0);
+
+    rng->req_vq = virtio_add_queue(vdev, 4, vu_rng_handle_output);
+    if (!rng->req_vq) {
+        error_setg_errno(errp, -1, "virtio_add_queue() failed");
+        goto virtio_add_queue_failed;
+    }
+
+    rng->vhost_dev.nvqs = 1;
+    rng->vhost_dev.vqs = g_new0(struct vhost_virtqueue, rng->vhost_dev.nvqs);
+    ret = vhost_dev_init(&rng->vhost_dev, &rng->vhost_user,
+                         VHOST_BACKEND_TYPE_USER, 0, errp);
+    if (ret < 0) {
+        error_setg_errno(errp, -ret, "vhost_dev_init() failed");
+        goto vhost_dev_init_failed;
+    }
+
+    qemu_chr_fe_set_handlers(&rng->chardev, NULL, NULL, vu_rng_event, NULL,
+                             dev, NULL, true);
+
+    return;
+
+vhost_dev_init_failed:
+    virtio_delete_queue(rng->req_vq);
+virtio_add_queue_failed:
+    virtio_cleanup(vdev);
+    vhost_user_cleanup(&rng->vhost_user);
+}
+
+static void vu_rng_device_unrealize(DeviceState *dev)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
+    VHostUserRNG *rng = VHOST_USER_RNG(dev);
+
+    vu_rng_set_status(vdev, 0);
+
+    vhost_dev_cleanup(&rng->vhost_dev);
+    g_free(rng->vhost_dev.vqs);
+    rng->vhost_dev.vqs = NULL;
+    virtio_delete_queue(rng->req_vq);
+    virtio_cleanup(vdev);
+    vhost_user_cleanup(&rng->vhost_user);
+}
+
+static const VMStateDescription vu_rng_vmstate = {
+    .name = "vhost-user-rng",
+    .unmigratable = 1,
+};
+
+static Property vu_rng_properties[] = {
+    DEFINE_PROP_CHR("chardev", VHostUserRNG, chardev),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void vu_rng_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
+
+    device_class_set_props(dc, vu_rng_properties);
+    dc->vmsd = &vu_rng_vmstate;
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+
+    vdc->realize = vu_rng_device_realize;
+    vdc->unrealize = vu_rng_device_unrealize;
+    vdc->get_features = vu_rng_get_features;
+    vdc->set_status = vu_rng_set_status;
+    vdc->guest_notifier_mask = vu_rng_guest_notifier_mask;
+    vdc->guest_notifier_pending = vu_rng_guest_notifier_pending;
+}
+
+static const TypeInfo vu_rng_info = {
+    .name = TYPE_VHOST_USER_RNG,
+    .parent = TYPE_VIRTIO_DEVICE,
+    .instance_size = sizeof(VHostUserRNG),
+    .class_init = vu_rng_class_init,
+};
+
+static void vu_rng_register_types(void)
+{
+    type_register_static(&vu_rng_info);
+}
+
+type_init(vu_rng_register_types)
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index 35ab45e209..c144d42f9b 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -63,3 +63,8 @@ config VHOST_USER_I2C
     bool
     default y
     depends on VIRTIO && VHOST_USER
+
+config VHOST_USER_RNG
+    bool
+    default y
+    depends on VIRTIO && VHOST_USER
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index bc352a6009..ae6b2cde10 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -27,6 +27,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_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_true: files('vhost-user-i2c-pci.c'))
+virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.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] 38+ messages in thread

* [PULL 23/29] vhost-user-rng-pci: Add vhost-user-rng-pci implementation
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (21 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 22/29] vhost-user-rng: Add vhost-user-rng implementation Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 24/29] docs: Add documentation for vhost based RNG implementation Michael S. Tsirkin
                     ` (8 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennée, Mathieu Poirier

From: Mathieu Poirier <mathieu.poirier@linaro.org>

This patch provides a PCI bus interface to the vhost-user-rng backend.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Message-Id: <20211012205904.4106769-3-mathieu.poirier@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-user-rng-pci.c | 79 ++++++++++++++++++++++++++++++++++
 hw/virtio/meson.build          |  1 +
 2 files changed, 80 insertions(+)
 create mode 100644 hw/virtio/vhost-user-rng-pci.c

diff --git a/hw/virtio/vhost-user-rng-pci.c b/hw/virtio/vhost-user-rng-pci.c
new file mode 100644
index 0000000000..c83dc86813
--- /dev/null
+++ b/hw/virtio/vhost-user-rng-pci.c
@@ -0,0 +1,79 @@
+/*
+ * Vhost-user RNG virtio device PCI glue
+ *
+ * Copyright (c) 2021 Mathieu Poirier <mathieu.poirier@linaro.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/qdev-properties.h"
+#include "hw/virtio/vhost-user-rng.h"
+#include "virtio-pci.h"
+
+struct VHostUserRNGPCI {
+    VirtIOPCIProxy parent_obj;
+    VHostUserRNG vdev;
+};
+
+typedef struct VHostUserRNGPCI VHostUserRNGPCI;
+
+#define TYPE_VHOST_USER_RNG_PCI "vhost-user-rng-pci-base"
+
+DECLARE_INSTANCE_CHECKER(VHostUserRNGPCI, VHOST_USER_RNG_PCI,
+                         TYPE_VHOST_USER_RNG_PCI)
+
+static Property vhost_user_rng_pci_properties[] = {
+    DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
+                       DEV_NVECTORS_UNSPECIFIED),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void vhost_user_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
+{
+    VHostUserRNGPCI *dev = VHOST_USER_RNG_PCI(vpci_dev);
+    DeviceState *vdev = DEVICE(&dev->vdev);
+
+    if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
+        vpci_dev->nvectors = 1;
+    }
+
+    qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
+}
+
+static void vhost_user_rng_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_rng_pci_realize;
+    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
+    device_class_set_props(dc, vhost_user_rng_pci_properties);
+    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_OTHERS;
+}
+
+static void vhost_user_rng_pci_instance_init(Object *obj)
+{
+    VHostUserRNGPCI *dev = VHOST_USER_RNG_PCI(obj);
+
+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+                                TYPE_VHOST_USER_RNG);
+}
+
+static const VirtioPCIDeviceTypeInfo vhost_user_rng_pci_info = {
+    .base_name = TYPE_VHOST_USER_RNG_PCI,
+    .non_transitional_name = "vhost-user-rng-pci",
+    .instance_size = sizeof(VHostUserRNGPCI),
+    .instance_init = vhost_user_rng_pci_instance_init,
+    .class_init = vhost_user_rng_pci_class_init,
+};
+
+static void vhost_user_rng_pci_register(void)
+{
+    virtio_pci_types_register(&vhost_user_rng_pci_info);
+}
+
+type_init(vhost_user_rng_pci_register);
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index ae6b2cde10..521f7d64a8 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -28,6 +28,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_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_true: files('vhost-user-i2c-pci.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c'))
+virtio_ss.add(when: ['CONFIG_VHOST_USER_RNG', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-rng-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] 38+ messages in thread

* [PULL 24/29] docs: Add documentation for vhost based RNG implementation
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (22 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 23/29] vhost-user-rng-pci: Add vhost-user-rng-pci implementation Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 25/29] vhost-user: fix duplicated notifier MR init Michael S. Tsirkin
                     ` (7 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Alex Bennée, Stefan Hajnoczi,
	Mathieu Poirier, Markus Armbruster

From: Mathieu Poirier <mathieu.poirier@linaro.org>

Add description and example for the vhost-user based RNG implementation.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Message-Id: <20211012205904.4106769-4-mathieu.poirier@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 docs/system/device-emulation.rst       |  1 +
 docs/system/devices/vhost-user-rng.rst | 39 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 docs/system/devices/vhost-user-rng.rst

diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulation.rst
index 7afcfd8064..19944f526c 100644
--- a/docs/system/device-emulation.rst
+++ b/docs/system/device-emulation.rst
@@ -88,3 +88,4 @@ Emulated Devices
    devices/usb.rst
    devices/vhost-user.rst
    devices/virtio-pmem.rst
+   devices/vhost-user-rng.rst
diff --git a/docs/system/devices/vhost-user-rng.rst b/docs/system/devices/vhost-user-rng.rst
new file mode 100644
index 0000000000..a145d4105c
--- /dev/null
+++ b/docs/system/devices/vhost-user-rng.rst
@@ -0,0 +1,39 @@
+QEMU vhost-user-rng - RNG emulation
+===================================
+
+Background
+----------
+
+What follows builds on the material presented in vhost-user.rst - it should
+be reviewed before moving forward with the content in this file.
+
+Description
+-----------
+
+The vhost-user-rng device implementation was designed to work with a random
+number generator daemon such as the one found in the vhost-device crate of
+the rust-vmm project available on github [1].
+
+[1]. https://github.com/rust-vmm/vhost-device
+
+Examples
+--------
+
+The daemon should be started first:
+
+::
+
+  host# vhost-device-rng --socket-path=rng.sock -c 1 -m 512 -p 1000
+
+The QEMU invocation needs to create a chardev socket the device can
+use to communicate as well as share the guests memory over a memfd.
+
+::
+
+  host# qemu-system								\
+      -chardev socket,path=$(PATH)/rng.sock,id=rng0				\
+      -device vhost-user-rng-pci,chardev=rng0					\
+      -m 4096 									\
+      -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on	\
+      -numa node,memdev=mem							\
+      ...
-- 
MST



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

* [PULL 25/29] vhost-user: fix duplicated notifier MR init
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (23 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 24/29] docs: Add documentation for vhost based RNG implementation Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 26/29] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob Michael S. Tsirkin
                     ` (6 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yuwei Zhang, Peter Maydell, tiwei.bie, Xueming Li, qemu-stable

From: Xueming Li <xuemingl@nvidia.com>

In case of device resume after suspend, VQ notifier MR still valid.
Duplicated registrations explode memory block list and slow down device
resume.

Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
Cc: tiwei.bie@intel.com
Cc: qemu-stable@nongnu.org
Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 2c8556237f..bf6e50223c 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1526,8 +1526,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
 
     name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]",
                            user, queue_idx);
-    memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
-                                      page_size, addr);
+    if (!n->mr.ram) /* Don't init again after suspend. */
+        memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
+                                          page_size, addr);
     g_free(name);
 
     if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
-- 
MST



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

* [PULL 26/29] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (24 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 25/29] vhost-user: fix duplicated notifier MR init Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:20   ` [PULL 27/29] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35 Michael S. Tsirkin
                     ` (5 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Ani Sinha <ani@anisinha.ca>

We are adding a new unit test to cover the acpi hotplug support in q35 for
multi-function bridges. This test uses a new table DSDT.multi-bridge.
We need to allow changes in DSDT acpi table for addition of this new
unit test.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Message-Id: <20211007135750.1277213-2-ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 tests/data/acpi/q35/DSDT.multi-bridge       | 0
 2 files changed, 1 insertion(+)
 create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..dabc024f53 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.multi-bridge",
diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
new file mode 100644
index 0000000000..e69de29bb2
-- 
MST



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

* [PULL 27/29] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (25 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 26/29] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob Michael S. Tsirkin
@ 2021-10-19 11:20   ` Michael S. Tsirkin
  2021-10-19 11:21   ` [PULL 28/29] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test Michael S. Tsirkin
                     ` (4 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Ani Sinha <ani@anisinha.ca>

commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges")
added ACPI hotplug descriptions for cold plugged bridges for functions other
than 0. For all other devices, the ACPI hotplug descriptions are limited to
function 0 only. This change adds unit tests for this feature.

This test adds the following devices to qemu and then checks the changes
introduced in the DSDT table due to the addition of the following devices:

(a) a multifunction bridge device
(b) a bridge device with function 1
(c) a non-bridge device with function 2

In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
For (a) we should find a hotplug AML description for function 0.

The following diff compares the DSDT table AML with the new unit test before
and after the change d7346e614f4ec is introduced. In other words,
this diff reflects the changes that occurs in the DSDT table due to the change
d7346e614f4ec .

@@ -1,60 +1,38 @@
 /*
  * Intel ACPI Component Architecture
  * AML/ASL+ Disassembler version 20190509 (64-bit version)
  * Copyright (c) 2000 - 2019 Intel Corporation
  *
  * Disassembling to symbolic ASL+ operators
  *
- * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct  7 18:56:05 2021
+ * Disassembly of /tmp/aml-AN0DA1, Thu Oct  7 18:56:05 2021
  *
  * Original Table Header:
  *     Signature        "DSDT"
- *     Length           0x000020FE (8446)
+ *     Length           0x00002187 (8583)
  *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
- *     Checksum         0xDE
+ *     Checksum         0x8D
  *     OEM ID           "BOCHS "
  *     OEM Table ID     "BXPC    "
  *     OEM Revision     0x00000001 (1)
  *     Compiler ID      "BXPC"
  *     Compiler Version 0x00000001 (1)
  */
 DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
 {
-    /*
-     * iASL Warning: There was 1 external control method found during
-     * disassembly, but only 0 were resolved (1 unresolved). Additional
-     * ACPI tables may be required to properly disassemble the code. This
-     * resulting disassembler output file may not compile because the
-     * disassembler did not know how many arguments to assign to the
-     * unresolved methods. Note: SSDTs can be dynamically loaded at
-     * runtime and may or may not be available via the host OS.
-     *
-     * In addition, the -fe option can be used to specify a file containing
-     * control method external declarations with the associated method
-     * argument counts. Each line of the file must be of the form:
-     *     External (<method pathname>, MethodObj, <argument count>)
-     * Invocation:
-     *     iasl -fe refs.txt -d dsdt.aml
-     *
-     * The following methods were unresolved and many not compile properly
-     * because the disassembler had to guess at the number of arguments
-     * required for each:
-     */
-    External (_SB_.PCI0.S19_.PCNT, MethodObj)    // Warning: Unknown method, guessing 1 arguments
-
     Scope (\)
     {
         OperationRegion (DBG, SystemIO, 0x0402, One)
         Field (DBG, ByteAcc, NoLock, Preserve)
         {
             DBGB,   8
         }

         Method (DBUG, 1, NotSerialized)
         {
             ToHexString (Arg0, Local0)
             ToBuffer (Local0, Local0)
             Local1 = (SizeOf (Local0) - One)
             Local2 = Zero
             While ((Local2 < Local1))
             {
@@ -3322,24 +3300,60 @@
                 Method (DVNT, 2, NotSerialized)
                 {
                     If ((Arg0 & One))
                     {
                         Notify (S00, Arg1)
                     }
                 }

                 Method (PCNT, 0, NotSerialized)
                 {
                     BNUM = One
                     DVNT (PCIU, One)
                     DVNT (PCID, 0x03)
                 }
             }

+            Device (S19)
+            {
+                Name (_ADR, 0x00030001)  // _ADR: Address
+                Name (BSEL, Zero)
+                Device (S00)
+                {
+                    Name (_SUN, Zero)  // _SUN: Slot User Number
+                    Name (_ADR, Zero)  // _ADR: Address
+                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
+                    {
+                        PCEJ (BSEL, _SUN)
+                    }
+
+                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
+                    {
+                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
+                    }
+                }
+
+                Method (DVNT, 2, NotSerialized)
+                {
+                    If ((Arg0 & One))
+                    {
+                        Notify (S00, Arg1)
+                    }
+                }
+
+                Method (PCNT, 0, NotSerialized)
+                {
+                    BNUM = Zero
+                    DVNT (PCIU, One)
+                    DVNT (PCID, 0x03)
+                }
+            }
+
             Method (PCNT, 0, NotSerialized)
             {
-                ^S19.PCNT (^S10.PCNT ())
+                ^S19.PCNT ()
+                ^S10.PCNT ()
             }
         }
     }
 }

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Message-Id: <20211007135750.1277213-3-ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 6e21a650d2..a5546180b7 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -852,6 +852,23 @@ static void test_acpi_q35_tcg_bridge(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_multif_bridge(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".multi-bridge",
+    };
+    test_acpi_one("-device pcie-root-port,id=pcie-root-port-0,"
+                  "multifunction=on,"
+                  "port=0x0,chassis=1,addr=0x2,bus=pcie.0 "
+                  "-device pcie-root-port,id=pcie-root-port-1,"
+                  "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 "
+                  "-device virtio-balloon,id=balloon0,"
+                  "bus=pcie.0,addr=0x4.0x2",
+                  &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_mmio64(void)
 {
     test_data data = {
@@ -1563,6 +1580,7 @@ int main(int argc, char *argv[])
                        test_acpi_piix4_no_acpi_pci_hotplug);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+        qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
         qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
         qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
         qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
-- 
MST



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

* [PULL 28/29] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (26 preceding siblings ...)
  2021-10-19 11:20   ` [PULL 27/29] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35 Michael S. Tsirkin
@ 2021-10-19 11:21   ` Michael S. Tsirkin
  2021-10-19 11:21   ` [PULL 29/29] failover: fix a regression introduced by JSON'ification of -device Michael S. Tsirkin
                     ` (3 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Peter Maydell, Igor Mammedov

From: Ani Sinha <ani@anisinha.ca>

We added a new unit test for testing acpi hotplug on multifunction bridges in
q35 machines. Here, we update the DSDT table gloden master blob for this unit
test.

The test adds the following devices to qemu and then checks the changes
introduced in the DSDT table due to the addition of the following devices:

(a) a multifunction bridge device
(b) a bridge device with function 1
(c) a non-bridge device with function 2

In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
For (a) we should find a hotplug AML description for function 0.

Following is the ASL diff between the original DSDT table and the modified DSDT
table due to the unit test. We see that multifunction bridge on bus 2 and single
function bridge on bus 3 function 1 are described, not the non-bridge balloon
device on bus 4, function 2.

@@ -1,30 +1,30 @@
 /*
  * Intel ACPI Component Architecture
  * AML/ASL+ Disassembler version 20190509 (64-bit version)
  * Copyright (c) 2000 - 2019 Intel Corporation
  *
  * Disassembling to symbolic ASL+ operators
  *
- * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct  7 18:29:19 2021
+ * Disassembly of /tmp/aml-C7JCA1, Thu Oct  7 18:29:19 2021
  *
  * Original Table Header:
  *     Signature        "DSDT"
- *     Length           0x00002061 (8289)
+ *     Length           0x00002187 (8583)
  *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
- *     Checksum         0xF9
+ *     Checksum         0x8D
  *     OEM ID           "BOCHS "
  *     OEM Table ID     "BXPC    "
  *     OEM Revision     0x00000001 (1)
  *     Compiler ID      "BXPC"
  *     Compiler Version 0x00000001 (1)
  */
 DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
 {
     Scope (\)
     {
         OperationRegion (DBG, SystemIO, 0x0402, One)
         Field (DBG, ByteAcc, NoLock, Preserve)
         {
             DBGB,   8
         }

@@ -3265,23 +3265,95 @@
                 Method (_S1D, 0, NotSerialized)  // _S1D: S1 Device State
                 {
                     Return (Zero)
                 }

                 Method (_S2D, 0, NotSerialized)  // _S2D: S2 Device State
                 {
                     Return (Zero)
                 }

                 Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                 {
                     Return (Zero)
                 }
             }

+            Device (S10)
+            {
+                Name (_ADR, 0x00020000)  // _ADR: Address
+                Name (BSEL, One)
+                Device (S00)
+                {
+                    Name (_SUN, Zero)  // _SUN: Slot User Number
+                    Name (_ADR, Zero)  // _ADR: Address
+                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
+                    {
+                        PCEJ (BSEL, _SUN)
+                    }
+
+                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
+                    {
+                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
+                    }
+                }
+
+                Method (DVNT, 2, NotSerialized)
+                {
+                    If ((Arg0 & One))
+                    {
+                        Notify (S00, Arg1)
+                    }
+                }
+
+                Method (PCNT, 0, NotSerialized)
+                {
+                    BNUM = One
+                    DVNT (PCIU, One)
+                    DVNT (PCID, 0x03)
+                }
+            }
+
+            Device (S19)
+            {
+                Name (_ADR, 0x00030001)  // _ADR: Address
+                Name (BSEL, Zero)
+                Device (S00)
+                {
+                    Name (_SUN, Zero)  // _SUN: Slot User Number
+                    Name (_ADR, Zero)  // _ADR: Address
+                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
+                    {
+                        PCEJ (BSEL, _SUN)
+                    }
+
+                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
+                    {
+                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
+                    }
+                }
+
+                Method (DVNT, 2, NotSerialized)
+                {
+                    If ((Arg0 & One))
+                    {
+                        Notify (S00, Arg1)
+                    }
+                }
+
+                Method (PCNT, 0, NotSerialized)
+                {
+                    BNUM = Zero
+                    DVNT (PCIU, One)
+                    DVNT (PCID, 0x03)
+                }
+            }
+
             Method (PCNT, 0, NotSerialized)
             {
+                ^S19.PCNT ()
+                ^S10.PCNT ()
             }
         }
     }
 }

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Message-Id: <20211007135750.1277213-4-ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 0 -> 8583 bytes
 2 files changed, 1 deletion(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dabc024f53..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.multi-bridge",
diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a24c713d22102a1a1583b5c902edffe1694e5cfe 100644
GIT binary patch
literal 8583
zcmcIpOKcm*8J^`sS}j-7l3Gc&>_n`S^pzr^>^%DjO78Myi4?`9;si8G%5qxCPLV|t
z14)bkvH~QIfd)<31U=FL1N7FOdaZ$8+M90;&{Ge+<XRN*DeU*p?8q}D1;mH)u-bq2
z`{w_@*`57XGk)N=KKKq}#%~InUM0vDUTSz*{0znzozq{Znz+c?2Y#X4F;cOF(Y}%5
z=QtEh_eXwVyKMY^ulrfI`{oB-V<%*nK6gI7v=hE}vwMjV=-Q>wvgpJq&UJ!9r+w&I
z4X>IrJC&+$=kHpk+400#-0bB2CNn$RRiC*V)1A%0OWeB3JpaO4zn<*vr57xxUHj*`
zuUAk1{Id&h=I{LMAHTeH)k*+x7Jp6rJr~lUd%bI|cKgmJy?x_dqVsEO{e@3@{IY0s
z=t|h7mfN;yqOR5kSKEir`OUn?Yn*M=8#ynxhPu3FkY2S;f3VD$O@l+fKMjY&zlc-j
zyv>}NDO48CN~744Dh+5ORqcaHqg7)zV|Twvu|)fZL-E3k#k!wuH2qH2eWnw%@+_p5
zZb(f#?{qDv+qXaNby=^Q8V(1nKlgEOhy8BHX8-zca=-@Gyr?a0&AmTEwcP!NB^X0B
z-+h9rq491Xu2h43hYvB*ucDMjwYe3ux|Z#%&p#QLKti<-pIR^Y0E>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nQ{-9mCgMHa=#FaZQ+<F{awoz}QjYf<1z%X#yk7C-S^b!~xu}jT&fb$p}
z@oJ=Y<(()tE>pt6`8zQ?m7Oy9PUrbVqta-KA*OBQ`<-BrCcIzA`?_P_v5gbhru@N0
zqz}$@GE)fywd4G$PR2}FF$;@$h@Pe^q{R8j{oBw!e4=#06TUaQRjh5}F*-|VZ04#J
zJ4q)=Z*j+8zR0)sHkRlvwhvQ5E+_VkF(f|>a?gnXcg$cg<6zBa*tEpSS$T4fPTGfM
zGgyn50LPeF!21RtF+UX@2HSO%LA(8KrbDhko1+Bj;0nH|u&-$kXm=A2@ztaDjQ?W2
z73-(2?-}fU>S*6xrDu_a2JNQORg}GLL?^x#7lk|@RSnw_g`mLyQz7h_LfjQz=r5iK
P)}F_He7!|yIezv(me~h+

literal 0
HcmV?d00001

-- 
MST



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

* [PULL 29/29] failover: fix a regression introduced by JSON'ification of -device
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (27 preceding siblings ...)
  2021-10-19 11:21   ` [PULL 28/29] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test Michael S. Tsirkin
@ 2021-10-19 11:21   ` Michael S. Tsirkin
  2021-10-19 14:07   ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (2 subsequent siblings)
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 11:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Peter Maydell, Jason Wang, kwolf

From: Laurent Vivier <lvivier@redhat.com>

The hide_device helper can be called several times for the same
devices as it shouldn't change any state and should only return an
information.

But not to rely anymore on QemuOpts we have introduced a new field
to store the parameters of the device and don't allow to update it
once it is done.

And as the function is called several times, we ends with:

  warning: Cannot attach more than one primary device to 'virtio0'

That is not only a warning as it prevents to hide the device and breaks
failover.

Fix that by checking the device id.

Now, we fail only if the virtio-net device is really used by two different
devices, for instance:

   -device virtio-net-pci,id=virtio0,failover=on,... \
   -device vfio-pci,id=hostdev0,failover_pair_id=virtio0,... \
   -device e1000e,id=e1000e0,failover_pair_id=virtio0,... \

will exit with:

  Cannot attach more than one primary device to 'virtio0': 'hostdev0' and 'e1000e0'

Fixes: 259a10dbcb4f ("virtio-net: Store failover primary opts pointer locally")
Cc: kwolf@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20211019071532.682717-2-lvivier@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/net/virtio-net.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 09e173a558..83642c85b2 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3304,15 +3304,27 @@ static bool failover_hide_primary_device(DeviceListener *listener,
         return false;
     }
 
+    /*
+     * The hide helper can be called several times for a given device.
+     * Check there is only one primary for a virtio-net device but
+     * don't duplicate the qdict several times if it's called for the same
+     * device.
+     */
     if (n->primary_opts) {
-        error_setg(errp, "Cannot attach more than one primary device to '%s'",
-                   n->netclient_name);
-        return false;
+        const char *old, *new;
+        /* devices with failover_pair_id always have an id */
+        old = qdict_get_str(n->primary_opts, "id");
+        new = qdict_get_str(device_opts, "id");
+        if (strcmp(old, new) != 0) {
+            error_setg(errp, "Cannot attach more than one primary device to "
+                       "'%s': '%s' and '%s'", n->netclient_name, old, new);
+            return false;
+        }
+    } else {
+        n->primary_opts = qdict_clone_shallow(device_opts);
+        n->primary_opts_from_json = from_json;
     }
 
-    n->primary_opts = qdict_clone_shallow(device_opts);
-    n->primary_opts_from_json = from_json;
-
     /* failover_primary_hidden is set during feature negotiation */
     return qatomic_read(&n->failover_primary_hidden);
 }
-- 
MST



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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (28 preceding siblings ...)
  2021-10-19 11:21   ` [PULL 29/29] failover: fix a regression introduced by JSON'ification of -device Michael S. Tsirkin
@ 2021-10-19 14:07   ` Michael S. Tsirkin
  2021-10-19 14:08   ` [PULL 30/29] vhost-user-blk-test: pass vhost-user socket fds to QSD Michael S. Tsirkin
  2021-10-19 18:38   ` [PULL 00/29] pc,pci,virtio: features, fixes Richard Henderson
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 14:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

On Tue, Oct 19, 2021 at 07:19:40AM -0400, Michael S. Tsirkin wrote:
> The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:
> 
>   Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
> 
> 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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
> 
>   failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)


I tacked on one more patch since it fixes a test hang that has
annoyed people for a while.

> ----------------------------------------------------------------
> pc,pci,virtio: features, fixes
> 
> vhost user rng
> Fixes, cleanups all over the place.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> ----------------------------------------------------------------
> Ani Sinha (3):
>       tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
>       tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
>       tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
> 
> David Hildenbrand (1):
>       libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
> 
> Eric Auger (2):
>       virtio-iommu: Remove the non transitional name
>       virtio-iommu: Drop base_name and change generic_name
> 
> Eugenio Pérez (3):
>       vdpa: Skip protected ram IOMMU mappings
>       vdpa: Add vhost_vdpa_section_end
>       vdpa: Check for iova range at mappings changes
> 
> Igor Mammedov (15):
>       tests: acpi: dump table with failed checksum
>       tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
>       tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
>       tests: acpi: q35: test for x2APIC entries in SRAT
>       tests: acpi: update expected tables blobs
>       tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
>       tests: acpi: add testcase for intel_iommu (DMAR table)
>       tests: acpi: add expected blob for DMAR table
>       tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
>       tests: acpi: add testcase for amd-iommu (IVRS table)
>       tests: acpi: update expected blobs
>       tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
>       tests: arm-cpu-features: use qtest_has_kvm() API
>       tests: migration-test: use qtest_has_accel() API
>       tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
> 
> Laurent Vivier (1):
>       failover: fix a regression introduced by JSON'ification of -device
> 
> Mathieu Poirier (3):
>       vhost-user-rng: Add vhost-user-rng implementation
>       vhost-user-rng-pci: Add vhost-user-rng-pci implementation
>       docs: Add documentation for vhost based RNG implementation
> 
> Xueming Li (1):
>       vhost-user: fix duplicated notifier MR init
> 
>  include/hw/virtio/vhost-user-rng.h        |  33 ++++
>  include/hw/virtio/vhost-vdpa.h            |   2 +
>  include/hw/virtio/virtio-iommu.h          |   2 +-
>  tests/qtest/libqos/libqtest.h             |   8 +
>  hw/net/virtio-net.c                       |  24 ++-
>  hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
>  hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
>  hw/virtio/vhost-user.c                    |   5 +-
>  hw/virtio/vhost-vdpa.c                    |  81 ++++++---
>  hw/virtio/virtio-iommu-pci.c              |   4 +-
>  subprojects/libvhost-user/libvhost-user.c |   1 +
>  tests/qtest/acpi-utils.c                  |  14 ++
>  tests/qtest/arm-cpu-features.c            |  29 +--
>  tests/qtest/bios-tables-test.c            |  90 ++++++++--
>  tests/qtest/libqtest.c                    |  27 +++
>  tests/qtest/migration-test.c              |  15 +-
>  docs/system/device-emulation.rst          |   1 +
>  docs/system/devices/vhost-user-rng.rst    |  39 ++++
>  hw/virtio/Kconfig                         |   5 +
>  hw/virtio/meson.build                     |   2 +
>  hw/virtio/trace-events                    |   1 +
>  meson.build                               |   6 +
>  tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
>  tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
>  tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
>  tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
>  tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
>  tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
>  tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
>  tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
>  30 files changed, 672 insertions(+), 85 deletions(-)
>  create mode 100644 include/hw/virtio/vhost-user-rng.h
>  create mode 100644 hw/virtio/vhost-user-rng-pci.c
>  create mode 100644 hw/virtio/vhost-user-rng.c
>  create mode 100644 docs/system/devices/vhost-user-rng.rst
>  create mode 100644 tests/data/acpi/q35/APIC.xapic
>  create mode 100644 tests/data/acpi/q35/DMAR.dmar
>  create mode 100644 tests/data/acpi/q35/DSDT.ivrs
>  create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
>  create mode 100644 tests/data/acpi/q35/DSDT.xapic
>  create mode 100644 tests/data/acpi/q35/FACP.xapic
>  create mode 100644 tests/data/acpi/q35/IVRS.ivrs
>  create mode 100644 tests/data/acpi/q35/SRAT.xapic
> 



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

* [PULL 30/29] vhost-user-blk-test: pass vhost-user socket fds to QSD
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (29 preceding siblings ...)
  2021-10-19 14:07   ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
@ 2021-10-19 14:08   ` Michael S. Tsirkin
  2021-10-19 18:38   ` [PULL 00/29] pc,pci,virtio: features, fixes Richard Henderson
  31 siblings, 0 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-19 14:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, Thomas Huth, Coiby Xu,
	Raphael Norwitz, Stefan Hajnoczi, Paolo Bonzini

From: Stefan Hajnoczi <stefanha@redhat.com>

qemu-storage-daemon is launched with the vhost-user listen socket path.
The path is first unlinked before opening the listen socket. This
prevents stale UNIX domain socket files from stopping socket
initialization.

This behavior is undesirable in vhost-user-blk-test and the cause of a
bug:

There is a race condition in vhost-user-blk-test when QEMU launches
before QSD. It connects to the old socket that QSD unlinks and the
vhost-user connection is never serviced, resulting in a hang.

Pass the listen socket fd to QSD to maintain listen socket continuity
and prevent the lost connection.

Fixes: 806952026df41939680abe92b329715b9b4e01cc ("test: new qTest case to test the vhost-user-blk-server")
Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Coiby Xu <coiby.xu@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20211019135655.83067-1-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/vhost-user-blk-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c
index 6f108a1b62..62e670f39b 100644
--- a/tests/qtest/vhost-user-blk-test.c
+++ b/tests/qtest/vhost-user-blk-test.c
@@ -906,9 +906,9 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances,
         img_path = drive_create();
         g_string_append_printf(storage_daemon_command,
             "--blockdev driver=file,node-name=disk%d,filename=%s "
-            "--export type=vhost-user-blk,id=disk%d,addr.type=unix,addr.path=%s,"
+            "--export type=vhost-user-blk,id=disk%d,addr.type=fd,addr.str=%d,"
             "node-name=disk%i,writable=on,num-queues=%d ",
-            i, img_path, i, sock_path, i, num_queues);
+            i, img_path, i, fd, i, num_queues);
 
         g_string_append_printf(cmd_line, "-chardev socket,id=char%d,path=%s ",
                                i + 1, sock_path);
-- 
MST



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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
                     ` (30 preceding siblings ...)
  2021-10-19 14:08   ` [PULL 30/29] vhost-user-blk-test: pass vhost-user socket fds to QSD Michael S. Tsirkin
@ 2021-10-19 18:38   ` Richard Henderson
  2021-10-20  8:39     ` Igor Mammedov
  31 siblings, 1 reply; 38+ messages in thread
From: Richard Henderson @ 2021-10-19 18:38 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Peter Maydell

On 10/19/21 4:19 AM, Michael S. Tsirkin wrote:
> The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:
> 
>    Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
> 
> 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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
> 
>    failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)
> 
> ----------------------------------------------------------------
> pc,pci,virtio: features, fixes
> 
> vhost user rng
> Fixes, cleanups all over the place.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> ----------------------------------------------------------------
> Ani Sinha (3):
>        tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
>        tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
>        tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
> 
> David Hildenbrand (1):
>        libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
> 
> Eric Auger (2):
>        virtio-iommu: Remove the non transitional name
>        virtio-iommu: Drop base_name and change generic_name
> 
> Eugenio Pérez (3):
>        vdpa: Skip protected ram IOMMU mappings
>        vdpa: Add vhost_vdpa_section_end
>        vdpa: Check for iova range at mappings changes
> 
> Igor Mammedov (15):
>        tests: acpi: dump table with failed checksum
>        tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
>        tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
>        tests: acpi: q35: test for x2APIC entries in SRAT
>        tests: acpi: update expected tables blobs
>        tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
>        tests: acpi: add testcase for intel_iommu (DMAR table)
>        tests: acpi: add expected blob for DMAR table
>        tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
>        tests: acpi: add testcase for amd-iommu (IVRS table)
>        tests: acpi: update expected blobs
>        tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
>        tests: arm-cpu-features: use qtest_has_kvm() API
>        tests: migration-test: use qtest_has_accel() API
>        tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
> 
> Laurent Vivier (1):
>        failover: fix a regression introduced by JSON'ification of -device
> 
> Mathieu Poirier (3):
>        vhost-user-rng: Add vhost-user-rng implementation
>        vhost-user-rng-pci: Add vhost-user-rng-pci implementation
>        docs: Add documentation for vhost based RNG implementation
> 
> Xueming Li (1):
>        vhost-user: fix duplicated notifier MR init
> 
>   include/hw/virtio/vhost-user-rng.h        |  33 ++++
>   include/hw/virtio/vhost-vdpa.h            |   2 +
>   include/hw/virtio/virtio-iommu.h          |   2 +-
>   tests/qtest/libqos/libqtest.h             |   8 +
>   hw/net/virtio-net.c                       |  24 ++-
>   hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
>   hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
>   hw/virtio/vhost-user.c                    |   5 +-
>   hw/virtio/vhost-vdpa.c                    |  81 ++++++---
>   hw/virtio/virtio-iommu-pci.c              |   4 +-
>   subprojects/libvhost-user/libvhost-user.c |   1 +
>   tests/qtest/acpi-utils.c                  |  14 ++
>   tests/qtest/arm-cpu-features.c            |  29 +--
>   tests/qtest/bios-tables-test.c            |  90 ++++++++--
>   tests/qtest/libqtest.c                    |  27 +++
>   tests/qtest/migration-test.c              |  15 +-
>   docs/system/device-emulation.rst          |   1 +
>   docs/system/devices/vhost-user-rng.rst    |  39 ++++
>   hw/virtio/Kconfig                         |   5 +
>   hw/virtio/meson.build                     |   2 +
>   hw/virtio/trace-events                    |   1 +
>   meson.build                               |   6 +
>   tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
>   tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
>   tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
>   tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
>   tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
>   tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
>   tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
>   tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
>   30 files changed, 672 insertions(+), 85 deletions(-)
>   create mode 100644 include/hw/virtio/vhost-user-rng.h
>   create mode 100644 hw/virtio/vhost-user-rng-pci.c
>   create mode 100644 hw/virtio/vhost-user-rng.c
>   create mode 100644 docs/system/devices/vhost-user-rng.rst
>   create mode 100644 tests/data/acpi/q35/APIC.xapic
>   create mode 100644 tests/data/acpi/q35/DMAR.dmar
>   create mode 100644 tests/data/acpi/q35/DSDT.ivrs
>   create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
>   create mode 100644 tests/data/acpi/q35/DSDT.xapic
>   create mode 100644 tests/data/acpi/q35/FACP.xapic
>   create mode 100644 tests/data/acpi/q35/IVRS.ivrs
>   create mode 100644 tests/data/acpi/q35/SRAT.xapic

32-bit printf errors:

../hw/virtio/vhost-vdpa.c: In function 'vhost_vdpa_listener_skipped_section':
../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long 
unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} 
[-Werror=format=]
          error_report("RAM section out of device range (min=%lu, addr=%lu)",
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       iova_min, section->offset_within_address_space);
                       ~~~~~~~~
../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long 
unsigned int', but argument 3 has type 'hwaddr' {aka 'long long unsigned int'} 
[-Werror=format=]
../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long 
unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} 
[-Werror=format=]
          error_report("RAM section out of device range (max=%lu, end addr=%lu)",
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       iova_max, int128_get64(llend));
                       ~~~~~~~~
../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long 
unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} 
[-Werror=format=]
cc1: all warnings being treated as errors


Also fails s390x host testing:


ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature == 
SIGNATURE): (0x00000000 == 0x0000dead)
ERROR qtest-i386/bios-tables-test - Bail out! 
ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature == 
SIGNATURE): (0x00000000 == 0x0000dead)
Makefile.mtest:368: recipe for target 'run-test-44' failed


r~


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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-19 18:38   ` [PULL 00/29] pc,pci,virtio: features, fixes Richard Henderson
@ 2021-10-20  8:39     ` Igor Mammedov
  2021-10-20  9:39       ` Thomas Huth
  0 siblings, 1 reply; 38+ messages in thread
From: Igor Mammedov @ 2021-10-20  8:39 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Peter Maydell, qemu-devel, Michael S. Tsirkin

On Tue, 19 Oct 2021 11:38:08 -0700
Richard Henderson <richard.henderson@linaro.org> wrote:

> On 10/19/21 4:19 AM, Michael S. Tsirkin wrote:
> > The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:
> > 
> >    Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
> > 
> > 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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
> > 
> >    failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)
> > 
> > ----------------------------------------------------------------
> > pc,pci,virtio: features, fixes
> > 
> > vhost user rng
> > Fixes, cleanups all over the place.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > ----------------------------------------------------------------
> > Ani Sinha (3):
> >        tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
> >        tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
> >        tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
> > 
> > David Hildenbrand (1):
> >        libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
> > 
> > Eric Auger (2):
> >        virtio-iommu: Remove the non transitional name
> >        virtio-iommu: Drop base_name and change generic_name
> > 
> > Eugenio Pérez (3):
> >        vdpa: Skip protected ram IOMMU mappings
> >        vdpa: Add vhost_vdpa_section_end
> >        vdpa: Check for iova range at mappings changes
> > 
> > Igor Mammedov (15):
> >        tests: acpi: dump table with failed checksum
> >        tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
> >        tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
> >        tests: acpi: q35: test for x2APIC entries in SRAT
> >        tests: acpi: update expected tables blobs
> >        tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
> >        tests: acpi: add testcase for intel_iommu (DMAR table)
> >        tests: acpi: add expected blob for DMAR table
> >        tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
> >        tests: acpi: add testcase for amd-iommu (IVRS table)
> >        tests: acpi: update expected blobs
> >        tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
> >        tests: arm-cpu-features: use qtest_has_kvm() API
> >        tests: migration-test: use qtest_has_accel() API
> >        tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
> > 
> > Laurent Vivier (1):
> >        failover: fix a regression introduced by JSON'ification of -device
> > 
> > Mathieu Poirier (3):
> >        vhost-user-rng: Add vhost-user-rng implementation
> >        vhost-user-rng-pci: Add vhost-user-rng-pci implementation
> >        docs: Add documentation for vhost based RNG implementation
> > 
> > Xueming Li (1):
> >        vhost-user: fix duplicated notifier MR init
> > 
> >   include/hw/virtio/vhost-user-rng.h        |  33 ++++
> >   include/hw/virtio/vhost-vdpa.h            |   2 +
> >   include/hw/virtio/virtio-iommu.h          |   2 +-
> >   tests/qtest/libqos/libqtest.h             |   8 +
> >   hw/net/virtio-net.c                       |  24 ++-
> >   hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
> >   hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
> >   hw/virtio/vhost-user.c                    |   5 +-
> >   hw/virtio/vhost-vdpa.c                    |  81 ++++++---
> >   hw/virtio/virtio-iommu-pci.c              |   4 +-
> >   subprojects/libvhost-user/libvhost-user.c |   1 +
> >   tests/qtest/acpi-utils.c                  |  14 ++
> >   tests/qtest/arm-cpu-features.c            |  29 +--
> >   tests/qtest/bios-tables-test.c            |  90 ++++++++--
> >   tests/qtest/libqtest.c                    |  27 +++
> >   tests/qtest/migration-test.c              |  15 +-
> >   docs/system/device-emulation.rst          |   1 +
> >   docs/system/devices/vhost-user-rng.rst    |  39 ++++
> >   hw/virtio/Kconfig                         |   5 +
> >   hw/virtio/meson.build                     |   2 +
> >   hw/virtio/trace-events                    |   1 +
> >   meson.build                               |   6 +
> >   tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
> >   tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
> >   tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
> >   tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
> >   tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
> >   tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
> >   tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
> >   tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
> >   30 files changed, 672 insertions(+), 85 deletions(-)
> >   create mode 100644 include/hw/virtio/vhost-user-rng.h
> >   create mode 100644 hw/virtio/vhost-user-rng-pci.c
> >   create mode 100644 hw/virtio/vhost-user-rng.c
> >   create mode 100644 docs/system/devices/vhost-user-rng.rst
> >   create mode 100644 tests/data/acpi/q35/APIC.xapic
> >   create mode 100644 tests/data/acpi/q35/DMAR.dmar
> >   create mode 100644 tests/data/acpi/q35/DSDT.ivrs
> >   create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
> >   create mode 100644 tests/data/acpi/q35/DSDT.xapic
> >   create mode 100644 tests/data/acpi/q35/FACP.xapic
> >   create mode 100644 tests/data/acpi/q35/IVRS.ivrs
> >   create mode 100644 tests/data/acpi/q35/SRAT.xapic  
> 
> 32-bit printf errors:
> 
> ../hw/virtio/vhost-vdpa.c: In function 'vhost_vdpa_listener_skipped_section':
> ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long 
> unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} 
> [-Werror=format=]
>           error_report("RAM section out of device range (min=%lu, addr=%lu)",
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                        iova_min, section->offset_within_address_space);
>                        ~~~~~~~~
> ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long 
> unsigned int', but argument 3 has type 'hwaddr' {aka 'long long unsigned int'} 
> [-Werror=format=]
> ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long 
> unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} 
> [-Werror=format=]
>           error_report("RAM section out of device range (max=%lu, end addr=%lu)",
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                        iova_max, int128_get64(llend));
>                        ~~~~~~~~
> ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long 
> unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} 
> [-Werror=format=]
> cc1: all warnings being treated as errors
>
 
>
> Also fails s390x host testing:
> 
> 
> ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature == 
> SIGNATURE): (0x00000000 == 0x0000dead)
> ERROR qtest-i386/bios-tables-test - Bail out! 
> ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature == 
> SIGNATURE): (0x00000000 == 0x0000dead)
> Makefile.mtest:368: recipe for target 'run-test-44' failed

it might happen if VM is too slow
   /* Wait at most 600 seconds ...
 
Let me find s390 host and see if it's reproducable

> r~
> 



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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-20  8:39     ` Igor Mammedov
@ 2021-10-20  9:39       ` Thomas Huth
  2021-10-20  9:41         ` Michael S. Tsirkin
  0 siblings, 1 reply; 38+ messages in thread
From: Thomas Huth @ 2021-10-20  9:39 UTC (permalink / raw)
  To: Igor Mammedov, Michael S. Tsirkin
  Cc: Peter Maydell, Marcel Apfelbaum, Richard Henderson, qemu-devel

On 20/10/2021 10.39, Igor Mammedov wrote:
> On Tue, 19 Oct 2021 11:38:08 -0700
> Richard Henderson <richard.henderson@linaro.org> wrote:
> 
>> On 10/19/21 4:19 AM, Michael S. Tsirkin wrote:
>>> The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:
>>>
>>>     Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
>>>
>>> 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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
>>>
>>>     failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)
>>>
>>> ----------------------------------------------------------------
>>> pc,pci,virtio: features, fixes
>>>
>>> vhost user rng
>>> Fixes, cleanups all over the place.
>>>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>>
>>> ----------------------------------------------------------------
>>> Ani Sinha (3):
>>>         tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
>>>         tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
>>>         tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
>>>
>>> David Hildenbrand (1):
>>>         libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
>>>
>>> Eric Auger (2):
>>>         virtio-iommu: Remove the non transitional name
>>>         virtio-iommu: Drop base_name and change generic_name
>>>
>>> Eugenio Pérez (3):
>>>         vdpa: Skip protected ram IOMMU mappings
>>>         vdpa: Add vhost_vdpa_section_end
>>>         vdpa: Check for iova range at mappings changes
>>>
>>> Igor Mammedov (15):
>>>         tests: acpi: dump table with failed checksum
>>>         tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
>>>         tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
>>>         tests: acpi: q35: test for x2APIC entries in SRAT
>>>         tests: acpi: update expected tables blobs
>>>         tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
>>>         tests: acpi: add testcase for intel_iommu (DMAR table)
>>>         tests: acpi: add expected blob for DMAR table
>>>         tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
>>>         tests: acpi: add testcase for amd-iommu (IVRS table)
>>>         tests: acpi: update expected blobs
>>>         tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
>>>         tests: arm-cpu-features: use qtest_has_kvm() API
>>>         tests: migration-test: use qtest_has_accel() API
>>>         tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
>>>
>>> Laurent Vivier (1):
>>>         failover: fix a regression introduced by JSON'ification of -device
>>>
>>> Mathieu Poirier (3):
>>>         vhost-user-rng: Add vhost-user-rng implementation
>>>         vhost-user-rng-pci: Add vhost-user-rng-pci implementation
>>>         docs: Add documentation for vhost based RNG implementation
>>>
>>> Xueming Li (1):
>>>         vhost-user: fix duplicated notifier MR init
>>>
>>>    include/hw/virtio/vhost-user-rng.h        |  33 ++++
>>>    include/hw/virtio/vhost-vdpa.h            |   2 +
>>>    include/hw/virtio/virtio-iommu.h          |   2 +-
>>>    tests/qtest/libqos/libqtest.h             |   8 +
>>>    hw/net/virtio-net.c                       |  24 ++-
>>>    hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
>>>    hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
>>>    hw/virtio/vhost-user.c                    |   5 +-
>>>    hw/virtio/vhost-vdpa.c                    |  81 ++++++---
>>>    hw/virtio/virtio-iommu-pci.c              |   4 +-
>>>    subprojects/libvhost-user/libvhost-user.c |   1 +
>>>    tests/qtest/acpi-utils.c                  |  14 ++
>>>    tests/qtest/arm-cpu-features.c            |  29 +--
>>>    tests/qtest/bios-tables-test.c            |  90 ++++++++--
>>>    tests/qtest/libqtest.c                    |  27 +++
>>>    tests/qtest/migration-test.c              |  15 +-
>>>    docs/system/device-emulation.rst          |   1 +
>>>    docs/system/devices/vhost-user-rng.rst    |  39 ++++
>>>    hw/virtio/Kconfig                         |   5 +
>>>    hw/virtio/meson.build                     |   2 +
>>>    hw/virtio/trace-events                    |   1 +
>>>    meson.build                               |   6 +
>>>    tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
>>>    tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
>>>    tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
>>>    tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
>>>    tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
>>>    tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
>>>    tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
>>>    tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
>>>    30 files changed, 672 insertions(+), 85 deletions(-)
>>>    create mode 100644 include/hw/virtio/vhost-user-rng.h
>>>    create mode 100644 hw/virtio/vhost-user-rng-pci.c
>>>    create mode 100644 hw/virtio/vhost-user-rng.c
>>>    create mode 100644 docs/system/devices/vhost-user-rng.rst
>>>    create mode 100644 tests/data/acpi/q35/APIC.xapic
>>>    create mode 100644 tests/data/acpi/q35/DMAR.dmar
>>>    create mode 100644 tests/data/acpi/q35/DSDT.ivrs
>>>    create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
>>>    create mode 100644 tests/data/acpi/q35/DSDT.xapic
>>>    create mode 100644 tests/data/acpi/q35/FACP.xapic
>>>    create mode 100644 tests/data/acpi/q35/IVRS.ivrs
>>>    create mode 100644 tests/data/acpi/q35/SRAT.xapic
>>
>> 32-bit printf errors:
>>
>> ../hw/virtio/vhost-vdpa.c: In function 'vhost_vdpa_listener_skipped_section':
>> ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long
>> unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'}
>> [-Werror=format=]
>>            error_report("RAM section out of device range (min=%lu, addr=%lu)",
>>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>                         iova_min, section->offset_within_address_space);
>>                         ~~~~~~~~
>> ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long
>> unsigned int', but argument 3 has type 'hwaddr' {aka 'long long unsigned int'}
>> [-Werror=format=]
>> ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long
>> unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'}
>> [-Werror=format=]
>>            error_report("RAM section out of device range (max=%lu, end addr=%lu)",
>>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>                         iova_max, int128_get64(llend));
>>                         ~~~~~~~~
>> ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long
>> unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'}
>> [-Werror=format=]
>> cc1: all warnings being treated as errors
>>
>   
>>
>> Also fails s390x host testing:
>>
>>
>> ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature ==
>> SIGNATURE): (0x00000000 == 0x0000dead)
>> ERROR qtest-i386/bios-tables-test - Bail out!
>> ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature ==
>> SIGNATURE): (0x00000000 == 0x0000dead)
>> Makefile.mtest:368: recipe for target 'run-test-44' failed
> 
> it might happen if VM is too slow
>     /* Wait at most 600 seconds ...
>   
> Let me find s390 host and see if it's reproducable

Micheal already asked Cornelia and me off-list whether it's reproducible, 
and it is. It's the new multif-bridge test that is hanging, but it seems 
like this only uncovered a pre-existing problem: SeaBIOS does bail out as 
soon as QEMU is started with "-device pcie-root-port" on a s390x host. I've 
already enabled the serial debug in SeaBIOS and got this output:

$ build/qemu-system-x86_64 -nographic -machine q35  -vga none  -device 
pcie-root-port -bios ~/bios.bin
Changing serial settings was 0/0 now 3/0
SeaBIOS (version rel-1.14.0-0-g155821a)
BUILD: gcc: (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) binutils: version 2.30-93.el8
No Xen hypervisor found.
Running on QEMU (q35)
Found QEMU fw_cfg
QEMU fw_cfg DMA interface supported
qemu/e820: addr 0x0000000000000000 len 0x0000000008000000 [RAM]
Relocating init from 0x000d6400 to 0x07faa7a0 (size 88000)
Moving pm_base to 0x600
=== PCI bus & bridge init ===
PCI: pci_bios_init_bus_rec bus = 0x0
PCI: pci_bios_init_bus_rec bdf = 0x10
PCI: primary bus = 0x0
PCI: secondary bus = 0xff -> 0x1
PCI: pci_bios_init_bus_rec bus = 0x1
PCI: subordinate bus = 0x0 -> 0x1
=== PCI device probing ===
Found 6 PCI devices (max PCI bus is 01)
PCIe: using q35 mmconfig at 0xb0000000
=== PCI new allocation pass #1 ===
PCI: check devices
PCI: QEMU resource reserve cap: size 10000000000000 type io
PCI: secondary bus 1 size 10000000000000 type io
PCI: secondary bus 1 size 00200000 type mem
PCI: secondary bus 1 size 00200000 type prefmem
=== PCI new allocation pass #2 ===
PCI: out of I/O address space

I also noticed that the problem did not occur on older versions of QEMU, so 
I just bisected and ended up with this commit here:

e2a6290aab578b2170c1f5909fa556385dc0d820 is the first bad commit
commit e2a6290aab578b2170c1f5909fa556385dc0d820
Author: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Date:   Mon Aug 2 12:00:57 2021 +0300

     hw/pcie-root-port: Fix hotplug for PCI devices requiring IO

Seems like something goes wrong with setting up the IO space on big endian 
hosts?

  Thomas



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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-20  9:39       ` Thomas Huth
@ 2021-10-20  9:41         ` Michael S. Tsirkin
  2021-10-20  9:46           ` Thomas Huth
  2021-10-20 15:34           ` Marcel Apfelbaum
  0 siblings, 2 replies; 38+ messages in thread
From: Michael S. Tsirkin @ 2021-10-20  9:41 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Igor Mammedov, Marcel Apfelbaum, Richard Henderson, qemu-devel,
	Peter Maydell

On Wed, Oct 20, 2021 at 11:39:28AM +0200, Thomas Huth wrote:
> On 20/10/2021 10.39, Igor Mammedov wrote:
> > On Tue, 19 Oct 2021 11:38:08 -0700
> > Richard Henderson <richard.henderson@linaro.org> wrote:
> > 
> > > On 10/19/21 4:19 AM, Michael S. Tsirkin wrote:
> > > > The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:
> > > > 
> > > >     Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
> > > > 
> > > > 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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
> > > > 
> > > >     failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)
> > > > 
> > > > ----------------------------------------------------------------
> > > > pc,pci,virtio: features, fixes
> > > > 
> > > > vhost user rng
> > > > Fixes, cleanups all over the place.
> > > > 
> > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > 
> > > > ----------------------------------------------------------------
> > > > Ani Sinha (3):
> > > >         tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
> > > >         tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
> > > >         tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
> > > > 
> > > > David Hildenbrand (1):
> > > >         libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
> > > > 
> > > > Eric Auger (2):
> > > >         virtio-iommu: Remove the non transitional name
> > > >         virtio-iommu: Drop base_name and change generic_name
> > > > 
> > > > Eugenio Pérez (3):
> > > >         vdpa: Skip protected ram IOMMU mappings
> > > >         vdpa: Add vhost_vdpa_section_end
> > > >         vdpa: Check for iova range at mappings changes
> > > > 
> > > > Igor Mammedov (15):
> > > >         tests: acpi: dump table with failed checksum
> > > >         tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
> > > >         tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
> > > >         tests: acpi: q35: test for x2APIC entries in SRAT
> > > >         tests: acpi: update expected tables blobs
> > > >         tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
> > > >         tests: acpi: add testcase for intel_iommu (DMAR table)
> > > >         tests: acpi: add expected blob for DMAR table
> > > >         tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
> > > >         tests: acpi: add testcase for amd-iommu (IVRS table)
> > > >         tests: acpi: update expected blobs
> > > >         tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
> > > >         tests: arm-cpu-features: use qtest_has_kvm() API
> > > >         tests: migration-test: use qtest_has_accel() API
> > > >         tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
> > > > 
> > > > Laurent Vivier (1):
> > > >         failover: fix a regression introduced by JSON'ification of -device
> > > > 
> > > > Mathieu Poirier (3):
> > > >         vhost-user-rng: Add vhost-user-rng implementation
> > > >         vhost-user-rng-pci: Add vhost-user-rng-pci implementation
> > > >         docs: Add documentation for vhost based RNG implementation
> > > > 
> > > > Xueming Li (1):
> > > >         vhost-user: fix duplicated notifier MR init
> > > > 
> > > >    include/hw/virtio/vhost-user-rng.h        |  33 ++++
> > > >    include/hw/virtio/vhost-vdpa.h            |   2 +
> > > >    include/hw/virtio/virtio-iommu.h          |   2 +-
> > > >    tests/qtest/libqos/libqtest.h             |   8 +
> > > >    hw/net/virtio-net.c                       |  24 ++-
> > > >    hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
> > > >    hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
> > > >    hw/virtio/vhost-user.c                    |   5 +-
> > > >    hw/virtio/vhost-vdpa.c                    |  81 ++++++---
> > > >    hw/virtio/virtio-iommu-pci.c              |   4 +-
> > > >    subprojects/libvhost-user/libvhost-user.c |   1 +
> > > >    tests/qtest/acpi-utils.c                  |  14 ++
> > > >    tests/qtest/arm-cpu-features.c            |  29 +--
> > > >    tests/qtest/bios-tables-test.c            |  90 ++++++++--
> > > >    tests/qtest/libqtest.c                    |  27 +++
> > > >    tests/qtest/migration-test.c              |  15 +-
> > > >    docs/system/device-emulation.rst          |   1 +
> > > >    docs/system/devices/vhost-user-rng.rst    |  39 ++++
> > > >    hw/virtio/Kconfig                         |   5 +
> > > >    hw/virtio/meson.build                     |   2 +
> > > >    hw/virtio/trace-events                    |   1 +
> > > >    meson.build                               |   6 +
> > > >    tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
> > > >    tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
> > > >    tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
> > > >    tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
> > > >    tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
> > > >    tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
> > > >    tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
> > > >    tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
> > > >    30 files changed, 672 insertions(+), 85 deletions(-)
> > > >    create mode 100644 include/hw/virtio/vhost-user-rng.h
> > > >    create mode 100644 hw/virtio/vhost-user-rng-pci.c
> > > >    create mode 100644 hw/virtio/vhost-user-rng.c
> > > >    create mode 100644 docs/system/devices/vhost-user-rng.rst
> > > >    create mode 100644 tests/data/acpi/q35/APIC.xapic
> > > >    create mode 100644 tests/data/acpi/q35/DMAR.dmar
> > > >    create mode 100644 tests/data/acpi/q35/DSDT.ivrs
> > > >    create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
> > > >    create mode 100644 tests/data/acpi/q35/DSDT.xapic
> > > >    create mode 100644 tests/data/acpi/q35/FACP.xapic
> > > >    create mode 100644 tests/data/acpi/q35/IVRS.ivrs
> > > >    create mode 100644 tests/data/acpi/q35/SRAT.xapic
> > > 
> > > 32-bit printf errors:
> > > 
> > > ../hw/virtio/vhost-vdpa.c: In function 'vhost_vdpa_listener_skipped_section':
> > > ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long
> > > unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'}
> > > [-Werror=format=]
> > >            error_report("RAM section out of device range (min=%lu, addr=%lu)",
> > >                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >                         iova_min, section->offset_within_address_space);
> > >                         ~~~~~~~~
> > > ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long
> > > unsigned int', but argument 3 has type 'hwaddr' {aka 'long long unsigned int'}
> > > [-Werror=format=]
> > > ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long
> > > unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'}
> > > [-Werror=format=]
> > >            error_report("RAM section out of device range (max=%lu, end addr=%lu)",
> > >                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >                         iova_max, int128_get64(llend));
> > >                         ~~~~~~~~
> > > ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long
> > > unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'}
> > > [-Werror=format=]
> > > cc1: all warnings being treated as errors
> > > 
> > > 
> > > Also fails s390x host testing:
> > > 
> > > 
> > > ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature ==
> > > SIGNATURE): (0x00000000 == 0x0000dead)
> > > ERROR qtest-i386/bios-tables-test - Bail out!
> > > ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature ==
> > > SIGNATURE): (0x00000000 == 0x0000dead)
> > > Makefile.mtest:368: recipe for target 'run-test-44' failed
> > 
> > it might happen if VM is too slow
> >     /* Wait at most 600 seconds ...
> > Let me find s390 host and see if it's reproducable
> 
> Micheal already asked Cornelia and me off-list whether it's reproducible,
> and it is. It's the new multif-bridge test that is hanging, but it seems
> like this only uncovered a pre-existing problem: SeaBIOS does bail out as
> soon as QEMU is started with "-device pcie-root-port" on a s390x host. I've
> already enabled the serial debug in SeaBIOS and got this output:
> 
> $ build/qemu-system-x86_64 -nographic -machine q35  -vga none  -device
> pcie-root-port -bios ~/bios.bin
> Changing serial settings was 0/0 now 3/0
> SeaBIOS (version rel-1.14.0-0-g155821a)
> BUILD: gcc: (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) binutils: version 2.30-93.el8
> No Xen hypervisor found.
> Running on QEMU (q35)
> Found QEMU fw_cfg
> QEMU fw_cfg DMA interface supported
> qemu/e820: addr 0x0000000000000000 len 0x0000000008000000 [RAM]
> Relocating init from 0x000d6400 to 0x07faa7a0 (size 88000)
> Moving pm_base to 0x600
> === PCI bus & bridge init ===
> PCI: pci_bios_init_bus_rec bus = 0x0
> PCI: pci_bios_init_bus_rec bdf = 0x10
> PCI: primary bus = 0x0
> PCI: secondary bus = 0xff -> 0x1
> PCI: pci_bios_init_bus_rec bus = 0x1
> PCI: subordinate bus = 0x0 -> 0x1
> === PCI device probing ===
> Found 6 PCI devices (max PCI bus is 01)
> PCIe: using q35 mmconfig at 0xb0000000
> === PCI new allocation pass #1 ===
> PCI: check devices
> PCI: QEMU resource reserve cap: size 10000000000000 type io
> PCI: secondary bus 1 size 10000000000000 type io
> PCI: secondary bus 1 size 00200000 type mem
> PCI: secondary bus 1 size 00200000 type prefmem
> === PCI new allocation pass #2 ===
> PCI: out of I/O address space
> 
> I also noticed that the problem did not occur on older versions of QEMU, so
> I just bisected and ended up with this commit here:
> 
> e2a6290aab578b2170c1f5909fa556385dc0d820 is the first bad commit
> commit e2a6290aab578b2170c1f5909fa556385dc0d820
> Author: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Date:   Mon Aug 2 12:00:57 2021 +0300
> 
>     hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
> 
> Seems like something goes wrong with setting up the IO space on big endian
> hosts?
> 
>  Thomas

Yep. The bug is older though, going back to when we first
added the vendor specific capability. Does this help?

diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index d1f902ee86..da34c8ebcd 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
     PCIBridgeQemuCap cap = {
             .len = cap_len,
             .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
-            .bus_res = res_reserve.bus,
-            .io = res_reserve.io,
-            .mem = res_reserve.mem_non_pref,
-            .mem_pref_32 = res_reserve.mem_pref_32,
-            .mem_pref_64 = res_reserve.mem_pref_64
+            .bus_res = cpu_to_le32(res_reserve.bus),
+            .io = cpu_to_le64(res_reserve.io),
+            .mem = cpu_to_le32(res_reserve.mem_non_pref),
+            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
+            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
     };
 
     int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,



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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-20  9:41         ` Michael S. Tsirkin
@ 2021-10-20  9:46           ` Thomas Huth
  2021-10-20 15:34           ` Marcel Apfelbaum
  1 sibling, 0 replies; 38+ messages in thread
From: Thomas Huth @ 2021-10-20  9:46 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Igor Mammedov, Marcel Apfelbaum, Richard Henderson, qemu-devel,
	Peter Maydell

On 20/10/2021 11.41, Michael S. Tsirkin wrote:
> On Wed, Oct 20, 2021 at 11:39:28AM +0200, Thomas Huth wrote:
>> On 20/10/2021 10.39, Igor Mammedov wrote:
>>> On Tue, 19 Oct 2021 11:38:08 -0700
>>> Richard Henderson <richard.henderson@linaro.org> wrote:
>>>
>>>> On 10/19/21 4:19 AM, Michael S. Tsirkin wrote:
>>>>> The following changes since commit 9c050b661d3a43dfe2fd44106e559b39706d1296:
>>>>>
>>>>>      Merge remote-tracking branch 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
>>>>>
>>>>> 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 bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
>>>>>
>>>>>      failover: fix a regression introduced by JSON'ification of -device (2021-10-19 07:15:34 -0400)
>>>>>
>>>>> ----------------------------------------------------------------
>>>>> pc,pci,virtio: features, fixes
>>>>>
>>>>> vhost user rng
>>>>> Fixes, cleanups all over the place.
>>>>>
>>>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>>>>
>>>>> ----------------------------------------------------------------
>>>>> Ani Sinha (3):
>>>>>          tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
>>>>>          tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
>>>>>          tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
>>>>>
>>>>> David Hildenbrand (1):
>>>>>          libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
>>>>>
>>>>> Eric Auger (2):
>>>>>          virtio-iommu: Remove the non transitional name
>>>>>          virtio-iommu: Drop base_name and change generic_name
>>>>>
>>>>> Eugenio Pérez (3):
>>>>>          vdpa: Skip protected ram IOMMU mappings
>>>>>          vdpa: Add vhost_vdpa_section_end
>>>>>          vdpa: Check for iova range at mappings changes
>>>>>
>>>>> Igor Mammedov (15):
>>>>>          tests: acpi: dump table with failed checksum
>>>>>          tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator
>>>>>          tests: acpi: whitelist expected tables for acpi/q35/xapic testcase
>>>>>          tests: acpi: q35: test for x2APIC entries in SRAT
>>>>>          tests: acpi: update expected tables blobs
>>>>>          tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar
>>>>>          tests: acpi: add testcase for intel_iommu (DMAR table)
>>>>>          tests: acpi: add expected blob for DMAR table
>>>>>          tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase
>>>>>          tests: acpi: add testcase for amd-iommu (IVRS table)
>>>>>          tests: acpi: update expected blobs
>>>>>          tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()
>>>>>          tests: arm-cpu-features: use qtest_has_kvm() API
>>>>>          tests: migration-test: use qtest_has_accel() API
>>>>>          tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests
>>>>>
>>>>> Laurent Vivier (1):
>>>>>          failover: fix a regression introduced by JSON'ification of -device
>>>>>
>>>>> Mathieu Poirier (3):
>>>>>          vhost-user-rng: Add vhost-user-rng implementation
>>>>>          vhost-user-rng-pci: Add vhost-user-rng-pci implementation
>>>>>          docs: Add documentation for vhost based RNG implementation
>>>>>
>>>>> Xueming Li (1):
>>>>>          vhost-user: fix duplicated notifier MR init
>>>>>
>>>>>     include/hw/virtio/vhost-user-rng.h        |  33 ++++
>>>>>     include/hw/virtio/vhost-vdpa.h            |   2 +
>>>>>     include/hw/virtio/virtio-iommu.h          |   2 +-
>>>>>     tests/qtest/libqos/libqtest.h             |   8 +
>>>>>     hw/net/virtio-net.c                       |  24 ++-
>>>>>     hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
>>>>>     hw/virtio/vhost-user-rng.c                | 289 ++++++++++++++++++++++++++++++
>>>>>     hw/virtio/vhost-user.c                    |   5 +-
>>>>>     hw/virtio/vhost-vdpa.c                    |  81 ++++++---
>>>>>     hw/virtio/virtio-iommu-pci.c              |   4 +-
>>>>>     subprojects/libvhost-user/libvhost-user.c |   1 +
>>>>>     tests/qtest/acpi-utils.c                  |  14 ++
>>>>>     tests/qtest/arm-cpu-features.c            |  29 +--
>>>>>     tests/qtest/bios-tables-test.c            |  90 ++++++++--
>>>>>     tests/qtest/libqtest.c                    |  27 +++
>>>>>     tests/qtest/migration-test.c              |  15 +-
>>>>>     docs/system/device-emulation.rst          |   1 +
>>>>>     docs/system/devices/vhost-user-rng.rst    |  39 ++++
>>>>>     hw/virtio/Kconfig                         |   5 +
>>>>>     hw/virtio/meson.build                     |   2 +
>>>>>     hw/virtio/trace-events                    |   1 +
>>>>>     meson.build                               |   6 +
>>>>>     tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
>>>>>     tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
>>>>>     tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
>>>>>     tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
>>>>>     tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
>>>>>     tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
>>>>>     tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
>>>>>     tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
>>>>>     30 files changed, 672 insertions(+), 85 deletions(-)
>>>>>     create mode 100644 include/hw/virtio/vhost-user-rng.h
>>>>>     create mode 100644 hw/virtio/vhost-user-rng-pci.c
>>>>>     create mode 100644 hw/virtio/vhost-user-rng.c
>>>>>     create mode 100644 docs/system/devices/vhost-user-rng.rst
>>>>>     create mode 100644 tests/data/acpi/q35/APIC.xapic
>>>>>     create mode 100644 tests/data/acpi/q35/DMAR.dmar
>>>>>     create mode 100644 tests/data/acpi/q35/DSDT.ivrs
>>>>>     create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
>>>>>     create mode 100644 tests/data/acpi/q35/DSDT.xapic
>>>>>     create mode 100644 tests/data/acpi/q35/FACP.xapic
>>>>>     create mode 100644 tests/data/acpi/q35/IVRS.ivrs
>>>>>     create mode 100644 tests/data/acpi/q35/SRAT.xapic
>>>>
>>>> 32-bit printf errors:
>>>>
>>>> ../hw/virtio/vhost-vdpa.c: In function 'vhost_vdpa_listener_skipped_section':
>>>> ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long
>>>> unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'}
>>>> [-Werror=format=]
>>>>             error_report("RAM section out of device range (min=%lu, addr=%lu)",
>>>>                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>                          iova_min, section->offset_within_address_space);
>>>>                          ~~~~~~~~
>>>> ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects argument of type 'long
>>>> unsigned int', but argument 3 has type 'hwaddr' {aka 'long long unsigned int'}
>>>> [-Werror=format=]
>>>> ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long
>>>> unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'}
>>>> [-Werror=format=]
>>>>             error_report("RAM section out of device range (max=%lu, end addr=%lu)",
>>>>                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>                          iova_max, int128_get64(llend));
>>>>                          ~~~~~~~~
>>>> ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects argument of type 'long
>>>> unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'}
>>>> [-Werror=format=]
>>>> cc1: all warnings being treated as errors
>>>>
>>>>
>>>> Also fails s390x host testing:
>>>>
>>>>
>>>> ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature ==
>>>> SIGNATURE): (0x00000000 == 0x0000dead)
>>>> ERROR qtest-i386/bios-tables-test - Bail out!
>>>> ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion failed (signature ==
>>>> SIGNATURE): (0x00000000 == 0x0000dead)
>>>> Makefile.mtest:368: recipe for target 'run-test-44' failed
>>>
>>> it might happen if VM is too slow
>>>      /* Wait at most 600 seconds ...
>>> Let me find s390 host and see if it's reproducable
>>
>> Micheal already asked Cornelia and me off-list whether it's reproducible,
>> and it is. It's the new multif-bridge test that is hanging, but it seems
>> like this only uncovered a pre-existing problem: SeaBIOS does bail out as
>> soon as QEMU is started with "-device pcie-root-port" on a s390x host. I've
>> already enabled the serial debug in SeaBIOS and got this output:
>>
>> $ build/qemu-system-x86_64 -nographic -machine q35  -vga none  -device
>> pcie-root-port -bios ~/bios.bin
>> Changing serial settings was 0/0 now 3/0
>> SeaBIOS (version rel-1.14.0-0-g155821a)
>> BUILD: gcc: (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) binutils: version 2.30-93.el8
>> No Xen hypervisor found.
>> Running on QEMU (q35)
>> Found QEMU fw_cfg
>> QEMU fw_cfg DMA interface supported
>> qemu/e820: addr 0x0000000000000000 len 0x0000000008000000 [RAM]
>> Relocating init from 0x000d6400 to 0x07faa7a0 (size 88000)
>> Moving pm_base to 0x600
>> === PCI bus & bridge init ===
>> PCI: pci_bios_init_bus_rec bus = 0x0
>> PCI: pci_bios_init_bus_rec bdf = 0x10
>> PCI: primary bus = 0x0
>> PCI: secondary bus = 0xff -> 0x1
>> PCI: pci_bios_init_bus_rec bus = 0x1
>> PCI: subordinate bus = 0x0 -> 0x1
>> === PCI device probing ===
>> Found 6 PCI devices (max PCI bus is 01)
>> PCIe: using q35 mmconfig at 0xb0000000
>> === PCI new allocation pass #1 ===
>> PCI: check devices
>> PCI: QEMU resource reserve cap: size 10000000000000 type io
>> PCI: secondary bus 1 size 10000000000000 type io
>> PCI: secondary bus 1 size 00200000 type mem
>> PCI: secondary bus 1 size 00200000 type prefmem
>> === PCI new allocation pass #2 ===
>> PCI: out of I/O address space
>>
>> I also noticed that the problem did not occur on older versions of QEMU, so
>> I just bisected and ended up with this commit here:
>>
>> e2a6290aab578b2170c1f5909fa556385dc0d820 is the first bad commit
>> commit e2a6290aab578b2170c1f5909fa556385dc0d820
>> Author: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> Date:   Mon Aug 2 12:00:57 2021 +0300
>>
>>      hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
>>
>> Seems like something goes wrong with setting up the IO space on big endian
>> hosts?
>>
>>   Thomas
> 
> Yep. The bug is older though, going back to when we first
> added the vendor specific capability. Does this help?
> 
> diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
> index d1f902ee86..da34c8ebcd 100644
> --- a/hw/pci/pci_bridge.c
> +++ b/hw/pci/pci_bridge.c
> @@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
>       PCIBridgeQemuCap cap = {
>               .len = cap_len,
>               .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
> -            .bus_res = res_reserve.bus,
> -            .io = res_reserve.io,
> -            .mem = res_reserve.mem_non_pref,
> -            .mem_pref_32 = res_reserve.mem_pref_32,
> -            .mem_pref_64 = res_reserve.mem_pref_64
> +            .bus_res = cpu_to_le32(res_reserve.bus),
> +            .io = cpu_to_le64(res_reserve.io),
> +            .mem = cpu_to_le32(res_reserve.mem_non_pref),
> +            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
> +            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
>       };
>   
>       int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,

Yes, that fixes the issue, indeed!

  Thanks,
   Thomas



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

* Re: [PULL 00/29] pc,pci,virtio: features, fixes
  2021-10-20  9:41         ` Michael S. Tsirkin
  2021-10-20  9:46           ` Thomas Huth
@ 2021-10-20 15:34           ` Marcel Apfelbaum
  1 sibling, 0 replies; 38+ messages in thread
From: Marcel Apfelbaum @ 2021-10-20 15:34 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Igor Mammedov, Thomas Huth, Richard Henderson, qemu-devel, Peter Maydell

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

Hi Thomas,

On Wed, Oct 20, 2021 at 12:41 PM Michael S. Tsirkin <mst@redhat.com> wrote:

> On Wed, Oct 20, 2021 at 11:39:28AM +0200, Thomas Huth wrote:
> > On 20/10/2021 10.39, Igor Mammedov wrote:
> > > On Tue, 19 Oct 2021 11:38:08 -0700
> > > Richard Henderson <richard.henderson@linaro.org> wrote:
> > >
> > > > On 10/19/21 4:19 AM, Michael S. Tsirkin wrote:
> > > > > The following changes since commit
> 9c050b661d3a43dfe2fd44106e559b39706d1296:
> > > > >
> > > > >     Merge remote-tracking branch
> 'remotes/philmd/tags/mips-20211018' into staging (2021-10-18 09:16:51 -0700)
> > > > >
> > > > > 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
> bf2dd99b7d536cdba157fd6687810ce7b8340ccc:
> > > > >
> > > > >     failover: fix a regression introduced by JSON'ification of
> -device (2021-10-19 07:15:34 -0400)
> > > > >
> > > > > ----------------------------------------------------------------
> > > > > pc,pci,virtio: features, fixes
> > > > >
> > > > > vhost user rng
> > > > > Fixes, cleanups all over the place.
> > > > >
> > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > >
> > > > > ----------------------------------------------------------------
> > > > > Ani Sinha (3):
> > > > >         tests/acpi/bios-tables-test: add and allow changes to a
> new q35 DSDT table blob
> > > > >         tests/acpi/pcihp: add unit tests for hotplug on
> multifunction bridges for q35
> > > > >         tests/acpi/bios-tables-test: update DSDT blob for
> multifunction bridge test
> > > > >
> > > > > David Hildenbrand (1):
> > > > >         libvhost-user: fix VHOST_USER_REM_MEM_REG skipping
> mmap_addr
> > > > >
> > > > > Eric Auger (2):
> > > > >         virtio-iommu: Remove the non transitional name
> > > > >         virtio-iommu: Drop base_name and change generic_name
> > > > >
> > > > > Eugenio Pérez (3):
> > > > >         vdpa: Skip protected ram IOMMU mappings
> > > > >         vdpa: Add vhost_vdpa_section_end
> > > > >         vdpa: Check for iova range at mappings changes
> > > > >
> > > > > Igor Mammedov (15):
> > > > >         tests: acpi: dump table with failed checksum
> > > > >         tests: qtest: add qtest_has_accel() to check if tested
> binary supports accelerator
> > > > >         tests: acpi: whitelist expected tables for acpi/q35/xapic
> testcase
> > > > >         tests: acpi: q35: test for x2APIC entries in SRAT
> > > > >         tests: acpi: update expected tables blobs
> > > > >         tests: acpi: whitelist new expected table
> tests/data/acpi/q35/DMAR.dmar
> > > > >         tests: acpi: add testcase for intel_iommu (DMAR table)
> > > > >         tests: acpi: add expected blob for DMAR table
> > > > >         tests: acpi: whitelist expected blobs for new
> acpi/q35/ivrs testcase
> > > > >         tests: acpi: add testcase for amd-iommu (IVRS table)
> > > > >         tests: acpi: update expected blobs
> > > > >         tests: acpi: arm/virt: drop redundant test_acpi_one() in
> test_acpi_virt_tcg()
> > > > >         tests: arm-cpu-features: use qtest_has_kvm() API
> > > > >         tests: migration-test: use qtest_has_accel() API
> > > > >         tests: bios-tables-test: use qtest_has_accel() API to
> register TCG only tests
> > > > >
> > > > > Laurent Vivier (1):
> > > > >         failover: fix a regression introduced by JSON'ification of
> -device
> > > > >
> > > > > Mathieu Poirier (3):
> > > > >         vhost-user-rng: Add vhost-user-rng implementation
> > > > >         vhost-user-rng-pci: Add vhost-user-rng-pci implementation
> > > > >         docs: Add documentation for vhost based RNG implementation
> > > > >
> > > > > Xueming Li (1):
> > > > >         vhost-user: fix duplicated notifier MR init
> > > > >
> > > > >    include/hw/virtio/vhost-user-rng.h        |  33 ++++
> > > > >    include/hw/virtio/vhost-vdpa.h            |   2 +
> > > > >    include/hw/virtio/virtio-iommu.h          |   2 +-
> > > > >    tests/qtest/libqos/libqtest.h             |   8 +
> > > > >    hw/net/virtio-net.c                       |  24 ++-
> > > > >    hw/virtio/vhost-user-rng-pci.c            |  79 ++++++++
> > > > >    hw/virtio/vhost-user-rng.c                | 289
> ++++++++++++++++++++++++++++++
> > > > >    hw/virtio/vhost-user.c                    |   5 +-
> > > > >    hw/virtio/vhost-vdpa.c                    |  81 ++++++---
> > > > >    hw/virtio/virtio-iommu-pci.c              |   4 +-
> > > > >    subprojects/libvhost-user/libvhost-user.c |   1 +
> > > > >    tests/qtest/acpi-utils.c                  |  14 ++
> > > > >    tests/qtest/arm-cpu-features.c            |  29 +--
> > > > >    tests/qtest/bios-tables-test.c            |  90 ++++++++--
> > > > >    tests/qtest/libqtest.c                    |  27 +++
> > > > >    tests/qtest/migration-test.c              |  15 +-
> > > > >    docs/system/device-emulation.rst          |   1 +
> > > > >    docs/system/devices/vhost-user-rng.rst    |  39 ++++
> > > > >    hw/virtio/Kconfig                         |   5 +
> > > > >    hw/virtio/meson.build                     |   2 +
> > > > >    hw/virtio/trace-events                    |   1 +
> > > > >    meson.build                               |   6 +
> > > > >    tests/data/acpi/q35/APIC.xapic            | Bin 0 -> 2686 bytes
> > > > >    tests/data/acpi/q35/DMAR.dmar             | Bin 0 -> 120 bytes
> > > > >    tests/data/acpi/q35/DSDT.ivrs             | Bin 0 -> 8306 bytes
> > > > >    tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
> > > > >    tests/data/acpi/q35/DSDT.xapic            | Bin 0 -> 35652 bytes
> > > > >    tests/data/acpi/q35/FACP.xapic            | Bin 0 -> 244 bytes
> > > > >    tests/data/acpi/q35/IVRS.ivrs             | Bin 0 -> 104 bytes
> > > > >    tests/data/acpi/q35/SRAT.xapic            | Bin 0 -> 5080 bytes
> > > > >    30 files changed, 672 insertions(+), 85 deletions(-)
> > > > >    create mode 100644 include/hw/virtio/vhost-user-rng.h
> > > > >    create mode 100644 hw/virtio/vhost-user-rng-pci.c
> > > > >    create mode 100644 hw/virtio/vhost-user-rng.c
> > > > >    create mode 100644 docs/system/devices/vhost-user-rng.rst
> > > > >    create mode 100644 tests/data/acpi/q35/APIC.xapic
> > > > >    create mode 100644 tests/data/acpi/q35/DMAR.dmar
> > > > >    create mode 100644 tests/data/acpi/q35/DSDT.ivrs
> > > > >    create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge
> > > > >    create mode 100644 tests/data/acpi/q35/DSDT.xapic
> > > > >    create mode 100644 tests/data/acpi/q35/FACP.xapic
> > > > >    create mode 100644 tests/data/acpi/q35/IVRS.ivrs
> > > > >    create mode 100644 tests/data/acpi/q35/SRAT.xapic
> > > >
> > > > 32-bit printf errors:
> > > >
> > > > ../hw/virtio/vhost-vdpa.c: In function
> 'vhost_vdpa_listener_skipped_section':
> > > > ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects
> argument of type 'long
> > > > unsigned int', but argument 2 has type 'uint64_t' {aka 'long long
> unsigned int'}
> > > > [-Werror=format=]
> > > >            error_report("RAM section out of device range (min=%lu,
> addr=%lu)",
> > > >
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >                         iova_min,
> section->offset_within_address_space);
> > > >                         ~~~~~~~~
> > > > ../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects
> argument of type 'long
> > > > unsigned int', but argument 3 has type 'hwaddr' {aka 'long long
> unsigned int'}
> > > > [-Werror=format=]
> > > > ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects
> argument of type 'long
> > > > unsigned int', but argument 2 has type 'uint64_t' {aka 'long long
> unsigned int'}
> > > > [-Werror=format=]
> > > >            error_report("RAM section out of device range (max=%lu,
> end addr=%lu)",
> > > >
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >                         iova_max, int128_get64(llend));
> > > >                         ~~~~~~~~
> > > > ../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects
> argument of type 'long
> > > > unsigned int', but argument 3 has type 'uint64_t' {aka 'long long
> unsigned int'}
> > > > [-Werror=format=]
> > > > cc1: all warnings being treated as errors
> > > >
> > > >
> > > > Also fails s390x host testing:
> > > >
> > > >
> > > > ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion
> failed (signature ==
> > > > SIGNATURE): (0x00000000 == 0x0000dead)
> > > > ERROR qtest-i386/bios-tables-test - Bail out!
> > > > ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion
> failed (signature ==
> > > > SIGNATURE): (0x00000000 == 0x0000dead)
> > > > Makefile.mtest:368: recipe for target 'run-test-44' failed
> > >
> > > it might happen if VM is too slow
> > >     /* Wait at most 600 seconds ...
> > > Let me find s390 host and see if it's reproducable
> >
> > Micheal already asked Cornelia and me off-list whether it's reproducible,
> > and it is. It's the new multif-bridge test that is hanging, but it seems
> > like this only uncovered a pre-existing problem: SeaBIOS does bail out as
> > soon as QEMU is started with "-device pcie-root-port" on a s390x host.
> I've
> > already enabled the serial debug in SeaBIOS and got this output:
> >
> > $ build/qemu-system-x86_64 -nographic -machine q35  -vga none  -device
> > pcie-root-port -bios ~/bios.bin
> > Changing serial settings was 0/0 now 3/0
> > SeaBIOS (version rel-1.14.0-0-g155821a)
> > BUILD: gcc: (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) binutils: version
> 2.30-93.el8
> > No Xen hypervisor found.
> > Running on QEMU (q35)
> > Found QEMU fw_cfg
> > QEMU fw_cfg DMA interface supported
> > qemu/e820: addr 0x0000000000000000 len 0x0000000008000000 [RAM]
> > Relocating init from 0x000d6400 to 0x07faa7a0 (size 88000)
> > Moving pm_base to 0x600
> > === PCI bus & bridge init ===
> > PCI: pci_bios_init_bus_rec bus = 0x0
> > PCI: pci_bios_init_bus_rec bdf = 0x10
> > PCI: primary bus = 0x0
> > PCI: secondary bus = 0xff -> 0x1
> > PCI: pci_bios_init_bus_rec bus = 0x1
> > PCI: subordinate bus = 0x0 -> 0x1
> > === PCI device probing ===
> > Found 6 PCI devices (max PCI bus is 01)
> > PCIe: using q35 mmconfig at 0xb0000000
> > === PCI new allocation pass #1 ===
> > PCI: check devices
> > PCI: QEMU resource reserve cap: size 10000000000000 type io
> > PCI: secondary bus 1 size 10000000000000 type io
> > PCI: secondary bus 1 size 00200000 type mem
> > PCI: secondary bus 1 size 00200000 type prefmem
> > === PCI new allocation pass #2 ===
> > PCI: out of I/O address space
> >
> > I also noticed that the problem did not occur on older versions of QEMU,
> so
> > I just bisected and ended up with this commit here:
> >
> > e2a6290aab578b2170c1f5909fa556385dc0d820 is the first bad commit
> > commit e2a6290aab578b2170c1f5909fa556385dc0d820
> > Author: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > Date:   Mon Aug 2 12:00:57 2021 +0300
> >
> >     hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
> >
> > Seems like something goes wrong with setting up the IO space on big
> endian
> > hosts?
>

Thank you for finding the issue! Indeed it was there from the start.


> >
> >  Thomas
>
> Yep. The bug is older though, going back to when we first
> added the vendor specific capability.

Does this help?
>
> diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
> index d1f902ee86..da34c8ebcd 100644
> --- a/hw/pci/pci_bridge.c
> +++ b/hw/pci/pci_bridge.c
> @@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev,
> int cap_offset,
>      PCIBridgeQemuCap cap = {
>              .len = cap_len,
>              .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
> -            .bus_res = res_reserve.bus,
> -            .io = res_reserve.io,
> -            .mem = res_reserve.mem_non_pref,
> -            .mem_pref_32 = res_reserve.mem_pref_32,
> -            .mem_pref_64 = res_reserve.mem_pref_64
> +            .bus_res = cpu_to_le32(res_reserve.bus),
> +            .io = cpu_to_le64(res_reserve.io),
> +            .mem = cpu_to_le32(res_reserve.mem_non_pref),
> +            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
> +            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
>      };
>
>      int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,
>
>
Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Thanks,
Marcel

[-- Attachment #2: Type: text/html, Size: 17044 bytes --]

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

end of thread, other threads:[~2021-10-20 15:36 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211019140622.738008-1-mst@redhat.com>
2021-10-19 11:19 ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 01/29] tests: acpi: dump table with failed checksum Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 02/29] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 03/29] tests: acpi: whitelist expected tables for acpi/q35/xapic testcase Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 04/29] tests: acpi: q35: test for x2APIC entries in SRAT Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 05/29] tests: acpi: update expected tables blobs Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 06/29] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar Michael S. Tsirkin
2021-10-19 11:19   ` [PULL 07/29] tests: acpi: add testcase for intel_iommu (DMAR table) Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 08/29] tests: acpi: add expected blob for DMAR table Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 09/29] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 10/29] tests: acpi: add testcase for amd-iommu (IVRS table) Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 11/29] tests: acpi: update expected blobs Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 12/29] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg() Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 13/29] tests: arm-cpu-features: use qtest_has_kvm() API Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 14/29] tests: migration-test: use qtest_has_accel() API Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 15/29] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 16/29] vdpa: Skip protected ram IOMMU mappings Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 17/29] vdpa: Add vhost_vdpa_section_end Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 18/29] vdpa: Check for iova range at mappings changes Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 19/29] virtio-iommu: Remove the non transitional name Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 20/29] virtio-iommu: Drop base_name and change generic_name Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 21/29] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 22/29] vhost-user-rng: Add vhost-user-rng implementation Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 23/29] vhost-user-rng-pci: Add vhost-user-rng-pci implementation Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 24/29] docs: Add documentation for vhost based RNG implementation Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 25/29] vhost-user: fix duplicated notifier MR init Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 26/29] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob Michael S. Tsirkin
2021-10-19 11:20   ` [PULL 27/29] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35 Michael S. Tsirkin
2021-10-19 11:21   ` [PULL 28/29] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test Michael S. Tsirkin
2021-10-19 11:21   ` [PULL 29/29] failover: fix a regression introduced by JSON'ification of -device Michael S. Tsirkin
2021-10-19 14:07   ` [PULL 00/29] pc,pci,virtio: features, fixes Michael S. Tsirkin
2021-10-19 14:08   ` [PULL 30/29] vhost-user-blk-test: pass vhost-user socket fds to QSD Michael S. Tsirkin
2021-10-19 18:38   ` [PULL 00/29] pc,pci,virtio: features, fixes Richard Henderson
2021-10-20  8:39     ` Igor Mammedov
2021-10-20  9:39       ` Thomas Huth
2021-10-20  9:41         ` Michael S. Tsirkin
2021-10-20  9:46           ` Thomas Huth
2021-10-20 15:34           ` Marcel Apfelbaum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).