aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/mce_amd_inj.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2014-11-22 05:22:35 -0500
committerBorislav Petkov <bp@suse.de>2014-11-25 07:09:37 -0500
commit21690934d93408bb7247943f886b960cf30ecd19 (patch)
tree45219ea03c3ef132b3dfda4ec9002d4a3e85d1b2 /drivers/edac/mce_amd_inj.c
parentfd19fcd6324d29c97ba69ac3433e392989af401c (diff)
EDAC, mce_amd_inj: Enable direct writes to MCE MSRs
Normally, writing those causes a #GP but HWCR[McStatusWrEn] controls that. Provide a knob. Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac/mce_amd_inj.c')
-rw-r--r--drivers/edac/mce_amd_inj.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 9b5023d6f553..9b5ca92737a2 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -55,6 +55,30 @@ DEFINE_SIMPLE_ATTRIBUTE(misc_fops, inj_misc_get, inj_misc_set, "%llx\n");
55DEFINE_SIMPLE_ATTRIBUTE(addr_fops, inj_addr_get, inj_addr_set, "%llx\n"); 55DEFINE_SIMPLE_ATTRIBUTE(addr_fops, inj_addr_get, inj_addr_set, "%llx\n");
56 56
57/* 57/*
58 * Caller needs to be make sure this cpu doesn't disappear
59 * from under us, i.e.: get_cpu/put_cpu.
60 */
61static int toggle_hw_mce_inject(unsigned int cpu, bool enable)
62{
63 u32 l, h;
64 int err;
65
66 err = rdmsr_on_cpu(cpu, MSR_K7_HWCR, &l, &h);
67 if (err) {
68 pr_err("%s: error reading HWCR\n", __func__);
69 return err;
70 }
71
72 enable ? (l |= BIT(18)) : (l &= ~BIT(18));
73
74 err = wrmsr_on_cpu(cpu, MSR_K7_HWCR, l, h);
75 if (err)
76 pr_err("%s: error writing HWCR\n", __func__);
77
78 return err;
79}
80
81/*
58 * This denotes into which bank we're injecting and triggers 82 * This denotes into which bank we're injecting and triggers
59 * the injection, at the same time. 83 * the injection, at the same time.
60 */ 84 */