aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/mce_amd_inj.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2014-11-22 05:35:26 -0500
committerBorislav Petkov <bp@suse.de>2014-11-25 07:09:42 -0500
commitb18f3864bfb4ef2af0e25b6ed5e1292f2ac36878 (patch)
treeaf5cbfd24c8e6dcfae31c6a6046ff645138ce6cb /drivers/edac/mce_amd_inj.c
parent21690934d93408bb7247943f886b960cf30ecd19 (diff)
EDAC, mce_amd_inj: Add hw-injection attributes
Expose struct mce->inject_flags. 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.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 9b5ca92737a2..5a758d63a8cc 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -78,6 +78,44 @@ static int toggle_hw_mce_inject(unsigned int cpu, bool enable)
78 return err; 78 return err;
79} 79}
80 80
81static int flags_get(void *data, u64 *val)
82{
83 struct mce *m = (struct mce *)data;
84
85 *val = m->inject_flags;
86
87 return 0;
88}
89
90static int flags_set(void *data, u64 val)
91{
92 struct mce *m = (struct mce *)data;
93
94 m->inject_flags = (u8)val;
95 return 0;
96}
97
98DEFINE_SIMPLE_ATTRIBUTE(flags_fops, flags_get, flags_set, "%llu\n");
99
100/*
101 * On which CPU to inject?
102 */
103MCE_INJECT_GET(extcpu);
104
105static int inj_extcpu_set(void *data, u64 val)
106{
107 struct mce *m = (struct mce *)data;
108
109 if (val >= nr_cpu_ids || !cpu_online(val)) {
110 pr_err("%s: Invalid CPU: %llu\n", __func__, val);
111 return -EINVAL;
112 }
113 m->extcpu = val;
114 return 0;
115}
116
117DEFINE_SIMPLE_ATTRIBUTE(extcpu_fops, inj_extcpu_get, inj_extcpu_set, "%llu\n");
118
81/* 119/*
82 * This denotes into which bank we're injecting and triggers 120 * This denotes into which bank we're injecting and triggers
83 * the injection, at the same time. 121 * the injection, at the same time.
@@ -119,6 +157,8 @@ struct dfs_node {
119 { .name = "misc", .fops = &misc_fops }, 157 { .name = "misc", .fops = &misc_fops },
120 { .name = "addr", .fops = &addr_fops }, 158 { .name = "addr", .fops = &addr_fops },
121 { .name = "bank", .fops = &bank_fops }, 159 { .name = "bank", .fops = &bank_fops },
160 { .name = "flags", .fops = &flags_fops },
161 { .name = "cpu", .fops = &extcpu_fops },
122}; 162};
123 163
124static int __init init_mce_inject(void) 164static int __init init_mce_inject(void)