Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/conf/domain_conf.c | 21 +++++++++++++++++++++ src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + 3 files changed, 23 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d1cda8c3f5..1815308a8c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2441,6 +2441,27 @@ virDomainControllerIsPSeriesPHB(const virDomainControllerDef *cont) } +bool +virDomainControllerIsPowerNVPHB(const virDomainControllerDef *cont) +{ + virDomainControllerPCIModelName name; + + /* PowerNV PHBs are pcie-root controllers */ + if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI || + cont->model != VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) { + return false; + } + + 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; + + return true; +} + + virDomainFSDef * virDomainFSDefNew(virDomainXMLOption *xmlopt) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index db9021146d..4317039e8b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3333,6 +3333,7 @@ virDomainControllerDef *virDomainControllerDefNew(virDomainControllerType type); void virDomainControllerDefFree(virDomainControllerDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainControllerDef, virDomainControllerDefFree); bool virDomainControllerIsPSeriesPHB(const virDomainControllerDef *cont); +bool virDomainControllerIsPowerNVPHB(const virDomainControllerDef *cont); virDomainFSDef *virDomainFSDefNew(virDomainXMLOption *xmlopt); void virDomainFSDefFree(virDomainFSDef *def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ba3462d849..a18fbd4bb8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -287,6 +287,7 @@ virDomainControllerFindByType; virDomainControllerFindUnusedIndex; virDomainControllerInsert; virDomainControllerInsertPreAlloced; +virDomainControllerIsPowerNVPHB; virDomainControllerIsPSeriesPHB; virDomainControllerModelIDETypeFromString; virDomainControllerModelIDETypeToString; -- 2.34.1