提交 5781990e 编写于 作者: T Thomas Gleixner 提交者: Lin Wang

x86/mce: Deduplicate exception handling

mainline inclusion
from mainline-v5.16-rc1
commit e42404af
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I590ZC
CVE: NA

Intel-SIG: commit e42404af x86/mce: Deduplicate exception handling.

--------------------------------

Prepare code for further simplification. No functional change.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210908132525.096452100@linutronix.deSigned-off-by: NLin Wang <lin.x.wang@intel.com>
上级 2fea76ad
...@@ -382,13 +382,16 @@ static int msr_to_offset(u32 msr) ...@@ -382,13 +382,16 @@ static int msr_to_offset(u32 msr)
return -1; return -1;
} }
__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup, static void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr)
struct pt_regs *regs, int trapnr,
unsigned long error_code,
unsigned long fault_addr)
{ {
if (wrmsr) {
pr_emerg("MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\n",
(unsigned int)regs->cx, (unsigned int)regs->dx, (unsigned int)regs->ax,
regs->ip, (void *)regs->ip);
} else {
pr_emerg("MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\n", pr_emerg("MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\n",
(unsigned int)regs->cx, regs->ip, (void *)regs->ip); (unsigned int)regs->cx, regs->ip, (void *)regs->ip);
}
show_stack_regs(regs); show_stack_regs(regs);
...@@ -396,7 +399,14 @@ __visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup, ...@@ -396,7 +399,14 @@ __visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup,
while (true) while (true)
cpu_relax(); cpu_relax();
}
__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup,
struct pt_regs *regs, int trapnr,
unsigned long error_code,
unsigned long fault_addr)
{
ex_handler_msr_mce(regs, false);
return true; return true;
} }
...@@ -441,17 +451,7 @@ __visible bool ex_handler_wrmsr_fault(const struct exception_table_entry *fixup, ...@@ -441,17 +451,7 @@ __visible bool ex_handler_wrmsr_fault(const struct exception_table_entry *fixup,
unsigned long error_code, unsigned long error_code,
unsigned long fault_addr) unsigned long fault_addr)
{ {
pr_emerg("MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\n", ex_handler_msr_mce(regs, true);
(unsigned int)regs->cx, (unsigned int)regs->dx, (unsigned int)regs->ax,
regs->ip, (void *)regs->ip);
show_stack_regs(regs);
panic("MCA architectural violation!\n");
while (true)
cpu_relax();
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册