]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainDefAddDefaultDevices: Populate default USB for 'versatilepb' and 'realview...
authorPeter Krempa <pkrempa@redhat.com>
Mon, 26 Feb 2024 15:17:41 +0000 (16:17 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 6 Mar 2024 15:30:36 +0000 (16:30 +0100)
The machine types historically have a default USB controller populated
via '-usb' which libvirt assumed implicitly. Qemu will use 'pci-ohci'
for both if '-usb' is used.

Unfortunately an USB controller instantiated via '-usb' is unusable as
the bus name libvirt generates doesn't reflect the real name qemu uses,
and thus no libvirt-defined USB devices can be put on the controller.

This patch will populate the default USB controller into the XML and
select it's model to 'pci-ohci' unconditionally as the machine would
fail to start with '-usb' if that controller model is not available.

This patch doesn't try to make any other assumptions about
auto-populated model of USB controllers, which means that for an
explicit USB controller without model a different model will be picked.

Note that this will likely cause ABI differences and break migration for
the two machine types, in the corner case when the default USB
controller would be populated, but given that both are obsolete board
types and USB was unusable it doesn't make sense to keep supporting this
specific case when '-usb' was formatted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 files changed:
src/qemu/qemu_domain.c
tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args
tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml
tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args
tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml
tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.args
tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.xml
tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.args
tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.xml
tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.args
tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.args
tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml

index f5b0c58bf4a73a22a3fbdd68680cd1c0acd067d1..0aec49449c54e3f2a53f69efd0b5634ce999e5be 100644 (file)
@@ -4195,6 +4195,14 @@ qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
         if (STREQ(def->os.machine, "versatilepb"))
             addPCIRoot = true;
 
+        /* Add default USB for the two machine types which historically
+         * supported -usb */
+        if (STREQ(def->os.machine, "versatilepb") ||
+            STRPREFIX(def->os.machine, "realview")) {
+            addDefaultUSB = true;
+            usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
+        }
+
         if (qemuDomainIsARMVirt(def))
             addPCIeRoot = true;
 
index 8097510ab40e8d4f053a5ecba8c73299514f3184..84a88aad58cb839aa507a0d16d337fb07da9ccd2 100644 (file)
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 7e42aa7158ea3efaae1b3b7ec73cea66b58da463..372d5bda6a66ad13e50243b9b37410985bd79e1d 100644 (file)
@@ -15,6 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='pci-ohci'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
   </devices>
index 8097510ab40e8d4f053a5ecba8c73299514f3184..84a88aad58cb839aa507a0d16d337fb07da9ccd2 100644 (file)
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 7e42aa7158ea3efaae1b3b7ec73cea66b58da463..372d5bda6a66ad13e50243b9b37410985bd79e1d 100644 (file)
@@ -15,6 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='pci-ohci'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
   </devices>
index 6dec983eccd86f644c33cb34783dab86e006d7b9..2f45355a5d5a9825b7ca01cb0563eec0014c065f 100644 (file)
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 2b5feaa665bc9c9192a0ead12dc40cad024a7dfa..fddf8fd3a72167ff567674ba7d0512b30e402265 100644 (file)
@@ -15,6 +15,9 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='pci-ohci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
index 6dec983eccd86f644c33cb34783dab86e006d7b9..2f45355a5d5a9825b7ca01cb0563eec0014c065f 100644 (file)
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 2b5feaa665bc9c9192a0ead12dc40cad024a7dfa..fddf8fd3a72167ff567674ba7d0512b30e402265 100644 (file)
@@ -15,6 +15,9 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='pci-ohci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
index d7bad74061d78238c408505a0d39a8dcf4f11e3a..a05a4132903b0ce0e1ff3b4e09a66ae876387406 100644 (file)
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armv7ltest/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 2c15244cc4fbb9e7bff9321dfe6623cc4eeebf7e..482029e3b09aec8397b8ca8984208bb6aaec2375 100644 (file)
@@ -17,6 +17,9 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-armv7l</emulator>
+    <controller type='usb' index='0' model='pci-ohci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>
index d7bad74061d78238c408505a0d39a8dcf4f11e3a..a05a4132903b0ce0e1ff3b4e09a66ae876387406 100644 (file)
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armv7ltest/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 2c15244cc4fbb9e7bff9321dfe6623cc4eeebf7e..482029e3b09aec8397b8ca8984208bb6aaec2375 100644 (file)
@@ -17,6 +17,9 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-armv7l</emulator>
+    <controller type='usb' index='0' model='pci-ohci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <audio id='1' type='none'/>
     <memballoon model='none'/>