提交 5d6904b9 编写于 作者: E Erik Skultety 提交者: Ján Tomko

qemu: Fix auto-adding PCI bridge when all slots are reserved

Commit 93c8ca tried to fix the issue with auto-adding of a PCI bridge
controller, but didn't work properly in all scenarios.

This patch provides a better fix of the issue when all slots on a PCI bus
are reserved by devices with user specified addresses and no additional
bridges need to be created.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1132900
上级 a3ecd63e
......@@ -1910,6 +1910,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
int nbuses = 0;
size_t i;
int rv;
bool buses_reserved = true;
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI;
for (i = 0; i < def->ncontrollers; i++) {
......@@ -1932,18 +1934,21 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
goto cleanup;
if (qemuAssignDevicePCISlots(def, addrs) < 0)
goto cleanup;
for (i = 0; i < addrs->nbuses; i++) {
if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i])) {
/* Reserve 1 extra slot for a (potential) bridge */
if (virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
goto cleanup;
}
if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i]))
buses_reserved = false;
}
/* Reserve 1 extra slot for a (potential) bridge only if buses
* are not fully reserved yet
*/
if (!buses_reserved &&
virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
goto cleanup;
if (qemuAssignDevicePCISlots(def, addrs) < 0)
goto cleanup;
for (i = 1; i < addrs->nbuses; i++) {
virDomainPCIAddressBusPtr bus = &addrs->buses[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册