[PATCH v2 24/29] qemu: introduce QEMU_CAPS_DEVICE_PNV_PHB4

Daniel Henrique Barboza danielhb413 at gmail.com
Tue Jan 25 20:48:57 UTC 2022


This capability enables two devices:

- pnv-phb4 device, the pcie-root controller for PowerNV9 domains
- pnv-phb4-root-port, the pcie-root-port model that is used with the
pnv-phb4 device.

As with the pnv-phb3 devices, these are also user creatable only after
QEMU 6.2.0 but the capability is available since 5.0.0, meaning that we
need to check QEMU version and arch manually before setting it.

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/qemu/qemu_capabilities.c                    | 7 ++++++-
 src/qemu/qemu_capabilities.h                    | 1 +
 tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d60240912c..668579dbcc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -663,6 +663,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "device.json+hotplug", /* QEMU_CAPS_DEVICE_JSON */
               "hvf", /* QEMU_CAPS_HVF */
               "pnv-phb3", /* QEMU_CAPS_DEVICE_PNV_PHB3 */
+              "pnv-phb4", /* QEMU_CAPS_DEVICE_PNV_PHB4 */
     );
 
 
@@ -1403,6 +1404,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
      *
      * { "pnv-phb3", QEMU_CAPS_DEVICE_PNV_PHB3 },
      * { "pnv-phb3-root-port", QEMU_CAPS_DEVICE_PNV_PHB3 },
+     * { "pnv-phb4", QEMU_CAPS_DEVICE_PNV_PHB4 },
+     * { "pnv-phb4-root-port", QEMU_CAPS_DEVICE_PNV_PHB4 },
      *
      * Because they are present in QEMU binaries since QEMU 5.0.0
      * but became user creatable only in the QEMU 7.0.0 development
@@ -5248,8 +5251,10 @@ virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps)
      * QEMU 6.2.0. The version value set here was taken from a
      * binary post 6.2.0 release that has user creatable pnv-phb
      * support. */
-    if (qemuCaps->version >= 6002050 && ARCH_IS_PPC64(qemuCaps->arch))
+    if (qemuCaps->version >= 6002050 && ARCH_IS_PPC64(qemuCaps->arch)) {
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_PNV_PHB3);
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_PNV_PHB4);
+    }
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index ed3973c0ba..f69155f863 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -638,6 +638,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_DEVICE_JSON, /* -device accepts JSON (and works with hot-unplug) */
     QEMU_CAPS_HVF, /* Whether Hypervisor.framework is available */
     QEMU_CAPS_DEVICE_PNV_PHB3, /* devices pnv-phb3 and pnv-phb3-root-port */
+    QEMU_CAPS_DEVICE_PNV_PHB4, /* devices pnv-phb4 and pnv-phb4-root-port */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
index cb6c146a28..9833c5548e 100644
--- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
@@ -201,6 +201,7 @@
   <flag name='sev-guest-kernel-hashes'/>
   <flag name='device.json+hotplug'/>
   <flag name='pnv-phb3'/>
+  <flag name='pnv-phb4'/>
   <version>6002050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900243</microcodeVersion>
-- 
2.34.1




More information about the libvir-list mailing list