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 <pkrempa@redhat.com>
---
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 @@
-<domain type='kvm'>
- <name>foo</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219136</memory>
- <currentMemory unit='KiB'>219136</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough'>
- <cache mode='disable'/>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- </devices>
-</domain>
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 @@
-<domain type='kvm'>
- <name>foo</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219136</memory>
- <currentMemory unit='KiB'>219136</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough'>
- <cache mode='passthrough'/>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- </devices>
-</domain>
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);
--
2.41.0