提交 e6ee94d5 编写于 作者: B Borislav Petkov 提交者: H. Peter Anvin

x86, cpu: Convert AMD Erratum 383

Convert the AMD erratum 383 testing code to the bug infrastructure. This
allows keeping the AMD-specific erratum testing machinery private to
amd.c and not export symbols to modules needlessly.
Signed-off-by: NBorislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1363788448-31325-6-git-send-email-bp@alien8.deSigned-off-by: NH. Peter Anvin <hpa@zytor.com>
上级 c5b41a67
...@@ -225,6 +225,7 @@ ...@@ -225,6 +225,7 @@
#define X86_BUG_F00F X86_BUG(0) /* Intel F00F */ #define X86_BUG_F00F X86_BUG(0) /* Intel F00F */
#define X86_BUG_FDIV X86_BUG(1) /* FPU FDIV */ #define X86_BUG_FDIV X86_BUG(1) /* FPU FDIV */
#define X86_BUG_COMA X86_BUG(2) /* Cyrix 6x86 coma */ #define X86_BUG_COMA X86_BUG(2) /* Cyrix 6x86 coma */
#define X86_BUG_AMD_TLB_MMATCH X86_BUG(3) /* AMD Erratum 383 */
#if defined(__KERNEL__) && !defined(__ASSEMBLY__) #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
......
...@@ -974,7 +974,6 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old, ...@@ -974,7 +974,6 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
* AMD errata checking * AMD errata checking
*/ */
#ifdef CONFIG_CPU_SUP_AMD #ifdef CONFIG_CPU_SUP_AMD
extern const int amd_erratum_383[];
extern const int amd_erratum_400[]; extern const int amd_erratum_400[];
extern bool cpu_has_amd_erratum(const int *); extern bool cpu_has_amd_erratum(const int *);
......
...@@ -513,6 +513,8 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) ...@@ -513,6 +513,8 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
#endif #endif
} }
static const int amd_erratum_383[];
static void __cpuinit init_amd(struct cpuinfo_x86 *c) static void __cpuinit init_amd(struct cpuinfo_x86 *c)
{ {
u32 dummy; u32 dummy;
...@@ -727,6 +729,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) ...@@ -727,6 +729,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
rdmsrl_safe(MSR_AMD64_BU_CFG2, &value); rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
value &= ~(1ULL << 24); value &= ~(1ULL << 24);
wrmsrl_safe(MSR_AMD64_BU_CFG2, value); wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
if (cpu_has_amd_erratum(amd_erratum_383))
set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
} }
rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy); rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
...@@ -863,9 +868,8 @@ const int amd_erratum_400[] = ...@@ -863,9 +868,8 @@ const int amd_erratum_400[] =
AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf)); AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));
EXPORT_SYMBOL_GPL(amd_erratum_400); EXPORT_SYMBOL_GPL(amd_erratum_400);
const int amd_erratum_383[] = static const int amd_erratum_383[] =
AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf)); AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));
EXPORT_SYMBOL_GPL(amd_erratum_383);
bool cpu_has_amd_erratum(const int *erratum) bool cpu_has_amd_erratum(const int *erratum)
{ {
......
...@@ -555,7 +555,7 @@ static void svm_init_erratum_383(void) ...@@ -555,7 +555,7 @@ static void svm_init_erratum_383(void)
int err; int err;
u64 val; u64 val;
if (!cpu_has_amd_erratum(amd_erratum_383)) if (!static_cpu_has_bug(X86_BUG_AMD_TLB_MMATCH))
return; return;
/* Use _safe variants to not break nested virtualization */ /* Use _safe variants to not break nested virtualization */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册