Skip to content

Commit 88f66a4

Browse files
committed
x86/mce: Use mce_rdmsrl() in severity checking code
MCA has its own special MSR accessors. Use them. No functional changes. Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ad669ec commit 88f66a4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr)
362362
}
363363

364364
/* MSR access wrappers used for error injection */
365-
static noinstr u64 mce_rdmsrl(u32 msr)
365+
noinstr u64 mce_rdmsrl(u32 msr)
366366
{
367367
DECLARE_ARGS(val, low, high);
368368

arch/x86/kernel/cpu/mce/internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,6 @@ static inline void pentium_machine_check(struct pt_regs *regs) {}
207207
static inline void winchip_machine_check(struct pt_regs *regs) {}
208208
#endif
209209

210+
noinstr u64 mce_rdmsrl(u32 msr);
211+
210212
#endif /* __X86_MCE_INTERNAL_H__ */

arch/x86/kernel/cpu/mce/severity.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ static int error_context(struct mce *m, struct pt_regs *regs)
288288

289289
static int mce_severity_amd_smca(struct mce *m, enum context err_ctx)
290290
{
291-
u32 addr = MSR_AMD64_SMCA_MCx_CONFIG(m->bank);
292-
u32 low, high;
291+
u64 mcx_cfg;
293292

294293
/*
295294
* We need to look at the following bits:
@@ -300,11 +299,10 @@ static int mce_severity_amd_smca(struct mce *m, enum context err_ctx)
300299
if (!mce_flags.succor)
301300
return MCE_PANIC_SEVERITY;
302301

303-
if (rdmsr_safe(addr, &low, &high))
304-
return MCE_PANIC_SEVERITY;
302+
mcx_cfg = mce_rdmsrl(MSR_AMD64_SMCA_MCx_CONFIG(m->bank));
305303

306304
/* TCC (Task context corrupt). If set and if IN_KERNEL, panic. */
307-
if ((low & MCI_CONFIG_MCAX) &&
305+
if ((mcx_cfg & MCI_CONFIG_MCAX) &&
308306
(m->status & MCI_STATUS_TCC) &&
309307
(err_ctx == IN_KERNEL))
310308
return MCE_PANIC_SEVERITY;

0 commit comments

Comments
 (0)