From d007ec33445490f77fc999c6216d9bae9fe09260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 26 Sep 2017 12:35:29 +0200 Subject: [PATCH] qemu: reserve PCI addresses for implicit i440fx devices Somewhere around commit 9ff9d9f reserving entire PCI slots was eliminated, as demonstrated by commit 6cc2014. Reserve the functions required by the implicit devices: 00:01.0 ISA Bridge 00:01.1 IDE Controller 00:01.2 USB Controller (unless USB is disabled) 00:01.3 Bridge https://bugzilla.redhat.com/show_bug.cgi?id=1460143 --- src/qemu/qemu_domain_address.c | 15 ++++++++--- ...emuxml2argv-440fx-ide-address-conflict.xml | 25 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-440fx-ide-address-conflict.xml diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 9edfc5c2d8..c4485d4ab5 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1429,15 +1429,24 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def, cont->info.addr.pci.slot = 1; cont->info.addr.pci.function = 2; } + } else { + /* this controller is not skipped in qemuDomainCollectPCIAddress */ + continue; } + if (addrs->nbuses && + virDomainPCIAddressReserveAddr(addrs, &cont->info.addr.pci, flags, 0) < 0) + goto cleanup; } - /* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller) - * hardcoded slot=1, multifunction device - */ + /* Implicit PIIX3 devices living on slot 1 not handled above */ if (addrs->nbuses) { memset(&tmp_addr, 0, sizeof(tmp_addr)); tmp_addr.slot = 1; + /* ISA Bridge at 00:01.0 */ + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) + goto cleanup; + /* Bridge at 00:01.3 */ + tmp_addr.function = 3; if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) goto cleanup; } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-440fx-ide-address-conflict.xml b/tests/qemuxml2argvdata/qemuxml2argv-440fx-ide-address-conflict.xml new file mode 100644 index 0000000000..4195880aac --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-440fx-ide-address-conflict.xml @@ -0,0 +1,25 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a505864b87..01e7d6f6a9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2259,6 +2259,7 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_QXL); DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE); + DO_TEST_PARSE_ERROR("440fx-ide-address-conflict", NONE); DO_TEST_PARSE_ERROR("pcie-root-port-too-many", QEMU_CAPS_DEVICE_IOH3420, -- GitLab