]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: command: Don't downgrade to '-usb' for x86 based machines
authorPeter Krempa <pkrempa@redhat.com>
Mon, 19 Feb 2024 14:28:33 +0000 (15:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 6 Mar 2024 15:30:36 +0000 (16:30 +0100)
- 'q35' machine type already explicitly forbids fallback
- 'isapc' never supported USB and '-usb' is ignored
- 'i440fx' does support '-usb' and translates it into 'piix3-uhci' which
  is identical to what libvirt selects
- we currently don't care about 'microvm'

Attempting to start an 'pc' (i440fx) machine with -usb when 'piix3-uhci'
is compiled out will fail and in any other case libvirt will use the
proper explicitly selected controller.

Drop the '-usb' downgrade for x86 arch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_command.c
tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.args [deleted file]
tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.err [new file with mode: 0644]
tests/qemuxmlconfdata/usb-controller-implicit-isapc.x86_64-latest.args
tests/qemuxmlconftest.c

index 2719574fb58d993b39008c81f1fc0ee8a4d53f93..d6328af70be79491a0b4064da5b70f340cd790d4 100644 (file)
@@ -2922,7 +2922,7 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef,
 static bool
 qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def)
 {
-    if (qemuDomainIsQ35(def) ||
+    if (ARCH_IS_X86(def->os.arch) ||
         qemuDomainIsARMVirt(def) ||
         qemuDomainIsRISCVVirt(def))
         return true;
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.args b/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.args
deleted file mode 100644 (file)
index c8de26e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=QEMUGuest1,debug-threads=on \
--S \
--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
--machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
--accel tcg \
--cpu qemu64 \
--m size=219136k \
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--usb \
--audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.err b/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.err
new file mode 100644 (file)
index 0000000..7a71aa1
--- /dev/null
@@ -0,0 +1 @@
+unsupported configuration: no model provided for USB controller
index 62dc26ee8b6652b31c7cfbcd000bfa54eea0efc5..cf8a176cd849129e71a99e8f238479bba8a16935 100644 (file)
@@ -26,7 +26,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--usb \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 58ea59aed56aad2e1b9bff62f65aedc9bf19f5e0..eeabf1f059e92c56c21a0d3afc05300b6648f873 100644 (file)
@@ -1865,13 +1865,15 @@ mymain(void)
     DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-mac99", "ppc64");
     DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-mac99ppc", "ppc");
     DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-powernv9", "ppc64");
-    /* i440fx downgrades to use '-usb' if the explicit controller is not present */
+    /* Until qemu-8.1 (see commit 6fe4464c05f) it was possible to compile
+     * out USB support from i440fx; the implicit -usb controller still failed */
     DO_TEST_FULL("usb-controller-default-unavailable-i440fx", ".x86_64-latest",
                  ARG_CAPS_ARCH, "x86_64",
                  ARG_CAPS_VER, "latest",
+                 ARG_FLAGS, FLAG_EXPECT_FAILURE,
                  ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
                  ARG_END);
-    /* q35 fails instead */
+    /* The implicit controller can be compiled out for q35; initialization fails though */
     DO_TEST_FULL("usb-controller-default-unavailable-q35", ".x86_64-latest",
                  ARG_CAPS_ARCH, "x86_64",
                  ARG_CAPS_VER, "latest",