libvirt/SOURCES/libvirt-qemu-Translate-feat...

70 lines
2.7 KiB
Diff

From f2962c42448d442414246715a30ae74c8dc9fef3 Mon Sep 17 00:00:00 2001
Message-Id: <f2962c42448d442414246715a30ae74c8dc9fef3@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 27 Feb 2020 15:23:04 +0100
Subject: [PATCH] qemu: Translate features in virQEMUCapsGetCPUFeatures
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Starting with QEMU 4.1 qemuMonitorCPUModelInfo structure in virQEMUCaps
stores only canonical feature names which may differ from the name used
by libvirt. We need translate these canonical names into libvirt names
for further consumption.
This fixes a bug in qemuConnectBaselineHypervisorCPU which would remove
all features for which libvirt's spelling differs from the QEMU's
preferred name. For example, the following result of
qemuConnectBaselineHypervisorCPU on my host with QEMU 4.1 is wrong:
<cpu mode='custom' match='exact'>
<model fallback='forbid'>Skylake-Client</model>
<vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='clflushopt'/>
<feature policy='require' name='umip'/>
<feature policy='require' name='arch-capabilities'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='invtsc'/>
<feature policy='disable' name='pclmuldq'/>
<feature policy='disable' name='lahf_lm'/>
</cpu>
The 'pclmuldq' and 'lahf_lm' should not be disabled in the baseline CPU
as they are supported by QEMU on this host.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit 1fd28a2e79692babd63d6b8e9eea90168dd0897e)
https://bugzilla.redhat.com/show_bug.cgi?id=1804224
https://bugzilla.redhat.com/show_bug.cgi?id=1809510
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <d6d9ffeea42852d1baf6ff08b3174af22b113353.1582813158.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_capabilities.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c25d8c3e1a..a7cc324105 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2521,7 +2521,8 @@ virQEMUCapsGetCPUFeatures(virQEMUCapsPtr qemuCaps,
if (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO)
continue;
- if (VIR_STRDUP(list[n++], prop->name) < 0)
+ if (VIR_STRDUP(list[n++],
+ virQEMUCapsCPUFeatureFromQEMU(qemuCaps, prop->name)) < 0)
goto cleanup;
}
--
2.25.1