cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
619821
From 30c05c032f0af4e959b304f5223dbaf331955488 Mon Sep 17 00:00:00 2001
619821
From: Eduardo Habkost <ehabkost@redhat.com>
619821
Date: Thu, 23 Feb 2017 14:29:43 +0100
619821
Subject: [PATCH 13/17] target-i386: Define TCG_*_FEATURES earlier in cpu.c
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-13-ehabkost@redhat.com>
619821
Patchwork-id: 74042
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 12/14] target-i386: Define TCG_*_FEATURES earlier in cpu.c
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
Those macros will be used in the feature_word_info array data, so need
619821
to be defined earlier.
619821
619821
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
619821
Signed-off-by: Andreas Färber <afaerber@suse.de>
619821
(cherry picked from commit 621626ce7d44f008298c7e6cfefa9fbb80a33dc2)
619821
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
---
619821
 target-i386/cpu.c | 121 +++++++++++++++++++++++++++---------------------------
619821
 1 file changed, 61 insertions(+), 60 deletions(-)
619821
619821
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
619821
index e6821b6..d611062 100644
619821
--- a/target-i386/cpu.c
619821
+++ b/target-i386/cpu.c
619821
@@ -187,6 +187,67 @@ static const char *cpuid_xsave_feature_name[] = {
619821
     NULL, NULL, NULL, NULL,
619821
 };
619821
 
619821
+#define I486_FEATURES (CPUID_FP87 | CPUID_VME | CPUID_PSE)
619821
+#define PENTIUM_FEATURES (I486_FEATURES | CPUID_DE | CPUID_TSC | \
619821
+          CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_MMX | CPUID_APIC)
619821
+#define PENTIUM2_FEATURES (PENTIUM_FEATURES | CPUID_PAE | CPUID_SEP | \
619821
+          CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | CPUID_PAT | \
619821
+          CPUID_PSE36 | CPUID_FXSR)
619821
+#define PENTIUM3_FEATURES (PENTIUM2_FEATURES | CPUID_SSE)
619821
+#define PPRO_FEATURES (CPUID_FP87 | CPUID_DE | CPUID_PSE | CPUID_TSC | \
619821
+          CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_PGE | CPUID_CMOV | \
619821
+          CPUID_PAT | CPUID_FXSR | CPUID_MMX | CPUID_SSE | CPUID_SSE2 | \
619821
+          CPUID_PAE | CPUID_SEP | CPUID_APIC)
619821
+
619821
+#define TCG_FEATURES (CPUID_FP87 | CPUID_PSE | CPUID_TSC | CPUID_MSR | \
619821
+          CPUID_PAE | CPUID_MCE | CPUID_CX8 | CPUID_APIC | CPUID_SEP | \
619821
+          CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | CPUID_PAT | \
619821
+          CPUID_PSE36 | CPUID_CLFLUSH | CPUID_ACPI | CPUID_MMX | \
619821
+          CPUID_FXSR | CPUID_SSE | CPUID_SSE2 | CPUID_SS)
619821
+          /* partly implemented:
619821
+          CPUID_MTRR, CPUID_MCA, CPUID_CLFLUSH (needed for Win64)
619821
+          CPUID_PSE36 (needed for Solaris) */
619821
+          /* missing:
619821
+          CPUID_VME, CPUID_DTS, CPUID_SS, CPUID_HT, CPUID_TM, CPUID_PBE */
619821
+#define TCG_EXT_FEATURES (CPUID_EXT_SSE3 | CPUID_EXT_PCLMULQDQ | \
619821
+          CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 | CPUID_EXT_CX16 | \
619821
+          CPUID_EXT_SSE41 | CPUID_EXT_SSE42 | CPUID_EXT_POPCNT | \
619821
+          CPUID_EXT_MOVBE | CPUID_EXT_AES | CPUID_EXT_HYPERVISOR)
619821
+          /* missing:
619821
+          CPUID_EXT_DTES64, CPUID_EXT_DSCPL, CPUID_EXT_VMX, CPUID_EXT_SMX,
619821
+          CPUID_EXT_EST, CPUID_EXT_TM2, CPUID_EXT_CID, CPUID_EXT_FMA,
619821
+          CPUID_EXT_XTPR, CPUID_EXT_PDCM, CPUID_EXT_PCID, CPUID_EXT_DCA,
619821
+          CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER, CPUID_EXT_XSAVE,
619821
+          CPUID_EXT_OSXSAVE, CPUID_EXT_AVX, CPUID_EXT_F16C,
619821
+          CPUID_EXT_RDRAND */
619821
+
619821
+#ifdef TARGET_X86_64
619821
+#define TCG_EXT2_X86_64_FEATURES (CPUID_EXT2_SYSCALL | CPUID_EXT2_LM)
619821
+#else
619821
+#define TCG_EXT2_X86_64_FEATURES 0
619821
+#endif
619821
+
619821
+#define TCG_EXT2_FEATURES ((TCG_FEATURES & CPUID_EXT2_AMD_ALIASES) | \
619821
+          CPUID_EXT2_NX | CPUID_EXT2_MMXEXT | CPUID_EXT2_RDTSCP | \
619821
+          CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | \
619821
+          TCG_EXT2_X86_64_FEATURES)
619821
+          /* missing:
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
+          CPUID_7_0_EBX_FSGSBASE, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2,
619821
+          CPUID_7_0_EBX_ERMS, CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM,
619821
+          CPUID_7_0_EBX_RDSEED */
619821
+#define TCG_7_0_ECX_FEATURES 0
619821
+#define TCG_7_0_EDX_FEATURES 0
619821
+
619821
+
619821
 typedef struct FeatureWordInfo {
619821
     const char **feat_names;
619821
     uint32_t cpuid_eax;   /* Input EAX for CPUID */
619821
@@ -453,66 +514,6 @@ typedef struct x86_def_t {
619821
     char model_id[48];
619821
 } x86_def_t;
619821
 
619821
-#define I486_FEATURES (CPUID_FP87 | CPUID_VME | CPUID_PSE)
619821
-#define PENTIUM_FEATURES (I486_FEATURES | CPUID_DE | CPUID_TSC | \
619821
-          CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_MMX | CPUID_APIC)
619821
-#define PENTIUM2_FEATURES (PENTIUM_FEATURES | CPUID_PAE | CPUID_SEP | \
619821
-          CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | CPUID_PAT | \
619821
-          CPUID_PSE36 | CPUID_FXSR)
619821
-#define PENTIUM3_FEATURES (PENTIUM2_FEATURES | CPUID_SSE)
619821
-#define PPRO_FEATURES (CPUID_FP87 | CPUID_DE | CPUID_PSE | CPUID_TSC | \
619821
-          CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_PGE | CPUID_CMOV | \
619821
-          CPUID_PAT | CPUID_FXSR | CPUID_MMX | CPUID_SSE | CPUID_SSE2 | \
619821
-          CPUID_PAE | CPUID_SEP | CPUID_APIC)
619821
-
619821
-#define TCG_FEATURES (CPUID_FP87 | CPUID_PSE | CPUID_TSC | CPUID_MSR | \
619821
-          CPUID_PAE | CPUID_MCE | CPUID_CX8 | CPUID_APIC | CPUID_SEP | \
619821
-          CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | CPUID_PAT | \
619821
-          CPUID_PSE36 | CPUID_CLFLUSH | CPUID_ACPI | CPUID_MMX | \
619821
-          CPUID_FXSR | CPUID_SSE | CPUID_SSE2 | CPUID_SS)
619821
-          /* partly implemented:
619821
-          CPUID_MTRR, CPUID_MCA, CPUID_CLFLUSH (needed for Win64)
619821
-          CPUID_PSE36 (needed for Solaris) */
619821
-          /* missing:
619821
-          CPUID_VME, CPUID_DTS, CPUID_SS, CPUID_HT, CPUID_TM, CPUID_PBE */
619821
-#define TCG_EXT_FEATURES (CPUID_EXT_SSE3 | CPUID_EXT_PCLMULQDQ | \
619821
-          CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 | CPUID_EXT_CX16 | \
619821
-          CPUID_EXT_SSE41 | CPUID_EXT_SSE42 | CPUID_EXT_POPCNT | \
619821
-          CPUID_EXT_MOVBE | CPUID_EXT_AES | CPUID_EXT_HYPERVISOR)
619821
-          /* missing:
619821
-          CPUID_EXT_DTES64, CPUID_EXT_DSCPL, CPUID_EXT_VMX, CPUID_EXT_SMX,
619821
-          CPUID_EXT_EST, CPUID_EXT_TM2, CPUID_EXT_CID, CPUID_EXT_FMA,
619821
-          CPUID_EXT_XTPR, CPUID_EXT_PDCM, CPUID_EXT_PCID, CPUID_EXT_DCA,
619821
-          CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER, CPUID_EXT_XSAVE,
619821
-          CPUID_EXT_OSXSAVE, CPUID_EXT_AVX, CPUID_EXT_F16C,
619821
-          CPUID_EXT_RDRAND */
619821
-
619821
-#ifdef TARGET_X86_64
619821
-#define TCG_EXT2_X86_64_FEATURES (CPUID_EXT2_SYSCALL | CPUID_EXT2_LM)
619821
-#else
619821
-#define TCG_EXT2_X86_64_FEATURES 0
619821
-#endif
619821
-
619821
-#define TCG_EXT2_FEATURES ((TCG_FEATURES & CPUID_EXT2_AMD_ALIASES) | \
619821
-          CPUID_EXT2_NX | CPUID_EXT2_MMXEXT | CPUID_EXT2_RDTSCP | \
619821
-          CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | \
619821
-          TCG_EXT2_X86_64_FEATURES)
619821
-          /* missing:
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
-          CPUID_7_0_EBX_FSGSBASE, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2,
619821
-          CPUID_7_0_EBX_ERMS, CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM,
619821
-          CPUID_7_0_EBX_RDSEED */
619821
-#define TCG_7_0_ECX_FEATURES 0
619821
-#define TCG_7_0_EDX_FEATURES 0
619821
-
619821
 /* built-in CPU model definitions
619821
  */
619821
 static x86_def_t builtin_x86_defs[] = {
619821
-- 
619821
1.8.3.1
619821