Browse Source

powerpc/64s: allow machine check handler to set severity and initiator

Currently severity and initiator are always set to MCE_SEV_ERROR_SYNC and
MCE_INITIATOR_CPU in the core mce code. Allow them to be set by the
machine specific mce handlers.

No functional change for existing handlers.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Nicholas Piggin 8 years ago
parent
commit
c1bbf387d6
3 changed files with 11 additions and 3 deletions
  1. 2 1
      arch/powerpc/include/asm/mce.h
  2. 3 2
      arch/powerpc/kernel/mce.c
  3. 6 0
      arch/powerpc/kernel/mce_power.c

+ 2 - 1
arch/powerpc/include/asm/mce.h

@@ -177,7 +177,8 @@ struct mce_error_info {
 		enum MCE_EratErrorType erat_error_type:8;
 		enum MCE_EratErrorType erat_error_type:8;
 		enum MCE_TlbErrorType tlb_error_type:8;
 		enum MCE_TlbErrorType tlb_error_type:8;
 	} u;
 	} u;
-	uint8_t		reserved[2];
+	enum MCE_Severity	severity:8;
+	enum MCE_Initiator	initiator:8;
 };
 };
 
 
 #define MAX_MC_EVT	100
 #define MAX_MC_EVT	100

+ 3 - 2
arch/powerpc/kernel/mce.c

@@ -90,13 +90,14 @@ void save_mce_event(struct pt_regs *regs, long handled,
 	mce->gpr3 = regs->gpr[3];
 	mce->gpr3 = regs->gpr[3];
 	mce->in_use = 1;
 	mce->in_use = 1;
 
 
-	mce->initiator = MCE_INITIATOR_CPU;
 	/* Mark it recovered if we have handled it and MSR(RI=1). */
 	/* Mark it recovered if we have handled it and MSR(RI=1). */
 	if (handled && (regs->msr & MSR_RI))
 	if (handled && (regs->msr & MSR_RI))
 		mce->disposition = MCE_DISPOSITION_RECOVERED;
 		mce->disposition = MCE_DISPOSITION_RECOVERED;
 	else
 	else
 		mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
 		mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
-	mce->severity = MCE_SEV_ERROR_SYNC;
+
+	mce->initiator = mce_err->initiator;
+	mce->severity = mce_err->severity;
 
 
 	/*
 	/*
 	 * Populate the mce error_type and type-specific error_type.
 	 * Populate the mce error_type and type-specific error_type.

+ 6 - 0
arch/powerpc/kernel/mce_power.c

@@ -281,6 +281,9 @@ long __machine_check_early_realmode_p7(struct pt_regs *regs)
 	long handled = 1;
 	long handled = 1;
 	struct mce_error_info mce_error_info = { 0 };
 	struct mce_error_info mce_error_info = { 0 };
 
 
+	mce_error_info.severity = MCE_SEV_ERROR_SYNC;
+	mce_error_info.initiator = MCE_INITIATOR_CPU;
+
 	srr1 = regs->msr;
 	srr1 = regs->msr;
 	nip = regs->nip;
 	nip = regs->nip;
 
 
@@ -352,6 +355,9 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs)
 	long handled = 1;
 	long handled = 1;
 	struct mce_error_info mce_error_info = { 0 };
 	struct mce_error_info mce_error_info = { 0 };
 
 
+	mce_error_info.severity = MCE_SEV_ERROR_SYNC;
+	mce_error_info.initiator = MCE_INITIATOR_CPU;
+
 	srr1 = regs->msr;
 	srr1 = regs->msr;
 	nip = regs->nip;
 	nip = regs->nip;