Blame SOURCES/kvm-target-i386-Make-TCG-feature-filtering-more-readable.patch

9ae3a8
From 6e553d9996682836a35a1020e9d992c856236342 Mon Sep 17 00:00:00 2001
9ae3a8
From: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Date: Thu, 23 Feb 2017 14:29:40 +0100
9ae3a8
Subject: [PATCH 10/17] target-i386: Make TCG feature filtering more readable
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Message-id: <20170223142945.17790-10-ehabkost@redhat.com>
9ae3a8
Patchwork-id: 74041
9ae3a8
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 09/14] target-i386: Make TCG feature filtering more readable
9ae3a8
Bugzilla: 1382122
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Instead of an #ifdef in the middle of the code, just set
9ae3a8
TCG_EXT2_FEATURES to a different value depending on TARGET_X86_64.
9ae3a8
9ae3a8
Reviewed-by: Richard Henderson <rth@twiddle.net>
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Signed-off-by: Andreas Färber <afaerber@suse.de>
9ae3a8
(cherry picked from commit a42d9938a162c3e3c9e441d1927dca5bd59167d9)
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 target-i386/cpu.c | 16 ++++++++++------
9ae3a8
 1 file changed, 10 insertions(+), 6 deletions(-)
9ae3a8
9ae3a8
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
9ae3a8
index bb8abf7..e32d4d7 100644
9ae3a8
--- a/target-i386/cpu.c
9ae3a8
+++ b/target-i386/cpu.c
9ae3a8
@@ -486,9 +486,17 @@ typedef struct x86_def_t {
9ae3a8
           CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER, CPUID_EXT_XSAVE,
9ae3a8
           CPUID_EXT_OSXSAVE, CPUID_EXT_AVX, CPUID_EXT_F16C,
9ae3a8
           CPUID_EXT_RDRAND */
9ae3a8
+
9ae3a8
+#ifdef TARGET_X86_64
9ae3a8
+#define TCG_EXT2_X86_64_FEATURES (CPUID_EXT2_SYSCALL | CPUID_EXT2_LM)
9ae3a8
+#else
9ae3a8
+#define TCG_EXT2_X86_64_FEATURES 0
9ae3a8
+#endif
9ae3a8
+
9ae3a8
 #define TCG_EXT2_FEATURES ((TCG_FEATURES & CPUID_EXT2_AMD_ALIASES) | \
9ae3a8
           CPUID_EXT2_NX | CPUID_EXT2_MMXEXT | CPUID_EXT2_RDTSCP | \
9ae3a8
-          CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT)
9ae3a8
+          CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | \
9ae3a8
+          TCG_EXT2_X86_64_FEATURES)
9ae3a8
           /* missing:
9ae3a8
           CPUID_EXT2_PDPE1GB */
9ae3a8
 #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \
9ae3a8
@@ -2632,11 +2640,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
9ae3a8
     if (!kvm_enabled()) {
9ae3a8
         env->features[FEAT_1_EDX] &= TCG_FEATURES;
9ae3a8
         env->features[FEAT_1_ECX] &= TCG_EXT_FEATURES;
9ae3a8
-        env->features[FEAT_8000_0001_EDX] &= (TCG_EXT2_FEATURES
9ae3a8
-#ifdef TARGET_X86_64
9ae3a8
-            | CPUID_EXT2_SYSCALL | CPUID_EXT2_LM
9ae3a8
-#endif
9ae3a8
-            );
9ae3a8
+        env->features[FEAT_8000_0001_EDX] &= TCG_EXT2_FEATURES;
9ae3a8
         env->features[FEAT_8000_0001_ECX] &= TCG_EXT3_FEATURES;
9ae3a8
         env->features[FEAT_SVM] &= TCG_SVM_FEATURES;
9ae3a8
         env->features[FEAT_XSAVE] = 0;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8