Skip to content

Commit

Permalink
Add support for remembering deconfigs without GUARD
Browse files Browse the repository at this point in the history
 Currently on reconfig reboots only parts that are GUARDed
 are remembered and reapplied.
   - Add suport for a semi persisent PNOR partition,
     HB_VOLATILE which Hostboot uses to keep track of the reconfig
     reboots vs power off
   - Add a new GUARD type specifically for reconfig loops
   - Add RECALL_DECONFIG_ON_RECONFIG config flag to control
     what gets added to GUARD partition
   - During boot will add/clear guard records on deconfig based
     on config flags and semi persisent state.

Change-Id: Iec636058cde8095c0c4216d1f95ae4fda554395e
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39780
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
sannerd authored and dcrowell77 committed May 25, 2017
1 parent c578a6c commit e0a1b4a
Show file tree
Hide file tree
Showing 15 changed files with 401 additions and 12 deletions.
22 changes: 22 additions & 0 deletions src/include/usr/hwas/common/deconfigGard.H
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ namespace HWAS
*/
errlHndl_t collectGard(const TARGETING::PredicateBase *i_pPredicate = NULL);

/**
* @brief clearGardByType Common HWAS function to clear all GARD records of
* given type
*
* It will call into hwas platform-specific functions.
*
* @param i_type Type of records to be cleared
*
* @return errlHndl_t valid errlHndl_t handle if there was an error
* NULL if no errors;
*/
errlHndl_t clearGardByType(const GARD_ErrorType i_type);

/**
* @brief Returns a reference to the DeconfigGard singleton.
*/
Expand Down Expand Up @@ -238,6 +251,15 @@ public:
*/
errlHndl_t clearGardRecordsForReplacedTargets();

/**
* @brief Clears GARD Records that match requested error type
*
* @param i_type error type to clear
*
* @return errlHndl_t. Error log handle.
*/
errlHndl_t clearGardRecordsByType(GARD_ErrorType i_type);

/**
* @brief Deconfigures Targets that have GARD Records in preparation to IPL.
*
Expand Down
1 change: 1 addition & 0 deletions src/include/usr/hwas/common/hwasCallout.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ typedef enum {
GARD_Predictive = 0xE6, //Policy flag to disable.
GARD_Power = 0xE9, //Needed since EID is NOT passed in.
GARD_PHYP = 0xEA, //Needed since EID is NOT passed in.
GARD_Reconfig = 0xEB, //Force deconfig on reconfig loop
GARD_Void = 0xFF
} GARD_ErrorType;

Expand Down
1 change: 1 addition & 0 deletions src/include/usr/pnor/pnor_const.H
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ enum SectionId
RINGOVD, /**< Ring override data */
WOFDATA, /**< VFRT data tables for WOF */
SBKT, /**< SecureBoot Key Transition */
HB_VOLATILE, /**< Semi volatile partition for reconfig */
#endif
NUM_SECTIONS, /**< Number of defined sections */

Expand Down
83 changes: 83 additions & 0 deletions src/include/usr/util/utilsemipersist.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/util/utilsemipersist.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2017 */
/* [+] 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 UTILSEMIPERSIST_H
#define UTILSEMIPERSIST_H

/**
* @file utilsemipersist.H
*
* @brief Utilies to access the semi persistent memory
*
*
*/

/*****************************************************************************/
// I n c l u d e s
/*****************************************************************************/

// Utility Includes

/*****************************************************************************/
// Forwards
/*****************************************************************************/

//*****************************************************************************/
// C o n s t a n t s
/*****************************************************************************/
namespace Util
{
enum
{
PERSIST_MAGIC = 0x48425f56, // HB_V
};

struct semiPersistData_t
{
uint32_t magic; //HB_V
uint32_t reboot_cnt; // Number of reboots with valid data
semiPersistData_t(): magic(0), reboot_cnt(0) {};
} PACKED;

/**
* @brief This function writes data structure to the HB semi persistent
* region. Data is flushed to storage once this call returns
* @param[in] i_data Structure to write
*
* @return none
*/
void writeSemiPersistData(const semiPersistData_t i_data);

/**
* @brief This function reads data structure from the HB semi persistent
* region. If the region cannot be found it will return 0s for all data.
* User must check magic header to know if data is valid
* @param[in] o_data Structure to read
*
* @return none
*/
void readSemiPersistData(semiPersistData_t & o_data);
};

#endif //UTILMEM_H
5 changes: 4 additions & 1 deletion src/usr/errl/plugins/errludcallout.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -114,6 +114,7 @@ case HWAS::_type: i_parser.PrintString( "GARD Error Type", #_type); break;
case_GARD_ERROR_TYPE(GARD_Predictive)
case_GARD_ERROR_TYPE(GARD_Power)
case_GARD_ERROR_TYPE(GARD_PHYP)
case_GARD_ERROR_TYPE(GARD_Reconfig)
case_GARD_ERROR_TYPE(GARD_Void)
default:
i_parser.PrintNumber( "Deconfig State", "UNKNOWN: 0x%X",
Expand Down Expand Up @@ -171,6 +172,7 @@ case HWAS::_type: i_parser.PrintString( "GARD Error Type", #_type); break;
case_GARD_ERROR_TYPE(GARD_Predictive)
case_GARD_ERROR_TYPE(GARD_Power)
case_GARD_ERROR_TYPE(GARD_PHYP)
case_GARD_ERROR_TYPE(GARD_Reconfig)
case_GARD_ERROR_TYPE(GARD_Void)
default:
i_parser.PrintNumber( "Deconfig State", "UNKNOWN: 0x%X",
Expand Down Expand Up @@ -246,6 +248,7 @@ case HWAS::_type: i_parser.PrintString( "GARD Error Type", #_type); break;
case_GARD_ERROR_TYPE(GARD_Predictive)
case_GARD_ERROR_TYPE(GARD_Power)
case_GARD_ERROR_TYPE(GARD_PHYP)
case_GARD_ERROR_TYPE(GARD_Reconfig)
case_GARD_ERROR_TYPE(GARD_Void)
default:
i_parser.PrintNumber( "Deconfig State", "UNKNOWN: 0x%X",
Expand Down
1 change: 1 addition & 0 deletions src/usr/errldisplay/errldisplay.C
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ case HWAS::_type: CONSOLE::displayf(NULL, " GARD Error Type : %s", #_t
case_GARD_ERROR_TYPE(GARD_Predictive)
case_GARD_ERROR_TYPE(GARD_Power)
case_GARD_ERROR_TYPE(GARD_PHYP)
case_GARD_ERROR_TYPE(GARD_Reconfig)
case_GARD_ERROR_TYPE(GARD_Void)
default:
CONSOLE::displayf(NULL, " GARD Error Type : UNKNOWN: 0x%X",
Expand Down
6 changes: 6 additions & 0 deletions src/usr/hwas/HBconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ config NO_GARD_SUPPORT
help
Skip guarding when set

config RECALL_DECONFIG_ON_RECONFIG
default n
help
Remember both garded and deconfigured parts on a reconfig loop.
Normally only garded parts are remembered.

config HOST_HCDB_SUPPORT
default n
depends on MEMVPD_READ_FROM_HW || MVPD_READ_FROM_HW || DJVPD_READ_FROM_HW
Expand Down
59 changes: 58 additions & 1 deletion src/usr/hwas/common/deconfigGard.C
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ errlHndl_t collectGard(const PredicateBase *i_pPredicate)
}
return errl;
} // collectGard

errlHndl_t clearGardByType(const GARD_ErrorType i_type)
{
return theDeconfigGard().clearGardRecordsByType(i_type);
}

#endif

//******************************************************************************
Expand Down Expand Up @@ -190,7 +196,7 @@ errlHndl_t DeconfigGard::applyGardRecord(Target *i_pTarget,
//******************************************************************************
errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets()
{
HWAS_INF("User Request: Clear GARD Records for replaced Targets");
HWAS_INF("Clear GARD Records for replaced Targets");
errlHndl_t l_pErr = NULL;

// Create the predicate with HWAS changed state and our GARD bit
Expand Down Expand Up @@ -354,6 +360,57 @@ errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets()
return l_pErr;
} // clearGardRecordsForReplacedTargets

//******************************************************************************
errlHndl_t DeconfigGard::clearGardRecordsByType(const GARD_ErrorType i_type)
{
HWAS_INF("Clear GARD Records by type %x", i_type);
errlHndl_t l_pErr = nullptr;

do
{
GardRecords_t l_gardRecords;
l_pErr = platGetGardRecords(nullptr, l_gardRecords);
if (l_pErr)
{
HWAS_ERR("Error from platGetGardRecords");
break;
}

// For each GARD Record
for (const auto & l_gardRecord : l_gardRecords)
{
//If this is the type to clear
if(l_gardRecord.iv_errorType == i_type)
{
// Find the associated Target
Target* l_pTarget = targetService().
toTarget(l_gardRecord.iv_targetId);

if (l_pTarget == nullptr)
{
// could be a platform specific target for the other
// ie, we are hostboot and this is an FSP target, or
// vice-versa
// we just skip this GARD record
continue;
}

l_pErr = platClearGardRecords(l_pTarget);
if (l_pErr)
{
HWAS_ERR("Error from platClearGardRecords");
break;
}

}
}
}
while (0);

return l_pErr;
} // clearGardRecordsByType


//******************************************************************************
errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl(
const PredicateBase *i_pPredicate)
Expand Down
22 changes: 22 additions & 0 deletions src/usr/hwas/hwasPlatCallout.C
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,18 @@ errlHndl_t platHandleHWCallout(
}
default:
{

#ifndef CONFIG_NO_GARD_SUPPORT
errl = HWAS::theDeconfigGard().platCreateGardRecord(i_pTarget,
io_errl->eid(),
i_gardErrorType);
#elif CONFIG_RECALL_DECONFIG_ON_RECONFIG
//If Gard is turned off, always populate a reconfig type
//in case of a reconfig loop
errl = HWAS::theDeconfigGard()
.platCreateGardRecord(i_pTarget,io_errl->eid(),
GARD_Reconfig);
#endif
break;
}
} // switch i_gardErrorType
Expand All @@ -115,6 +124,19 @@ errlHndl_t platHandleHWCallout(
// call HWAS common function
errl = HWAS::theDeconfigGard().deconfigureTarget(*i_pTarget,
io_errl->eid());

#ifdef CONFIG_RECALL_DECONFIG_ON_RECONFIG
//Always force a gard record on deconfig. If already
//garded, won't update/harm anything
if(!errl)
{
errl = HWAS::theDeconfigGard()
.platCreateGardRecord(i_pTarget,
io_errl->eid(),
GARD_Reconfig);
}
#endif

break;
}
case (DELAYED_DECONFIG):
Expand Down
8 changes: 1 addition & 7 deletions src/usr/hwas/hwasPlatDeconfigGard.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
Expand Down Expand Up @@ -91,7 +91,6 @@ errlHndl_t DeconfigGard::platClearGardRecords(
{
errlHndl_t l_pErr = NULL;

#ifndef CONFIG_NO_GARD_SUPPORT
EntityPath l_targetId;
if (!i_pTarget)
{
Expand Down Expand Up @@ -144,7 +143,6 @@ errlHndl_t DeconfigGard::platClearGardRecords(
}

HWAS_MUTEX_UNLOCK(iv_mutex);
#endif // CONFIG_NO_GARD_SUPPORT
return l_pErr;
}

Expand All @@ -155,7 +153,6 @@ errlHndl_t DeconfigGard::platGetGardRecords(
errlHndl_t l_pErr = NULL;
o_records.clear();

#ifndef CONFIG_NO_GARD_SUPPORT
EntityPath l_targetId;
if (!i_pTarget)
{
Expand Down Expand Up @@ -201,7 +198,6 @@ errlHndl_t DeconfigGard::platGetGardRecords(

HWAS_MUTEX_UNLOCK(iv_mutex);
HWAS_INF("Get returning %d GARD Records", o_records.size());
#endif // CONFIG_NO_GARD_SUPPORT
return l_pErr;
}

Expand All @@ -215,7 +211,6 @@ errlHndl_t DeconfigGard::platCreateGardRecord(
get_huid(i_pTarget), i_errlEid);
errlHndl_t l_pErr = NULL;

#ifndef CONFIG_NO_GARD_SUPPORT
HWAS_MUTEX_LOCK(iv_mutex);

do
Expand Down Expand Up @@ -396,7 +391,6 @@ errlHndl_t DeconfigGard::platCreateGardRecord(
while (0);

HWAS_MUTEX_UNLOCK(iv_mutex);
#endif // CONFIG_NO_GARD_SUPPORT
return l_pErr;
}

Expand Down

0 comments on commit e0a1b4a

Please sign in to comment.