]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainControllerDefPostParse: Use 'pci-ohci' as last-resort fallback USB controller
authorPeter Krempa <pkrempa@redhat.com>
Tue, 27 Feb 2024 11:52:08 +0000 (12:52 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 6 Mar 2024 15:30:36 +0000 (16:30 +0100)
This controller is used as the default/implicit USB controller by
multiple machine types which honour the '-usb' flag of qemu. Add it as
fallback in libvirt too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_domain.c
tests/qemuxmlconfdata/usb-controller-default-fallback-mac99ppc.ppc-latest.args
tests/qemuxmlconfdata/usb-controller-default-fallback-mac99ppc.ppc-latest.xml
tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.args
tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.xml

index 0aec49449c54e3f2a53f69efd0b5634ce999e5be..8c85446c3de7b264c6969d43eca471226465b40b 100644 (file)
@@ -5641,9 +5641,14 @@ qemuDomainControllerDefPostParse(virDomainControllerDef *cont,
              *
              * See qemuBuildControllersCommandLine() */
 
-            /* Default USB controller is piix3-uhci if available. */
+            /* Default USB controller is piix3-uhci if available. Fall back to
+             * 'pci-ohci' otherwise which is the default for non-x86 machines
+             * which honour -usb */
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI))
                 cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
+            else if (!ARCH_IS_X86(def->os.arch) &&
+                     virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI))
+                cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
 
             if (ARCH_IS_S390(def->os.arch)) {
                 if (cont->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
index 8a9bc370af230dc267beed0f7409f171dc0035d4..c89656699a5e2426a574c9d7e711f3931eb7d806 100644 (file)
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
+-device '{"driver":"pci-ohci","id":"usb","bus":"pci.0","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index 3899a4ecb17d916cfc8bf283b5d768e75d683e4d..7e74642ba5b50a03edb5939fed02f6a4c651574e 100644 (file)
@@ -19,7 +19,7 @@
   <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-ppc</emulator>
-    <controller type='usb' index='0'>
+    <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'/>
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 ebea79c6d04b01f609c09aabd1af604ceaa90aa3..d934c3e842717035bc7bae30a442570d4b5f0c75 100644 (file)
@@ -18,7 +18,7 @@
   <devices>
     <emulator>/usr/bin/qemu-system-armv7l</emulator>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='usb' index='0'>
+    <controller type='usb' index='0' model='pci-ohci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <audio id='1' type='none'/>