Blob Blame History Raw
From 4f2bf4edfb640c38281d63e54145433ce8a78d28 Mon Sep 17 00:00:00 2001
Message-Id: <4f2bf4edfb640c38281d63e54145433ce8a78d28@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:04:11 -0400
Subject: [PATCH] conf/qemu:
 s/VIR_PCI_CONNECT_HOTPLUGGABLE/VIR_PCI_CONNECT_AUTOASSIGN/g

When the HOTPLUGGABLE flag was originally added, it was set for all
the PCI controllers that accepted hotplugged devices, and requested
for all devices that were auto-assigned to a controller. While we're
still autoassigning to the same list of controllers, those controllers
may or may not support hotplug, so let's use the flag that fits what
we're actually doing.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 7c98f5e3652e19e4eb015d290c1eed2f1b58ee72)

https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426170415.18328-9-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/conf/domain_addr.c         | 18 +++++++++---------
 src/qemu/qemu_domain_address.c | 14 +++++++-------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index e0be655772..53be6cd34b 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -362,8 +362,8 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
          * libvirt's assumptions about whether or not hotplug
          * capability will be required.
          */
-        if (devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)
-            busFlags |= VIR_PCI_CONNECT_HOTPLUGGABLE;
+        if (devFlags & VIR_PCI_CONNECT_AUTOASSIGN)
+            busFlags |= VIR_PCI_CONNECT_AUTOASSIGN;
         /* if the device is a pci-bridge, allow manually
          * assigning to any bus that would also accept a
          * standard PCI device.
@@ -419,8 +419,8 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
                        addrStr, addr->bus, connectStr);
         return false;
     }
-    if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
-        !(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
+    if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) &&
+        !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) {
         if (reportError) {
             virReportError(errType,
                            _("The device at PCI address %s requires "
@@ -509,7 +509,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
      */
     switch (model) {
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
-        bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+        bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
                       VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
                       VIR_PCI_CONNECT_TYPE_PCI_BRIDGE |
                       VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS);
@@ -517,14 +517,14 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
         bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
-        bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+        bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
                       VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
                       VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
         bus->minSlot = 1;
         bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
-        bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+        bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
                       VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
                       VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
         bus->minSlot = 0;
@@ -555,7 +555,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
         /* Same as pci-bridge: 32 hotpluggable traditional PCI slots (0-31),
          * the first of which is not usable because of the SHPC */
-        bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+        bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
                       VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
                       VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
         bus->minSlot = 1;
@@ -566,7 +566,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
         /* provides one slot which is pcie, can be used by endpoint
          * devices, pcie-switch-upstream-ports or pcie-to-pci-bridges,
          * and is hotpluggable */
-        bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+        bus->flags = (VIR_PCI_CONNECT_AUTOASSIGN |
                       VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
                       VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT |
                       VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 3c6ac62ff5..e81585bc6c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -571,7 +571,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
                                          virDomainPCIConnectFlags virtioFlags)
 {
     virDomainPCIConnectFlags pciFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
-                                         VIR_PCI_CONNECT_HOTPLUGGABLE);
+                                         VIR_PCI_CONNECT_AUTOASSIGN);
 
     switch ((virDomainDeviceType)dev->type) {
     case VIR_DOMAIN_DEVICE_CONTROLLER: {
@@ -1063,17 +1063,17 @@ qemuDomainFillDevicePCIConnectFlagsIterInit(virDomainDefPtr def,
 
     if (qemuDomainHasPCIeRoot(def)) {
         data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
-                           VIR_PCI_CONNECT_HOTPLUGGABLE);
+                           VIR_PCI_CONNECT_AUTOASSIGN);
     } else {
         data->pcieFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
-                           VIR_PCI_CONNECT_HOTPLUGGABLE);
+                           VIR_PCI_CONNECT_AUTOASSIGN);
     }
 
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
         data->virtioFlags = data->pcieFlags;
     } else {
         data->virtioFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
-                             VIR_PCI_CONNECT_HOTPLUGGABLE);
+                             VIR_PCI_CONNECT_AUTOASSIGN);
     }
 }
 
@@ -1729,7 +1729,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
     virPCIDeviceAddress tmp_addr;
     bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
     g_autofree char *addrStr = NULL;
-    virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE
+    virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_AUTOASSIGN
                                       | VIR_PCI_CONNECT_TYPE_PCI_DEVICE);
 
     /* Verify that first IDE and USB controllers (if any) is on the PIIX3, fn 1 */
@@ -2666,7 +2666,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
              * domain.
              */
             virDomainDeviceInfo info = {
-                .pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+                .pciConnectFlags = (VIR_PCI_CONNECT_AUTOASSIGN |
                                     VIR_PCI_CONNECT_TYPE_PCI_DEVICE),
                 .pciAddrExtFlags = VIR_PCI_ADDRESS_EXTENSION_NONE
             };
@@ -2707,7 +2707,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
             addrs->nbuses > max_idx + 1 &&
             qemuDomainHasPCIeRoot(def)) {
             virDomainDeviceInfo info = {
-                .pciConnectFlags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+                .pciConnectFlags = (VIR_PCI_CONNECT_AUTOASSIGN |
                                     VIR_PCI_CONNECT_TYPE_PCIE_DEVICE),
                 .pciAddrExtFlags = VIR_PCI_ADDRESS_EXTENSION_NONE
             };
-- 
2.26.2