render / rpms / libvirt

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