powerpc/fsl_rio: move machine_check handler
authorShaohui Xie <b21989@freescale.com>
Thu, 18 Nov 2010 06:57:32 +0000 (14:57 +0800)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 20 May 2011 13:46:57 +0000 (08:46 -0500)
Add support for machine_check support into machine_check_e500 and
machine_check_e500mc.

Signed-off-by: Shaohui Xie <b21989@freescale.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Roy Zang <tie-fei.zang@freescale.com>
Cc: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/include/asm/rio.h
arch/powerpc/kernel/traps.c
arch/powerpc/sysdev/fsl_rio.c

index 0018bf80cb25d523562a6754cbec75a7eee63688..d902abd3399506cfcacc056645e68f6e5de3f263 100644 (file)
 #define ASM_PPC_RIO_H
 
 extern void platform_rio_init(void);
+#ifdef CONFIG_RAPIDIO
+extern int fsl_rio_mcheck_exception(struct pt_regs *);
+#else
+static inline int fsl_rio_mcheck_exception(struct pt_regs *regs) {return 0; }
+#endif
 
 #endif                         /* ASM_PPC_RIO_H */
index b13306b0d9259ffa27b5d9d906e9ece0e9a42de9..0ff4ab98d50ca713f1c8a983349aa2369fcad22e 100644 (file)
@@ -55,6 +55,7 @@
 #endif
 #include <asm/kexec.h>
 #include <asm/ppc-opcode.h>
+#include <asm/rio.h>
 
 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
 int (*__debugger)(struct pt_regs *regs) __read_mostly;
@@ -424,6 +425,12 @@ int machine_check_e500mc(struct pt_regs *regs)
        unsigned long reason = mcsr;
        int recoverable = 1;
 
+       if (reason & MCSR_BUS_RBERR) {
+               recoverable = fsl_rio_mcheck_exception(regs);
+               if (recoverable == 1)
+                       goto silent_out;
+       }
+
        printk("Machine check in kernel mode.\n");
        printk("Caused by (from MCSR=%lx): ", reason);
 
@@ -499,6 +506,7 @@ int machine_check_e500mc(struct pt_regs *regs)
                       reason & MCSR_MEA ? "Effective" : "Physical", addr);
        }
 
+silent_out:
        mtspr(SPRN_MCSR, mcsr);
        return mfspr(SPRN_MCSR) == 0 && recoverable;
 }
@@ -507,6 +515,11 @@ int machine_check_e500(struct pt_regs *regs)
 {
        unsigned long reason = get_mc_reason(regs);
 
+       if (reason & MCSR_BUS_RBERR) {
+               if (fsl_rio_mcheck_exception(regs))
+                       return 1;
+       }
+
        printk("Machine check in kernel mode.\n");
        printk("Caused by (from MCSR=%lx): ", reason);
 
index 49798532b477b8630c77a203dfb76c62ad3caf46..34440e1bac189750a37ef0feff31723ea97eb696 100644 (file)
@@ -260,9 +260,7 @@ struct rio_priv {
 static void __iomem *rio_regs_win;
 
 #ifdef CONFIG_E500
-static int (*saved_mcheck_exception)(struct pt_regs *regs);
-
-static int fsl_rio_mcheck_exception(struct pt_regs *regs)
+int fsl_rio_mcheck_exception(struct pt_regs *regs)
 {
        const struct exception_table_entry *entry = NULL;
        unsigned long reason = mfspr(SPRN_MCSR);
@@ -284,11 +282,9 @@ static int fsl_rio_mcheck_exception(struct pt_regs *regs)
                }
        }
 
-       if (saved_mcheck_exception)
-               return saved_mcheck_exception(regs);
-       else
-               return cur_cpu_spec->machine_check(regs);
+       return 0;
 }
+EXPORT_SYMBOL_GPL(fsl_rio_mcheck_exception);
 #endif
 
 /**
@@ -1538,11 +1534,6 @@ int fsl_rio_setup(struct platform_device *dev)
        fsl_rio_doorbell_init(port);
        fsl_rio_port_write_init(port);
 
-#ifdef CONFIG_E500
-       saved_mcheck_exception = ppc_md.machine_check_exception;
-       ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
-#endif
-
        return 0;
 err:
        iounmap(priv->regs_win);