]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/powerpc/kernel/traps.c
powerpc/traps: machine_check_generic() is only used on 32-bit
[mirror_ubuntu-bionic-kernel.git] / arch / powerpc / kernel / traps.c
index bfcfd9ef09f20a3980f544373616e6ceba3de88c..ef957c28bbc4163fc3d32694492b41ecc8318e21 100644 (file)
@@ -288,6 +288,8 @@ void system_reset_exception(struct pt_regs *regs)
        if (!nested)
                nmi_enter();
 
+       __this_cpu_inc(irq_stat.sreset_irqs);
+
        /* See if any machine dependent calls */
        if (ppc_md.system_reset_exception) {
                if (ppc_md.system_reset_exception(regs))
@@ -397,11 +399,6 @@ static inline int check_io_access(struct pt_regs *regs)
 /* On 4xx, the reason for the machine check or program exception
    is in the ESR. */
 #define get_reason(regs)       ((regs)->dsisr)
-#ifndef CONFIG_FSL_BOOKE
-#define get_mc_reason(regs)    ((regs)->dsisr)
-#else
-#define get_mc_reason(regs)    (mfspr(SPRN_MCSR))
-#endif
 #define REASON_FP              ESR_FP
 #define REASON_ILLEGAL         (ESR_PIL | ESR_PUO)
 #define REASON_PRIVILEGED      ESR_PPR
@@ -415,7 +412,6 @@ static inline int check_io_access(struct pt_regs *regs)
 /* On non-4xx, the reason for the machine check or program
    exception is in the MSR. */
 #define get_reason(regs)       ((regs)->msr)
-#define get_mc_reason(regs)    ((regs)->msr)
 #define REASON_TM              0x200000
 #define REASON_FP              0x100000
 #define REASON_ILLEGAL         0x80000
@@ -426,97 +422,7 @@ static inline int check_io_access(struct pt_regs *regs)
 #define clear_single_step(regs)        ((regs)->msr &= ~MSR_SE)
 #endif
 
-#if defined(CONFIG_4xx)
-int machine_check_4xx(struct pt_regs *regs)
-{
-       unsigned long reason = get_mc_reason(regs);
-
-       if (reason & ESR_IMCP) {
-               printk("Instruction");
-               mtspr(SPRN_ESR, reason & ~ESR_IMCP);
-       } else
-               printk("Data");
-       printk(" machine check in kernel mode.\n");
-
-       return 0;
-}
-
-int machine_check_440A(struct pt_regs *regs)
-{
-       unsigned long reason = get_mc_reason(regs);
-
-       printk("Machine check in kernel mode.\n");
-       if (reason & ESR_IMCP){
-               printk("Instruction Synchronous Machine Check exception\n");
-               mtspr(SPRN_ESR, reason & ~ESR_IMCP);
-       }
-       else {
-               u32 mcsr = mfspr(SPRN_MCSR);
-               if (mcsr & MCSR_IB)
-                       printk("Instruction Read PLB Error\n");
-               if (mcsr & MCSR_DRB)
-                       printk("Data Read PLB Error\n");
-               if (mcsr & MCSR_DWB)
-                       printk("Data Write PLB Error\n");
-               if (mcsr & MCSR_TLBP)
-                       printk("TLB Parity Error\n");
-               if (mcsr & MCSR_ICP){
-                       flush_instruction_cache();
-                       printk("I-Cache Parity Error\n");
-               }
-               if (mcsr & MCSR_DCSP)
-                       printk("D-Cache Search Parity Error\n");
-               if (mcsr & MCSR_DCFP)
-                       printk("D-Cache Flush Parity Error\n");
-               if (mcsr & MCSR_IMPE)
-                       printk("Machine Check exception is imprecise\n");
-
-               /* Clear MCSR */
-               mtspr(SPRN_MCSR, mcsr);
-       }
-       return 0;
-}
-
-int machine_check_47x(struct pt_regs *regs)
-{
-       unsigned long reason = get_mc_reason(regs);
-       u32 mcsr;
-
-       printk(KERN_ERR "Machine check in kernel mode.\n");
-       if (reason & ESR_IMCP) {
-               printk(KERN_ERR
-                      "Instruction Synchronous Machine Check exception\n");
-               mtspr(SPRN_ESR, reason & ~ESR_IMCP);
-               return 0;
-       }
-       mcsr = mfspr(SPRN_MCSR);
-       if (mcsr & MCSR_IB)
-               printk(KERN_ERR "Instruction Read PLB Error\n");
-       if (mcsr & MCSR_DRB)
-               printk(KERN_ERR "Data Read PLB Error\n");
-       if (mcsr & MCSR_DWB)
-               printk(KERN_ERR "Data Write PLB Error\n");
-       if (mcsr & MCSR_TLBP)
-               printk(KERN_ERR "TLB Parity Error\n");
-       if (mcsr & MCSR_ICP) {
-               flush_instruction_cache();
-               printk(KERN_ERR "I-Cache Parity Error\n");
-       }
-       if (mcsr & MCSR_DCSP)
-               printk(KERN_ERR "D-Cache Search Parity Error\n");
-       if (mcsr & PPC47x_MCSR_GPR)
-               printk(KERN_ERR "GPR Parity Error\n");
-       if (mcsr & PPC47x_MCSR_FPR)
-               printk(KERN_ERR "FPR Parity Error\n");
-       if (mcsr & PPC47x_MCSR_IPR)
-               printk(KERN_ERR "Machine Check exception is imprecise\n");
-
-       /* Clear MCSR */
-       mtspr(SPRN_MCSR, mcsr);
-
-       return 0;
-}
-#elif defined(CONFIG_E500)
+#if defined(CONFIG_E500)
 int machine_check_e500mc(struct pt_regs *regs)
 {
        unsigned long mcsr = mfspr(SPRN_MCSR);
@@ -618,7 +524,7 @@ silent_out:
 
 int machine_check_e500(struct pt_regs *regs)
 {
-       unsigned long reason = get_mc_reason(regs);
+       unsigned long reason = mfspr(SPRN_MCSR);
 
        if (reason & MCSR_BUS_RBERR) {
                if (fsl_rio_mcheck_exception(regs))
@@ -665,7 +571,7 @@ int machine_check_generic(struct pt_regs *regs)
 #elif defined(CONFIG_E200)
 int machine_check_e200(struct pt_regs *regs)
 {
-       unsigned long reason = get_mc_reason(regs);
+       unsigned long reason = mfspr(SPRN_MCSR);
 
        printk("Machine check in kernel mode.\n");
        printk("Caused by (from MCSR=%lx): ", reason);
@@ -690,7 +596,7 @@ int machine_check_e200(struct pt_regs *regs)
 #elif defined(CONFIG_PPC_8xx)
 int machine_check_8xx(struct pt_regs *regs)
 {
-       unsigned long reason = get_mc_reason(regs);
+       unsigned long reason = regs->msr;
 
        pr_err("Machine check in kernel mode.\n");
        pr_err("Caused by (from SRR1=%lx): ", reason);
@@ -712,10 +618,10 @@ int machine_check_8xx(struct pt_regs *regs)
        return 0;
 #endif
 }
-#else
+#elif defined(CONFIG_PPC32)
 int machine_check_generic(struct pt_regs *regs)
 {
-       unsigned long reason = get_mc_reason(regs);
+       unsigned long reason = regs->msr;
 
        printk("Machine check in kernel mode.\n");
        printk("Caused by (from SRR1=%lx): ", reason);
@@ -755,7 +661,9 @@ void machine_check_exception(struct pt_regs *regs)
        enum ctx_state prev_state = exception_enter();
        int recover = 0;
 
-       __this_cpu_inc(irq_stat.mce_exceptions);
+       /* 64s accounts the mce in machine_check_early when in HVMODE */
+       if (!IS_ENABLED(CONFIG_PPC_BOOK3S_64) || !cpu_has_feature(CPU_FTR_HVMODE))
+               __this_cpu_inc(irq_stat.mce_exceptions);
 
        add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);