]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: prefer to put a Q35 machine's dmi-to-pci-bridge at 00:1E.0
authorLaine Stump <laine@laine.org>
Wed, 25 Sep 2013 12:02:19 +0000 (08:02 -0400)
committerLaine Stump <laine@laine.org>
Wed, 25 Sep 2013 14:39:23 +0000 (10:39 -0400)
This resolves one of the issues listed in:

   https://bugzilla.redhat.com/show_bug.cgi?id=1003983

00:1E.0 is the location of this controller on at least some actual Q35
hardware, so we try to replicate the placement. The bridge should work
just as well in any other location though, so if 00:1E.0 isn't
available, just allow it to be auto-assigned anywhere appropriate.

src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
tests/qemuxml2argvdata/qemuxml2argv-q35.args

index 9baed5601db7eb7b8c48ef0befcd6917eb00c72d..38dd4517d1dd68ef465d3bd118175708596f6f19 100644 (file)
@@ -2560,6 +2560,28 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
                 }
             }
             break;
+
+        case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
+            if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE &&
+                def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+                /* Try to assign this bridge to 00:1E.0 (because that
+                * is its standard location on real hardware) unless
+                * it's already taken, but don't insist on it.
+                */
+                memset(&tmp_addr, 0, sizeof(tmp_addr));
+                tmp_addr.slot = 0x1E;
+                if (!qemuDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
+                    if (qemuDomainPCIAddressReserveAddr(addrs, &tmp_addr,
+                                                        flags, true, false) < 0)
+                        goto cleanup;
+                    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 = 0x1E;
+                    def->controllers[i]->info.addr.pci.function = 0;
+                }
+            }
+            break;
         }
     }
 
index 010e089e2cac6a033917e787c83d0d5de8df3e7e..48c21cd85f6b60a7ddf717e0428a39e23198a830 100644 (file)
@@ -2,5 +2,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 /usr/libexec/qemu-kvm \
 -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1
index 175c0dcf00c6d585cc13b8ef6aa70ab23e586f3c..6855cd262cb4ff3e2a59f24d2c4918bc7e85b402 100644 (file)
@@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 /usr/libexec/qemu-kvm -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
 -boot c -global q35-pcihost.pci-hole64-size=1048576K \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
 -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
 -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
index 6bd5f4c0c2aca70e6ba0f1e27e7d85028fda6331..8cc5874c430a7db4e513e771bdaaf1574bf6e11a 100644 (file)
@@ -1,7 +1,7 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 /usr/libexec/qemu-kvm -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
 -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
 -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \