From 8e8b74fdbd588872c346a6b1038f07e9c561406d Mon Sep 17 00:00:00 2001 From: Mike Baiocchi Date: Wed, 16 May 2018 10:42:04 -0500 Subject: Add option to masterProcChipTargetHandle() to return functional chip This commit adds an option to the two masterProcChipTargetHandle() functions to only look for and return a functional master proc chip as necessary with the issue in Defect SW424528. The default behavior of these functions - where the functionality is not checked - remains the same. Once use of these functions has also been updated to use this new option. Change-Id: I37049d2cb9299a9404b57d85031a364bdb257c82 CQ:SW424528 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/58920 Reviewed-by: Nicholas E. Bofferding Reviewed-by: Marshall J. Wilks Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Tested-by: Jenkins OP HW Reviewed-by: Sachin Gupta Reviewed-by: Daniel M. Crowell --- src/include/usr/targeting/common/targetservice.H | 17 ++++++- src/usr/isteps/istep10/call_proc_build_smp.C | 63 +++++++++++++++--------- src/usr/targeting/common/targetservice.C | 35 ++++++++++--- 3 files changed, 84 insertions(+), 31 deletions(-) diff --git a/src/include/usr/targeting/common/targetservice.H b/src/include/usr/targeting/common/targetservice.H index 82001c0ae..4fee83b92 100644 --- a/src/include/usr/targeting/common/targetservice.H +++ b/src/include/usr/targeting/common/targetservice.H @@ -421,6 +421,12 @@ class TargetService * processor. If NULL, HB will search whatever node it's * running on, and FSP will search the physical drawer containing * the lowest ordered fabric node ID. * + * @param[in] i_onlyFunctional + * Specifies whether to limit the search to only functional chips. + * If true, will only return a functional chip. If false, which + * is the default, the functional state of the chips are not + * checked. + * * @pre Target Service must be initialized * * @post Master processor chip target returned or NULL is returned if @@ -429,7 +435,8 @@ class TargetService */ void masterProcChipTargetHandle( Target*& o_masterProcChipTargetHandle, - const Target* i_pNodeTarget = NULL) const; + const Target* i_pNodeTarget = NULL, + const bool i_onlyFunctional = false) const; /** * @brief Returns the master processor chip target handle @@ -450,6 +457,11 @@ class TargetService * Target handle of node to search. If NULL, HB will search * whatver node it's running on, andFSP will search the physical * drawer containing the lowest orderd fabric node ID + * @param[in] i_onlyFunctional + * Specifies whether to limit the search to only functional chips. + * If true, will only return a functional chip. If false, which + * is the default, the functional state of the chips are not + * checked. * * @pre Target Service must be initialized * @@ -465,7 +477,8 @@ class TargetService */ errlHndl_t queryMasterProcChipTargetHandle( Target*& o_masterProcChipTargetHandle, - const Target* i_pNodeTarget = NULL) const; + const Target* i_pNodeTarget = NULL, + const bool i_onlyFunctional = false) const; /** * @brief Returns whether the specified entity path attribute exists diff --git a/src/usr/isteps/istep10/call_proc_build_smp.C b/src/usr/isteps/istep10/call_proc_build_smp.C index fcba369c0..adf809a5d 100644 --- a/src/usr/isteps/istep10/call_proc_build_smp.C +++ b/src/usr/isteps/istep10/call_proc_build_smp.C @@ -61,34 +61,51 @@ void* call_proc_build_smp (void *io_pArgs) IStepError l_StepError; - errlHndl_t l_errl = NULL; - TARGETING::TargetHandleList l_cpuTargetList; - getAllChips(l_cpuTargetList, TYPE_PROC); - - // - // Identify the master processor - // - TARGETING::Target * l_masterProc = NULL; - (void)TARGETING::targetService().masterProcChipTargetHandle( l_masterProc ); + do + { + errlHndl_t l_errl = nullptr; + TARGETING::TargetHandleList l_cpuTargetList; + getAllChips(l_cpuTargetList, TYPE_PROC); + + // + // Identify the master processor + // + TARGETING::Target * l_masterProc = nullptr; + TARGETING::Target * l_masterNode = nullptr; + bool l_onlyFunctional = true; // Make sure masterproc is functional + l_errl = TARGETING::targetService().queryMasterProcChipTargetHandle( + l_masterProc, + l_masterNode, + l_onlyFunctional); - std::vector> l_procList; + if(l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR : call_proc_build_smp: " + "queryMasterProcChipTargetHandle() returned PLID=0x%x", + l_errl->plid() ); + // Create IStep error log and cross reference error that occurred + l_StepError.addErrorDetails(l_errl); + // Commit error + errlCommit( l_errl, HWPF_COMP_ID ); + break; + } - // Loop through all proc chips and convert them to FAPI targets - for (const auto & curproc: l_cpuTargetList) - { - const fapi2::Target - l_fapi2_proc_target (curproc); - l_procList.push_back(l_fapi2_proc_target); - } + std::vector> l_procList; - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "call_proc_build_smp entry" ); + // Loop through all proc chips and convert them to FAPI targets + for (const auto & curproc: l_cpuTargetList) + { + const fapi2::Target + l_fapi2_proc_target (curproc); + l_procList.push_back(l_fapi2_proc_target); + } - const fapi2::Target - l_fapi2_master_proc (l_masterProc); + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_proc_build_smp entry" ); - do - { + const fapi2::Target + l_fapi2_master_proc (l_masterProc); FAPI_INVOKE_HWP( l_errl, p9_build_smp, l_procList, diff --git a/src/usr/targeting/common/targetservice.C b/src/usr/targeting/common/targetservice.C index 940c5dd39..c5dad4f5d 100644 --- a/src/usr/targeting/common/targetservice.C +++ b/src/usr/targeting/common/targetservice.C @@ -702,14 +702,16 @@ Target* TargetService::toTarget( void TargetService::masterProcChipTargetHandle( Target*& o_masterProcChipTargetHandle, - const Target* i_pNodeTarget) const + const Target* i_pNodeTarget, + const bool i_onlyFunctional) const { #define TARG_FN "masterProcChipTargetHandle(...)" errlHndl_t pError = NULL; pError = queryMasterProcChipTargetHandle( o_masterProcChipTargetHandle, - i_pNodeTarget); + i_pNodeTarget, + i_onlyFunctional); if(pError != NULL) { /* Error is already traced w.r.t api called, not repeating here*/ @@ -727,7 +729,8 @@ void TargetService::masterProcChipTargetHandle( errlHndl_t TargetService::queryMasterProcChipTargetHandle( Target*& o_masterProcChipTargetHandle, - const Target* const i_pNodeTarget) const + const Target* const i_pNodeTarget, + const bool i_onlyFunctional) const { #define TARG_FN "queryMasterProcChipTargetHandle(...)" @@ -744,15 +747,25 @@ errlHndl_t TargetService::queryMasterProcChipTargetHandle( { static Target* pActingMasterTarget = NULL; - if(!pActingMasterTarget || PLAT::PROPERTIES::MULTINODE_AWARE) + if(!pActingMasterTarget + || PLAT::PROPERTIES::MULTINODE_AWARE + || i_onlyFunctional ) { // Create filter that finds acting master processors PredicateCTM procFilter(CLASS_CHIP, TYPE_PROC); PredicateAttrVal actingMasterFilter( PROC_MASTER_TYPE_ACTING_MASTER); + PredicateHwas functionalFilter; + functionalFilter.functional(true); PredicatePostfixExpr actingMasterProcFilter; actingMasterProcFilter.push(&procFilter).push( - &actingMasterFilter).And(); + &actingMasterFilter).And(); + + // Limit to only functional procs if requested + if (i_onlyFunctional) + { + actingMasterProcFilter.push(&functionalFilter).And(); + } // Find all the acting master processors (max one per physical // node), sorted by fabric node ID, and return the one with the @@ -777,7 +790,8 @@ errlHndl_t TargetService::queryMasterProcChipTargetHandle( } if( (pMasterProc) - && (!PLAT::PROPERTIES::MULTINODE_AWARE)) + && (!PLAT::PROPERTIES::MULTINODE_AWARE) + && (!i_onlyFunctional)) { pActingMasterTarget = pMasterProc; } @@ -798,10 +812,19 @@ errlHndl_t TargetService::queryMasterProcChipTargetHandle( PROC_MASTER_TYPE_ACTING_MASTER); PredicateCTM l_procPredicate(TARGETING::CLASS_CHIP,TARGETING::TYPE_PROC); + PredicateHwas functionalFilter; + functionalFilter.functional(true); PredicatePostfixExpr l_masterProcFilter; l_masterProcFilter.push(&l_procPredicate).push( &l_procMasterMatches).And(); + + // Limit to only functional procs if requested + if (i_onlyFunctional) + { + l_masterProcFilter.push(&functionalFilter).And(); + } + // Find the acting master within the node TARGETING::TargetHandleList l_masterProclist; getAssociated(l_masterProclist, -- cgit v1.2.1