mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Fix PCI address assignment if no IDE controller is present
The PCI slot 1 must be reserved at all times, since PIIX3 is always present, even if no IDE device is in use for guest disks * src/qemu/qemu_conf.c: Always reserve slot 1 for PIIX3
This commit is contained in:
parent
7af5f4689f
commit
020d220421
@ -2265,19 +2265,23 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
|
|||||||
* - VirtIO balloon
|
* - VirtIO balloon
|
||||||
* - Host device passthrough
|
* - Host device passthrough
|
||||||
* - Watchdog
|
* - Watchdog
|
||||||
|
*
|
||||||
|
* Prior to this function being invoked, qemuCollectPCIAddress() will have
|
||||||
|
* added all existing PCI addresses from the 'def' to 'addrs'. Thus this
|
||||||
|
* function must only try to reserve addresses if info.type == NONE and
|
||||||
|
* skip over info.type == PCI
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
|
qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
bool reservedIDE = false;
|
||||||
|
|
||||||
/* Host bridge */
|
/* Host bridge */
|
||||||
if (qemuDomainPCIAddressReserveSlot(addrs, 0) < 0)
|
if (qemuDomainPCIAddressReserveSlot(addrs, 0) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller)
|
/* Verify that first IDE controller (if any) is on the PIIX3, fn 1 */
|
||||||
* hardcoded slot=1, multifunction device
|
|
||||||
*/
|
|
||||||
for (i = 0; i < def->ncontrollers ; i++) {
|
for (i = 0; i < def->ncontrollers ; i++) {
|
||||||
/* First IDE controller lives on the PIIX3 at slot=1, function=1 */
|
/* First IDE controller lives on the PIIX3 at slot=1, function=1 */
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
||||||
@ -2291,18 +2295,26 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
|
|||||||
_("Primary IDE controller must have PCI address 0:0:1.1"));
|
_("Primary IDE controller must have PCI address 0:0:1.1"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
/* If TYPE==PCI, then then qemuCollectPCIAddress() function
|
||||||
|
* has already reserved the address, so we must skip */
|
||||||
|
reservedIDE = true;
|
||||||
} else {
|
} else {
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
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.domain = 0;
|
||||||
def->controllers[i]->info.addr.pci.bus = 0;
|
def->controllers[i]->info.addr.pci.bus = 0;
|
||||||
def->controllers[i]->info.addr.pci.slot = 1;
|
def->controllers[i]->info.addr.pci.slot = 1;
|
||||||
def->controllers[i]->info.addr.pci.function = 1;
|
def->controllers[i]->info.addr.pci.function = 1;
|
||||||
if (qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller)
|
||||||
|
* hardcoded slot=1, multifunction device
|
||||||
|
*/
|
||||||
|
if (!reservedIDE &&
|
||||||
|
qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
/* First VGA is hardcoded slot=2 */
|
/* First VGA is hardcoded slot=2 */
|
||||||
if (def->nvideos > 0) {
|
if (def->nvideos > 0) {
|
||||||
if (def->videos[0]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
if (def->videos[0]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user