Skip to content

Commit e6ee94d

Browse files
suryasaimadhuH. Peter Anvin
authored andcommitted
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: Borislav Petkov <bp@suse.de> Link: http://lkml.kernel.org/r/1363788448-31325-6-git-send-email-bp@alien8.de Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1 parent c5b41a6 commit e6ee94d

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎arch/x86/include/asm/cpufeature.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@
225225
#define X86_BUG_F00F X86_BUG(0) /* Intel F00F */
226226
#define X86_BUG_FDIV X86_BUG(1) /* FPU FDIV */
227227
#define X86_BUG_COMA X86_BUG(2) /* Cyrix 6x86 coma */
228+
#define X86_BUG_AMD_TLB_MMATCH X86_BUG(3) /* AMD Erratum 383 */
228229

229230
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
230231

‎arch/x86/include/asm/processor.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,6 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
974974
* AMD errata checking
975975
*/
976976
#ifdef CONFIG_CPU_SUP_AMD
977-
extern const int amd_erratum_383[];
978977
extern const int amd_erratum_400[];
979978
extern bool cpu_has_amd_erratum(const int *);
980979

‎arch/x86/kernel/cpu/amd.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
513513
#endif
514514
}
515515

516+
static const int amd_erratum_383[];
517+
516518
static void __cpuinit init_amd(struct cpuinfo_x86 *c)
517519
{
518520
u32 dummy;
@@ -727,6 +729,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
727729
rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
728730
value &= ~(1ULL << 24);
729731
wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
732+
733+
if (cpu_has_amd_erratum(amd_erratum_383))
734+
set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
730735
}
731736

732737
rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
@@ -863,9 +868,8 @@ const int amd_erratum_400[] =
863868
AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));
864869
EXPORT_SYMBOL_GPL(amd_erratum_400);
865870

866-
const int amd_erratum_383[] =
871+
static const int amd_erratum_383[] =
867872
AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));
868-
EXPORT_SYMBOL_GPL(amd_erratum_383);
869873

870874
bool cpu_has_amd_erratum(const int *erratum)
871875
{

‎arch/x86/kvm/svm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static void svm_init_erratum_383(void)
555555
int err;
556556
u64 val;
557557

558-
if (!cpu_has_amd_erratum(amd_erratum_383))
558+
if (!static_cpu_has_bug(X86_BUG_AMD_TLB_MMATCH))
559559
return;
560560

561561
/* Use _safe variants to not break nested virtualization */

0 commit comments

Comments
 (0)