Re: [PATCH v2 27/29] conf, qemu: add 'pnv-phb4' controller model name

2022-02-21 Thread Ján Tomko

On a Tuesday in 2022, Daniel Henrique Barboza wrote:

Similar to the existing pnv-phb3 device, pnv-phb4 is also an
implementation of pcie-root. No user doc is needed in this case since
the user doesn't ideally set PCI model names manually.

Signed-off-by: Daniel Henrique Barboza 
---
docs/schemas/domaincommon.rng  |  1 +
src/conf/domain_conf.c |  2 +-
src/conf/domain_conf.h |  1 +
src/qemu/qemu_domain_address.c | 14 +-
src/qemu/qemu_validate.c   |  2 ++
5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 116fedc19e..dce2548825 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2599,6 +2599,7 @@
i82801b11-bridge

pnv-phb3
+pnv-phb4

pcie-pci-bridge

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0305c913d9..585e7d9dae 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -441,6 +441,7 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
  "pnv-phb3-root-port",
  "pnv-phb3",
  "pnv-phb4-root-port",
+  "pnv-phb4",
);

VIR_ENUM_IMPL(virDomainControllerModelSCSI,
@@ -2456,7 +2457,6 @@ virDomainControllerIsPowerNVPHB(const 
virDomainControllerDef *cont)

name = cont->opts.pciopts.modelName;

-/* The actual device used for PHBs is pnv-phb3 */


This removal is suspicious. Better to not add the comment in the first
place.


if (name != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3)
return false;



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


[PATCH v2 27/29] conf, qemu: add 'pnv-phb4' controller model name

2022-01-25 Thread Daniel Henrique Barboza
Similar to the existing pnv-phb3 device, pnv-phb4 is also an
implementation of pcie-root. No user doc is needed in this case since
the user doesn't ideally set PCI model names manually.

Signed-off-by: Daniel Henrique Barboza 
---
 docs/schemas/domaincommon.rng  |  1 +
 src/conf/domain_conf.c |  2 +-
 src/conf/domain_conf.h |  1 +
 src/qemu/qemu_domain_address.c | 14 +-
 src/qemu/qemu_validate.c   |  2 ++
 5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 116fedc19e..dce2548825 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2599,6 +2599,7 @@
 i82801b11-bridge
 
 pnv-phb3
+pnv-phb4
 
 pcie-pci-bridge
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0305c913d9..585e7d9dae 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -441,6 +441,7 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
   "pnv-phb3-root-port",
   "pnv-phb3",
   "pnv-phb4-root-port",
+  "pnv-phb4",
 );
 
 VIR_ENUM_IMPL(virDomainControllerModelSCSI,
@@ -2456,7 +2457,6 @@ virDomainControllerIsPowerNVPHB(const 
virDomainControllerDef *cont)
 
 name = cont->opts.pciopts.modelName;
 
-/* The actual device used for PHBs is pnv-phb3 */
 if (name != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3)
 return false;
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6532b78322..2755a19e2d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -649,6 +649,7 @@ typedef enum {
 VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT,
 VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3,
 VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4_ROOT_PORT,
+VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4,
 
 VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
 } virDomainControllerPCIModelName;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index e18cc81f04..615182cb85 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2424,6 +2424,18 @@ virDomainControllerGetPowerNVRootPortName(virDomainDef 
*def)
 }
 
 
+static virDomainControllerPCIModelName
+virDomainControllerGetPowerNVPHBName(virDomainDef *def)
+{
+if (STREQ(def->os.machine, "powernv8"))
+return VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3;
+else if (STREQ(def->os.machine, "powernv9"))
+return VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4;
+
+return VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE;
+}
+
+
 static void
 qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef *cont,
virDomainDef *def,
@@ -2476,7 +2488,7 @@ 
qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef *cont,
 break;
 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
 if (qemuDomainIsPowerNV(def))
-*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3;
+*modelName = virDomainControllerGetPowerNVPHBName(def);
 break;
 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT:
 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 6f49a5f17b..fb907a3109 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3434,6 +3434,8 @@ virValidateControllerPCIModelNameToQEMUCaps(int modelName)
 return QEMU_CAPS_DEVICE_PNV_PHB3;
 case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4_ROOT_PORT:
 return QEMU_CAPS_DEVICE_PNV_PHB4;
+case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4:
+return QEMU_CAPS_DEVICE_PNV_PHB4;
 case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE:
 return 0;
 case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST:
-- 
2.34.1