[PATCH v2 09/29] qemu: introduce QEMU_CAPS_DEVICE_PNV_PHB3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



QEMU_CAPS_DEVICE_PNV_PHB3 indicates binary support for the pnv-phb3
device, the pcie-root controller for PowerNV8 domains, and also
the pnv-phb3-root-port device, its pcie-root-port device.

This capability is present in QEMU since 5.0.0 but these devices are
user-creatable only after QEMU 6.2.0. This means that probing it as
default will be misleading for users. Instead, let's use
virQEMUCapsInitQMPVersionCaps() to check for the adequate QEMU version
and arch and set it manually.

Suggested-by: Peter Krempa <pkrempa@xxxxxxxxxx>
Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_capabilities.c                  | 19 +++++++++++++++++++
 src/qemu/qemu_capabilities.h                  |  1 +
 .../qemucapabilitiesdata/caps_7.0.0.ppc64.xml |  1 +
 3 files changed, 21 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index bb90715569..d60240912c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -662,6 +662,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               /* 420 */
               "device.json+hotplug", /* QEMU_CAPS_DEVICE_JSON */
               "hvf", /* QEMU_CAPS_HVF */
+              "pnv-phb3", /* QEMU_CAPS_DEVICE_PNV_PHB3 */
     );
 
 
@@ -1397,6 +1398,17 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "virtio-vga-gl", QEMU_CAPS_VIRTIO_VGA_GL },
     { "s390-pv-guest", QEMU_CAPS_S390_PV_GUEST },
     { "virtio-mem-pci", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI },
+    /*
+     * We don't probe the following PowerNV devices:
+     *
+     * { "pnv-phb3", QEMU_CAPS_DEVICE_PNV_PHB3 },
+     * { "pnv-phb3-root-port", QEMU_CAPS_DEVICE_PNV_PHB3 },
+     *
+     * Because they are present in QEMU binaries since QEMU 5.0.0
+     * but became user creatable only in the QEMU 7.0.0 development
+     * cycle. Their respective capabilities are being set in
+     * virQEMUCapsInitQMPVersionCaps().
+     */
 };
 
 
@@ -5231,6 +5243,13 @@ virQEMUCapsInitQMPVersionCaps(virQEMUCaps *qemuCaps)
      */
     if (qemuCaps->version < 5002000)
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_FIPS);
+
+    /* PowerNV pnv-phb devices weren't user creatable up to
+     * 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))
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_PNV_PHB3);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index c6fb87a73a..ed3973c0ba 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -637,6 +637,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     /* 420 */
     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_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 88eee87587..cb6c146a28 100644
--- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
@@ -200,6 +200,7 @@
   <flag name='rbd-encryption'/>
   <flag name='sev-guest-kernel-hashes'/>
   <flag name='device.json+hotplug'/>
+  <flag name='pnv-phb3'/>
   <version>6002050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900243</microcodeVersion>
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux