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(a)redhat.com>
---
src/qemu/qemu_domain.c | 7 ++++++-
...-default-fallback-versatilepb-armv7l.armv7l-latest.args | 2 +-
...r-default-fallback-versatilepb-armv7l.armv7l-latest.xml | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 23ba9521ec..d3a8446e46 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5650,9 +5650,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) {
diff --git
a/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.args
b/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.args
index d7bad74061..a05a413290 100644
---
a/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.args
+++
b/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.args
@@ -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
diff --git
a/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.xml
b/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.xml
index ebea79c6d0..d934c3e842 100644
---
a/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.xml
+++
b/tests/qemuxmlconfdata/usb-controller-default-fallback-versatilepb-armv7l.armv7l-latest.xml
@@ -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'/>
--
2.43.0