]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Permit PCI-free aarch64 mach-virt guests
authorAndrea Bolognani <abologna@redhat.com>
Thu, 16 Jun 2016 17:13:19 +0000 (19:13 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 17 Jun 2016 16:30:04 +0000 (18:30 +0200)
There has been some progress lately in enabling virtio-pci on
aarch64 guests; however, guest OS support is still spotty at best,
so most guests are going to be using virtio-mmio instead.

Currently, mach-virt guests are closely modeled after q35 guests,
and that includes always adding a dmi-to-pci-bridge that's just
impossible to get rid of. While that's acceptable (if suboptimal)
for q35, where you will always need some kind of PCI device anyway,
mach-virt guests should be allowed to avoid it.

src/qemu/qemu_domain.c
src/qemu/qemu_domain_address.c
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml
tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml
tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml

index 1eb5644b72fabc67ebb14a5798b90a98ae715270..595ad648d487eb9b1cf9c78bcb8d52edec7d515a 100644 (file)
@@ -1951,11 +1951,15 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
                                              VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) {
             goto cleanup;
         }
-        /* add a dmi-to-pci-bridge and a pci-bridge if there are no pci controllers
+        /* Add a dmi-to-pci-bridge bridge if there are no PCI controllers
          * other than the pcie-root. This is so that there will be hot-pluggable
-         * PCI slots available
+         * PCI slots available.
+         *
+         * We skip this step for aarch64 mach-virt guests, where we want to
+         * be able to have a pure virtio-mmio topology
          */
         if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1) < 0 &&
+            !qemuDomainMachineIsVirt(def) &&
             !virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
                                        VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE))
             goto cleanup;
index ca3adc0b72f757f43698f02895715b0791722aef..883264ada6b0e01e05dac7ac518d0f7771331901 100644 (file)
@@ -1483,9 +1483,15 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
         }
 
         /* Reserve 1 extra slot for a (potential) bridge only if buses
-         * are not fully reserved yet
+         * are not fully reserved yet.
+         *
+         * We don't reserve the extra slot for aarch64 mach-virt guests
+         * either because we want to be able to have pure virtio-mmio
+         * guests, and reserving this slot would force us to add at least
+         * a dmi-to-pci-bridge to an otherwise PCI-free topology
          */
         if (!buses_reserved &&
+            !qemuDomainMachineIsVirt(def) &&
             virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
             goto cleanup;
 
index 2a5702f8fae0250cb6dc6431e8233b3478c58dbc..3e6bee903913fab4840f47498f576e0b1e1422dd 100644 (file)
@@ -21,7 +21,6 @@ QEMU_AUDIO_DRV=none \
 -initrd /aarch64.initrd \
 -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
 -dtb /aarch64.dtb \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
 -device virtio-serial-device,id=virtio-serial0 \
 -usb \
 -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \
index a2df858f4276c88fb0fa4c4a501590b86679363a..566bee2c87be16d8bc5836fe89ba3d49558987cc 100644 (file)
@@ -21,7 +21,6 @@ QEMU_AUDIO_DRV=none \
 -initrd /aarch64.initrd \
 -append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
 -dtb /aarch64.dtb \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
 -device virtio-serial-device,id=virtio-serial0 \
 -usb \
 -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \
index 0234404f00a1197d1a5ead03ac51295eb03eecd4..4e5dbdb013142eb38cd483c3353d9383ca77c955 100644 (file)
@@ -23,12 +23,13 @@ QEMU_AUDIO_DRV=none \
 -dtb /aarch64.dtb \
 -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
--device virtio-scsi-pci,id=scsi0,bus=pcie.0,addr=0x3 \
+-device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.1,addr=0x1 \
+-device virtio-scsi-pci,id=scsi0,bus=pci.3,addr=0x1 \
 -usb \
 -drive file=/aarch64.raw,format=raw,if=none,id=drive-scsi0-0-0-0 \
 -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,\
 id=scsi0-0-0-0 \
--device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:09:a4:37,bus=pcie.0,addr=0x2 \
+-device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:09:a4:37,bus=pci.3,addr=0x2 \
 -net user,vlan=0,name=hostnet0 \
 -device virtio-net-pci,vlan=1,id=net1,mac=52:54:00:09:a4:38,bus=pci.2,addr=0x1 \
 -net user,vlan=1,name=hostnet1
index bf0f2491f39c02b72d7301ee0a4ae96451292291..5e1b494ed7c56f5934877175260dc1ed1731cb3e 100644 (file)
       <target dev='sda' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
+      <model name='i82801b11-bridge'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='2'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+    </controller>
     <controller type='scsi' index='0' model='virtio-scsi'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/>
     </controller>
     <interface type='user'>
       <mac address='52:54:00:09:a4:37'/>
       <model type='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/>
     </interface>
     <interface type='user'>
       <mac address='52:54:00:09:a4:38'/>
index a212601ec6743600e50c135b7ab1149d7a784141..7c3fc198170e9f802e07f31d71f7715ea1bc301f 100644 (file)
       <address type='virtio-mmio'/>
     </disk>
     <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
-      <model name='i82801b11-bridge'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
-    </controller>
     <controller type='virtio-serial' index='0'>
       <address type='virtio-mmio'/>
     </controller>
index 4fdedac9e8454dabcb23791f18e1646907562e61..1b50f75f0cc6519424abd8eab7cc36676f786e4c 100644 (file)
@@ -32,9 +32,6 @@
       <target dev='sda' bus='scsi'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <controller type='scsi' index='0' model='virtio-scsi'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
-    </controller>
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
       <model name='i82801b11-bridge'/>
       <target chassisNr='2'/>
       <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
     </controller>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='3' model='pci-bridge'>
+      <model name='pci-bridge'/>
+      <target chassisNr='3'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </controller>
     <interface type='user'>
       <mac address='52:54:00:09:a4:37'/>
       <model type='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x03' slot='0x02' function='0x0'/>
     </interface>
     <interface type='user'>
       <mac address='52:54:00:09:a4:38'/>