Patchwork [v4,08/18] target-i386: Filter KVM and 0xC0000001 features on TCG

login
register
mail settings
Submitter Eduardo Habkost
Date April 30, 2014, 4:48 p.m.
Message ID <1398876525-28831-9-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/344222/
State New
Headers show

Comments

Eduardo Habkost - April 30, 2014, 4:48 p.m.
TCG doesn't support any of the feature flags on FEAT_KVM and
FEAT_C000_0001_EDX feature words, so clear all bits on those feature
words.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
 * Trivial rebase to latest qom-cpu (commit 90c5d39c)
   (Reviewed-by line kept)
Changes v2 -> v3:
 * Trivial rebase after QEMU 2.0 (onto commit 2d03b49)
   (Reviewed-by line kept)
---
 target-i386/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 714d121..f2f2bd5 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -587,7 +587,9 @@  struct X86CPUDefinition {
           CPUID_EXT2_PDPE1GB */
 #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \
           CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A)
+#define TCG_EXT4_FEATURES 0
 #define TCG_SVM_FEATURES 0
+#define TCG_KVM_FEATURES 0
 #define TCG_7_0_EBX_FEATURES (CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_SMAP | \
           CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX)
           /* missing:
@@ -2600,6 +2602,8 @@  static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
         env->features[FEAT_8000_0001_EDX] &= TCG_EXT2_FEATURES;
         env->features[FEAT_8000_0001_ECX] &= TCG_EXT3_FEATURES;
         env->features[FEAT_SVM] &= TCG_SVM_FEATURES;
+        env->features[FEAT_KVM] &= TCG_KVM_FEATURES;
+        env->features[FEAT_C000_0001_EDX] &= TCG_EXT4_FEATURES;
     } else {
         if (x86_cpu_filter_features(cpu) && cpu->enforce_cpuid) {
             error_setg(&local_err,