diff options
author | Roland Veloz <rveloz@us.ibm.com> | 2019-07-18 02:37:26 -0500 |
---|---|---|
committer | Daniel M Crowell <dcrowell@us.ibm.com> | 2019-07-31 16:13:03 -0500 |
commit | eafe3e3d5719c9becb864f60daa525f8ce2c38c0 (patch) | |
tree | 98be7950a9d14637fe6d1202a7727ba965c96b77 /src/usr/util/runtime/rt_fwnotify.C | |
parent | f088a0dc26ed66496d593af1c0c291ac44f4cb4f (diff) | |
download | talos-hostboot-eafe3e3d5719c9becb864f60daa525f8ce2c38c0.tar.gz talos-hostboot-eafe3e3d5719c9becb864f60daa525f8ce2c38c0.zip |
Added support for checking on the health status of an NVDIMM
* The check for the health status piggy backs off the current
NVDIMM operation interface.
* Added the method doNvDimmCheckHealthStatus to perform the
health check status of the individual NVDIMMs.
* Added wrapper methods nvDimmCheckHealthStatusOnSystem and
nvdimmCheckHealthStatus that call the doNvDimmCheckHealthStatus
* Added an interface in the runtime commands to call make
the check health status call.
Change-Id: Iefa1fcf5cb6a13c496fd776cdc34ade58ae0612b
CQ:SW469962
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/80589
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: Corey V Swenson <cswenson@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/util/runtime/rt_fwnotify.C')
-rw-r--r-- | src/usr/util/runtime/rt_fwnotify.C | 202 |
1 files changed, 117 insertions, 85 deletions
diff --git a/src/usr/util/runtime/rt_fwnotify.C b/src/usr/util/runtime/rt_fwnotify.C index 5b02584c6..252876524 100644 --- a/src/usr/util/runtime/rt_fwnotify.C +++ b/src/usr/util/runtime/rt_fwnotify.C @@ -396,7 +396,7 @@ void set_ATTR_NVDIMM_ENCRYPTION_ENABLE( *@errortype *@reasoncode RC_CANNOT_MAKE_ATTRIBUTE *@severity ERRORLOG_SEV_PREDICTIVE - *@moduleid SET_ATTR_NVDIMM_ENCRYPTION_ENABLE + *@moduleid SET_ATTR_NVDIMM_ENCRYPTION_ENABLE *@devdesc Couldn't create an Attribute to send the data * to the FSP *@custdesc NVDIMM encryption error @@ -427,16 +427,18 @@ void set_ATTR_NVDIMM_ENCRYPTION_ENABLE( /** * @brief Perform an NVDIMM operation - * @param[in] nvDimmOp - A struct that contains the operation(s) to perform - * and a flag indicating whether to perform operation - * on all processors or a given single processor. - * @Note The operations below are in the order of which they should be - * performed. If a new operation is added, make sure it inserted in the + * @param[in] i_nvDimmOp - A struct that contains the operation(s) to perform + * and a flag indicating whether to perform operation + * on all processors or a given single processor. + * + * @Note The arming/disarming operations below are in the order of which they + * should be performed. If a new sequence is added to the + * arming/disarming sequence, make sure it is inserted in the * correct order. * The current order is: disarm -> disable encryption -> remove keys -> * enable encryption -> arm **/ -void doNvDimmOperation(const hostInterfaces::nvdimm_operation_t& nvDimmOp) +void doNvDimmOperation(const hostInterfaces::nvdimm_operation_t& i_nvDimmOp) { #ifndef CONFIG_NVDIMM TRACFCOMP(g_trac_runtime, ENTER_MRK"doNvDimmOperation: not an " @@ -445,20 +447,21 @@ void doNvDimmOperation(const hostInterfaces::nvdimm_operation_t& nvDimmOp) #else TRACFCOMP(g_trac_runtime, ENTER_MRK"doNvDimmOperation: Operation(s) " "0x%0X, processor ID 0x%0X", - nvDimmOp.opType, - nvDimmOp.procId); + i_nvDimmOp.opType, + i_nvDimmOp.procId); // Error log handle for capturing any errors errlHndl_t l_err{nullptr}; // List of NVDIMM Targets to execute NVDIMM operation on TargetHandleList l_nvDimmTargetList; + // Perform the operations requested do { /// Populate the NVDIMM target list // If requesting to perform operation on all NVDIMMs, then // retrieve all NVDIMMs from system - if (HBRT_NVDIMM_OPERATION_APPLY_TO_ALL_NVDIMMS == nvDimmOp.procId) + if (HBRT_NVDIMM_OPERATION_APPLY_TO_ALL_NVDIMMS == i_nvDimmOp.procId) { nvdimm_getNvdimmList(l_nvDimmTargetList); } @@ -468,13 +471,13 @@ void doNvDimmOperation(const hostInterfaces::nvdimm_operation_t& nvDimmOp) /// Get the NVDIMMs associated with procId // Convert the procId to a real boy, uh, I mean target TARGETING::TargetHandle_t l_procTarget; - l_err = RT_TARG::getHbTarget(nvDimmOp.procId, l_procTarget); + l_err = RT_TARG::getHbTarget(i_nvDimmOp.procId, l_procTarget); if (l_err) { TRACFCOMP(g_trac_runtime, "doNvDimmOperation: Error getting " "HB Target from processor ID 0x%0X, " "exiting ...", - nvDimmOp.procId); + i_nvDimmOp.procId); break; } @@ -491,113 +494,142 @@ void doNvDimmOperation(const hostInterfaces::nvdimm_operation_t& nvDimmOp) break; } - /// Perform the operation(s) requested - // Disarm the NV logic - if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_DISARM) + // Perform the arming/disarming operations. If anyone fails in the + // sequence, no point in calling the next, if there is a next operation. + do { - // Make call to disarm - if (!nvdimmDisarm(l_nvDimmTargetList)) + // Disarm the NV logic + if (i_nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_DISARM) { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to disarm failed, exiting ..."); - break; - } - else - { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to disarm succeeded"); + // Make call to disarm + if (!nvdimmDisarm(l_nvDimmTargetList)) + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to disarm failed. Will not perform any " + "more arming/disarming calls, if they exist"); + break; + } + else + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to disarm succeeded"); + } } - } - // Disable encryption on the NVDIMM and clear saved values from FW - if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_DISABLE_ENCRYPTION) - { - // Make call to disable encryption - if (!nvdimm_crypto_erase(l_nvDimmTargetList)) + // Disable encryption on the NVDIMM and clear saved values from FW + if (i_nvDimmOp.opType & + hostInterfaces::HBRT_FW_NVDIMM_DISABLE_ENCRYPTION) { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to disable encryption failed, exiting ..."); + // Make call to disable encryption + if (!nvdimm_crypto_erase(l_nvDimmTargetList)) + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to disable encryption failed. Will not " + "perform any more arming/disarming calls, if " + "they exist"); - // Clear the encryption enable attribute - set_ATTR_NVDIMM_ENCRYPTION_ENABLE(0); + // Clear the encryption enable attribute + set_ATTR_NVDIMM_ENCRYPTION_ENABLE(0); - break; - } - else - { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + break; + } + else + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " "Call to disable encryption succeeded."); - } - - // Clear the encryption enable attribute - set_ATTR_NVDIMM_ENCRYPTION_ENABLE(0); - } + } - // Remove keys - if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_REMOVE_KEYS) - { - // Make call to remove keys - if (!nvdimm_remove_keys()) - { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to remove keys failed, exiting ..."); - break; + // Clear the encryption enable attribute + set_ATTR_NVDIMM_ENCRYPTION_ENABLE(0); } - else + + // Remove keys + if (i_nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_REMOVE_KEYS) { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to remove keys succeeded."); + // Make call to remove keys + if (!nvdimm_remove_keys()) + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to remove keys failed. Will not perform " + "any more arming/disarming calls, if they exist"); + break; + } + else + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to remove keys succeeded."); + } } - } - // Enable encryption on the NVDIMM - if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_ENABLE_ENCRYPTION) - { - // Set the encryption enable attribute - set_ATTR_NVDIMM_ENCRYPTION_ENABLE(1); - - // Make call to generate keys before enabling encryption - if(!nvdimm_gen_keys()) + // Enable encryption on the NVDIMM + if (i_nvDimmOp.opType & + hostInterfaces::HBRT_FW_NVDIMM_ENABLE_ENCRYPTION) { - TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to generate keys failed, unable" - " to enable encryption, exiting ..."); - break; + // Set the encryption enable attribute + set_ATTR_NVDIMM_ENCRYPTION_ENABLE(1); + + // Make call to generate keys before enabling encryption + if(!nvdimm_gen_keys()) + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to generate keys failed, unable to enable " + "encryption. Will not perform any more " + "arming/disarming calls, if they exist"); + break; + } + else + { + // Make call to enable encryption + if (!nvdimm_encrypt_enable(l_nvDimmTargetList)) + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to enable encryption failed. " + "Will not perform any more arming/disarming " + "calls, if they exist"); + break; + } + else + { + TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " + "Call to enable encryption succeeded."); + } + } // end if(!nvdimm_gen_keys()) ... else ... } - else + + // Arm the NV logic + if (i_nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_ARM) { - // Make call to enable encryption - if (!nvdimm_encrypt_enable(l_nvDimmTargetList)) + // Make call to arm + if (!nvdimmArm(l_nvDimmTargetList)) { TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to enable encryption failed, exiting ..."); + "Call to arm failed."); break; } else { TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to enable encryption succeeded."); + "Call to arm succeeded."); } - } // end if(!nvdimm_gen_keys()) ... else ... - } + } // end if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_ARM) + } while (0); // end Perform the arming/disarming operations. - // Arm the NV logic - if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_ARM) + // Perform the health check operation + if (i_nvDimmOp.opType & hostInterfaces::HBRT_FW_MNFG_ES_HEALTH_CHECK) { - // Make call to arm - if (!nvdimmArm(l_nvDimmTargetList)) + if (!nvDimmCheckHealthStatus(l_nvDimmTargetList)) { TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to arm failed, exiting ..."); + "Call to do a health check failed."); break; } else { TRACFCOMP(g_trac_runtime, "doNvDimmOperation: " - "Call to arm succeeded."); + "Call to do a health check succeeded."); } - } // end if (nvDimmOp.opType & hostInterfaces::HBRT_FW_NVDIMM_ARM) - } while(0); + } + } while(0); // end Perform the operations requested if (l_err) { |