Skip to content

Commit 5f95eb2

Browse files
cjcaindcrowell77
authored andcommitted
HTMGT: Update GPU config to send calculated power values
Change-Id: I36badb11c9350a176265f11b3046cf88a30292c0 RTC: 179616 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46439 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: Sheldon R. Bailey <baileysh@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent eebc5b9 commit 5f95eb2

File tree

6 files changed

+223
-179
lines changed

6 files changed

+223
-179
lines changed

src/usr/htmgt/htmgt_cfgdata.C

Lines changed: 98 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ namespace HTMGT
130130
{
131131
case OCC_CFGDATA_FREQ_POINT:
132132
getFrequencyPointMessageData(cmdData,
133-
cmdDataLen,
134-
occ->wofResetCount());
133+
cmdDataLen);
135134
break;
136135

137136
case OCC_CFGDATA_OCC_ROLE:
@@ -1066,8 +1065,6 @@ void getGPUConfigMessageData(const TargetHandle_t i_occ,
10661065

10671066
uint16_t power = 0;
10681067
power = sys->getAttr<ATTR_CALCULATED_MAX_SYS_POWER_EXCLUDING_GPUS>();
1069-
//uint16_t miscpwr =
1070-
// sys->getAttr<ATTR_MISC_SYSTEM_COMPONENTS_MAX_POWER_WATTS>();
10711068
UINT16_PUT(&o_data[index], power); // Total non-GPU max power (W)
10721069
index += 2;
10731070

@@ -1154,8 +1151,7 @@ void getGPUConfigMessageData(const TargetHandle_t i_occ,
11541151

11551152

11561153
void getFrequencyPointMessageData(uint8_t* o_data,
1157-
uint64_t & o_size,
1158-
uint8_t i_wofResetCount )
1154+
uint64_t & o_size)
11591155
{
11601156
uint64_t index = 0;
11611157
uint16_t min = 0;
@@ -1177,73 +1173,13 @@ void getFrequencyPointMessageData(uint8_t* o_data,
11771173
memcpy(&o_data[index], &nominal, 2);
11781174
index += 2;
11791175

1180-
uint8_t turboAllowed =
1181-
sys->getAttr<ATTR_OPEN_POWER_TURBO_MODE_SUPPORTED>();
1182-
1183-
if (turboAllowed)
1184-
{
1185-
turbo = sys->getAttr<ATTR_FREQ_CORE_MAX>();
1186-
1187-
//Ultra Turbo Frequency in MHz
1188-
ATTR_SYSTEM_WOF_DISABLE_type wofSupported;
1189-
if (!sys->tryGetAttr<ATTR_SYSTEM_WOF_DISABLE>(wofSupported))
1190-
{
1191-
ultra = WOF_SYSTEM_DISABLED;
1192-
G_wofSupported = false;
1193-
}
1194-
else
1195-
{
1196-
uint16_t tempUt = sys->getAttr<ATTR_ULTRA_TURBO_FREQ_MHZ>();
1197-
if( wofSupported == SYSTEM_WOF_DISABLE_ON )
1198-
{
1199-
TMGT_INF("System does not support WOF");
1200-
G_wofSupported = false;
1201-
ultra = WOF_SYSTEM_DISABLED;
1202-
}
1203-
else if( tempUt == 0 )
1204-
{
1205-
TMGT_INF("Missing Ultra Turbo VPD point. WOF disabled.");
1206-
G_wofSupported = false;
1207-
ultra = WOF_MISSING_ULTRA_TURBO;
1208-
}
1209-
else if( i_wofResetCount >= WOF_RESET_COUNT_THRESHOLD )
1210-
{
1211-
TMGT_INF("WOF reset count reached. WOF disabled.");
1212-
G_wofSupported = false;
1213-
ultra = WOF_RESET_COUNT_REACHED;
1214-
}
1215-
else if( turbo <= nominal )
1216-
{
1217-
TMGT_INF("Turbo is less than nominal. WOF disabled.");
1218-
G_wofSupported = false;
1219-
ultra = WOF_UNSUPPORTED_FREQ;
1220-
}
1221-
else if( tempUt <= turbo )
1222-
{
1223-
TMGT_INF("Ultra Turbo is less than Turbo. WOF disabled.");
1224-
G_wofSupported = false;
1225-
ultra = WOF_UNSUPPORTED_FREQ;
1226-
}
1227-
else
1228-
{
1229-
ultra = tempUt;
1230-
}
1231-
1232-
}
1233-
1234-
if( !G_wofSupported )
1235-
{
1236-
TMGT_INF("getFrequencyPoint: WOF not enabled! RC = %x", ultra);
1237-
}
1238-
}
1239-
else
1176+
check_wof_support(turbo, ultra);
1177+
if (turbo == 0)
12401178
{
12411179
// If turbo not supported, send nominal for turbo
12421180
// and reason code for ultra-turbo (no WOF support)
1243-
TMGT_INF("getFrequencyPoint: Turbo/WOF not supported");
12441181
turbo = nominal;
12451182
ultra = WOF_UNSUPPORTED_FREQ;
1246-
G_wofSupported = false;
12471183
}
12481184

12491185
//Turbo Frequency in MHz
@@ -1375,4 +1311,97 @@ void getApssMessageData(uint8_t* o_data,
13751311
}
13761312

13771313

1378-
}// namespace HTMGT
1314+
// Determine if WOF is supported and what the turbo/ultra frequencies are
1315+
bool check_wof_support(uint16_t & o_turbo, uint16_t & o_ultra)
1316+
{
1317+
o_turbo = 0;
1318+
o_ultra = 0;
1319+
1320+
Target* sys = nullptr;
1321+
targetService().getTopLevelTarget(sys);
1322+
assert(sys != nullptr);
1323+
1324+
uint8_t turboAllowed =
1325+
sys->getAttr<ATTR_OPEN_POWER_TURBO_MODE_SUPPORTED>();
1326+
if (turboAllowed)
1327+
{
1328+
o_turbo = sys->getAttr<ATTR_FREQ_CORE_MAX>();
1329+
1330+
//Ultra Turbo Frequency in MHz
1331+
ATTR_SYSTEM_WOF_DISABLE_type wofSupported;
1332+
if (!sys->tryGetAttr<ATTR_SYSTEM_WOF_DISABLE>(wofSupported))
1333+
{
1334+
o_ultra = WOF_SYSTEM_DISABLED;
1335+
G_wofSupported = false;
1336+
}
1337+
else
1338+
{
1339+
// Loop through all functional OCCs
1340+
uint8_t largest_wof_reset_count = 0;
1341+
uint8_t occ_instance = 0;
1342+
std::vector<Occ*> occList = OccManager::getOccArray();
1343+
for ( const auto & occ : occList )
1344+
{
1345+
if (occ->wofResetCount() > largest_wof_reset_count)
1346+
{
1347+
occ_instance = occ->getInstance();
1348+
largest_wof_reset_count = occ->wofResetCount();
1349+
}
1350+
}
1351+
const uint16_t nominal = sys->getAttr<ATTR_NOMINAL_FREQ_MHZ>();
1352+
const uint16_t tempUt = sys->getAttr<ATTR_ULTRA_TURBO_FREQ_MHZ>();
1353+
if( wofSupported == SYSTEM_WOF_DISABLE_ON )
1354+
{
1355+
TMGT_INF("System does not support WOF");
1356+
G_wofSupported = false;
1357+
o_ultra = WOF_SYSTEM_DISABLED;
1358+
}
1359+
else if( tempUt == 0 )
1360+
{
1361+
TMGT_INF("Missing Ultra Turbo VPD point. WOF disabled.");
1362+
G_wofSupported = false;
1363+
o_ultra = WOF_MISSING_ULTRA_TURBO;
1364+
}
1365+
else if( largest_wof_reset_count >= WOF_RESET_COUNT_THRESHOLD )
1366+
{
1367+
TMGT_INF("WOF reset count reached for OCC%d. WOF disabled.",
1368+
occ_instance);
1369+
G_wofSupported = false;
1370+
o_ultra = WOF_RESET_COUNT_REACHED;
1371+
}
1372+
else if( o_turbo <= nominal )
1373+
{
1374+
TMGT_INF("Turbo (%d) < nominal (%d). WOF disabled.",
1375+
o_turbo, nominal);
1376+
G_wofSupported = false;
1377+
o_ultra = WOF_UNSUPPORTED_FREQ;
1378+
}
1379+
else if( tempUt <= o_turbo )
1380+
{
1381+
TMGT_INF("Ultra Turbo (%d) < Turbo (%d). WOF disabled.",
1382+
tempUt, o_turbo);
1383+
G_wofSupported = false;
1384+
o_ultra = WOF_UNSUPPORTED_FREQ;
1385+
}
1386+
else
1387+
{
1388+
o_ultra = tempUt;
1389+
}
1390+
}
1391+
1392+
if( !G_wofSupported )
1393+
{
1394+
TMGT_INF("check_wof_support: WOF not enabled! RC = 0x%04X",o_ultra);
1395+
}
1396+
}
1397+
else
1398+
{
1399+
TMGT_INF("check_wof_support: Turbo/WOF not supported");
1400+
G_wofSupported = false;
1401+
}
1402+
1403+
return G_wofSupported;
1404+
} // end check_wof_support()
1405+
1406+
1407+
}

src/usr/htmgt/htmgt_cfgdata.H

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ namespace HTMGT
127127
{ OCC_CFGDATA_MEM_THROTTLE, TARGET_ALL, TO_20SEC, CFGSTATE_ALL },
128128
{ OCC_CFGDATA_TCT_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL },
129129
{ OCC_CFGDATA_AVSBUS_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL },
130+
// GPU config packet MUST be sent after APSS config
130131
{ OCC_CFGDATA_GPU_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL },
131132
};
132133
const size_t OCC_CONFIG_TABLE_SIZE = sizeof(occCfgDataTable) /
@@ -256,13 +257,10 @@ namespace HTMGT
256257
*
257258
* @param[out] o_data - preallocated buffer to fill in
258259
* @param[out] o_size - set to the message size
259-
* @param[in] i_wofResetCount - Number of times OCC requested a reset
260-
* due to WOF
261260
* @pre o_data is large enough.
262261
*/
263262
void getFrequencyPointMessageData(uint8_t* o_data,
264-
uint64_t & o_size,
265-
uint8_t i_wofResetCount );
263+
uint64_t & o_size);
266264

267265
/**
268266
* Generate the APSS configuration message
@@ -273,5 +271,11 @@ namespace HTMGT
273271
void getApssMessageData(uint8_t* o_data,
274272
uint64_t & o_size);
275273

274+
/**
275+
* Determine if WOF is supported and if so return frequencies
276+
* @param[out] turbo Turbo frequency in MHz (0 = no support)
277+
* @param[out] ultra Ultra Turbo frequency in MHz (0 = no support)
278+
*/
279+
bool check_wof_support(uint16_t & turbo, uint16_t & ultra);
276280
};
277281
#endif

0 commit comments

Comments
 (0)