619821
From d037664335efca55df79abcde79f4f2733ca535b Mon Sep 17 00:00:00 2001
619821
From: Eduardo Habkost <ehabkost@redhat.com>
619821
Date: Thu, 23 Feb 2017 14:29:42 +0100
619821
Subject: [PATCH 12/17] target-i386: Filter KVM and 0xC0000001 features on TCG
619821
MIME-Version: 1.0
619821
Content-Type: text/plain; charset=UTF-8
619821
Content-Transfer-Encoding: 8bit
619821
619821
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
619821
Message-id: <20170223142945.17790-12-ehabkost@redhat.com>
619821
Patchwork-id: 74040
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 11/14] target-i386: Filter KVM and 0xC0000001 features on TCG
619821
Bugzilla: 1382122
619821
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
619821
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
619821
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
619821
TCG doesn't support any of the feature flags on FEAT_KVM and
619821
FEAT_C000_0001_EDX feature words, so clear all bits on those feature
619821
words.
619821
619821
Reviewed-by: Richard Henderson <rth@twiddle.net>
619821
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
619821
Signed-off-by: Andreas Färber <afaerber@suse.de>
619821
(cherry picked from commit 84a6c6cd40687598c7e85d7de8095e08b5e636d7)
619821
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
---
619821
 target-i386/cpu.c | 4 ++++
619821
 1 file changed, 4 insertions(+)
619821
619821
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
619821
index d424211..e6821b6 100644
619821
--- a/target-i386/cpu.c
619821
+++ b/target-i386/cpu.c
619821
@@ -501,7 +501,9 @@ typedef struct x86_def_t {
619821
           CPUID_EXT2_PDPE1GB */
619821
 #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \
619821
           CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A)
619821
+#define TCG_EXT4_FEATURES 0
619821
 #define TCG_SVM_FEATURES 0
619821
+#define TCG_KVM_FEATURES 0
619821
 #define TCG_7_0_EBX_FEATURES (CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_SMAP | \
619821
           CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX)
619821
           /* missing:
619821
@@ -2644,6 +2646,8 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
619821
         env->features[FEAT_8000_0001_EDX] &= TCG_EXT2_FEATURES;
619821
         env->features[FEAT_8000_0001_ECX] &= TCG_EXT3_FEATURES;
619821
         env->features[FEAT_SVM] &= TCG_SVM_FEATURES;
619821
+        env->features[FEAT_KVM] &= TCG_KVM_FEATURES;
619821
+        env->features[FEAT_C000_0001_EDX] &= TCG_EXT4_FEATURES;
619821
         env->features[FEAT_XSAVE] = 0;
619821
         env->features[FEAT_7_0_ECX] &= TCG_7_0_ECX_FEATURES;
619821
         env->features[FEAT_7_0_EDX] &= TCG_7_0_EDX_FEATURES;
619821
-- 
619821
1.8.3.1
619821