From 1379d3210980b4fbe81845b621caa1f2ab913bb5 Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 23 May 2019 23:37:11 +0000 Subject: [PATCH] Add a constant for the LS config MSR on AMD CPUs. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19506 --- sys/amd64/amd64/initcpu.c | 12 ++++++------ sys/x86/include/specialreg.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 5b574faa9544..2de9cc35f3b7 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -124,9 +124,9 @@ init_amd(void) */ if (CPUID_TO_FAMILY(cpu_id) == 0x16 && CPUID_TO_MODEL(cpu_id) <= 0xf) { if ((cpu_feature2 & CPUID2_HV) == 0) { - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= (uint64_t)1 << 15; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); } } @@ -139,9 +139,9 @@ init_amd(void) wrmsr(0xc0011029, msr); /* 1033 */ - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= 0x10; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); /* 1049 */ msr = rdmsr(0xc0011028); @@ -149,9 +149,9 @@ init_amd(void) wrmsr(0xc0011028, msr); /* 1095 */ - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= 0x200000000000000; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); } /* diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index 620979eca24e..f528bad55cff 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -1098,6 +1098,7 @@ #define MSR_VM_HSAVE_PA 0xc0010117 /* SVM: host save area address */ #define MSR_AMD_CPUID07 0xc0011002 /* CPUID 07 %ebx override */ #define MSR_EXTFEATURES 0xc0011005 /* Extended CPUID Features override */ +#define MSR_LS_CFG 0xc0011020 #define MSR_IC_CFG 0xc0011021 /* Instruction Cache Configuration */ /* MSR_VM_CR related */