From 917cf3e1641048063d289ae429b064189fafad52 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 4 Sep 2023 16:24:52 +0200 Subject: [PATCH] qemu: Always assume support for QEMU_CAPS_CPU_CACHE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All supported qemu versions have this feature and it can't be compiled out. The logic is a bit more complex in this instance as the flag is asserted if: if (ARCH_IS_X86(qemuCaps->arch) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) { virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_CACHE); } Now QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION is available since qemu-2.8 but only on certain architectures, thus we need to keep the flag itself, but x86_64 is one of them. The flag can be also assumed as qemuValidateDomainDefCpu rejects any cache config on non-x86 arches. Remove any use of the capability and drop the impossible test cases. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_command.c | 6 ++-- .../qemuxml2argvdata/cpu-cache-disable2.args | 32 ------------------- tests/qemuxml2argvdata/cpu-cache-disable2.xml | 20 ------------ .../cpu-cache-passthrough2.args | 32 ------------------- .../cpu-cache-passthrough2.xml | 20 ------------ tests/qemuxml2argvtest.c | 10 +++--- 6 files changed, 6 insertions(+), 114 deletions(-) delete mode 100644 tests/qemuxml2argvdata/cpu-cache-disable2.args delete mode 100644 tests/qemuxml2argvdata/cpu-cache-disable2.xml delete mode 100644 tests/qemuxml2argvdata/cpu-cache-passthrough2.args delete mode 100644 tests/qemuxml2argvdata/cpu-cache-passthrough2.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f7079c6920..a912ed064f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6560,12 +6560,10 @@ qemuBuildCpuCommandLine(virCommand *cmd, if (hostOff && (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH || - def->cpu->mode == VIR_CPU_MODE_MAXIMUM) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_CACHE)) + def->cpu->mode == VIR_CPU_MODE_MAXIMUM)) virBufferAddLit(&buf, ",host-cache-info=off"); - if (l3Off && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_CACHE)) + if (l3Off) virBufferAddLit(&buf, ",l3-cache=off"); } diff --git a/tests/qemuxml2argvdata/cpu-cache-disable2.args b/tests/qemuxml2argvdata/cpu-cache-disable2.args deleted file mode 100644 index adfad725aa..0000000000 --- a/tests/qemuxml2argvdata/cpu-cache-disable2.args +++ /dev/null @@ -1,32 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/var/lib/libvirt/qemu/domain--1-foo \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-foo/.local/share \ -XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-foo/.cache \ -XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-foo/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=foo,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-foo/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ --accel kvm \ --cpu host \ --m size=219136k \ --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 \ --no-acpi \ --boot strict=on \ --usb \ --audiodev '{"id":"audio1","driver":"none"}' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/cpu-cache-disable2.xml b/tests/qemuxml2argvdata/cpu-cache-disable2.xml deleted file mode 100644 index e6f39951ca..0000000000 --- a/tests/qemuxml2argvdata/cpu-cache-disable2.xml +++ /dev/null @@ -1,20 +0,0 @@ - - foo - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - - hvm - - - - - - - destroy - restart - destroy - - - diff --git a/tests/qemuxml2argvdata/cpu-cache-passthrough2.args b/tests/qemuxml2argvdata/cpu-cache-passthrough2.args deleted file mode 100644 index 37b27e450a..0000000000 --- a/tests/qemuxml2argvdata/cpu-cache-passthrough2.args +++ /dev/null @@ -1,32 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/var/lib/libvirt/qemu/domain--1-foo \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-foo/.local/share \ -XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-foo/.cache \ -XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-foo/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=foo,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-foo/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ --accel kvm \ --cpu host,host-cache-info=on \ --m size=219136k \ --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 \ --no-acpi \ --boot strict=on \ --usb \ --audiodev '{"id":"audio1","driver":"none"}' \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/cpu-cache-passthrough2.xml b/tests/qemuxml2argvdata/cpu-cache-passthrough2.xml deleted file mode 100644 index 74846fdd31..0000000000 --- a/tests/qemuxml2argvdata/cpu-cache-passthrough2.xml +++ /dev/null @@ -1,20 +0,0 @@ - - foo - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - - hvm - - - - - - - destroy - restart - destroy - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8238dceed8..8afb2bf2be 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2521,12 +2521,10 @@ mymain(void) DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM); DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM); - DO_TEST("cpu-cache-disable", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); - DO_TEST("cpu-cache-disable2", QEMU_CAPS_KVM); - DO_TEST("cpu-cache-disable3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); - DO_TEST("cpu-cache-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); - DO_TEST("cpu-cache-passthrough2", QEMU_CAPS_KVM); - DO_TEST("cpu-cache-emulate-l3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); + DO_TEST("cpu-cache-disable", QEMU_CAPS_KVM); + DO_TEST("cpu-cache-disable3", QEMU_CAPS_KVM); + DO_TEST("cpu-cache-passthrough", QEMU_CAPS_KVM); + DO_TEST("cpu-cache-emulate-l3", QEMU_CAPS_KVM); DO_TEST_PARSE_ERROR("cpu-cache-emulate-l2", QEMU_CAPS_KVM); DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM); DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM);