The machine types historically have a default USB controller populated
via '-usb' which libvirt assumed implicitly. Qemu will use 'pci-ohci'
for both if '-usb' is used.
Unfortunately an USB controller instantiated via '-usb' is unusable as
the bus name libvirt generates doesn't reflect the real name qemu uses,
and thus no libvirt-defined USB devices can be put on the controller.
This patch will populate the default USB controller into the XML and
select it's model to 'pci-ohci' unconditionally as the machine would
fail to start with '-usb' if that controller model is not available.
This patch doesn't try to make any other assumptions about
auto-populated model of USB controllers, which means that for an
explicit USB controller without model a different model will be picked.
Note that this will likely cause ABI differences and break migration for
the two machine types, in the corner case when the default USB
controller would be populated, but given that both are obsolete board
types and USB was unusable it doesn't make sense to keep supporting this
specific case when '-usb' was formatted.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 8 ++++++++
...h64-versatilepb-minimal.aarch64-latest.abi-update.args | 2 +-
...ch64-versatilepb-minimal.aarch64-latest.abi-update.xml | 3 +++
.../aarch64-versatilepb-minimal.aarch64-latest.args | 2 +-
.../aarch64-versatilepb-minimal.aarch64-latest.xml | 3 +++
...mv7l-versatilepb-minimal.armv7l-latest.abi-update.args | 2 +-
...rmv7l-versatilepb-minimal.armv7l-latest.abi-update.xml | 3 +++
.../armv7l-versatilepb-minimal.armv7l-latest.args | 2 +-
.../armv7l-versatilepb-minimal.armv7l-latest.xml | 3 +++
9 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d96acd8916..23ba9521ec 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4204,6 +4204,14 @@ qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
if (STREQ(def->os.machine, "versatilepb"))
addPCIRoot = true;
+ /* Add default USB for the two machine types which historically
+ * supported -usb */
+ if (STREQ(def->os.machine, "versatilepb") ||
+ STRPREFIX(def->os.machine, "realview")) {
+ addDefaultUSB = true;
+ usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
+ }
+
if (qemuDomainIsARMVirt(def))
addPCIeRoot = true;
diff --git
a/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.args
b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.args
index 6dec983ecc..2f45355a5d 100644
--- a/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.args
+++ b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.args
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.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/aarch64-versatilepb-minimal.aarch64-latest.abi-update.xml
b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.xml
index 2b5feaa665..fddf8fd3a7 100644
--- a/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.abi-update.xml
@@ -15,6 +15,9 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <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'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.args
b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.args
index 6dec983ecc..2f45355a5d 100644
--- a/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.args
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.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/aarch64-versatilepb-minimal.aarch64-latest.xml
b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.xml
index 2b5feaa665..fddf8fd3a7 100644
--- a/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-versatilepb-minimal.aarch64-latest.xml
@@ -15,6 +15,9 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <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'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
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 d7bad74061..a05a413290 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 \
--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/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
index 2c15244cc4..482029e3b0 100644
--- a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.abi-update.xml
@@ -17,6 +17,9 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-armv7l</emulator>
+ <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'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
diff --git a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.args
b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.args
index d7bad74061..a05a413290 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 \
--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/armv7l-versatilepb-minimal.armv7l-latest.xml
b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml
index 2c15244cc4..482029e3b0 100644
--- a/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml
+++ b/tests/qemuxmlconfdata/armv7l-versatilepb-minimal.armv7l-latest.xml
@@ -17,6 +17,9 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-armv7l</emulator>
+ <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'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
--
2.43.0