From f35bbf7be72702f14f9a81f147322f95cbef4003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 2 Sep 2011 22:42:09 +0800 Subject: [PATCH] qemu: don't reserve slot 1 if a PIIX3 USB controller is defined there Applies only to piix3 and check if piix3 controller is on correct address, or report error --- src/qemu/qemu_command.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cf41a180bc..ff8a8313f2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1091,6 +1091,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) { int i; bool reservedIDE = false; + bool reservedUSB = false; bool reservedVGA = false; int function; @@ -1122,6 +1123,13 @@ 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; } } @@ -1129,7 +1137,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) * hardcoded slot=1, multifunction device */ for (function = 0; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) { - if (function == 1 && reservedIDE) + if (function == 1 && (reservedIDE || reservedUSB)) /* we have reserved this pci address */ continue;