qemuDomainControllerDefPostParse: Use 'pci-ohci' as last-resort fallback USB controller

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>
This commit is contained in:
Peter Krempa 2024-02-27 12:52:08 +01:00
parent c6d71bf813
commit b37096778b
5 changed files with 10 additions and 5 deletions

View 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) {

View 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 \

View 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'/>

View 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

View 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'/>