Skip to content

Commit

Permalink
Support for detecting a WOF requested reset
Browse files Browse the repository at this point in the history
Change-Id: I385b20538230b152828075f695e8352f969d5cf2
RTC:174543
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45986
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@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: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
aalugore authored and dcrowell77 committed Sep 22, 2017
1 parent 72cf613 commit c17f8e4
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 65 deletions.
6 changes: 4 additions & 2 deletions src/usr/htmgt/htmgt.C
Expand Up @@ -107,8 +107,8 @@ namespace HTMGT
if (OccManager::occNeedsReset())
{
// No need to continue if reset is required
TMGT_ERR("sendOccConfigData(): OCCs need "
"to be reset");
TMGT_ERR("processOccStartStatus(): "
"OCCs need to be reset");
break;
}
else
Expand Down Expand Up @@ -305,6 +305,8 @@ namespace HTMGT
errlHndl_t err = OccManager::resetOccs(nullptr);
if(err)
{
TMGT_ERR("processOccError(): Error when attempting"
" to reset OCCs");
ERRORLOG::errlCommit(err, HTMGT_COMP_ID);
}
}
Expand Down
50 changes: 41 additions & 9 deletions src/usr/htmgt/htmgt_cfgdata.C
Expand Up @@ -130,7 +130,8 @@ namespace HTMGT
{
case OCC_CFGDATA_FREQ_POINT:
getFrequencyPointMessageData(cmdData,
cmdDataLen);
cmdDataLen,
occ->wofResetCount());
break;

case OCC_CFGDATA_OCC_ROLE:
Expand Down Expand Up @@ -1153,7 +1154,8 @@ void getGPUConfigMessageData(const TargetHandle_t i_occ,


void getFrequencyPointMessageData(uint8_t* o_data,
uint64_t & o_size)
uint64_t & o_size,
uint8_t i_wofResetCount )
{
uint64_t index = 0;
uint16_t min = 0;
Expand All @@ -1177,6 +1179,7 @@ void getFrequencyPointMessageData(uint8_t* o_data,

uint8_t turboAllowed =
sys->getAttr<ATTR_OPEN_POWER_TURBO_MODE_SUPPORTED>();

if (turboAllowed)
{
turbo = sys->getAttr<ATTR_FREQ_CORE_MAX>();
Expand All @@ -1185,31 +1188,61 @@ void getFrequencyPointMessageData(uint8_t* o_data,
ATTR_SYSTEM_WOF_DISABLE_type wofSupported;
if (!sys->tryGetAttr<ATTR_SYSTEM_WOF_DISABLE>(wofSupported))
{
ultra = WOF_SYSTEM_DISABLED;
G_wofSupported = false;
}
else
{
if( wofSupported != SYSTEM_WOF_DISABLE_ON )
uint16_t tempUt = sys->getAttr<ATTR_ULTRA_TURBO_FREQ_MHZ>();
if( wofSupported == SYSTEM_WOF_DISABLE_ON )
{
ultra = sys->getAttr<ATTR_ULTRA_TURBO_FREQ_MHZ>();
TMGT_INF("System does not support WOF");
G_wofSupported = false;
ultra = WOF_SYSTEM_DISABLED;
}
else
else if( tempUt == 0 )
{
TMGT_INF("Missing Ultra Turbo VPD point. WOF disabled.");
G_wofSupported = false;
ultra = WOF_MISSING_ULTRA_TURBO;
}
else if( i_wofResetCount >= WOF_RESET_COUNT_THRESHOLD )
{
TMGT_INF("WOF reset count reached. WOF disabled.");
G_wofSupported = false;
ultra = WOF_RESET_COUNT_REACHED;
}
else if( turbo <= nominal )
{
TMGT_INF("Turbo is less than nominal. WOF disabled.");
G_wofSupported = false;
ultra = WOF_UNSUPPORTED_FREQ;
}
else if( tempUt <= turbo )
{
TMGT_INF("Ultra Turbo is less than Turbo. WOF disabled.");
G_wofSupported = false;
ultra = WOF_UNSUPPORTED_FREQ;
}
else
{
ultra = tempUt;
}

}

if( !G_wofSupported )
{
TMGT_INF("getFrequencyPoint: WOF not enabled");
TMGT_INF("getFrequencyPoint: WOF not enabled! RC = %x", ultra);
}
}
else
{
// If turbo not supported, send nominal for turbo
// and 0 for ultra-turbo (no WOF support)
// and reason code for ultra-turbo (no WOF support)
TMGT_INF("getFrequencyPoint: Turbo/WOF not supported");
turbo = nominal;
ultra = WOF_UNSUPPORTED_FREQ;
G_wofSupported = false;
}

Expand Down Expand Up @@ -1342,5 +1375,4 @@ void getApssMessageData(uint8_t* o_data,
}



}
}// namespace HTMGT
12 changes: 11 additions & 1 deletion src/usr/htmgt/htmgt_cfgdata.H
Expand Up @@ -80,6 +80,13 @@ namespace HTMGT
CFDATA_DVFS_NOT_DEFINED = 0xFF,
};

enum // WOF disabled reasons
{
WOF_MISSING_ULTRA_TURBO = 0x0000,
WOF_SYSTEM_DISABLED = 0x0001,
WOF_RESET_COUNT_REACHED = 0x0002,
WOF_UNSUPPORTED_FREQ = 0x0003,
};

enum cfgTargets
{
Expand Down Expand Up @@ -249,10 +256,13 @@ namespace HTMGT
*
* @param[out] o_data - preallocated buffer to fill in
* @param[out] o_size - set to the message size
* @param[in] i_wofResetCount - Number of times OCC requested a reset
* due to WOF
* @pre o_data is large enough.
*/
void getFrequencyPointMessageData(uint8_t* o_data,
uint64_t & o_size);
uint64_t & o_size,
uint8_t i_wofResetCount );

/**
* Generate the APSS configuration message
Expand Down
53 changes: 41 additions & 12 deletions src/usr/htmgt/htmgt_occ.C
Expand Up @@ -57,6 +57,8 @@ namespace HTMGT
iv_state(OCC_STATE_UNKNOWN),
iv_commEstablished(false),
iv_needsReset(false),
iv_needsWofReset(false),
iv_wofResetCount(0),
iv_failed(false),
iv_seqNumber(0),
iv_homer(i_homer),
Expand Down Expand Up @@ -202,9 +204,15 @@ namespace HTMGT
atThreshold = true;
}
}
else if( iv_needsWofReset ) //If WOF reset, increment count
{
iv_wofResetCount++;
TMGT_INF("resetPrep(): WOF reset requested. Reset Count = %d",
iv_wofResetCount );
}
else
{
cmdData[1] = OCC_RESET_FAIL_OTHER_OCC;
cmdData[1] = OCC_RESET_FAIL_THIS_OCC;
}

if (iv_commEstablished)
Expand Down Expand Up @@ -239,6 +247,7 @@ namespace HTMGT
iv_state = OCC_STATE_UNKNOWN;
iv_commEstablished = false;
iv_needsReset = false;
iv_needsWofReset = false;
iv_failed = false;
iv_lastPollValid = false;
iv_resetReason = OCC_RESET_REASON_NONE;
Expand Down Expand Up @@ -401,7 +410,7 @@ namespace HTMGT
:iv_occMaster(nullptr),
iv_state(OCC_STATE_UNKNOWN),
iv_targetState(OCC_STATE_ACTIVE),
iv_resetCount(0),
iv_sysResetCount(0),
iv_normalPstateTables(true)
{
}
Expand Down Expand Up @@ -903,17 +912,23 @@ namespace HTMGT
atThreshold = true;
}
}
// If we need a WOF reset, skip system count increment
if( occ->needsWofReset() )
{
i_skipCountIncrement = true;
}

}

if ((false == i_skipCountIncrement) && (false == _occFailed()))
{
// No OCC has been marked failed, increment sys reset count
++iv_resetCount;
++iv_sysResetCount;

TMGT_INF("_resetOCCs: Incrementing system OCC reset count"
" to %d", iv_resetCount);
" to %d", iv_sysResetCount);

if(iv_resetCount > OCC_RESET_COUNT_THRESHOLD)
if(iv_sysResetCount > OCC_RESET_COUNT_THRESHOLD)
{
atThreshold = true;
}
Expand Down Expand Up @@ -1225,7 +1240,7 @@ namespace HTMGT

for( const auto & occ : iv_occArray )
{
if (occ->needsReset())
if (occ->needsReset() || occ->needsWofReset())
{
needsReset = true;
break;
Expand All @@ -1235,7 +1250,6 @@ namespace HTMGT
return needsReset;
}


// Return true if any OCC has been marked as failed
bool OccManager::_occFailed()
{
Expand Down Expand Up @@ -1290,7 +1304,7 @@ namespace HTMGT
o_data[index++] = (nullptr!=iv_occMaster)?iv_occMaster->getInstance():0xFF;
o_data[index++] = iv_state;
o_data[index++] = iv_targetState;
o_data[index++] = iv_resetCount;
o_data[index++] = iv_sysResetCount;
o_data[index++] = iv_normalPstateTables ? 0 : 1;
index += 1; // reserved for expansion
o_data[index++] = safeMode;
Expand Down Expand Up @@ -1393,21 +1407,36 @@ namespace HTMGT
{
TMGT_INF("_clearResetCounts: Clearing OCC%d reset count "
"(was %d)",
occ->getInstance(), occ->iv_resetCount);
occ->getInstance(),
occ->iv_resetCount);
occ->iv_resetCount = 0;
if (safeMode)
{
// Clear OCC flags (failed, commEstablished, etc)
occ->postResetClear();
}
}

if(occ->iv_wofResetCount != 0)
{
occ->iv_wofResetCount = 0;
TMGT_INF("_clearResetCounts: Clearing OCC%d WOF reset count "
"( was %d)",
occ->getInstance(),
occ->iv_wofResetCount);
if(safeMode)
{
// Clear OCC flags
occ->postResetClear();
}
}
}

if (iv_resetCount != 0)
if (iv_sysResetCount != 0)
{
TMGT_INF("_clearResetCounts: Clearing system reset count "
"(was %d)", iv_resetCount);
iv_resetCount = 0;
"(was %d)", iv_sysResetCount);
iv_sysResetCount = 0;
}
}

Expand Down

0 comments on commit c17f8e4

Please sign in to comment.