Re: [libvirt] [PATCH 07/11] conf: Add virDomainPCIAddressSet.isPCIeToPCIBridgeSupported

2018-04-03 Thread John Ferlan


On 03/28/2018 10:06 AM, Andrea Bolognani wrote:
> Just like the existing areMultipleRootsSupported, this will
> allow us to change the results of the driver-agnostic PCI
> address allocation logic based on whether the QEMU binary
> supports certain features.
> 
> Signed-off-by: Andrea Bolognani 
> ---
>  src/conf/domain_addr.h | 2 ++
>  src/qemu/qemu_domain_address.c | 8 ++--
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 

Could also pass the bool instead of the qemuCaps to
qemuDomainPCIAddressSetCreate - this way is fine though ;-)

Reviewed-by: John Ferlan 

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 07/11] conf: Add virDomainPCIAddressSet.isPCIeToPCIBridgeSupported

2018-03-28 Thread Andrea Bolognani
Just like the existing areMultipleRootsSupported, this will
allow us to change the results of the driver-agnostic PCI
address allocation logic based on whether the QEMU binary
supports certain features.

Signed-off-by: Andrea Bolognani 
---
 src/conf/domain_addr.h | 2 ++
 src/qemu/qemu_domain_address.c | 8 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 87248a4fb8..3236b7d6de 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -118,6 +118,8 @@ struct _virDomainPCIAddressSet {
  and addresses aren't saved in device infos */
 /* If true, the guest can have multiple pci-root controllers */
 bool areMultipleRootsSupported;
+/* If true, the guest can use the pcie-to-pci-bridge controller */
+bool isPCIeToPCIBridgeSupported;
 };
 typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
 typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 86d9807908..7fe9d5926c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1338,6 +1338,7 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def 
ATTRIBUTE_UNUSED,
 
 static virDomainPCIAddressSetPtr
 qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
+  virQEMUCapsPtr qemuCaps,
   unsigned int nbuses,
   bool dryRun)
 {
@@ -1355,6 +1356,9 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
 if (qemuDomainIsPSeries(def))
 addrs->areMultipleRootsSupported = true;
 
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE))
+addrs->isPCIeToPCIBridgeSupported = true;
+
 for (i = 0; i < def->ncontrollers; i++) {
 virDomainControllerDefPtr cont = def->controllers[i];
 size_t idx = cont->idx;
@@ -2361,7 +2365,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
 
 if (nbuses > 0) {
 /* 1st pass to figure out how many PCI bridges we need */
-if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true)))
+if (!(addrs = qemuDomainPCIAddressSetCreate(def, qemuCaps, nbuses, 
true)))
 goto cleanup;
 
 if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps,
@@ -2491,7 +2495,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
 addrs = NULL;
 }
 
-if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
+if (!(addrs = qemuDomainPCIAddressSetCreate(def, qemuCaps, nbuses, false)))
 goto cleanup;
 
 if (qemuDomainSupportsPCI(def, qemuCaps)) {
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list