[libvirt] [PATCH 01/24] qemu: Drop qemuFeatureNoEffect

Jiri Denemark jdenemar at redhat.com
Wed Jun 19 09:37:58 UTC 2019


We already have virQEMUCapsCPUFilterFeatures for filtering features
which QEMU does not know about. Let's move osxsave and ospke from
qemuFeatureNoEffect there.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_capabilities.c |  9 ++++++++-
 src/qemu/qemu_command.c      | 24 ++----------------------
 2 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d0fdd1da9f..5f989a2613 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2823,6 +2823,11 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps,
 }
 
 
+/*
+ * Filter for features which should never be passed to QEMU. Either because
+ * QEMU never supported them or they were dropped as they never did anything
+ * useful.
+ */
 bool
 virQEMUCapsCPUFilterFeatures(const char *name,
                              void *opaque)
@@ -2834,7 +2839,9 @@ virQEMUCapsCPUFilterFeatures(const char *name,
 
     if (STREQ(name, "cmt") ||
         STREQ(name, "mbm_total") ||
-        STREQ(name, "mbm_local"))
+        STREQ(name, "mbm_local") ||
+        STREQ(name, "osxsave") ||
+        STREQ(name, "ospke"))
         return false;
 
     return true;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 59dc134785..6cc165a118 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7038,27 +7038,6 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
     return 0;
 }
 
-/**
- * qemuFeatureNoEffect:
- * @feature: CPU Feature
- *
- * Returns true, if the feature is known to have (never had) an effect on QEMU.
- * Those features might be dropped in qemu without a longer deprecation cycle
- * and must therefore be known e.g. to no more define them on command line.
- */
-static bool
-qemuFeatureNoEffect(virCPUFeatureDefPtr feature)
-{
-    if (!feature->name)
-        return false;
-
-    if (STREQ(feature->name, "osxsave"))
-        return true;
-    if (STREQ(feature->name, "ospke"))
-        return true;
-
-    return false;
-}
 
 static int
 qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
@@ -7127,7 +7106,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
         virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
 
     for (i = 0; i < cpu->nfeatures; i++) {
-        if (qemuFeatureNoEffect(&(cpu->features[i])))
+        if (!virQEMUCapsCPUFilterFeatures(cpu->features[i].name,
+                                          (virArch *)&def->os.arch))
             continue;
         switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
         case VIR_CPU_FEATURE_FORCE:
-- 
2.22.0




More information about the libvir-list mailing list