From fbd875d77f30ee9a713625c3f4400cde06e70ac8 Mon Sep 17 00:00:00 2001 From: Vasant Hegde Date: Fri, 12 Jul 2019 16:47:53 +0530 Subject: [PATCH] MPIPL: Save crashing PIR Crashing CPU PIR is required to get proper backtrace from core file. Save crashing CPU PIR before triggering MPIPL. Post MPIPL OPAL will pass saved PIR to kernel and kernel will use that to create OPAL dump. Signed-off-by: Vasant Hegde [oliver: rebased] Signed-off-by: Oliver O'Halloran --- core/opal-dump.c | 7 +++++++ hw/sbe-p9.c | 4 ++++ include/opal-dump.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index 9ca01e5e21fd..bb90c45d0bb9 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -16,6 +16,7 @@ #define pr_fmt(fmt) "DUMP: " fmt +#include #include #include #include @@ -328,6 +329,12 @@ static int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, return rc; } +void opal_mpipl_save_crashing_pir(void) +{ + mpipl_metadata->crashing_pir = this_cpu()->pir; + prlog(PR_NOTICE, "Crashing PIR = 0x%x\n", this_cpu()->pir); +} + void opal_mpipl_init(void) { void *mdst_base = (void *)MDST_TABLE_BASE; diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index a9810a1e83fb..5c63ec1cc91e 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -951,6 +952,9 @@ void p9_sbe_terminate(void) if (!dt_find_by_path(opal_node, "dump")) return; + /* Save crashing CPU details */ + opal_mpipl_save_crashing_pir(); + /* * Send S0 interrupt to all SBE. Sequence: * - S0 interrupt on secondary chip SBE diff --git a/include/opal-dump.h b/include/opal-dump.h index e1153821b9e8..866d11aba855 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -121,4 +121,7 @@ struct mpipl_metadata { /* init opal dump */ extern void opal_mpipl_init(void); +/* Save metadata before triggering MPIPL */ +void opal_mpipl_save_crashing_pir(void); + #endif /* __OPAL_DUMP_H */