|
|
c687bc |
From 4daa8dca77edec191dfe0ae4a0a9fc70f8f63607 Mon Sep 17 00:00:00 2001
|
|
|
c687bc |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
c687bc |
Date: Wed, 24 Feb 2021 11:30:37 -0500
|
|
|
c687bc |
Subject: [PATCH 4/4] i386: Add the support for AMD EPYC 3rd generation
|
|
|
c687bc |
processors
|
|
|
c687bc |
|
|
|
c687bc |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
c687bc |
Message-id: <20210224113037.15599-5-dgilbert@redhat.com>
|
|
|
c687bc |
Patchwork-id: 101202
|
|
|
c687bc |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 4/4] i386: Add the support for AMD EPYC 3rd generation processors
|
|
|
c687bc |
Bugzilla: 1790620
|
|
|
c687bc |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
c687bc |
|
|
|
c687bc |
From: Babu Moger <babu.moger@amd.com>
|
|
|
c687bc |
|
|
|
c687bc |
Adds the support for AMD 3rd generation processors. The model
|
|
|
c687bc |
display for the new processor will be EPYC-Milan.
|
|
|
c687bc |
|
|
|
c687bc |
Adds the following new feature bits on top of the feature bits from
|
|
|
c687bc |
the first and second generation EPYC models.
|
|
|
c687bc |
|
|
|
c687bc |
pcid : Process context identifiers support
|
|
|
c687bc |
ibrs : Indirect Branch Restricted Speculation
|
|
|
c687bc |
ssbd : Speculative Store Bypass Disable
|
|
|
c687bc |
erms : Enhanced REP MOVSB/STOSB support
|
|
|
c687bc |
fsrm : Fast Short REP MOVSB support
|
|
|
c687bc |
invpcid : Invalidate processor context ID
|
|
|
c687bc |
pku : Protection keys support
|
|
|
c687bc |
svme-addr-chk : SVM instructions address check for #GP handling
|
|
|
c687bc |
|
|
|
c687bc |
Depends on the following kernel commits:
|
|
|
c687bc |
14c2bf81fcd2 ("KVM: SVM: Fix #GP handling for doubly-nested virtualization")
|
|
|
c687bc |
3b9c723ed7cf ("KVM: SVM: Add support for SVM instruction address check change")
|
|
|
c687bc |
4aa2691dcbd3 ("8ce1c461188799d863398dd2865d KVM: x86: Factor out x86 instruction emulation with decoding")
|
|
|
c687bc |
4407a797e941 ("KVM: SVM: Enable INVPCID feature on AMD")
|
|
|
c687bc |
9715092f8d7e ("KVM: X86: Move handling of INVPCID types to x86")
|
|
|
c687bc |
3f3393b3ce38 ("KVM: X86: Rename and move the function vmx_handle_memory_failure to x86.c")
|
|
|
c687bc |
830bd71f2c06 ("KVM: SVM: Remove set_cr_intercept, clr_cr_intercept and is_cr_intercept")
|
|
|
c687bc |
4c44e8d6c193 ("KVM: SVM: Add new intercept word in vmcb_control_area")
|
|
|
c687bc |
c62e2e94b9d4 ("KVM: SVM: Modify 64 bit intercept field to two 32 bit vectors")
|
|
|
c687bc |
9780d51dc2af ("KVM: SVM: Modify intercept_exceptions to generic intercepts")
|
|
|
c687bc |
30abaa88382c ("KVM: SVM: Change intercept_dr to generic intercepts")
|
|
|
c687bc |
03bfeeb988a9 ("KVM: SVM: Change intercept_cr to generic intercepts")
|
|
|
c687bc |
c45ad7229d13 ("KVM: SVM: Introduce vmcb_(set_intercept/clr_intercept/_is_intercept)")
|
|
|
c687bc |
a90c1ed9f11d ("(pcid) KVM: nSVM: Remove unused field")
|
|
|
c687bc |
fa44b82eb831 ("KVM: x86: Move MPK feature detection to common code")
|
|
|
c687bc |
38f3e775e9c2 ("x86/Kconfig: Update config and kernel doc for MPK feature on AMD")
|
|
|
c687bc |
37486135d3a7 ("KVM: x86: Fix pkru save/restore when guest CR4.PKE=0, move it to x86.c")
|
|
|
c687bc |
|
|
|
c687bc |
Signed-off-by: Babu Moger <babu.moger@amd.com>
|
|
|
c687bc |
Message-Id: <161290460478.11352.8933244555799318236.stgit@bmoger-ubuntu>
|
|
|
c687bc |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
c687bc |
(cherry picked from commit 623972ceae091b31331ae4a1dc94fe5cbb891937)
|
|
|
c687bc |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
c687bc |
---
|
|
|
c687bc |
target/i386/cpu.c | 107 +++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
c687bc |
target/i386/cpu.h | 4 ++
|
|
|
c687bc |
2 files changed, 110 insertions(+), 1 deletion(-)
|
|
|
c687bc |
|
|
|
c687bc |
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
|
c687bc |
index 7227c803c3..d5b0d4b7f0 100644
|
|
|
c687bc |
--- a/target/i386/cpu.c
|
|
|
c687bc |
+++ b/target/i386/cpu.c
|
|
|
c687bc |
@@ -1133,7 +1133,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
|
c687bc |
"clzero", NULL, "xsaveerptr", NULL,
|
|
|
c687bc |
NULL, NULL, NULL, NULL,
|
|
|
c687bc |
NULL, "wbnoinvd", NULL, NULL,
|
|
|
c687bc |
- "ibpb", NULL, NULL, "amd-stibp",
|
|
|
c687bc |
+ "ibpb", NULL, "ibrs", "amd-stibp",
|
|
|
c687bc |
NULL, NULL, NULL, NULL,
|
|
|
c687bc |
NULL, NULL, NULL, NULL,
|
|
|
c687bc |
"amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL,
|
|
|
c687bc |
@@ -1853,6 +1853,56 @@ static CPUCaches epyc_rome_cache_info = {
|
|
|
c687bc |
},
|
|
|
c687bc |
};
|
|
|
c687bc |
|
|
|
c687bc |
+static CPUCaches epyc_milan_cache_info = {
|
|
|
c687bc |
+ .l1d_cache = &(CPUCacheInfo) {
|
|
|
c687bc |
+ .type = DATA_CACHE,
|
|
|
c687bc |
+ .level = 1,
|
|
|
c687bc |
+ .size = 32 * KiB,
|
|
|
c687bc |
+ .line_size = 64,
|
|
|
c687bc |
+ .associativity = 8,
|
|
|
c687bc |
+ .partitions = 1,
|
|
|
c687bc |
+ .sets = 64,
|
|
|
c687bc |
+ .lines_per_tag = 1,
|
|
|
c687bc |
+ .self_init = 1,
|
|
|
c687bc |
+ .no_invd_sharing = true,
|
|
|
c687bc |
+ },
|
|
|
c687bc |
+ .l1i_cache = &(CPUCacheInfo) {
|
|
|
c687bc |
+ .type = INSTRUCTION_CACHE,
|
|
|
c687bc |
+ .level = 1,
|
|
|
c687bc |
+ .size = 32 * KiB,
|
|
|
c687bc |
+ .line_size = 64,
|
|
|
c687bc |
+ .associativity = 8,
|
|
|
c687bc |
+ .partitions = 1,
|
|
|
c687bc |
+ .sets = 64,
|
|
|
c687bc |
+ .lines_per_tag = 1,
|
|
|
c687bc |
+ .self_init = 1,
|
|
|
c687bc |
+ .no_invd_sharing = true,
|
|
|
c687bc |
+ },
|
|
|
c687bc |
+ .l2_cache = &(CPUCacheInfo) {
|
|
|
c687bc |
+ .type = UNIFIED_CACHE,
|
|
|
c687bc |
+ .level = 2,
|
|
|
c687bc |
+ .size = 512 * KiB,
|
|
|
c687bc |
+ .line_size = 64,
|
|
|
c687bc |
+ .associativity = 8,
|
|
|
c687bc |
+ .partitions = 1,
|
|
|
c687bc |
+ .sets = 1024,
|
|
|
c687bc |
+ .lines_per_tag = 1,
|
|
|
c687bc |
+ },
|
|
|
c687bc |
+ .l3_cache = &(CPUCacheInfo) {
|
|
|
c687bc |
+ .type = UNIFIED_CACHE,
|
|
|
c687bc |
+ .level = 3,
|
|
|
c687bc |
+ .size = 32 * MiB,
|
|
|
c687bc |
+ .line_size = 64,
|
|
|
c687bc |
+ .associativity = 16,
|
|
|
c687bc |
+ .partitions = 1,
|
|
|
c687bc |
+ .sets = 32768,
|
|
|
c687bc |
+ .lines_per_tag = 1,
|
|
|
c687bc |
+ .self_init = true,
|
|
|
c687bc |
+ .inclusive = true,
|
|
|
c687bc |
+ .complex_indexing = true,
|
|
|
c687bc |
+ },
|
|
|
c687bc |
+};
|
|
|
c687bc |
+
|
|
|
c687bc |
/* The following VMX features are not supported by KVM and are left out in the
|
|
|
c687bc |
* CPU definitions:
|
|
|
c687bc |
*
|
|
|
c687bc |
@@ -4124,6 +4174,61 @@ static X86CPUDefinition builtin_x86_defs[] = {
|
|
|
c687bc |
.model_id = "AMD EPYC-Rome Processor",
|
|
|
c687bc |
.cache_info = &epyc_rome_cache_info,
|
|
|
c687bc |
},
|
|
|
c687bc |
+ {
|
|
|
c687bc |
+ .name = "EPYC-Milan",
|
|
|
c687bc |
+ .level = 0xd,
|
|
|
c687bc |
+ .vendor = CPUID_VENDOR_AMD,
|
|
|
c687bc |
+ .family = 25,
|
|
|
c687bc |
+ .model = 1,
|
|
|
c687bc |
+ .stepping = 1,
|
|
|
c687bc |
+ .features[FEAT_1_EDX] =
|
|
|
c687bc |
+ CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUSH |
|
|
|
c687bc |
+ CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE |
|
|
|
c687bc |
+ CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE |
|
|
|
c687bc |
+ CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE |
|
|
|
c687bc |
+ CPUID_VME | CPUID_FP87,
|
|
|
c687bc |
+ .features[FEAT_1_ECX] =
|
|
|
c687bc |
+ CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX |
|
|
|
c687bc |
+ CPUID_EXT_XSAVE | CPUID_EXT_AES | CPUID_EXT_POPCNT |
|
|
|
c687bc |
+ CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
|
|
|
c687bc |
+ CPUID_EXT_CX16 | CPUID_EXT_FMA | CPUID_EXT_SSSE3 |
|
|
|
c687bc |
+ CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 |
|
|
|
c687bc |
+ CPUID_EXT_PCID,
|
|
|
c687bc |
+ .features[FEAT_8000_0001_EDX] =
|
|
|
c687bc |
+ CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB |
|
|
|
c687bc |
+ CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX |
|
|
|
c687bc |
+ CPUID_EXT2_SYSCALL,
|
|
|
c687bc |
+ .features[FEAT_8000_0001_ECX] =
|
|
|
c687bc |
+ CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH |
|
|
|
c687bc |
+ CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
|
|
|
c687bc |
+ CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM |
|
|
|
c687bc |
+ CPUID_EXT3_TOPOEXT | CPUID_EXT3_PERFCORE,
|
|
|
c687bc |
+ .features[FEAT_8000_0008_EBX] =
|
|
|
c687bc |
+ CPUID_8000_0008_EBX_CLZERO | CPUID_8000_0008_EBX_XSAVEERPTR |
|
|
|
c687bc |
+ CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_IBPB |
|
|
|
c687bc |
+ CPUID_8000_0008_EBX_IBRS | CPUID_8000_0008_EBX_STIBP |
|
|
|
c687bc |
+ CPUID_8000_0008_EBX_AMD_SSBD,
|
|
|
c687bc |
+ .features[FEAT_7_0_EBX] =
|
|
|
c687bc |
+ CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 |
|
|
|
c687bc |
+ CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED |
|
|
|
c687bc |
+ CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSHOPT |
|
|
|
c687bc |
+ CPUID_7_0_EBX_SHA_NI | CPUID_7_0_EBX_CLWB | CPUID_7_0_EBX_ERMS |
|
|
|
c687bc |
+ CPUID_7_0_EBX_INVPCID,
|
|
|
c687bc |
+ .features[FEAT_7_0_ECX] =
|
|
|
c687bc |
+ CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_RDPID | CPUID_7_0_ECX_PKU,
|
|
|
c687bc |
+ .features[FEAT_7_0_EDX] =
|
|
|
c687bc |
+ CPUID_7_0_EDX_FSRM,
|
|
|
c687bc |
+ .features[FEAT_XSAVE] =
|
|
|
c687bc |
+ CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
|
|
|
c687bc |
+ CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES,
|
|
|
c687bc |
+ .features[FEAT_6_EAX] =
|
|
|
c687bc |
+ CPUID_6_EAX_ARAT,
|
|
|
c687bc |
+ .features[FEAT_SVM] =
|
|
|
c687bc |
+ CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE | CPUID_SVM_SVME_ADDR_CHK,
|
|
|
c687bc |
+ .xlevel = 0x8000001E,
|
|
|
c687bc |
+ .model_id = "AMD EPYC-Milan Processor",
|
|
|
c687bc |
+ .cache_info = &epyc_milan_cache_info,
|
|
|
c687bc |
+ },
|
|
|
c687bc |
};
|
|
|
c687bc |
|
|
|
c687bc |
/* KVM-specific features that are automatically added/removed
|
|
|
c687bc |
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
|
|
c687bc |
index e1b67910c2..7a3aa40201 100644
|
|
|
c687bc |
--- a/target/i386/cpu.h
|
|
|
c687bc |
+++ b/target/i386/cpu.h
|
|
|
c687bc |
@@ -800,8 +800,12 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
|
|
|
c687bc |
#define CPUID_8000_0008_EBX_WBNOINVD (1U << 9)
|
|
|
c687bc |
/* Indirect Branch Prediction Barrier */
|
|
|
c687bc |
#define CPUID_8000_0008_EBX_IBPB (1U << 12)
|
|
|
c687bc |
+/* Indirect Branch Restricted Speculation */
|
|
|
c687bc |
+#define CPUID_8000_0008_EBX_IBRS (1U << 14)
|
|
|
c687bc |
/* Single Thread Indirect Branch Predictors */
|
|
|
c687bc |
#define CPUID_8000_0008_EBX_STIBP (1U << 15)
|
|
|
c687bc |
+/* Speculative Store Bypass Disable */
|
|
|
c687bc |
+#define CPUID_8000_0008_EBX_AMD_SSBD (1U << 24)
|
|
|
c687bc |
|
|
|
c687bc |
#define CPUID_XSAVE_XSAVEOPT (1U << 0)
|
|
|
c687bc |
#define CPUID_XSAVE_XSAVEC (1U << 1)
|
|
|
c687bc |
--
|
|
|
c687bc |
2.27.0
|
|
|
c687bc |
|