]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Remove fallback to piix3-uhci for Arm virt guests
authorAndrea Bolognani <abologna@redhat.com>
Fri, 25 Jul 2025 15:47:03 +0000 (17:47 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 6 Oct 2025 09:16:32 +0000 (11:16 +0200)
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 <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c
tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.args
tests/qemuxmlconfdata/usb-controller-default-fallback-virt-aarch64.aarch64-latest.xml
tests/qemuxmlconftest.c

index 9927ab3cbb6570a2fa5c04e5e0d30ec491758a7c..b1a92279a72a8522e29d15c59c31b8c31bea4ee9 100644 (file)
@@ -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))
index 63ea7be2aa4c421257f8e58446ac8a0cd8e724bd..44689d81f9c64984f637a9921348d32f940c6bb3 100644 (file)
@@ -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
index cea6dde62db64e4c40191eaa0e72896860a5487d..943c433f40d9d1ca70dc5bb691a5e88683754a43 100644 (file)
@@ -20,8 +20,8 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='piix3-uhci'>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
+    <controller type='usb' index='0' model='nec-xhci'>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pcie-root'/>
     <controller type='pci' index='1' model='pcie-root-port'>
       <target chassis='1' port='0x8'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
     </controller>
-    <controller type='pci' index='2' model='pcie-to-pci-bridge'>
-      <model name='pcie-pci-bridge'/>
-      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
-    </controller>
-    <controller type='pci' index='3' model='pcie-root-port'>
+    <controller type='pci' index='2' model='pcie-root-port'>
       <model name='pcie-root-port'/>
-      <target chassis='3' port='0x9'/>
+      <target chassis='2' port='0x9'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <audio id='1' type='none'/>
index 0bf4afbf242780d89a7cfd3c497ecff62f220f12..55c622176a98c2fb25235785ec987a8318cacf0a 100644 (file)
@@ -2174,7 +2174,7 @@ mymain(void)
     DO_TEST_FULL("usb-controller-default-fallback-virt-aarch64", ".aarch64-latest",
                  ARG_CAPS_ARCH, "aarch64",
                  ARG_CAPS_VER, "latest",
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_LAST,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_LAST,
                  ARG_END);
     DO_TEST_FULL("usb-controller-default-unavailable-virt-aarch64", ".aarch64-latest",
                  ARG_CAPS_ARCH, "aarch64",