From c6d71bf81309874ba21cc6a38c835a8871f0b896 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 26 Feb 2024 16:17:41 +0100 Subject: [PATCH] qemuDomainDefAddDefaultDevices: Populate default USB for 'versatilepb' and 'realview' ARM machines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko Reviewed-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 8 ++++++++ ...arch64-realview-minimal.aarch64-latest.abi-update.args | 2 +- ...aarch64-realview-minimal.aarch64-latest.abi-update.xml | 1 + .../aarch64-realview-minimal.aarch64-latest.args | 2 +- .../aarch64-realview-minimal.aarch64-latest.xml | 1 + ...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 +++ 13 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f5b0c58bf4..0aec49449c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4195,6 +4195,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-realview-minimal.aarch64-latest.abi-update.args b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.args index 8097510ab4..84a88aad58 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 \ --usb \ +-device '{"driver":"pci-ohci","id":"usb"}' \ -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 7e42aa7158..372d5bda6a 100644 --- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml +++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.abi-update.xml @@ -15,6 +15,7 @@ destroy /usr/bin/qemu-system-aarch64 + diff --git a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.args index 8097510ab4..84a88aad58 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 \ --usb \ +-device '{"driver":"pci-ohci","id":"usb"}' \ -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 7e42aa7158..372d5bda6a 100644 --- a/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml +++ b/tests/qemuxmlconfdata/aarch64-realview-minimal.aarch64-latest.xml @@ -15,6 +15,7 @@ destroy /usr/bin/qemu-system-aarch64 + 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 @@ destroy /usr/bin/qemu-system-aarch64 + +
+