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

[libvirt] [RFC 09/12] RFC: Don't reserve slot 1 if a USB controller is defined there



---
 src/qemu/qemu_command.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9ea4b7c..d25f34f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1093,6 +1093,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
 {
     int i;
     bool reservedIDE = false;
+    bool reservedUSB = false;
     bool reservedVGA = false;
 
     /* Host bridge */
@@ -1123,13 +1124,20 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
                 def->controllers[i]->info.addr.pci.slot = 1;
                 def->controllers[i]->info.addr.pci.function = 1;
             }
+        } else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+                   def->controllers[i]->idx == 0 &&
+                   def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+                   def->controllers[i]->info.addr.pci.domain == 0 &&
+                   def->controllers[i]->info.addr.pci.bus == 0 &&
+                   def->controllers[i]->info.addr.pci.slot == 1) {
+            reservedUSB = true;
         }
     }
 
     /* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller)
      * hardcoded slot=1, multifunction device
      */
-    if (!reservedIDE &&
+    if (!reservedIDE && !reservedUSB &&
         qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
         goto error;
 
-- 
1.7.6


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