From eb9479855310fb1897fd14294cbdfc9564bf3605 Mon Sep 17 00:00:00 2001 From: Zane Shelley Date: Sat, 14 Apr 2018 22:24:26 -0500 Subject: PRD: Simplified use of pushToQueue() and handleTdEvent() Change-Id: Iaaa137886feb30d034360e8a16a74e98b0aaece3 RTC: 188516 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57234 Reviewed-by: Caleb N. Palmer Reviewed-by: Matt Derksen Tested-by: Jenkins Server Reviewed-by: Zane C. Shelley Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57477 CI-Ready: Zane C. Shelley Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins --- src/usr/diag/prdf/common/plat/mem/prdfMemDbUtils.H | 106 +++++++++++++++++ .../diag/prdf/common/plat/mem/prdfMemEccAnalysis.C | 125 ++++++--------------- .../diag/prdf/common/plat/mem/prdfMemEccAnalysis.H | 11 +- src/usr/diag/prdf/plat/mem/prdfMemTdCtlr.H | 44 +++----- src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_ipl.C | 16 --- src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C | 8 +- src/usr/diag/prdf/plat/mem/prdfMemTps_ipl.C | 8 +- src/usr/diag/prdf/plat/mem/prdfP9Mca.C | 8 +- 8 files changed, 171 insertions(+), 155 deletions(-) create mode 100644 src/usr/diag/prdf/common/plat/mem/prdfMemDbUtils.H (limited to 'src') diff --git a/src/usr/diag/prdf/common/plat/mem/prdfMemDbUtils.H b/src/usr/diag/prdf/common/plat/mem/prdfMemDbUtils.H new file mode 100644 index 000000000..46d3a7a66 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/mem/prdfMemDbUtils.H @@ -0,0 +1,106 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/mem/prdfMemDbUtils.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef prdfMemDbUtils_H +#define prdfMemDbUtils_H + +#include +#include + +namespace PRDF +{ + +namespace MemDbUtils +{ + +//############################################################################## +// Hostboot IPL/Runtime wrappers +//############################################################################## + +#ifdef __HOSTBOOT_MODULE + +/** + * @brief Generic wrapper to push a TdEntry to the Targeted Diagnostics queue. + * @param i_chip MCA or MBA. + * @param i_entry The new TdEntry. + * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise. + */ +template +void pushToQueue( ExtensibleChip * i_chip, TdEntry * i_entry ); + +template<> inline +void pushToQueue( ExtensibleChip * i_chip, + TdEntry * i_entry ) +{ + getMcaDataBundle(i_chip)->getTdCtlr()->pushToQueue( i_entry ); +} + +template<> inline +void pushToQueue( ExtensibleChip * i_chip, + TdEntry * i_entry ) +{ + getMbaDataBundle(i_chip)->getTdCtlr()->pushToQueue( i_entry ); +} + +#endif // Hostboot IPL/Runtime + +//############################################################################## +// Hostboot Runtime only wrappers +//############################################################################## + +#if defined(__HOSTBOOT_MODULE) && defined(__HOSTBOOT_RUNTIME) + +/** + * @brief Generic wrapper to tell the TD controller to process the next event + * in the TD queue. + * @param i_chip MCA or MBA. + * @param io_sc The step code data struct. + * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise. + */ +template +uint32_t handleTdEvent( ExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & io_sc ); + +template<> inline +uint32_t handleTdEvent( ExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & io_sc ) +{ + return getMcaDataBundle(i_chip)->getTdCtlr()->handleTdEvent( io_sc ); +} + +template<> inline +uint32_t handleTdEvent( ExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & io_sc ) +{ + return getMbaDataBundle(i_chip)->getTdCtlr()->handleTdEvent( io_sc ); +} + +#endif // Hostboot Runtime only + +} // end namespace MemDbUtils + +} // end namespace PRDF + +#endif // prdfMemDbUtils_H diff --git a/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.C b/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.C index 89a9a8b15..8f6b2a875 100644 --- a/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.C +++ b/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.C @@ -26,11 +26,10 @@ #include // Platform includes -#include #include #include +#include #include -#include #include #include @@ -393,68 +392,6 @@ bool queryIueTh( ExtensibleChip * i_chip, //------------------------------------------------------------------------------ -#ifdef __HOSTBOOT_MODULE - -template -uint32_t addVcmEvent( ExtensibleChip * i_chip, const MemRank & i_rank, - const MemMark & i_mark, STEP_CODE_DATA_STRUCT & io_sc, - bool i_isFetch ) -{ - PRDF_ASSERT( T == i_chip->getType() ); - - uint32_t o_rc = SUCCESS; - - D db = static_cast(i_chip->getDataBundle()); - - TdEntry * entry = new VcmEvent( i_chip, i_rank, i_mark ); - - // We only want to call handleTdEvent for fetch attentions, if we do it in - // other cases we will hit an infinite loop, so we just add the entry to the - // queue instead. - if ( i_isFetch ) - o_rc = db->getTdCtlr()->handleTdEvent( io_sc, entry ); - else - db->getTdCtlr()->pushToQueue( entry ); - - return o_rc; -} - -template -uint32_t addVcmEvent( ExtensibleChip * i_chip, - const MemRank & i_rank, - const MemMark & i_mark, - STEP_CODE_DATA_STRUCT & io_sc, - bool i_isFetch); - -#endif - -//------------------------------------------------------------------------------ - -#ifdef __HOSTBOOT_MODULE - -template -uint32_t addTpsEvent( ExtensibleChip * i_chip, const MemRank & i_rank, - STEP_CODE_DATA_STRUCT & io_sc, bool i_banTps ) -{ - PRDF_ASSERT( T == i_chip->getType() ); - - D db = static_cast(i_chip->getDataBundle()); - - TdEntry * entry = new TpsEvent( i_chip, i_rank, i_banTps ); - - return db->getTdCtlr()->handleTdEvent( io_sc, entry ); -} - -template -uint32_t addTpsEvent( ExtensibleChip * i_chip, - const MemRank & i_rank, - STEP_CODE_DATA_STRUCT & io_sc, - bool i_banTps ); - -#endif - -//------------------------------------------------------------------------------ - template uint32_t handleMpe( ExtensibleChip * i_chip, const MemRank & i_rank, STEP_CODE_DATA_STRUCT & io_sc, bool i_isFetch ) @@ -487,29 +424,22 @@ uint32_t handleMpe( ExtensibleChip * i_chip, const MemRank & i_rank, io_sc.service_data->SetCallout( mm ); // Add a VCM request to the TD queue if at runtime or at memdiags. - #ifdef __HOSTBOOT_RUNTIME - o_rc = addVcmEvent( i_chip, i_rank, chipMark, io_sc, i_isFetch ); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "addVcmEvent() failed: i_chip=0x%08x " - "i_rank=m%ds%d", i_chip->getHuid(), i_rank.getMaster(), - i_rank.getSlave() ); - break; - } - #elif defined(__HOSTBOOT_MODULE) && !defined(__HOSTBOOT_RUNTIME) + #ifdef __HOSTBOOT_MODULE + + #ifndef __HOSTBOOT_RUNTIME if ( isInMdiaMode() ) { - o_rc = addVcmEvent(i_chip, i_rank, chipMark, io_sc, i_isFetch); - if ( SUCCESS != o_rc ) - { - PRDF_ERR( PRDF_FUNC "addVcmEvent() failed: i_chip=0x%08x " - "i_rank=m%ds%d", i_chip->getHuid(), i_rank.getMaster(), - i_rank.getSlave() ); - break; - } + #endif + + TdEntry * entry = new VcmEvent( i_chip, i_rank, chipMark ); + MemDbUtils::pushToQueue( i_chip, entry ); + + #ifndef __HOSTBOOT_RUNTIME } #endif + #endif + }while(0); return o_rc; @@ -569,6 +499,7 @@ uint32_t analyzeFetchMpe( ExtensibleChip * i_chip, const MemRank & i_rank, D db = static_cast(i_chip->getDataBundle()); db->iv_ueTable.addEntry( UE_TABLE::FETCH_MPE, addr ); + // Get callouts, etc., and add the chip mark to the queue. o_rc = MemEcc::handleMpe( i_chip, i_rank, io_sc, true ); if ( SUCCESS != o_rc ) { @@ -577,6 +508,20 @@ uint32_t analyzeFetchMpe( ExtensibleChip * i_chip, const MemRank & i_rank, break; } + #ifdef __HOSTBOOT_RUNTIME + + // The chip mark has already been added to the queue. Now tell the TD + // controller to process it if not already in progress. + o_rc = MemDbUtils::handleTdEvent( i_chip, io_sc ); + if ( SUCCESS != o_rc ) + { + PRDF_ERR( PRDF_FUNC "handleTdEvent(0x%08x) failed on rank " + "0x%02x", i_chip->getHuid(), i_rank.getKey() ); + break; + } + + #endif + } while (0); // Add ECC capture data for FFDC. @@ -778,11 +723,13 @@ uint32_t analyzeFetchNceTce( ExtensibleChip * i_chip, // will still try to start TPS just in case MNFG disables the // termination policy. - o_rc = addTpsEvent( i_chip, rank, io_sc ); + MemDbUtils::pushToQueue( i_chip, new TpsEvent(i_chip, rank) ); + o_rc = MemDbUtils::handleTdEvent( i_chip, io_sc ); if ( SUCCESS != o_rc ) { - PRDF_ERR( PRDF_FUNC "addTpsEvent(0x%08x,0x%02x) failed", - i_chip->getHuid(), rank.getKey() ); + PRDF_ERR( PRDF_FUNC "handleTdEvent(0x%08x) failed on rank " + "0x%02x", i_chip->getHuid(), rank.getKey() ); + break; } #endif @@ -846,12 +793,12 @@ uint32_t analyzeFetchUe( ExtensibleChip * i_chip, // Add a TPS request to the TD queue and ban any further TPS requests // for this rank. MemRank rank = addr.getRank(); - o_rc = addTpsEvent( i_chip, rank, io_sc, true ); + MemDbUtils::pushToQueue(i_chip, new TpsEvent(i_chip, rank, true)); + o_rc = MemDbUtils::handleTdEvent( i_chip, io_sc ); if ( SUCCESS != o_rc ) { - PRDF_ERR( PRDF_FUNC "addTpsEvent() failed: i_chip=0x%08x " - "rank=%d,%d", i_chip->getHuid(), rank.getMaster(), - rank.getSlave() ); + PRDF_ERR( PRDF_FUNC "handleTdEvent(0x%08x) failed on rank 0x%02x", + i_chip->getHuid(), rank.getKey() ); break; } diff --git a/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.H b/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.H index 5988e2478..1cc49b95a 100644 --- a/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.H +++ b/src/usr/diag/prdf/common/plat/mem/prdfMemEccAnalysis.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -211,15 +211,6 @@ bool queryIueTh( ExtensibleChip * i_chip, STEP_CODE_DATA_STRUCT & io_sc ); template uint32_t maskMemPort( ExtensibleChip * i_chip ); -template -uint32_t addVcmEvent( ExtensibleChip * i_chip, const MemRank & i_rank, - const MemMark & i_mark, STEP_CODE_DATA_STRUCT & io_sc, - bool i_isFetch = false ); - -template -uint32_t addTpsEvent( ExtensibleChip * i_chip, const MemRank & i_rank, - STEP_CODE_DATA_STRUCT & io_sc, bool i_banTps = false ); - #endif } // end namespace MemEcc diff --git a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr.H b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr.H index 3f3f354fc..06d4bef58 100644 --- a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr.H +++ b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr.H @@ -79,40 +79,32 @@ class MemTdCtlr */ uint32_t handleCmdComplete( STEP_CODE_DATA_STRUCT & io_sc ); + /** + * @brief This only pushes a new TdEntry to the back of iv_queue. + * @post Fetch attentions must also call handleTdEvent() to trigger + * diagnostics, if not already in progress. + * @param i_entry The new TD queue entry. + */ + void pushToQueue( TdEntry * i_entry ) { iv_queue.push(i_entry); } + + #ifdef __HOSTBOOT_RUNTIME /** - * @brief Adds a new TD procedure to the queue. - * - * During runtime, this is used to process TD requests during analysis of - * attentions other than the command complete attention (i.e. memory CEs - * and UEs). If there isn't a current TD procedure in progress, this - * function will stop background scrubbing and start this new procedure. - * Otherwise, this new procedure is simply added to the queue. - * - * It is possible that some of the other attentions may occur during the IPL - * after Hostboot has been flushed from the cache to system memory. At that - * point we don't have time to complete a TD procedure. Therefore, the - * requests will be ignored. Any chip marks placed during this time will be - * redetected when the runtime TD controller is initialized. + * @brief This tells the TD controller there was a TdEntry added to the + * queue (via pushToQueue) because of a fetch attention and + * additional processing may be needed to start the next TD + * procedure. If there isn't a current TD procedure in progress, + * this function will stop background scrubbing and starts the first + * procedure in the queue. * - * During MemDiags, this will simply add a new procedure to the queue, since - * we know a TD procedure will already be in progress when this is called. + * @pre A TdEntry must be added to the queue (via pushToQueue) before + * calling this function. * * @note Initializes the TD controller, if needed. * @param io_sc The step code data struct. - * @param i_entry The new TD queue entry. * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise. */ - uint32_t handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc, - TdEntry * i_entry ); - - /** - * @brief Pushes a new TdEntry to the back of iv_queue. - * @param i_entry The new TD queue entry. - */ - void pushToQueue( TdEntry * i_entry ) { iv_queue.push(i_entry); } - - #ifdef __HOSTBOOT_RUNTIME + uint32_t handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc ); /** * @brief Handles reset-reload or FO scenario. diff --git a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_ipl.C b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_ipl.C index 7caba811b..1d25a9ecd 100644 --- a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_ipl.C +++ b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_ipl.C @@ -48,22 +48,6 @@ using namespace PlatServices; //------------------------------------------------------------------------------ -template -uint32_t MemTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc, - TdEntry * i_entry ) -{ - #define PRDF_FUNC "[MemTdCtlr::handleTdEvent] " - - // Add this entry to the queue. - iv_queue.push( i_entry ); - - return SUCCESS; - - #undef PRDF_FUNC -} - -//------------------------------------------------------------------------------ - template uint32_t MemTdCtlr::initialize() { diff --git a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C index f3693355e..a028f5b86 100644 --- a/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C +++ b/src/usr/diag/prdf/plat/mem/prdfMemTdCtlr_rt.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -164,8 +164,7 @@ void __recaptureRegs( STEP_CODE_DATA_STRUCT & io_sc, //------------------------------------------------------------------------------ template -uint32_t MemTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc, - TdEntry * i_entry ) +uint32_t MemTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc ) { #define PRDF_FUNC "[MemTdCtlr::handleTdEvent] " @@ -182,9 +181,6 @@ uint32_t MemTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc, break; } - // Add this entry to the queue. - iv_queue.push( i_entry ); - // Don't interrupt a TD procedure if one is already in progress. if ( nullptr != iv_curProcedure ) break; diff --git a/src/usr/diag/prdf/plat/mem/prdfMemTps_ipl.C b/src/usr/diag/prdf/plat/mem/prdfMemTps_ipl.C index da993d51e..993216f9f 100644 --- a/src/usr/diag/prdf/plat/mem/prdfMemTps_ipl.C +++ b/src/usr/diag/prdf/plat/mem/prdfMemTps_ipl.C @@ -26,6 +26,7 @@ /** @file prdfMemTps_ipl.C */ // Platform includes +#include #include #include #include @@ -157,9 +158,10 @@ uint32_t TpsEvent::nextStep( STEP_CODE_DATA_STRUCT & io_sc, chipMark.getSymbol() ); io_sc.service_data->SetCallout( memmru ); - //Add a VCM procedure to the queue - MemEcc::addVcmEvent(iv_chip, iv_rank, - chipMark, io_sc); + // Add a VCM procedure to the queue. + TdEntry * entry = new VcmEvent { iv_chip, iv_rank, + chipMark }; + MemDbUtils::pushToQueue( iv_chip, entry ); //Abort this procedure o_done = true; diff --git a/src/usr/diag/prdf/plat/mem/prdfP9Mca.C b/src/usr/diag/prdf/plat/mem/prdfP9Mca.C index a08385e5c..7a5d10d64 100644 --- a/src/usr/diag/prdf/plat/mem/prdfP9Mca.C +++ b/src/usr/diag/prdf/plat/mem/prdfP9Mca.C @@ -29,15 +29,14 @@ #include // Platform includes +#include #include -#include #include #include #ifdef __HOSTBOOT_RUNTIME #include #endif - using namespace TARGETING; namespace PRDF @@ -150,8 +149,6 @@ int32_t RcdParityError( ExtensibleChip * i_mcaChip, { io_sc.service_data->setServiceCall(); - McbistDataBundle * mcbdb = getMcbistDataBundle( mcbChip ); - std::vector list; getSlaveRanks( i_mcaChip->getTrgt(), list ); PRDF_ASSERT( !list.empty() ); // target configured with no ranks @@ -159,7 +156,8 @@ int32_t RcdParityError( ExtensibleChip * i_mcaChip, for ( auto & r : list ) { TdEntry * entry = new TpsEvent( i_mcaChip, r ); - uint32_t rc = mcbdb->getTdCtlr()->handleTdEvent( io_sc, entry ); + MemDbUtils::pushToQueue( i_mcaChip, entry ); + uint32_t rc = MemDbUtils::handleTdEvent(i_mcaChip, io_sc); if ( SUCCESS != rc ) { PRDF_ERR( PRDF_FUNC "handleTdEvent() failed on 0x%08x", -- cgit v1.2.1