From 198e68197c5835bea16a8531efb342ba397f5af5 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 25 Jul 2025 17:47:03 +0200 Subject: [PATCH] qemu: Remove fallback to piix3-uhci for Arm virt guests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is another case where the current behavior can be traced back to the fact that x86 was the only architecture to really be taken into account for a long time: in reality, using an Intel-specific USB1 controller for a modern, PCIe-native, virtualization-friendly Arm guest just doesn't make any sense. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_domain.c | 10 ++++++++++ ...default-fallback-virt-aarch64.aarch64-latest.args | 5 ++--- ...-default-fallback-virt-aarch64.aarch64-latest.xml | 12 ++++-------- tests/qemuxmlconftest.c | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9927ab3cbb..b1a92279a7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4331,6 +4331,16 @@ qemuDomainDefaultUSBControllerModel(const virDomainDef *def, return VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT; } + if (qemuDomainIsARMVirt(def)) { + /* Use qemu-xhci or nec-xhci (USB3) with no fallback */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) + return VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI; + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) + return VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; + + return VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT; + } + if (ARCH_IS_ARM(def->os.arch)) { /* Prefer qemu-xhci or nec-xhci (USB3) */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) diff --git a/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.args index 63ea7be2aa..44689d81f9 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.args +++ b/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.args @@ -27,9 +27,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \ -no-shutdown \ -boot strict=on \ -device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \ --device '{"driver":"pcie-pci-bridge","id":"pci.2","bus":"pci.1","addr":"0x0"}' \ --device '{"driver":"pcie-root-port","port":9,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x1"}' \ --device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.2","addr":"0x1"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \ +-device '{"driver":"nec-usb-xhci","id":"usb","bus":"pci.1","addr":"0x0"}' \ -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-virt-aarch64.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.xml index cea6dde62d..943c433f40 100644 --- a/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.xml @@ -20,8 +20,8 @@ destroy /usr/bin/qemu-system-aarch64 - -
+ +
@@ -29,13 +29,9 @@
- - -
- - + - +