From cb35695328fbc1cb6764f048a8dbb3e81faba1e9 Mon Sep 17 00:00:00 2001 From: Matt Derksen Date: Tue, 15 Jan 2019 10:48:31 -0600 Subject: Inform PHYP of NVDIMM protection by OCC The OCC is responsible for detecting the EPOW signal and triggering the save operation on the NVDIMM. Therefore, if the OCC is not running we are unprotected from a poweroff event. PHYP needs to inform the LPARs using the NV (non-volatile) memory of this state so they can behave accordingly. HBRT is responsible for telling PHYP when we get into this state. There are two ways we can detect this state: a) HBRT explicitly puts the PM complex into reset b) PRD detects a specific FIR bit The message should include this data: - what state we are in (protected or unprotected) - which processor is affected Work for this story will include: - Definition of the new message - Creating a utility function to send the message - Calling utility function to send 'unprotected' message inside of all pm reset paths at runtime Change-Id: Ib015d001d47883a247faedabedb0705ba0f1b215 RTC:201181 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68870 Reviewed-by: Christian R. Geddes Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: TSUNG K. YEUNG Reviewed-by: Roland Veloz Reviewed-by: Daniel M. Crowell --- src/usr/util/runtime/rt_cmds.C | 69 +++++++++++++++++++++++++++++++++- src/usr/util/runtime/rt_fwreq_helper.C | 60 +++++++++++++++++++++++++++-- 2 files changed, 125 insertions(+), 4 deletions(-) (limited to 'src/usr/util') diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C index bab3a85d4..c015215b5 100644 --- a/src/usr/util/runtime/rt_cmds.C +++ b/src/usr/util/runtime/rt_cmds.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,6 +46,9 @@ #include // sendScomOpToFsp, // sendMultiScomReadToFsp, // switchToFspScomAccess +#ifdef CONFIG_NVDIMM +#include // notify NVDIMM protection change +#endif extern char hbi_ImageId; @@ -1153,6 +1156,49 @@ void cmd_sendMultiScomReadToFSP( char* &o_output, } } +#ifdef CONFIG_NVDIMM +void cmd_nvdimm_protection_msg( char* &o_output, uint32_t i_huid, + uint32_t protection ) +{ + errlHndl_t l_err = nullptr; + o_output = new char[500]; + uint8_t l_notifyType = NVDIMM::NOT_PROTECTED; + + TARGETING::Target* l_targ{}; + l_targ = getTargetFromHUID(i_huid); + if (l_targ != NULL) + { + if (protection == 1) + { + l_notifyType = NVDIMM::PROTECTED; + l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::PROTECTED); + } + else if (protection == 2) + { + l_notifyType = NVDIMM::UNPROTECTED_BECAUSE_ERROR; + l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::UNPROTECTED_BECAUSE_ERROR); + } + else + { + l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NOT_PROTECTED); + } + if (l_err) + { + sprintf( o_output, "Error on call to notifyNvdimmProtectionChange" + "(0x%.8X, %d), rc=0x%.8X, plid=0x%.8X", + i_huid, l_notifyType, ERRL_GETRC_SAFE(l_err), l_err->plid() ); + errlCommit(l_err, UTIL_COMP_ID); + return; + } + } + else + { + sprintf( o_output, "cmd_nvdimm_protection_msg: HUID 0x%.8X not found", + i_huid ); + return; + } +} +#endif /** * @brief Execute an arbitrary command inside Hostboot Runtime @@ -1473,6 +1519,22 @@ int hbrtCommand( int argc, "ERROR: multiScomReadToFsp "); } } +#ifdef CONFIG_NVDIMM + else if( !strcmp( argv[0], "nvdimm_protection" ) ) + { + if (argc >= 3) + { + uint32_t huid = strtou64(argv[1], NULL, 16); + uint32_t protection = strtou64( argv[2], NULL, 16); + cmd_nvdimm_protection_msg( *l_output, huid, protection ); + } + else + { + *l_output = new char[100]; + sprintf(*l_output, "ERROR: nvdimm_protection <0 or 1>"); + } + } +#endif else { *l_output = new char[50+100*12]; @@ -1509,6 +1571,11 @@ int hbrtCommand( int argc, strcat( *l_output, l_tmpstr ); sprintf( l_tmpstr, "multiScomReadToFsp \n"); strcat( *l_output, l_tmpstr ); +#ifdef CONFIG_NVDIMM + sprintf( l_tmpstr, "nvdimm_protection <0 or 1>\n"); + strcat( *l_output, l_tmpstr ); +#endif + } if( l_traceOut && (*l_output != NULL) ) diff --git a/src/usr/util/runtime/rt_fwreq_helper.C b/src/usr/util/runtime/rt_fwreq_helper.C index 40a8373e5..f94dab238 100644 --- a/src/usr/util/runtime/rt_fwreq_helper.C +++ b/src/usr/util/runtime/rt_fwreq_helper.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2018 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -250,6 +250,34 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, } break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_SBE_STATE: + case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + { + TRACFCOMP(g_trac_runtime, + ERR_MRK"FSP is doing a reset/reload, " + "Send NVDIMM state to PHYP failed. " + "retry:%d/%d, rc:%d, procId:0x%.8X, " + "state:%d - %s", + i, + HBRT_FW_REQUEST_RETRIES, + rc, + l_req_fw_msg->sbe_state.i_procId, + l_req_fw_msg->sbe_state.i_state, + l_req_fw_msg->sbe_state.i_state? + "protected":"not protected"); + + // Pack user data 1 with Hypervisor return code and + // firmware request message type + l_userData1 = TWO_UINT32_TO_UINT64(rc, + l_req_fw_msg->io_type); + + // Pack user data 2 with processor ID of NVDIMM + // and state of the NVDIMM + l_userData2 = TWO_UINT32_TO_UINT64( + l_req_fw_msg->nvdimm_protection_state.i_procId, + l_req_fw_msg->nvdimm_protection_state.i_state); + } + break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + default: break; } // END switch (l_req_fw_msg->io_type) @@ -270,7 +298,8 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, chipID * @userdata2[32:63] SCOM data (HCODE Update) || Message Type (FSP MSG) || - SBE state + SBE state || + NVDIMM protection * @devdesc The Firmware Request call failed */ l_err = new ErrlEntry(ERRL_SEV_INFORMATIONAL, @@ -439,6 +468,30 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, } break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_SBE_STATE: + case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + { + TRACFCOMP(g_trac_runtime, + ERR_MRK"Failed sending NVDIMM protection state to PHYP." + " rc:0x%X, procId:0x%.8X, state:%d - %s", + rc, + l_req_fw_msg->sbe_state.i_procId, + l_req_fw_msg->sbe_state.i_state, + l_req_fw_msg->sbe_state.i_state? + "protected":"not protected"); + + // Pack user data 1 with Hypervisor return code and + // firmware request message type + l_userData1 = TWO_UINT32_TO_UINT64(rc, + l_req_fw_msg->io_type); + + // Pack user data 2 with processor ID of NVDIMM + // and state of the NVDIMM + l_userData2 = TWO_UINT32_TO_UINT64( + l_req_fw_msg->nvdimm_protection_state.i_procId, + l_req_fw_msg->nvdimm_protection_state.i_state); + } + break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + default: break; } // END switch (l_req_fw_msg->io_type) @@ -459,7 +512,8 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, chipId * @userdata2[32:63] SCOM data (HCODE Update) || Message Type (FSP MSG) || - SBE state + SBE state || + NVDIMM protection state * @devdesc The Firmware Request call failed */ l_err = new ErrlEntry(ERRL_SEV_PREDICTIVE, -- cgit v1.2.3