15 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/string.h>
25 #include <linux/sched.h>
32 static void inject_mce(
struct mce *
m)
50 static void raise_poll(
struct mce *m)
55 memset(&b, 0xff,
sizeof(mce_banks_t));
62 static void raise_exception(
struct mce *m,
struct pt_regs *pregs)
83 static int mce_raise_notify(
unsigned int cmd,
struct pt_regs *
regs)
89 cpumask_clear_cpu(cpu, mce_inject_cpumask);
91 raise_exception(m, regs);
97 static void mce_irq_ipi(
void *
info)
104 cpumask_clear_cpu(cpu, mce_inject_cpumask);
105 raise_exception(m,
NULL);
110 static int raise_local(
void)
128 raise_exception(m,
NULL);
146 static void raise_mce(
struct mce *m)
155 #ifdef CONFIG_X86_LOCAL_APIC
161 cpumask_copy(mce_inject_cpumask, cpu_online_mask);
162 cpumask_clear_cpu(
get_cpu(), mce_inject_cpumask);
167 cpumask_clear_cpu(cpu, mce_inject_cpumask);
169 if (!cpumask_empty(mce_inject_cpumask)) {
177 mce_irq_ipi,
NULL, 0);
184 while (!cpumask_empty(mce_inject_cpumask)) {
187 "Timeout waiting for mce inject %lx\n",
206 static ssize_t mce_write(
struct file *filp,
const char __user *ubuf,
207 size_t usize, loff_t *off)
220 if ((
unsigned long)usize >
sizeof(
struct mce))
221 usize =
sizeof(
struct mce);
240 static int inject_init(
void)
242 if (!alloc_cpumask_var(&mce_inject_cpumask,
GFP_KERNEL))