aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/ras
diff options
context:
space:
mode:
authorAravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>2015-10-12 05:22:39 -0400
committerIngo Molnar <mingo@kernel.org>2015-10-12 10:15:47 -0400
commita1300e50529795cd605da6a015d4944a18921db0 (patch)
tree22bd772a668beefb4ed234eae7a4bdca6fb54343 /arch/x86/ras
parent85c9306d44f757d2fb3b0e3e399080a025315c7f (diff)
x86/ras/mce_amd_inj: Trigger deferred and thresholding errors interrupts
Add the capability to trigger deferred error interrupts and threshold interrupts in order to test the APIC interrupt handler functionality for these type of errors. Update README section about the same too. Reported by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com> [ Cleanup comments. ] [ Include asm/irq_vectors.h directly so that misc randbuilds don't fail. ] Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/1443190851-2172-3-git-send-email-Aravind.Gopalakrishnan@amd.com Link: http://lkml.kernel.org/r/1444641762-9437-4-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/ras')
-rw-r--r--arch/x86/ras/mce_amd_inj.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/arch/x86/ras/mce_amd_inj.c b/arch/x86/ras/mce_amd_inj.c
index 4fd8bb9b90b9..4d3bafb540c2 100644
--- a/arch/x86/ras/mce_amd_inj.c
+++ b/arch/x86/ras/mce_amd_inj.c
@@ -17,7 +17,9 @@
17#include <linux/cpu.h> 17#include <linux/cpu.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/uaccess.h> 19#include <linux/uaccess.h>
20
20#include <asm/mce.h> 21#include <asm/mce.h>
22#include <asm/irq_vectors.h>
21 23
22#include "../kernel/cpu/mcheck/mce-internal.h" 24#include "../kernel/cpu/mcheck/mce-internal.h"
23 25
@@ -34,12 +36,16 @@ static u8 n_banks;
34enum injection_type { 36enum injection_type {
35 SW_INJ = 0, /* SW injection, simply decode the error */ 37 SW_INJ = 0, /* SW injection, simply decode the error */
36 HW_INJ, /* Trigger a #MC */ 38 HW_INJ, /* Trigger a #MC */
39 DFR_INT_INJ, /* Trigger Deferred error interrupt */
40 THR_INT_INJ, /* Trigger threshold interrupt */
37 N_INJ_TYPES, 41 N_INJ_TYPES,
38}; 42};
39 43
40static const char * const flags_options[] = { 44static const char * const flags_options[] = {
41 [SW_INJ] = "sw", 45 [SW_INJ] = "sw",
42 [HW_INJ] = "hw", 46 [HW_INJ] = "hw",
47 [DFR_INT_INJ] = "df",
48 [THR_INT_INJ] = "th",
43 NULL 49 NULL
44}; 50};
45 51
@@ -182,6 +188,16 @@ static void trigger_mce(void *info)
182 asm volatile("int $18"); 188 asm volatile("int $18");
183} 189}
184 190
191static void trigger_dfr_int(void *info)
192{
193 asm volatile("int %0" :: "i" (DEFERRED_ERROR_VECTOR));
194}
195
196static void trigger_thr_int(void *info)
197{
198 asm volatile("int %0" :: "i" (THRESHOLD_APIC_VECTOR));
199}
200
185static void do_inject(void) 201static void do_inject(void)
186{ 202{
187 u64 mcg_status = 0; 203 u64 mcg_status = 0;
@@ -202,6 +218,16 @@ static void do_inject(void)
202 if (!(i_mce.status & MCI_STATUS_PCC)) 218 if (!(i_mce.status & MCI_STATUS_PCC))
203 mcg_status |= MCG_STATUS_RIPV; 219 mcg_status |= MCG_STATUS_RIPV;
204 220
221 /*
222 * Ensure necessary status bits for deferred errors:
223 * - MCx_STATUS[Deferred]: make sure it is a deferred error
224 * - MCx_STATUS[UC] cleared: deferred errors are _not_ UC
225 */
226 if (inj_type == DFR_INT_INJ) {
227 i_mce.status |= MCI_STATUS_DEFERRED;
228 i_mce.status |= (i_mce.status & ~MCI_STATUS_UC);
229 }
230
205 get_online_cpus(); 231 get_online_cpus();
206 if (!cpu_online(cpu)) 232 if (!cpu_online(cpu))
207 goto err; 233 goto err;
@@ -222,7 +248,16 @@ static void do_inject(void)
222 248
223 toggle_hw_mce_inject(cpu, false); 249 toggle_hw_mce_inject(cpu, false);
224 250
225 smp_call_function_single(cpu, trigger_mce, NULL, 0); 251 switch (inj_type) {
252 case DFR_INT_INJ:
253 smp_call_function_single(cpu, trigger_dfr_int, NULL, 0);
254 break;
255 case THR_INT_INJ:
256 smp_call_function_single(cpu, trigger_thr_int, NULL, 0);
257 break;
258 default:
259 smp_call_function_single(cpu, trigger_mce, NULL, 0);
260 }
226 261
227err: 262err:
228 put_online_cpus(); 263 put_online_cpus();
@@ -287,6 +322,11 @@ static const char readme_msg[] =
287"\t handle the error. Be warned: might cause system panic if MCi_STATUS[PCC] \n" 322"\t handle the error. Be warned: might cause system panic if MCi_STATUS[PCC] \n"
288"\t is set. Therefore, consider setting (debugfs_mountpoint)/mce/fake_panic \n" 323"\t is set. Therefore, consider setting (debugfs_mountpoint)/mce/fake_panic \n"
289"\t before injecting.\n" 324"\t before injecting.\n"
325"\t - \"df\": Trigger APIC interrupt for Deferred error. Causes deferred \n"
326"\t error APIC interrupt handler to handle the error if the feature is \n"
327"\t is present in hardware. \n"
328"\t - \"th\": Trigger APIC interrupt for Threshold errors. Causes threshold \n"
329"\t APIC interrupt handler to handle the error. \n"
290"\n"; 330"\n";
291 331
292static ssize_t 332static ssize_t