|
Pablo Greco |
40546a |
From 243a37dbf1a42f75a2529b954dac40bb0dd4059e Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <243a37dbf1a42f75a2529b954dac40bb0dd4059e@dist-git>
|
|
Pablo Greco |
40546a |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Fri, 21 Jun 2019 09:25:55 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] qemu_command: Use canonical names of CPU features
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
When building QEMU command line, we should use the preferred spelling of
|
|
Pablo Greco |
40546a |
each CPU feature without relying on compatibility aliases (which may be
|
|
Pablo Greco |
40546a |
removed at some point).
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
The "unavailable-features" CPU property is used as a witness for the
|
|
Pablo Greco |
40546a |
correct names of the features in our translation table.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 5030a7450b0f0117a7903303572c6bda6c012327)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Conflicts:
|
|
Pablo Greco |
40546a |
src/qemu/qemu_capabilities.c
|
|
Pablo Greco |
40546a |
- several refactors are missing
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.args
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args
|
|
Pablo Greco |
40546a |
- these were not backported
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
Pablo Greco |
40546a |
- downstream patch to add rtm=on and hle=on for Haswell
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <5d34d0b9087230e4dc0f0936b34e73b5f1781832.1561068591.git.jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/qemu/qemu_capabilities.c | 8 +++++++-
|
|
Pablo Greco |
40546a |
src/qemu/qemu_capabilities.h | 1 +
|
|
Pablo Greco |
40546a |
src/qemu/qemu_command.c | 2 ++
|
|
Pablo Greco |
40546a |
tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 +
|
|
Pablo Greco |
40546a |
tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args | 6 +++---
|
|
Pablo Greco |
40546a |
5 files changed, 14 insertions(+), 4 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
Pablo Greco |
40546a |
index fb260eae96..c48d66b39b 100644
|
|
Pablo Greco |
40546a |
--- a/src/qemu/qemu_capabilities.c
|
|
Pablo Greco |
40546a |
+++ b/src/qemu/qemu_capabilities.c
|
|
Pablo Greco |
40546a |
@@ -516,6 +516,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
|
Pablo Greco |
40546a |
"machine.pseries.cap-nested-hv",
|
|
Pablo Greco |
40546a |
"x86-max-cpu",
|
|
Pablo Greco |
40546a |
"cpu-unavailable-features",
|
|
Pablo Greco |
40546a |
+ "canonical-cpu-features",
|
|
Pablo Greco |
40546a |
);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -2799,7 +2800,9 @@ virQEMUCapsCPUFeatureTranslate(virQEMUCapsPtr qemuCaps,
|
|
Pablo Greco |
40546a |
if (ARCH_IS_X86(qemuCaps->arch))
|
|
Pablo Greco |
40546a |
table = virQEMUCapsCPUFeaturesX86;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (!table || !feature)
|
|
Pablo Greco |
40546a |
+ if (!table ||
|
|
Pablo Greco |
40546a |
+ !feature ||
|
|
Pablo Greco |
40546a |
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
|
|
Pablo Greco |
40546a |
return feature;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
for (entry = table; entry->libvirt; entry++) {
|
|
Pablo Greco |
40546a |
@@ -4381,6 +4384,9 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
|
|
Pablo Greco |
40546a |
virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES))
|
|
Pablo Greco |
40546a |
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
/* Probe for SEV capabilities */
|
|
Pablo Greco |
40546a |
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) {
|
|
Pablo Greco |
40546a |
int rc = virQEMUCapsProbeQMPSEVCapabilities(qemuCaps, mon);
|
|
Pablo Greco |
40546a |
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
|
Pablo Greco |
40546a |
index 5aa41efdb0..1767b2ab6c 100644
|
|
Pablo Greco |
40546a |
--- a/src/qemu/qemu_capabilities.h
|
|
Pablo Greco |
40546a |
+++ b/src/qemu/qemu_capabilities.h
|
|
Pablo Greco |
40546a |
@@ -496,6 +496,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
|
Pablo Greco |
40546a |
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, /* -machine pseries.cap-nested-hv */
|
|
Pablo Greco |
40546a |
QEMU_CAPS_X86_MAX_CPU, /* max-x86_64-cpu type exists */
|
|
Pablo Greco |
40546a |
QEMU_CAPS_CPU_UNAVAILABLE_FEATURES, /* "unavailable-features" CPU property */
|
|
Pablo Greco |
40546a |
+ QEMU_CAPS_CANONICAL_CPU_FEATURES, /* avoid CPU feature aliases */
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
QEMU_CAPS_LAST /* this must always be the last item */
|
|
Pablo Greco |
40546a |
} virQEMUCapsFlags;
|
|
Pablo Greco |
40546a |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
Pablo Greco |
40546a |
index bea9a208e5..b5c0588e3c 100644
|
|
Pablo Greco |
40546a |
--- a/src/qemu/qemu_command.c
|
|
Pablo Greco |
40546a |
+++ b/src/qemu/qemu_command.c
|
|
Pablo Greco |
40546a |
@@ -6819,6 +6819,8 @@ qemuBuildCpuFeature(virQEMUCapsPtr qemuCaps,
|
|
Pablo Greco |
40546a |
const char *name,
|
|
Pablo Greco |
40546a |
bool state)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
+ name = virQEMUCapsCPUFeatureToQEMU(qemuCaps, name);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
|
Pablo Greco |
40546a |
virBufferAsprintf(buf, ",%s=%s", name, state ? "on" : "off");
|
|
Pablo Greco |
40546a |
else
|
|
Pablo Greco |
40546a |
diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
|
|
Pablo Greco |
40546a |
index 95d26dfce8..9245641df8 100644
|
|
Pablo Greco |
40546a |
--- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
|
|
Pablo Greco |
40546a |
+++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
|
|
Pablo Greco |
40546a |
@@ -216,6 +216,7 @@
|
|
Pablo Greco |
40546a |
<flag name='vfio-pci.display'/>
|
|
Pablo Greco |
40546a |
<flag name='x86-max-cpu'/>
|
|
Pablo Greco |
40546a |
<flag name='cpu-unavailable-features'/>
|
|
Pablo Greco |
40546a |
+ <flag name='canonical-cpu-features'/>
|
|
Pablo Greco |
40546a |
<version>4000050</version>
|
|
Pablo Greco |
40546a |
<kvmVersion>0</kvmVersion>
|
|
Pablo Greco |
40546a |
<microcodeVersion>473743</microcodeVersion>
|
|
Pablo Greco |
40546a |
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
Pablo Greco |
40546a |
index 898b987086..6bc88bbe86 100644
|
|
Pablo Greco |
40546a |
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
Pablo Greco |
40546a |
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
Pablo Greco |
40546a |
@@ -10,9 +10,9 @@ QEMU_AUDIO_DRV=none \
|
|
Pablo Greco |
40546a |
-object secret,id=masterKey0,format=raw,\
|
|
Pablo Greco |
40546a |
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|
Pablo Greco |
40546a |
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
|
Pablo Greco |
40546a |
--cpu Haswell,pclmuldq=on,ds_cpl=on,tsc_adjust=on,fxsr_opt=on,lahf_lm=on,\
|
|
Pablo Greco |
40546a |
-cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,rtm=on,hle=on,\
|
|
Pablo Greco |
40546a |
-kvm_pv_eoi=on,kvm_pv_unhalt=on \
|
|
Pablo Greco |
40546a |
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,\
|
|
Pablo Greco |
40546a |
+cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,\
|
|
Pablo Greco |
40546a |
+kvm-pv-eoi=on,kvm-pv-unhalt=on \
|
|
Pablo Greco |
40546a |
-m 214 \
|
|
Pablo Greco |
40546a |
-realtime mlock=off \
|
|
Pablo Greco |
40546a |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|