[PATCH v2 35/38] qemu: Don't special-case realview/versatilebp for USB

Andrea Bolognani via Devel posted 38 patches 1 week, 2 days ago
[PATCH v2 35/38] qemu: Don't special-case realview/versatilebp for USB
Posted by Andrea Bolognani via Devel 1 week, 2 days ago
We have special behavior for these two machine types, and
more specifically for the USB controller that they get added
by default - something that doesn't generally happen on Arm.

Not only this is inconsistent with other machine types for
the architecture, it also means that the model for the USB
controller that gets added automatically (pci-ohci, USB1) is
worse than the default one for user-added USB controllers
(qemu-xhci, USB3) which is just silly.

Bring these machine types in line with the rest of the
architecture.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_domain.c                                     | 7 -------
 ...aarch64-realview-minimal.aarch64-latest.abi-update.args | 2 +-
 .../aarch64-realview-minimal.aarch64-latest.abi-update.xml | 2 +-
 .../aarch64-realview-minimal.aarch64-latest.args           | 2 +-
 .../aarch64-realview-minimal.aarch64-latest.xml            | 2 +-
 ...rmv7l-versatilepb-minimal.armv7l-latest.abi-update.args | 2 +-
 ...armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml | 2 +-
 .../armv7l-versatilepb-minimal.armv7l-latest.args          | 2 +-
 .../armv7l-versatilepb-minimal.armv7l-latest.xml           | 2 +-
 .../usb-controller-automatic-realview.aarch64-latest.args  | 2 +-
 .../usb-controller-automatic-realview.aarch64-latest.xml   | 2 +-
 ...usb-controller-automatic-versatilepb.armv7l-latest.args | 2 +-
 .../usb-controller-automatic-versatilepb.armv7l-latest.xml | 2 +-
 ...ontroller-default-fallback-realview.aarch64-latest.args | 2 +-
 ...controller-default-fallback-realview.aarch64-latest.xml | 2 +-
 tests/qemuxmlconftest.c                                    | 2 +-
 16 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 118470fef8..9927ab3cbb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4434,13 +4434,6 @@ qemuDomainDefaultUSBControllerModelAutoAdded(const virDomainDef *def,
         }
     }
 
-    if (ARCH_IS_ARM(def->os.arch)) {
-        if (STREQ(def->os.machine, "versatilepb") ||
-            STRPREFIX(def->os.machine, "realview-eb"))
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI))
-                return VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
-    }
-
     return VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT;
 }
 
diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args
index 0d956241fc..ccbff79f35 100644
--- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args
+++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
+-device '{"driver":"qemu-xhci","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/aarch64-realview-minimal.aarch64-latest.abi-update.xml b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml
index c31c7b2bbc..056e5e56a8 100644
--- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml
@@ -15,7 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='pci-ohci'>
+    <controller type='usb' index='0' model='qemu-xhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args
index 0d956241fc..ccbff79f35 100644
--- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
+-device '{"driver":"qemu-xhci","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/aarch64-realview-minimal.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml
index c31c7b2bbc..056e5e56a8 100644
--- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml
@@ -15,7 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='pci-ohci'>
+    <controller type='usb' index='0' model='qemu-xhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.args b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.args
index a05a413290..88fe2b62e8 100644
--- a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.args
+++ b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.args
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armv7ltest/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
+-device '{"driver":"qemu-xhci","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/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
index 7b21b24927..a9da2a3b13 100644
--- a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
@@ -17,7 +17,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-armv7l</emulator>
-    <controller type='usb' index='0' model='pci-ohci'>
+    <controller type='usb' index='0' model='qemu-xhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.args b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.args
index a05a413290..88fe2b62e8 100644
--- a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.args
+++ b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.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 \
--device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
+-device '{"driver":"qemu-xhci","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/armv7l-versatilepb-minimal.armv7l-latest.xml b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml
index 7b21b24927..a9da2a3b13 100644
--- a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml
+++ b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml
@@ -17,7 +17,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-armv7l</emulator>
-    <controller type='usb' index='0' model='pci-ohci'>
+    <controller type='usb' index='0' model='qemu-xhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args
index 0d956241fc..ccbff79f35 100644
--- a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.args
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
+-device '{"driver":"qemu-xhci","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-automatic-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml
index 250da1b5e0..8bb25de20a 100644
--- a/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-realview.aarch64-latest.xml
@@ -15,7 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='pci-ohci'>
+    <controller type='usb' index='0' model='qemu-xhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.armv7l-latest.args b/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.armv7l-latest.args
index a05a413290..88fe2b62e8 100644
--- a/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.armv7l-latest.args
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.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 \
--device '{"driver":"pci-ohci","id":"usb","bus":"pci","addr":"0x1"}' \
+-device '{"driver":"qemu-xhci","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-automatic-versatilepb.armv7l-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.armv7l-latest.xml
index 482029e3b0..8a12dda0f7 100644
--- a/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.armv7l-latest.xml
+++ b/tests/qemuxmlconfdata/usb-controller-automatic-versatilepb.armv7l-latest.xml
@@ -17,7 +17,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-armv7l</emulator>
-    <controller type='usb' index='0' model='pci-ohci'>
+    <controller type='usb' index='0' model='qemu-xhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args
index ccbff79f35..0d956241fc 100644
--- a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.args
@@ -25,7 +25,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"qemu-xhci","id":"usb","bus":"pci","addr":"0x1"}' \
+-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-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml
index 8bb25de20a..250da1b5e0 100644
--- a/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/usb-controller-default-fallback-realview.aarch64-latest.xml
@@ -15,7 +15,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <controller type='usb' index='0' model='qemu-xhci'>
+    <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'/>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index abe5609889..7663a43856 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2192,7 +2192,7 @@ mymain(void)
     DO_TEST_FULL("usb-controller-default-fallback-realview", ".aarch64-latest",
                  ARG_CAPS_ARCH, "aarch64",
                  ARG_CAPS_VER, "latest",
-                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
+                 ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
                  ARG_END);
     DO_TEST_FULL("usb-controller-default-unavailable-realview", ".aarch64-latest",
                  ARG_CAPS_ARCH, "aarch64",
-- 
2.51.0
Re: [PATCH v2 35/38] qemu: Don't special-case realview/versatilebp for USB
Posted by Peter Krempa via Devel 1 day, 11 hours ago
On Thu, Sep 25, 2025 at 20:07:21 +0200, Andrea Bolognani via Devel wrote:
> We have special behavior for these two machine types, and
> more specifically for the USB controller that they get added
> by default - something that doesn't generally happen on Arm.
> 
> Not only this is inconsistent with other machine types for
> the architecture, it also means that the model for the USB
> controller that gets added automatically (pci-ohci, USB1) is
> worse than the default one for user-added USB controllers
> (qemu-xhci, USB3) which is just silly.
> 
> Bring these machine types in line with the rest of the
> architecture.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/qemu/qemu_domain.c                                     | 7 -------
>  ...aarch64-realview-minimal.aarch64-latest.abi-update.args | 2 +-
>  .../aarch64-realview-minimal.aarch64-latest.abi-update.xml | 2 +-
>  .../aarch64-realview-minimal.aarch64-latest.args           | 2 +-
>  .../aarch64-realview-minimal.aarch64-latest.xml            | 2 +-
>  ...rmv7l-versatilepb-minimal.armv7l-latest.abi-update.args | 2 +-
>  ...armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml | 2 +-
>  .../armv7l-versatilepb-minimal.armv7l-latest.args          | 2 +-
>  .../armv7l-versatilepb-minimal.armv7l-latest.xml           | 2 +-
>  .../usb-controller-automatic-realview.aarch64-latest.args  | 2 +-
>  .../usb-controller-automatic-realview.aarch64-latest.xml   | 2 +-
>  ...usb-controller-automatic-versatilepb.armv7l-latest.args | 2 +-
>  .../usb-controller-automatic-versatilepb.armv7l-latest.xml | 2 +-
>  ...ontroller-default-fallback-realview.aarch64-latest.args | 2 +-
>  ...controller-default-fallback-realview.aarch64-latest.xml | 2 +-
>  tests/qemuxmlconftest.c                                    | 2 +-
>  16 files changed, 15 insertions(+), 22 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>