Blame SOURCES/kvm-i386-Enable-TOPOEXT-feature-on-AMD-EPYC-CPU.patch

357786
From 2f039646554d29873f39b867cfe80d044f2c56b4 Mon Sep 17 00:00:00 2001
357786
From: Eduardo Habkost <ehabkost@redhat.com>
357786
Date: Tue, 3 Jul 2018 17:23:55 +0200
357786
Subject: [PATCH 10/89] i386: Enable TOPOEXT feature on AMD EPYC CPU
357786
357786
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
357786
Message-id: <20180703172356.21038-10-ehabkost@redhat.com>
357786
Patchwork-id: 81219
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH v3 09/10] i386: Enable TOPOEXT feature on AMD EPYC CPU
357786
Bugzilla: 1481253
357786
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
357786
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
357786
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
357786
From: Babu Moger <babu.moger@amd.com>
357786
357786
Enable TOPOEXT feature on EPYC CPU. This is required to support
357786
hyperthreading on VM guests. Also extend xlevel to 0x8000001E.
357786
357786
Disable topoext on PC_COMPAT_2_12 and keep xlevel 0x8000000a.
357786
357786
Signed-off-by: Babu Moger <babu.moger@amd.com>
357786
Message-Id: <1529443919-67509-3-git-send-email-babu.moger@amd.com>
357786
[ehabkost: Added EPYC-IBPB.xlevel to PC_COMPAT_2_12]
357786
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
357786
(cherry picked from commit e00516475c270dcb6705753da96063f95699abf2)
357786
[ehabkost: moved compat code to PC_RHEL75_COMPAT]
357786
[ehabkost: fixed typo on EPYC-IBPB compat entry]
357786
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
357786
---
357786
Changes v2 -> v3:
357786
* Removed duplicate TYPE_X86_CPU.legacy-cache=on entry from
357786
  PC_RHEL7_5_COMPAT (caught by Laurent Vivier)
357786
357786
Changes v1 -> v2:
357786
* Fixed typo on EPYC-IBPB compat entry
357786
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 include/hw/i386/pc.h | 12 ++++++++++++
357786
 target/i386/cpu.c    | 10 ++++++----
357786
 2 files changed, 18 insertions(+), 4 deletions(-)
357786
357786
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
357786
index 3ff55c6..88e5a92 100644
357786
--- a/include/hw/i386/pc.h
357786
+++ b/include/hw/i386/pc.h
357786
@@ -983,6 +983,18 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
357786
             .driver   = TYPE_X86_CPU,\
357786
             .property = "legacy-cache",\
357786
             .value    = "on",\
357786
+        },{ /* PC_RHEL7_5_COMPAT from PC_COMPAT_2_12 */ \
357786
+            .driver   = TYPE_X86_CPU,\
357786
+            .property = "topoext",\
357786
+            .value    = "off",\
357786
+        },{ /* PC_RHEL7_5_COMPAT from PC_COMPAT_2_12 */ \
357786
+            .driver   = "EPYC-" TYPE_X86_CPU,\
357786
+            .property = "xlevel",\
357786
+            .value    = stringify(0x8000000a),\
357786
+        },{ /* PC_RHEL7_5_COMPAT from PC_COMPAT_2_12 */ \
357786
+            .driver   = "EPYC-IBPB-" TYPE_X86_CPU,\
357786
+            .property = "xlevel",\
357786
+            .value    = stringify(0x8000000a),\
357786
         },
357786
 
357786
 
357786
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
357786
index ef43ea0..5d5d7e6 100644
357786
--- a/target/i386/cpu.c
357786
+++ b/target/i386/cpu.c
357786
@@ -2562,7 +2562,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
357786
         .features[FEAT_8000_0001_ECX] =
357786
             CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH |
357786
             CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
357786
-            CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
357786
+            CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM |
357786
+            CPUID_EXT3_TOPOEXT,
357786
         .features[FEAT_7_0_EBX] =
357786
             CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 |
357786
             CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED |
357786
@@ -2577,7 +2578,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
357786
             CPUID_XSAVE_XGETBV1,
357786
         .features[FEAT_6_EAX] =
357786
             CPUID_6_EAX_ARAT,
357786
-        .xlevel = 0x8000000A,
357786
+        .xlevel = 0x8000001E,
357786
         .model_id = "AMD EPYC Processor",
357786
         .cache_info = &epyc_cache_info,
357786
     },
357786
@@ -2607,7 +2608,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
357786
         .features[FEAT_8000_0001_ECX] =
357786
             CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH |
357786
             CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
357786
-            CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
357786
+            CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM |
357786
+            CPUID_EXT3_TOPOEXT,
357786
         .features[FEAT_8000_0008_EBX] =
357786
             CPUID_8000_0008_EBX_IBPB,
357786
         .features[FEAT_7_0_EBX] =
357786
@@ -2624,7 +2626,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
357786
             CPUID_XSAVE_XGETBV1,
357786
         .features[FEAT_6_EAX] =
357786
             CPUID_6_EAX_ARAT,
357786
-        .xlevel = 0x8000000A,
357786
+        .xlevel = 0x8000001E,
357786
         .model_id = "AMD EPYC Processor (with IBPB)",
357786
         .cache_info = &epyc_cache_info,
357786
     },
357786
-- 
357786
1.8.3.1
357786