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

[libvirt] [PATCH 2/7] Release address in function granularity than slot



The commit 6fe678c is reverted. The code is moved around and cant revert
staright.

Signed-off-by: Shivaprasad G Bhat <sbhat linux vnet ibm com>
---
 src/conf/domain_addr.c         |   22 +++++++++-------------
 src/libvirt_private.syms       |    1 +
 src/qemu/qemu_domain_address.c |    2 +-
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index acd8ce6..35c7cd4 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -472,21 +472,17 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
         goto cleanup;
 
     if (dev->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-        /* We do not support hotplug multi-function PCI device now, so we should
-         * reserve the whole slot. The function of the PCI device must be 0.
-         */
-        if (dev->addr.pci.function != 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Only PCI device addresses with function=0"
-                             " are supported"));
-            goto cleanup;
-        }
+        if (((dev->addr.pci.function == 0) && (dev->addr.pci.multi == VIR_TRISTATE_SWITCH_ON)) ||
+            dev->addr.pci.function != 0) {
 
-        if (!virDomainPCIAddressValidate(addrs, &dev->addr.pci,
-                                         addrStr, flags, true))
-            goto cleanup;
+            if (!virDomainPCIAddressValidate(addrs, &dev->addr.pci,
+                                             addrStr, flags, true))
+                goto cleanup;
 
-        ret = virDomainPCIAddressReserveSlot(addrs, &dev->addr.pci, flags);
+            ret = virDomainPCIAddressReserveAddr(addrs, &dev->addr.pci, flags, false, true);
+        } else {
+            ret = virDomainPCIAddressReserveSlot(addrs, &dev->addr.pci, flags);
+        }
     } else {
         ret = virDomainPCIAddressReserveNextSlot(addrs, dev, flags);
     }
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fb24808..e4953b7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -98,6 +98,7 @@ virDomainPCIAddressBusSetModel;
 virDomainPCIAddressEnsureAddr;
 virDomainPCIAddressFlagsCompatible;
 virDomainPCIAddressGetNextSlot;
+virDomainPCIAddressReleaseAddr;
 virDomainPCIAddressReleaseSlot;
 virDomainPCIAddressReserveAddr;
 virDomainPCIAddressReserveNextSlot;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9c8c262..1e7d98c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1682,7 +1682,7 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
                  NULLSTR(devstr));
     else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
              virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
-             virDomainPCIAddressReleaseSlot(priv->pciaddrs,
+             virDomainPCIAddressReleaseAddr(priv->pciaddrs,
                                             &info->addr.pci) < 0)
         VIR_WARN("Unable to release PCI address on %s",
                  NULLSTR(devstr));


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