Stop instructions before collecting dump
The instructions need to be stopped before attempting to collect
the hostboot dump. This commit calls stop instructions chip-op
on each processor SBE to make sure the instructions are stopped
before collecting the dump.
If some SBEs are not ready to accept the chip-op or timed out
the hostboot dump will not be collected from those SBEs and an
SBE dump will lbe collected in the case of a timeout.
Tests:
Tested hardware dump and hostboot dump successfully
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I0b0ff9e6c6d62187a680395931de0a4dfaff579a
diff --git a/dump/sbe_dump_collector.cpp b/dump/sbe_dump_collector.cpp
index 9e7801c..bdf43c8 100644
--- a/dump/sbe_dump_collector.cpp
+++ b/dump/sbe_dump_collector.cpp
@@ -53,7 +53,16 @@
continue;
}
- targets.push_back(target);
+ bool includeTarget = true;
+ // if the dump type is hostboot then call stop instructions
+ if (type == SBE_DUMP_TYPE_HOSTBOOT)
+ {
+ includeTarget = executeThreadStop(target);
+ }
+ if (includeTarget)
+ {
+ targets.push_back(target);
+ }
}
std::vector<uint8_t> clockStates = {SBE_CLOCK_ON, SBE_CLOCK_OFF};
@@ -289,4 +298,42 @@
}
}
+bool SbeDumpCollector::executeThreadStop(struct pdbg_target* target)
+{
+ try
+ {
+ openpower::phal::sbe::threadStopProc(target);
+ return true;
+ }
+ catch (const openpower::phal::sbeError_t& sbeError)
+ {
+ uint64_t chipPos = pdbg_target_index(target);
+ if (sbeError.errType() ==
+ openpower::phal::exception::SBE_CHIPOP_NOT_ALLOWED)
+ {
+ lg2::info("SBE is not ready to accept chip-op: Skipping "
+ "stop instruction on proc-({POSITION}) error({ERROR}) ",
+ "POSITION", chipPos, "ERROR", sbeError);
+ return false; // Do not include the target for dump collection
+ }
+
+ lg2::error("Stop instructions failed on "
+ "proc-({POSITION}) error({ERROR}) ",
+ "POSITION", chipPos, "ERROR", sbeError);
+
+ logErrorAndCreatePEL(sbeError, chipPos, SBETypes::PROC,
+ SBEFIFO_CMD_CLASS_INSTRUCTION,
+ SBEFIFO_CMD_CONTROL_INSN);
+ // For TIMEOUT, log the error and skip adding the processor for dump
+ // collection
+ if (sbeError.errType() == openpower::phal::exception::SBE_CMD_TIMEOUT)
+ {
+ return false;
+ }
+ }
+ // Include the target for dump collection for SBE_CMD_FAILED or any other
+ // non-critical errors
+ return true;
+}
+
} // namespace openpower::dump::sbe_chipop