yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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