diff options
author | Ilya Smirnov <ismirno@us.ibm.com> | 2018-06-25 16:06:36 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2018-06-30 01:48:58 -0400 |
commit | d875133a8d13b69960eee85b69de8b238c4edf5d (patch) | |
tree | 2c0d1e794d771ea00c45a40e5283929cb9700bfb /src/kernel | |
parent | cb3442b8f94fd08ce764ad0a1ee97b3cbf90ed65 (diff) | |
download | blackbird-hostboot-d875133a8d13b69960eee85b69de8b238c4edf5d.tar.gz blackbird-hostboot-d875133a8d13b69960eee85b69de8b238c4edf5d.zip |
Pre-set HB TI Area in doStutdown Path
When a TI occurs during ECC corruption, the kernel asserts as part
of the error flow, and the assert makes it into the TI area before
the ECC error code, which makes it hard to debug the underlying
issue. This change introduces the logging of the TI code to the
HB TI area as part of the doShutdown path and a mechanism to not
overwrite the first logged error code. That way the TI area will
always contain the first error code that caused the TI.
Change-Id: Idcd5727314aea9b92a6eb9d19ec6ed223111861a
CQ:SW431570
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61661
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/kernel.C | 3 | ||||
-rw-r--r-- | src/kernel/makefile | 2 | ||||
-rw-r--r-- | src/kernel/terminate.C | 60 |
3 files changed, 46 insertions, 19 deletions
diff --git a/src/kernel/kernel.C b/src/kernel/kernel.C index da9470546..866170679 100644 --- a/src/kernel/kernel.C +++ b/src/kernel/kernel.C @@ -44,6 +44,7 @@ #include <usr/debugpointers.H> #include <kernel/segmentmgr.H> #include <kernel/block.H> +#include <kernel/terminate.H> #include <stdlib.h> @@ -111,6 +112,8 @@ int main() static_cast<uint64_t>(getPIR())); MAGIC_INST_PRINT_ISTEP(6,2); + initKernelTIMutex(); + // Erase task-pointer so that TaskManager::getCurrentTask() returns NULL. setSPRG3(NULL); diff --git a/src/kernel/makefile b/src/kernel/makefile index 004dfbe74..211a8b10e 100644 --- a/src/kernel/makefile +++ b/src/kernel/makefile @@ -69,5 +69,7 @@ OBJS += workitem.o OBJS += bltohbdatamgr.o +EXTRAINCDIR += ${ROOTPATH}/src/include + include ${ROOTPATH}/config.mk diff --git a/src/kernel/terminate.C b/src/kernel/terminate.C index 6158b3c49..cb70e9be6 100644 --- a/src/kernel/terminate.C +++ b/src/kernel/terminate.C @@ -26,6 +26,7 @@ #include <kernel/hbdescriptor.H> #include <kernel/hbterminatetypes.H> #include <kernel/terminate.H> +#include <sys/sync.h> #ifndef BOOTLOADER #include <stdint.h> #include <kernel/console.H> @@ -37,10 +38,11 @@ extern "C" void p9_force_attn() NO_RETURN; - #ifndef BOOTLOADER +mutex_t g_kernelMutex; + /* Instance of the TI Data Area */ -HB_TI_DataArea kernel_TIDataArea; +HB_TI_DataArea kernel_TIDataArea = {}; /* Instance of the HB descriptor struct */ HB_Descriptor kernel_hbDescriptor = @@ -58,6 +60,13 @@ void terminateExecuteTI() p9_force_attn(); } +void initKernelTIMutex() +{ +#ifndef BOOTLOADER + mutex_init(&g_kernelMutex); +#endif +} + #ifndef BOOTLOADER void termWritePlid(uint16_t i_source, uint32_t plid) { @@ -68,24 +77,37 @@ void termWritePlid(uint16_t i_source, uint32_t plid) #endif // BOOTLOADER void termWriteSRC(uint16_t i_source, uint16_t i_reasoncode,uint64_t i_failAddr, - uint32_t i_error_data) + uint32_t i_error_data, bool i_forceWrite) { - // Update the TI structure with the type of TI, who called, - // and extra error data (if applicable, otherwise 0) - kernel_TIDataArea.type = TI_WITH_SRC; - kernel_TIDataArea.source = i_source; - kernel_TIDataArea.error_data = i_error_data; - - // Update TID data area with the SRC info we have avail - kernel_TIDataArea.src.ID = 0xBC; - kernel_TIDataArea.src.subsystem = 0x8A; - kernel_TIDataArea.src.reasoncode = i_reasoncode; - kernel_TIDataArea.src.moduleID = 0; - kernel_TIDataArea.src.iType = TI_WITH_SRC; - kernel_TIDataArea.src.iSource = i_source; - - // Update User Data with address of fail location - kernel_TIDataArea.src.word6 = i_failAddr; +#ifndef BOOTLOADER + mutex_lock(&g_kernelMutex); +#endif + // If this is the first TI on the system or if i_forceWrite is true, then + // overwrite the HB TI area with the given info. Unless i_forceWrite is + // true, all subsequent TI codes will NOT overwrite the original TI + // information. + if(kernel_TIDataArea.src.reasoncode == NO_TI_ERROR || i_forceWrite) + { + // Update the TI structure with the type of TI, who called, + // and extra error data (if applicable, otherwise 0) + kernel_TIDataArea.type = TI_WITH_SRC; + kernel_TIDataArea.source = i_source; + kernel_TIDataArea.error_data = i_error_data; + + // Update TID data area with the SRC info we have avail + kernel_TIDataArea.src.ID = 0xBC; + kernel_TIDataArea.src.subsystem = 0x8A; + kernel_TIDataArea.src.reasoncode = i_reasoncode; + kernel_TIDataArea.src.moduleID = 0; + kernel_TIDataArea.src.iType = TI_WITH_SRC; + kernel_TIDataArea.src.iSource = i_source; + + // Update User Data with address of fail location + kernel_TIDataArea.src.word6 = i_failAddr; + } +#ifndef BOOTLOADER + mutex_unlock(&g_kernelMutex); +#endif } void termModifySRC(uint8_t i_moduleID, uint32_t i_word7, uint32_t i_word8) |