x86/cpu: Add Erratum 88 detection on AMD
Erratum 88 affects old AMD K8s, where a SWAPGS fails to cause an input dependency on GS. Therefore, we need to MFENCE before it. But that MFENCE is expensive and unnecessary on the remaining x86 CPUs out there so patch it out on the CPUs which don't require it. Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Andy Lutomirski <luto@kernel.org Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/aec6b2df1bfc56101d4e9e2e5d5d570bf41663c6.1460075211.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
0230bb038f
commit
96e5d28ae7
|
@ -783,7 +783,7 @@ ENTRY(native_load_gs_index)
|
||||||
SWAPGS
|
SWAPGS
|
||||||
gs_change:
|
gs_change:
|
||||||
movl %edi, %gs
|
movl %edi, %gs
|
||||||
2: mfence /* workaround */
|
2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
|
||||||
SWAPGS
|
SWAPGS
|
||||||
popfq
|
popfq
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -295,6 +295,8 @@
|
||||||
#define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
|
#define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
|
||||||
#define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
|
#define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
|
||||||
#define X86_BUG_NULL_SEG X86_BUG(9) /* Nulling a selector preserves the base */
|
#define X86_BUG_NULL_SEG X86_BUG(9) /* Nulling a selector preserves the base */
|
||||||
|
#define X86_BUG_SWAPGS_FENCE X86_BUG(10) /* SWAPGS without input dep on GS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -632,6 +632,7 @@ static void init_amd_k8(struct cpuinfo_x86 *c)
|
||||||
*/
|
*/
|
||||||
msr_set_bit(MSR_K7_HWCR, 6);
|
msr_set_bit(MSR_K7_HWCR, 6);
|
||||||
#endif
|
#endif
|
||||||
|
set_cpu_bug(c, X86_BUG_SWAPGS_FENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_amd_gh(struct cpuinfo_x86 *c)
|
static void init_amd_gh(struct cpuinfo_x86 *c)
|
||||||
|
|
Loading…
Reference in New Issue