qemu: Update qemuDomainSupportsPCI()

The sparc architecture doesn't support PCI, and neither do the
isapc and microvm machine types on x86 architectures.

One of the isapc/microvm tests starts failing as a consequence
of this change, which is expected; somewhat surprisingly,
another test for the same machine types goes from an early/hard
failure (PARSE_ERROR) to a late/soft one (FAILURE) instead.
This will be rectified by a later commit.

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>
This commit is contained in:
Andrea Bolognani
2025-10-06 11:15:47 +02:00
parent 2ad21cd97f
commit 956253d1cd
8 changed files with 23 additions and 70 deletions
+11
View File
@@ -7703,6 +7703,17 @@ qemuDomainSupportsPCI(const virDomainDef *def)
return false;
}
if (ARCH_IS_X86(def->os.arch)) {
if (STREQ(def->os.machine, "isapc") ||
STREQ(def->os.machine, "microvm")) {
return false;
}
return true;
}
if (def->os.arch == VIR_ARCH_SPARC)
return false;
/* On all other architectures, PCI support is assumed to
* be present */
return true;
@@ -1,31 +0,0 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-test \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-test/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-test/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=test,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \
-machine isapc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
-accel tcg \
-cpu 486 \
-m size=2097152k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
-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 \
-audiodev '{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
@@ -0,0 +1 @@
unsupported configuration: Machine type 'isapc' does not support PCI
@@ -1,31 +0,0 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-test \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-test/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-test/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=test,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \
-machine microvm,usb=off,dump-guest-core=off,memory-backend=microvm.ram,acpi=off \
-accel tcg \
-cpu qemu64 \
-m size=2097152k \
-object '{"qom-type":"memory-backend-ram","id":"microvm.ram","size":2147483648}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
-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 \
-audiodev '{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
@@ -0,0 +1 @@
unsupported configuration: Machine type 'microvm' does not support PCI
@@ -1,5 +1,5 @@
<domain type='qemu'>
<name>test</name>
<name>q35-test</name>
<uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
@@ -17,9 +17,10 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='pci' index='0' model='pci-root'/>
<controller type='usb' index='0' model='piix3-uhci'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
</devices>
</domain>
@@ -1,5 +1,5 @@
<domain type='qemu'>
<name>test</name>
<name>q35-test</name>
<uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
@@ -17,7 +17,8 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='pci' index='0' model='pci-root'/>
<controller type='usb' index='0' model='piix3-uhci'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
</devices>
</domain>
+4 -4
View File
@@ -1423,8 +1423,8 @@ mymain(void)
DO_TEST_CAPS_LATEST_PARSE_ERROR("no-memory");
DO_TEST_CAPS_LATEST("isapc-pci");
DO_TEST_CAPS_LATEST("microvm-pci");
DO_TEST_CAPS_LATEST_PARSE_ERROR("isapc-pci");
DO_TEST_CAPS_LATEST_PARSE_ERROR("microvm-pci");
DO_TEST_CAPS_LATEST("genid");
DO_TEST_CAPS_LATEST("genid-auto");
@@ -2118,8 +2118,8 @@ mymain(void)
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-controller-default-isapc");
DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-controller-default-microvm");
DO_TEST_CAPS_LATEST_FAILURE("usb-controller-default-isapc");
DO_TEST_CAPS_LATEST_FAILURE("usb-controller-default-microvm");
DO_TEST_CAPS_LATEST("usb-controller-default-i440fx");
DO_TEST_CAPS_LATEST("usb-controller-default-q35");
DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-pseries", "ppc64");