[PATCH v3 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, clearing the capability if necessary.

Suggested-by: Peter Krempa <pkrempa@xxxxxxxxxx>
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_capabilities.c                    | 11 +++++++++++
 src/qemu/qemu_capabilities.h                    |  3 +++
 tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml |  1 +
 tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml |  1 +
 tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml |  1 +
 tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml |  1 +
 6 files changed, 18 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 28e7820d0e..dbd9065a99 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -665,6 +665,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "virtio-mem-pci.prealloc", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC */
               "calc-dirty-rate", /* QEMU_CAPS_CALC_DIRTY_RATE */
               "dirtyrate-param.mode", /* QEMU_CAPS_DIRTYRATE_MODE */
+
+              /* 425 */
+              "pnv-phb3", /* QEMU_CAPS_DEVICE_PNV_PHB3 */
     );
 
 
@@ -1401,6 +1404,7 @@ 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 },
+    { "pnv-phb3", QEMU_CAPS_DEVICE_PNV_PHB3 },
 };
 
 
@@ -5243,6 +5247,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 <= 6002000 && ARCH_IS_PPC64(qemuCaps->arch))
+        virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_PNV_PHB3);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index f6188b42de..47845fbc59 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -641,6 +641,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_CALC_DIRTY_RATE, /* accepts calc-dirty-rate */
     QEMU_CAPS_DIRTYRATE_MODE , /* calc-dirty-rate accepts mode parameter */
 
+    /* 425 */
+    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_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
index 070d0f2982..adaa13f6e1 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
@@ -186,6 +186,7 @@
   <flag name='input-linux'/>
   <flag name='query-display-options'/>
   <flag name='virtio-blk.queue-size'/>
+  <flag name='pnv-phb3'/>
   <version>5000000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
index e050514fc1..4c3526f499 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
@@ -190,6 +190,7 @@
   <flag name='virtio-blk.queue-size'/>
   <flag name='query-dirty-rate'/>
   <flag name='calc-dirty-rate'/>
+  <flag name='pnv-phb3'/>
   <version>5002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
index 9fe9c27d14..7dfe86ba30 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
@@ -201,6 +201,7 @@
   <flag name='sev-guest-kernel-hashes'/>
   <flag name='calc-dirty-rate'/>
   <flag name='dirtyrate-param.mode'/>
+  <flag name='pnv-phb3'/>
   <version>6002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
index 5d7f283a73..57c5ead7a4 100644
--- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
@@ -202,6 +202,7 @@
   <flag name='device.json+hotplug'/>
   <flag name='calc-dirty-rate'/>
   <flag name='dirtyrate-param.mode'/>
+  <flag name='pnv-phb3'/>
   <version>6002050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900243</microcodeVersion>
-- 
2.35.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