[libvirt PATCH v2 10/22] DONOTMERGEYET: qemu: Introduce QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS

Andrea Bolognani abologna at redhat.com
Wed Oct 20 13:02:45 UTC 2021


This capability detects the availability of the boot-bypass
property of the virtio-iommu-pci device.

This property was only introduced in QEMU 6.2 but, since the
device has been around for much longer, we end up querying its
properties for several more releases. As I don't have convenient
access to the 10+ binaries necessary to regenerate the replies,
I just put some fake data in there.

NOTE: the QEMU 6.2 binaries were built from source trees where

  https://lists.gnu.org/archive/html/qemu-devel/2021-10/msg00161.html
  https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg07819.html

had been applied.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/qemu/qemu_capabilities.c                  |   8 +
 src/qemu/qemu_capabilities.h                  |   1 +
 .../caps_5.0.0.aarch64.replies                |  71 +++--
 .../caps_5.0.0.ppc64.replies                  |  59 ++--
 .../caps_5.0.0.riscv64.replies                |  55 ++--
 .../caps_5.0.0.x86_64.replies                 |  71 +++--
 .../caps_5.1.0.x86_64.replies                 |  71 +++--
 .../caps_5.2.0.aarch64.replies                |  71 +++--
 .../caps_5.2.0.ppc64.replies                  |  59 ++--
 .../caps_5.2.0.riscv64.replies                |  55 ++--
 .../caps_5.2.0.s390x.replies                  |  59 ++--
 .../caps_5.2.0.x86_64.replies                 |  71 +++--
 .../caps_6.0.0.aarch64.replies                |  71 +++--
 .../caps_6.0.0.s390x.replies                  |  59 ++--
 .../caps_6.0.0.x86_64.replies                 |  71 +++--
 .../caps_6.1.0.x86_64.replies                 |  71 +++--
 .../caps_6.2.0.aarch64.replies                | 275 ++++++++++++++++--
 .../caps_6.2.0.aarch64.xml                    |   1 +
 .../caps_6.2.0.x86_64.replies                 | 275 ++++++++++++++++--
 .../caps_6.2.0.x86_64.xml                     |   1 +
 20 files changed, 1099 insertions(+), 376 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 30eed6b1b9..4443fb6b19 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -652,6 +652,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "device.json", /* QEMU_CAPS_DEVICE_JSON */
               "query-dirty-rate", /* QEMU_CAPS_QUERY_DIRTY_RATE */
               "virtio-iommu-pci", /* QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI */
+              "virtio-iommu.boot-bypass", /* QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS */
     );
 
 
@@ -1552,6 +1553,10 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] =
     { "bootindex", QEMU_CAPS_VHOST_USER_FS_BOOTINDEX, NULL },
 };
 
+static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMMU[] = {
+    { "boot-bypass", QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS, NULL },
+};
+
 /* see documentation for virQEMUQAPISchemaPathGet for the query format */
 static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
     { "block-commit/arg-type/*top",  QEMU_CAPS_ACTIVE_COMMIT },
@@ -1711,6 +1716,9 @@ static virQEMUCapsDeviceTypeProps virQEMUCapsDeviceProps[] = {
     { "vhost-user-fs-device", virQEMUCapsDevicePropsVhostUserFS,
       G_N_ELEMENTS(virQEMUCapsDevicePropsVhostUserFS),
       QEMU_CAPS_DEVICE_VHOST_USER_FS },
+    { "virtio-iommu-pci", virQEMUCapsDevicePropsVirtioIOMMU,
+      G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioIOMMU),
+      QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendFile[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d8417c1955..8b40344985 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -632,6 +632,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_DEVICE_JSON, /* -device accepts JSON */
     QEMU_CAPS_QUERY_DIRTY_RATE, /* accepts query-dirty-rate */
     QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI, /* -device virtio-iommu-pci */
+    QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS, /* virtio-iommu.boot-bypass */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.replies b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.replies
index 574c14d4ce..29bde0357f 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.replies
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.replies
@@ -20244,12 +20244,31 @@
   "id": "libvirt-32"
 }
 
+{
+  "execute": "device-list-properties",
+  "arguments": {
+    "typename": "virtio-iommu-pci"
+  },
+  "id": "libvirt-33"
+}
+
+{
+  "return": [
+    {
+      "name": "fake-data",
+      "description": "pretend there's real data here",
+      "type": "str"
+    }
+  ],
+  "id": "libvirt-33"
+}
[...]
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.replies b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.replies
index e8ce132f3c..80bf3a4eb5 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.replies
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.replies
@@ -24217,12 +24217,235 @@
   "id": "libvirt-34"
 }
 
+{
+  "execute": "device-list-properties",
+  "arguments": {
+    "typename": "virtio-iommu-pci"
+  },
+  "id": "libvirt-35"
+}
+
+{
+  "return": [
+    {
+      "default-value": 1,
+      "name": "rombar",
+      "type": "uint32"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-lnksta-dllla",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": 4294967295,
+      "name": "romsize",
+      "type": "uint32"
+    },
+    {
+      "default-value": false,
+      "name": "multifunction",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": 0,
+      "name": "acpi-index",
+      "type": "uint32"
+    },
+    {
+      "name": "romfile",
+      "type": "str"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-extcap-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": -1,
+      "name": "addr",
+      "description": "Slot and optional function number, example: 06.0 or 06",
+      "type": "int32"
+    },
+    {
+      "name": "failover_pair_id",
+      "type": "str"
+    },
+    {
+      "default-value": false,
+      "name": "virtio-pci-bus-master-bug-migration",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-lnkctl-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-flr-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "x-ignore-backend-features",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "page-per-vq",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "migrate-extra",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-pm-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "modern-pio-notify",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-deverr-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "aer",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "ats",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "x-disable-pcie",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-ats-page-aligned",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": 0,
+      "name": "len-reserved-regions",
+      "type": "uint32"
+    },
+    {
+      "default-value": 0,
+      "name": "class",
+      "type": "uint32"
+    },
+    {
+      "default-value": false,
+      "name": "disable-modern",
+      "type": "bool"
+    },
+    {
+      "default-value": "auto",
+      "name": "disable-legacy",
+      "description": "on/off/auto",
+      "type": "OnOffAuto"
+    },
+    {
+      "default-value": true,
+      "name": "notify_on_empty",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "any_layout",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "indirect_desc",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "use-started",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "boot-bypass",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "event_idx",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "primary-bus",
+      "type": "link<PCI>"
+    },
+    {
+      "default-value": false,
+      "name": "x-disable-legacy-check",
+      "type": "bool"
+    },
+    {
+      "name": "virtio-backend",
+      "type": "child<virtio-iommu-device>"
+    },
+    {
+      "default-value": false,
+      "name": "iommu_platform",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "use-disabled-flag",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "packed",
+      "description": "on/off",
+      "type": "bool"
+    }
+  ],
+  "id": "libvirt-35"
+}
[...]
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
index 78efae4fdb..cc0349e1d2 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
@@ -205,6 +205,7 @@
   <flag name='device.json'/>
   <flag name='query-dirty-rate'/>
   <flag name='virtio-iommu-pci'/>
+  <flag name='virtio-iommu.boot-bypass'/>
   <version>6001050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>61700244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies
index aa7a779a68..a1ee80c6a1 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.replies
@@ -23425,12 +23425,235 @@
   "id": "libvirt-37"
 }
 
+{
+  "execute": "device-list-properties",
+  "arguments": {
+    "typename": "virtio-iommu-pci"
+  },
+  "id": "libvirt-38"
+}
+
+{
+  "return": [
+    {
+      "name": "failover_pair_id",
+      "type": "str"
+    },
+    {
+      "name": "romfile",
+      "type": "str"
+    },
+    {
+      "default-value": -1,
+      "name": "addr",
+      "description": "Slot and optional function number, example: 06.0 or 06",
+      "type": "int32"
+    },
+    {
+      "default-value": 4294967295,
+      "name": "romsize",
+      "type": "uint32"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-lnksta-dllla",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": 1,
+      "name": "rombar",
+      "type": "uint32"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-extcap-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": 0,
+      "name": "acpi-index",
+      "type": "uint32"
+    },
+    {
+      "default-value": false,
+      "name": "multifunction",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "migrate-extra",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "ats",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "x-ignore-backend-features",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-pm-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "aer",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-flr-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-lnkctl-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-ats-page-aligned",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "page-per-vq",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "x-pcie-deverr-init",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "virtio-pci-bus-master-bug-migration",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "modern-pio-notify",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "x-disable-pcie",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": 0,
+      "name": "len-reserved-regions",
+      "type": "uint32"
+    },
+    {
+      "default-value": 0,
+      "name": "class",
+      "type": "uint32"
+    },
+    {
+      "default-value": "auto",
+      "name": "disable-legacy",
+      "description": "on/off/auto",
+      "type": "OnOffAuto"
+    },
+    {
+      "default-value": false,
+      "name": "disable-modern",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "use-disabled-flag",
+      "type": "bool"
+    },
+    {
+      "name": "virtio-backend",
+      "type": "child<virtio-iommu-device>"
+    },
+    {
+      "default-value": false,
+      "name": "packed",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "iommu_platform",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "event_idx",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "boot-bypass",
+      "type": "bool"
+    },
+    {
+      "default-value": false,
+      "name": "x-disable-legacy-check",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "notify_on_empty",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "any_layout",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "use-started",
+      "type": "bool"
+    },
+    {
+      "default-value": true,
+      "name": "indirect_desc",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "primary-bus",
+      "type": "link<PCI>"
+    }
+  ],
+  "id": "libvirt-38"
+}
[...]
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
index 526c14208d..04432cde3b 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
@@ -242,6 +242,7 @@
   <flag name='device.json'/>
   <flag name='query-dirty-rate'/>
   <flag name='virtio-iommu-pci'/>
+  <flag name='virtio-iommu.boot-bypass'/>
   <version>6001050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>43100244</microcodeVersion>
-- 
2.31.1




More information about the libvir-list mailing list