Skip to contentSkip to conversation

pc,pci,virtio: features, fixes

GIT PULL Michael S. Tsirkin 5 participants 38 messages Oct 19, 2021 – Oct 20, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

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.

----------------------------------------------------------------
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
#1 lore raw

[PULL 06/29] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 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
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
index dfb8523c8b..a2843335c8 100644
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DMAR.dmar",
tests/data/acpi/q35/DMAR.dmar new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Signature · 1 line
MST
#2 lore raw

[PULL 01/29] tests: acpi: dump table with failed checksum

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 tests/qtest/acpi-utils.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
tests/qtest/acpi-utils.c +14 -0
index d2a202efca..766c48e3a6 100644
@@ -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));
     }
 }
Signature · 1 line
MST
#3 lore raw

[PULL 03/29] tests: acpi: whitelist expected tables for acpi/q35/xapic testcase

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 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
tests/qtest/bios-tables-test-allowed-diff.h +4 -0
index dfb8523c8b..344eee3acc 100644
@@ -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",
tests/data/acpi/q35/APIC.xapic new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/data/acpi/q35/DSDT.xapic new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/data/acpi/q35/FACP.xapic new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/data/acpi/q35/SRAT.xapic new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Signature · 1 line
MST
#4 lore raw

[PULL 12/29] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg()

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

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

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 3 ---
 1 file changed, 3 deletions(-)
tests/qtest/bios-tables-test.c +0 -3
index ef28bb41f3..873eb9c037 100644
@@ -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 "
Signature · 1 line
MST
#5 lore raw

[PULL 05/29] tests: acpi: update expected tables blobs

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

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

Message-Id: <[email protected]>

---
 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(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
index 344eee3acc..dfb8523c8b 100644
@@ -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",
tests/data/acpi/q35/APIC.xapic binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c1969c35aa12b61d25e0134bbb8d2187ba42d663 100644
GIT binary patch
tests/data/acpi/q35/DSDT.xapic binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..119fc90f1f8a7b6934df6fd95609446e627ce15d 100644
GIT binary patch
tests/data/acpi/q35/FACP.xapic binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2d3659c9c6753d07c3d48742343cb8e8cc034de7 100644
GIT binary patch
tests/data/acpi/q35/SRAT.xapic binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1a91cfa65fdbebe1756d63d80022c2af767e5d3f 100644
GIT binary patch
Signature · 1 line
MST
#6 lore raw

[PULL 04/29] tests: acpi: q35: test for x2APIC entries in SRAT

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

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.

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
tests/qtest/bios-tables-test.c +17 -0
index 4f11d03055..87a94a59fa 100644
@@ -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);
Signature · 1 line
MST
#7 lore raw

[PULL 02/29] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

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.

Message-Id: <[email protected]>

---
 tests/qtest/libqos/libqtest.h |  8 ++++++++
 tests/qtest/libqtest.c        | 27 +++++++++++++++++++++++++++
 meson.build                   |  6 ++++++
 3 files changed, 41 insertions(+)
tests/qtest/libqos/libqtest.h +8 -0
index a68dcd79d4..59e9271195 100644
@@ -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.
tests/qtest/libqtest.c +27 -0
index 73f6b977a6..25aeea385b 100644
@@ -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 */
meson.build +6 -0
index 6b7487b725..266b94644b 100644
@@ -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']
Signature · 1 line
MST
#8 lore raw

[PULL 11/29] tests: acpi: update expected blobs

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

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

Message-Id: <[email protected]>

---
 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(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -2
index 4fe8e8272a..dfb8523c8b 100644
@@ -1,3 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.ivrs",
-"tests/data/acpi/q35/IVRS.ivrs",
tests/data/acpi/q35/DSDT.ivrs binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b0eafe90e5832935557ec5e6802c0147c88f379c 100644
GIT binary patch
tests/data/acpi/q35/IVRS.ivrs binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..17611202e53a32f7da8e4925d6955b384670b8b1 100644
GIT binary patch
Signature · 1 line
MST
#9 lore raw

[PULL 07/29] tests: acpi: add testcase for intel_iommu (DMAR table)

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tests/qtest/bios-tables-test.c +13 -0
index 87a94a59fa..0361c84c5e 100644
@@ -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);
Signature · 1 line
MST
#10 lore raw

[PULL 09/29] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 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
tests/qtest/bios-tables-test-allowed-diff.h +2 -0
index dfb8523c8b..4fe8e8272a 100644
@@ -1 +1,3 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.ivrs",
+"tests/data/acpi/q35/IVRS.ivrs",
tests/data/acpi/q35/DSDT.ivrs new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
tests/data/acpi/q35/IVRS.ivrs new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Signature · 1 line
MST
#11 lore raw

[PULL 08/29] tests: acpi: add expected blob for DMAR table

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

[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

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 tests/data/acpi/q35/DMAR.dmar               | Bin 0 -> 120 bytes
 2 files changed, 1 deletion(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index a2843335c8..dfb8523c8b 100644
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DMAR.dmar",
tests/data/acpi/q35/DMAR.dmar binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0dca6e68ad8a8ca5b981bcfbc745385a63e9f216 100644
GIT binary patch
Signature · 1 line
MST
#12 lore raw

[PULL 13/29] tests: arm-cpu-features: use qtest_has_kvm() API

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

and drop custom function that were doing the job

Message-Id: <[email protected]>

---
 tests/qtest/arm-cpu-features.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)
tests/qtest/arm-cpu-features.c +5 -24
index 90a87f0ea9..f76652143a 100644
@@ -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);
     }
Signature · 1 line
MST
#13 lore raw

[PULL 19/29] virtio-iommu: Remove the non transitional name

In reply to Michael S. Tsirkin

From: Eric Auger <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/virtio/virtio-iommu-pci.c | 1 -
 1 file changed, 1 deletion(-)
hw/virtio/virtio-iommu-pci.c +0 -1
index 770c286be7..86fa4e6c28 100644
@@ -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,
Signature · 1 line
MST
#14 lore raw

[PULL 28/29] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test

In reply to Michael S. Tsirkin

From: Ani Sinha <[email protected]>

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 ()

             }
         }
     }

}

Message-Id: <[email protected]>

---
 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(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
index dabc024f53..dfb8523c8b 100644
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.multi-bridge",
tests/data/acpi/q35/DSDT.multi-bridge binary +0 -0
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a24c713d22102a1a1583b5c902edffe1694e5cfe 100644
GIT binary patch
Signature · 1 line
MST
#15 lore raw

[PULL 16/29] vdpa: Skip protected ram IOMMU mappings

In reply to Michael S. Tsirkin

From: Eugenio Pérez <[email protected]>

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.

Message-Id: <[email protected]>

---
 hw/virtio/vhost-vdpa.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/vhost-vdpa.c +1 -0
index 47d7a5a23d..ea1aa71ad8 100644
@@ -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) ||
            /*
Signature · 1 line
MST
#16 lore raw

[PULL 17/29] vdpa: Add vhost_vdpa_section_end

In reply to Michael S. Tsirkin

From: Eugenio Pérez <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/virtio/vhost-vdpa.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
hw/virtio/vhost-vdpa.c +15 -7
index ea1aa71ad8..be7c63b4ba 100644
@@ -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));
 
Signature · 1 line
MST
#17 lore raw

[PULL 18/29] vdpa: Check for iova range at mappings changes

In reply to Michael S. Tsirkin

From: Eugenio Pérez <[email protected]>

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

Message-Id: <[email protected]>

---
 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(-)
include/hw/virtio/vhost-vdpa.h +2 -0
index a8963da2d9..c288cf7ecb 100644
@@ -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;
hw/virtio/vhost-vdpa.c +45 -15

91 lines not on this page · raw message

hw/virtio/trace-events +1 -0
index 8ed19e9d0c..650e521e35 100644
@@ -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"
Signature · 1 line
MST
#18 lore raw

[PULL 14/29] tests: migration-test: use qtest_has_accel() API

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 tests/qtest/migration-test.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
tests/qtest/migration-test.c +4 -11
index cc5e83d98a..7b42f6fd90 100644
@@ -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);
Signature · 1 line
MST
#19 lore raw

[PULL 25/29] vhost-user: fix duplicated notifier MR init

In reply to Michael S. Tsirkin

From: Xueming Li <[email protected]>

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 Yuwei Zhang <[email protected]>

Message-Id: <[email protected]>

---
 hw/virtio/vhost-user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/virtio/vhost-user.c +3 -2
index 2c8556237f..bf6e50223c 100644
@@ -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)) {
Signature · 1 line
MST
#20 lore raw

[PULL 21/29] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr

In reply to Michael S. Tsirkin

From: David Hildenbrand <[email protected]>

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 Michael S. Tsirkin <[email protected]>
Cc Raphael Norwitz <[email protected]>
Cc "Marc-André Lureau" <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Coiby Xu <[email protected]>

Message-Id: <[email protected]>

---
 subprojects/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)
subprojects/libvhost-user/libvhost-user.c +1 -0
index bf09693255..787f4d2d4f 100644
@@ -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 {
Signature · 1 line
MST
#21 lore raw

[PULL 20/29] virtio-iommu: Drop base_name and change generic_name

In reply to Michael S. Tsirkin

From: Eric Auger <[email protected]>

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

Message-Id: <[email protected]>

---
 include/hw/virtio/virtio-iommu.h | 2 +-
 hw/virtio/virtio-iommu-pci.c     | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
include/hw/virtio/virtio-iommu.h +1 -1
index 273e35c04b..e2339e5b72 100644
@@ -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"
hw/virtio/virtio-iommu-pci.c +1 -2
index 86fa4e6c28..a160ae6b41 100644
@@ -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,
Signature · 1 line
MST
#22 lore raw

[PULL 26/29] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob

In reply to Michael S. Tsirkin

From: Ani Sinha <[email protected]>

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.

Message-Id: <[email protected]>

---
 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
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
index dfb8523c8b..dabc024f53 100644
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.multi-bridge",
tests/data/acpi/q35/DSDT.multi-bridge new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Signature · 1 line
MST
#23 lore raw

[PULL 22/29] vhost-user-rng: Add vhost-user-rng implementation

In reply to Michael S. Tsirkin

From: Mathieu Poirier <[email protected]>

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.

Message-Id: <[email protected]>

---
 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
include/hw/virtio/vhost-user-rng.h new file +33 -0
new file mode 100644
index 0000000000..071539996d
@@ -0,0 +1,33 @@
+/*
+ * Vhost-user RNG virtio device
+ *
+ * Copyright (c) 2021 Mathieu Poirier <[email protected]>
+ *
+ * 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 */
hw/virtio/vhost-user-rng.c new file +289 -0

289 lines not on this page · raw message

hw/virtio/Kconfig +5 -0
index 35ab45e209..c144d42f9b 100644
@@ -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
hw/virtio/meson.build +1 -0
index bc352a6009..ae6b2cde10 100644
@@ -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'))
Signature · 1 line
MST
#24 lore raw

[PULL 23/29] vhost-user-rng-pci: Add vhost-user-rng-pci implementation

In reply to Michael S. Tsirkin

From: Mathieu Poirier <[email protected]>

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

Message-Id: <[email protected]>

---
 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
hw/virtio/vhost-user-rng-pci.c new file +79 -0
new file mode 100644
index 0000000000..c83dc86813
@@ -0,0 +1,79 @@
+/*
+ * Vhost-user RNG virtio device PCI glue
+ *
+ * Copyright (c) 2021 Mathieu Poirier <[email protected]>
+ *
+ * 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);
hw/virtio/meson.build +1 -0
index ae6b2cde10..521f7d64a8 100644
@@ -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'))
Signature · 1 line
MST
#25 lore raw

[PULL 15/29] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

.. only if TCG is available

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
tests/qtest/bios-tables-test.c +13 -15
index 873eb9c037..6e21a650d2 100644
@@ -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);
Signature · 1 line
MST
#26 lore raw

[PULL 29/29] failover: fix a regression introduced by JSON'ification of -device

In reply to Michael S. Tsirkin

From: Laurent Vivier <[email protected]>

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")

Message-Id: <[email protected]>

---
 hw/net/virtio-net.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
hw/net/virtio-net.c +18 -6
index 09e173a558..83642c85b2 100644
@@ -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);
 }
Signature · 1 line
MST
#27 lore raw

[PULL 24/29] docs: Add documentation for vhost based RNG implementation

In reply to Michael S. Tsirkin

From: Mathieu Poirier <[email protected]>

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

Message-Id: <[email protected]>

---
 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
docs/system/device-emulation.rst +1 -0
index 7afcfd8064..19944f526c 100644
@@ -88,3 +88,4 @@ Emulated Devices
    devices/usb.rst
    devices/vhost-user.rst
    devices/virtio-pmem.rst
+   devices/vhost-user-rng.rst
docs/system/devices/vhost-user-rng.rst new file +39 -0
new file mode 100644
index 0000000000..a145d4105c
@@ -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							\
+      ...
Signature · 1 line
MST
#28 lore raw

[PULL 27/29] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35

In reply to Michael S. Tsirkin

From: Ani Sinha <[email protected]>

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 ()
             }
         }
     }

}

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/qtest/bios-tables-test.c +18 -0
index 6e21a650d2..a5546180b7 100644
@@ -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);
Signature · 1 line
MST
#29 lore raw

[PULL 10/29] tests: acpi: add testcase for amd-iommu (IVRS table)

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tests/qtest/bios-tables-test.c +13 -0
index 0361c84c5e..ef28bb41f3 100644
@@ -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);
Signature · 1 line
MST
#30 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin

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.

Quoted 98 lines

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

vhost user rng
Fixes, cleanups all over the place.

----------------------------------------------------------------
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
#31 lore raw

[PULL 30/29] vhost-user-blk-test: pass vhost-user socket fds to QSD

In reply to Michael S. Tsirkin

From: Stefan Hajnoczi <[email protected]>

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 <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Thomas Huth <[email protected]>
Cc Coiby Xu <[email protected]>

Message-Id: <[email protected]>

---
 tests/qtest/vhost-user-blk-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qtest/vhost-user-blk-test.c +2 -2
index 6f108a1b62..62e670f39b 100644
@@ -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);
Signature · 1 line
MST
#32 lore raw
In reply to Michael S. Tsirkin
Quoted 97 lines · Michael S. Tsirkin

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.

----------------------------------------------------------------
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(-)
Quoted 12 lines

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~

#33 lore raw
Quoted 141 lines · On Tue, 19 Oct 2021 11:38:08 -0700 Richard Henderson…
Quoted 97 lines · Michael S. Tsirkin

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.

----------------------------------------------------------------
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(-)
Quoted 12 lines

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:

Quoted 6 lines

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

Quoted 2 lines

r~

#34 lore raw
Quoted 151 lines · Igor Mammedov
Quoted 141 lines · On Tue, 19 Oct 2021 11:38:08 -0700 Richard Henderson…
Quoted 97 lines · Michael S. Tsirkin

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.

----------------------------------------------------------------
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(-)
Quoted 12 lines

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:

Quoted 6 lines

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

Quoted 4 lines

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 <[email protected]>
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

#35 lore raw
Quoted 200 lines · Thomas Huth
Quoted 150 lines · Igor Mammedov
Quoted 140 lines · On Tue, 19 Oct 2021 11:38:08 -0700 Richard Henderson…
Quoted 97 lines · Michael S. Tsirkin

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.

----------------------------------------------------------------
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(-)
Quoted 12 lines

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:

Quoted 6 lines

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

Quoted 3 lines

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 <[email protected]>
Date:   Mon Aug 2 12:00:57 2021 +0300
Quoted 6 lines

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?

hw/pci/pci_bridge.c +5 -5
index d1f902ee86..da34c8ebcd 100644
@@ -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,
#36 lore raw
Quoted 222 lines · Michael S. Tsirkin
Quoted 200 lines · Thomas Huth
Quoted 150 lines · Igor Mammedov
Quoted 140 lines · On Tue, 19 Oct 2021 11:38:08 -0700 Richard Henderson…
Quoted 101 lines · Michael S. Tsirkin

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.

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

Quoted 8 lines

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:

Quoted 6 lines

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

Quoted 3 lines

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 <[email protected]>
Date:   Mon Aug 2 12:00:57 2021 +0300
Quoted 6 lines

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?

hw/pci/pci_bridge.c +0 -3
index d1f902ee86..da34c8ebcd 100644
@@ -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,

hw/pci/pci_bridge.c int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset, · line 458

Quoted 10 lines
hw/pci/pci_bridge.c +5 -2
-            .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

Reviewed-by
#37 lore raw
In reply to Michael S. Tsirkin

Hi Thomas,

Quoted 237 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Igor Mammedov
Quoted 2 lines · On Tue, 19 Oct 2021 11:38:08 -0700 Richard Henderson…
Quoted 1 line · Michael S. Tsirkin

The following changes since commit

9c050b661d3a43dfe2fd44106e559b39706d1296:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Merge remote-tracking branch

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

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

are available in the Git repository at:

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

tags/for_upstream

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

for you to fetch changes up to

bf2dd99b7d536cdba157fd6687810ce7b8340ccc:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

failover: fix a regression introduced by JSON'ification of

-device (2021-10-19 07:15:34 -0400)

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

vhost user rng
Fixes, cleanups all over the place.

----------------------------------------------------------------
Ani Sinha (3):
tests/acpi/bios-tables-test: add and allow changes to a

new q35 DSDT table blob

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

tests/acpi/pcihp: add unit tests for hotplug on

multifunction bridges for q35

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

tests/acpi/bios-tables-test: update DSDT blob for

multifunction bridge test

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

mmap_addr

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

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

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

tests: acpi: whitelist expected tables for acpi/q35/xapic

testcase

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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()

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

-device

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

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

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
   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

++++++++++++++++++++++++++++++

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
   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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

32-bit printf errors:

../hw/virtio/vhost-vdpa.c: In function

'vhost_vdpa_listener_skipped_section':

Quoted 1 line
Quoted 1 line
Quoted 1 line

../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects

argument of type 'long

Quoted 1 line
Quoted 1 line
Quoted 1 line

unsigned int', but argument 2 has type 'uint64_t' {aka 'long long

unsigned int'}

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Werror=format=]
error_report("RAM section out of device range (min=%lu,

addr=%lu)",

Quoted 1 line
Quoted 1 line
Quoted 1 line

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line
Quoted 1 line

iova_min,

section->offset_within_address_space);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
                        ~~~~~~~~

../hw/virtio/vhost-vdpa.c:55:22: error: format '%lu' expects

argument of type 'long

Quoted 1 line
Quoted 1 line
Quoted 1 line

unsigned int', but argument 3 has type 'hwaddr' {aka 'long long

unsigned int'}

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Werror=format=]
../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects

argument of type 'long

Quoted 1 line
Quoted 1 line
Quoted 1 line

unsigned int', but argument 2 has type 'uint64_t' {aka 'long long

unsigned int'}

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Werror=format=]
error_report("RAM section out of device range (max=%lu,

end addr=%lu)",

Quoted 1 line
Quoted 1 line
Quoted 1 line

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
                        iova_max, int128_get64(llend));
                        ~~~~~~~~

../hw/virtio/vhost-vdpa.c:62:22: error: format '%lu' expects

argument of type 'long

Quoted 1 line
Quoted 1 line
Quoted 1 line

unsigned int', but argument 3 has type 'uint64_t' {aka 'long long

unsigned int'}

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

[-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 ==

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

SIGNATURE): (0x00000000 == 0x0000dead)
ERROR qtest-i386/bios-tables-test - Bail out! ERROR:../tests/qtest/boot-sector.c:170:boot_sector_test: assertion

failed (signature ==

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

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

Quoted 7 lines

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

Quoted 26 lines

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

Quoted 1 line

I also noticed that the problem did not occur on older versions of QEMU,

so

Quoted 7 lines

I just bisected and ended up with this commit here:

e2a6290aab578b2170c1f5909fa556385dc0d820 is the first bad commit commit e2a6290aab578b2170c1f5909fa556385dc0d820

Author: Marcel Apfelbaum <[email protected]>
Date:   Mon Aug 2 12:00:57 2021 +0300
Quoted 6 lines
Quoted 3 lines

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

Quoted 1 line

hosts?

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

Quoted 5 lines
Quoted 2 lines

Thomas

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

Does this help?

Quoted 22 lines
hw/pci/pci_bridge.c +5 -5
index d1f902ee86..da34c8ebcd 100644
@@ -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)
     };
 
Quoted 3 lines

int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,

Thanks,
Marcel