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