mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
x86/CPU/AMD: Always inline amd_clear_divider()
The routine is used on syscall exit and on non-AMD CPUs is guaranteed to be empty. It probably does not need to be a function call even on CPUs which do need the mitigation. [ bp: Make sure it is always inlined so that noinstr marking works. ] Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240613082637.659133-1-mjguzik@gmail.com
This commit is contained in:
parent
eb9d3c0bb0
commit
501bd734f9
@ -692,7 +692,17 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu)
|
||||
|
||||
#ifdef CONFIG_CPU_SUP_AMD
|
||||
extern u32 amd_get_highest_perf(void);
|
||||
extern void amd_clear_divider(void);
|
||||
|
||||
/*
|
||||
* Issue a DIV 0/1 insn to clear any division data from previous DIV
|
||||
* operations.
|
||||
*/
|
||||
static __always_inline void amd_clear_divider(void)
|
||||
{
|
||||
asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0)
|
||||
:: "a" (0), "d" (0), "r" (1));
|
||||
}
|
||||
|
||||
extern void amd_check_microcode(void);
|
||||
#else
|
||||
static inline u32 amd_get_highest_perf(void) { return 0; }
|
||||
|
@ -1220,14 +1220,3 @@ void amd_check_microcode(void)
|
||||
|
||||
on_each_cpu(zenbleed_check_cpu, NULL, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Issue a DIV 0/1 insn to clear any division data from previous DIV
|
||||
* operations.
|
||||
*/
|
||||
void noinstr amd_clear_divider(void)
|
||||
{
|
||||
asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0)
|
||||
:: "a" (0), "d" (0), "r" (1));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(amd_clear_divider);
|
||||
|
Loading…
Reference in New Issue
Block a user