From: Mahesh Salgaonkar <mah...@linux.vnet.ibm.com>

Print out details about new MCE errors from Power9.

Signed-off-by: Mahesh Salgaonkar <mah...@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/mce.c |   68 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
index 36da14a3..da12992 100644
--- a/arch/powerpc/kernel/mce.c
+++ b/arch/powerpc/kernel/mce.c
@@ -264,6 +264,29 @@ void machine_check_print_event_info(struct 
OpalMachineCheckEvent *evt)
                "Indeterminate",
                "Parity",
                "Multihit",
+               "Tlbiel programming error",
+       };
+       static const char *mc_nest_types[] = {
+               "Ifetch due to foreign link time out",
+               "Instruction tablewalk due to foreign link time out",
+               "Foreign Link Time out for load",
+               "Foreign Link Time out for tablewalk",
+       };
+       static const char *mc_cresp_types[] = {
+               "Real Address error for an ifetch",
+               "Real Address error for an ifetch tablewalk",
+               "Bad real address for a load",
+               "Bad address for load/store tablewalk",
+       };
+       static const char *mc_fspace_types[] = {
+               "Instruction Fetch to foreign address space",
+               "I-side tablewalk host real addr in the foreign address range",
+               "Host real addess to foreign space",
+               "Load/store real address went to a foreign address",
+       };
+       static const char *mc_async_types[] = {
+               "Real address error (CRESP) from store",
+               "Foreign link time out (nest abort) due to a store instruction",
        };
 
        /* Print things out */
@@ -341,6 +364,43 @@ void machine_check_print_event_info(struct 
OpalMachineCheckEvent *evt)
                        printk("%s    Effective address: %016llx\n",
                               level, evt->u.tlb_error.effective_address);
                break;
+       case MCE_ERROR_TYPE_NEST:
+               subtype = evt->u.nest_error.nest_error_type <
+                       ARRAY_SIZE(mc_nest_types) ?
+                       mc_nest_types[evt->u.nest_error.nest_error_type]
+                       : "Unknown";
+               printk("%s  Error type: NEST ABORT [%s]\n", level, subtype);
+               if (evt->u.nest_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.nest_error.effective_address);
+               break;
+       case MCE_ERROR_TYPE_CRESP:
+               subtype = evt->u.cresp_error.cresp_error_type <
+                       ARRAY_SIZE(mc_cresp_types) ?
+                       mc_cresp_types[evt->u.cresp_error.cresp_error_type]
+                       : "Unknown";
+               printk("%s  Error type: CRESP [%s]\n", level, subtype);
+               if (evt->u.cresp_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.cresp_error.effective_address);
+               break;
+       case MCE_ERROR_TYPE_FSPACE:
+               subtype = evt->u.fspace_error.fspace_error_type <
+                       ARRAY_SIZE(mc_fspace_types) ?
+                       mc_fspace_types[evt->u.fspace_error.fspace_error_type]
+                       : "Unknown";
+               printk("%s  Error type: FOREIGN SPACE [%s]\n", level, subtype);
+               if (evt->u.fspace_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.fspace_error.effective_address);
+               break;
+       case MCE_ERROR_TYPE_ASYNC:
+               subtype = evt->u.async_error.async_error_type <
+                       ARRAY_SIZE(mc_async_types) ?
+                       mc_async_types[evt->u.async_error.async_error_type]
+                       : "Unknown";
+               printk("%s  Error type: ASYNC MC [%s]\n", level, subtype);
+               break;
        default:
        case MCE_ERROR_TYPE_UNKNOWN:
                printk("%s  Error type: Unknown\n", level);
@@ -367,6 +427,14 @@ uint64_t get_mce_fault_addr(struct OpalMachineCheckEvent 
*evt)
                if (evt->u.tlb_error.effective_address_provided)
                        return evt->u.tlb_error.effective_address;
                break;
+       case MCE_ERROR_TYPE_NEST:
+               if (evt->u.nest_error.effective_address_provided)
+                       return evt->u.nest_error.effective_address;
+               break;
+       case MCE_ERROR_TYPE_CRESP:
+               if (evt->u.cresp_error.effective_address_provided)
+                       return evt->u.cresp_error.effective_address;
+               break;
        default:
        case MCE_ERROR_TYPE_UNKNOWN:
                break;

Reply via email to