Skip to content

Commit 71d9884

Browse files
BenAtIBMcrgeddes
authored andcommitted
Update p9_l2_flush to check if purge is busy on anything prior to flush.
The previous check was only checking once if CMD_REG_BUSY is off. This will now check if CMD_PRGSM_BUSY is off, indicating the Purge engine is not busy with any requests at all. It will also poll on busy prior to issuing the flush. If PURGE_CMD_ERR is on prior to starting flush a warning will be printed via FAPI_DBG. PURGE_CMD_ERR will be cleared prior to issuing the purge. Change-Id: I120cc9a00d26da8cf2ca4ec6dd7d8f3006633b61 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72562 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: MURULIDHAR NATARAJU <murulidhar@in.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72583 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
1 parent d27c5e1 commit 71d9884

File tree

3 files changed

+118
-6
lines changed

3 files changed

+118
-6
lines changed

src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.C

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -57,6 +57,72 @@ enum
5757
// Function definitions
5858
//------------------------------------------------------------------------------
5959

60+
/// See doxygen in header file
61+
fapi2::ReturnCode purgeReadyCheck(
62+
const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
63+
const uint64_t i_busyCount,
64+
fapi2::buffer<uint64_t>& o_prdPurgeCmdReg)
65+
{
66+
FAPI_DBG("Entering purgeReadyCheck");
67+
uint64_t l_loopCount = 0;
68+
69+
do
70+
{
71+
FAPI_TRY(fapi2::getScom(i_target, EX_PRD_PURGE_CMD_REG, o_prdPurgeCmdReg),
72+
"Error from getScom EX_PRD_PURGE_CMD_REG");
73+
74+
// Check the EX_PRD_PURGE_CMD_REG_BUSY bit from scom register
75+
if ( !o_prdPurgeCmdReg.getBit(EX_PRD_PURGE_CMD_REG_PRGSM_BUSY))
76+
{
77+
// PURGE is done, get out
78+
break;
79+
}
80+
else
81+
{
82+
l_loopCount++;
83+
84+
if (l_loopCount > i_busyCount)
85+
{
86+
// Time out, exit loop
87+
break;
88+
}
89+
90+
// Delay 10ns for each loop
91+
FAPI_TRY(fapi2::delay(P9_L2_FLUSH_HW_NS_DELAY,
92+
P9_L2_FLUSH_SIM_CYCLE_DELAY),
93+
"Fapi Delay call failed.");
94+
}
95+
}
96+
while (1);
97+
98+
// Error out if still busy
99+
if (l_loopCount > i_busyCount)
100+
{
101+
// engine busy, dump status
102+
FAPI_DBG("Purge engine busy (reg_busy = %d, busy_on_this = %d,"
103+
" sm_busy = %d)",
104+
o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_BUSY>(),
105+
o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_PRGSM_BUSY_ON_THIS>(),
106+
o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_PRGSM_BUSY>());
107+
108+
FAPI_ASSERT(false, fapi2::P9_PURGE_READY_COMPLETE_TIMEOUT()
109+
.set_TARGET(i_target)
110+
.set_COUNT_THRESHOLD(i_busyCount)
111+
.set_CMD_REG(o_prdPurgeCmdReg),
112+
"Previous purge request has not completed prior to issuing L2 flush.");
113+
}
114+
115+
if (o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_ERR>())
116+
{
117+
FAPI_INF("WARNING: EX_PRD_PURGE_CMD_REG_ERR set prior to L2 flush");
118+
}
119+
120+
fapi_try_exit:
121+
FAPI_DBG("Exiting purgeReadyCheck - Counter: %d; prdPurgeCmdReg: 0x%.16llX",
122+
l_loopCount, o_prdPurgeCmdReg);
123+
return fapi2::current_err;
124+
}
125+
60126
/// See doxygen in header file
61127
fapi2::ReturnCode purgeCompleteCheck(
62128
const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
@@ -79,7 +145,7 @@ fapi2::ReturnCode purgeCompleteCheck(
79145
"Purge failed. EX_PRD_PURGE_CMD_REG_ERR set");
80146

81147
// Check the EX_PRD_PURGE_CMD_REG_BUSY bit from scom register
82-
if ( !o_prdPurgeCmdReg.getBit(EX_PRD_PURGE_CMD_REG_BUSY) )
148+
if ( !o_prdPurgeCmdReg.getBit(EX_PRD_PURGE_CMD_REG_BUSY))
83149
{
84150
// PURGE is done, get out
85151
break;
@@ -140,6 +206,7 @@ fapi2::ReturnCode setupAndTriggerPrdPurge(
140206
// ensure PURGE_CMD_TYPE/MEM/CGC/BANK are clear to specify flush
141207
// of entire cache
142208
FAPI_DBG("Write L2 Purge Engine Command Register to initiate cache flush");
209+
l_cmdReg.clearBit<EX_PRD_PURGE_CMD_REG_ERR>();
143210
l_cmdReg.insert<EX_PRD_PURGE_CMD_REG_TYPE,
144211
EX_PRD_PURGE_CMD_REG_TYPE_LEN>(i_purgeData.iv_cmdType);
145212
l_cmdReg.insert<EX_PRD_PURGE_CMD_REG_MEM,
@@ -176,8 +243,8 @@ fapi2::ReturnCode l2_flush_start(
176243

177244
// Ensure that purge engine is idle before starting flush
178245
// poll Purge Engine status
179-
FAPI_TRY(purgeCompleteCheck(i_target, 0, l_cmdReg), // 0 = no wait
180-
"Error returned from purgeCompleteCheck call");
246+
FAPI_TRY(purgeReadyCheck(i_target, P9_L2_FLUSH_MAX_POLLS, l_cmdReg), // 0 = no wait
247+
"Error returned from purgeReadyCheck call");
181248

182249
FAPI_TRY(setupAndTriggerPrdPurge(i_target, i_purgeData, l_cmdReg),
183250
"Error returned from setupAndTriggerPrdPurge");

src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.H

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -93,6 +93,23 @@ typedef fapi2::ReturnCode (*p9_l2_flush_FP_t)
9393
extern "C"
9494
{
9595

96+
///-----------------------------------------------------------------------------
97+
///
98+
/// @brief Check if any purge is in progress before issuing a new one.
99+
///
100+
/// @param[in] i_target => EX chiplet target
101+
/// @param[in] i_busyCount => Max busy count waiting for idle
102+
/// @param[out] o_prdPurgeCmdReg => EX_PRD_PURGE_CMD_REG value.
103+
///
104+
/// @return FAPI2_RC_SUCCESS if engine status returns as idle (with no errors)
105+
/// before maximum number of polls has been reached
106+
/// else, return error.
107+
fapi2::ReturnCode purgeReadyCheck(
108+
const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
109+
const uint64_t i_busyCount,
110+
fapi2::buffer<uint64_t>& o_prdPurgeCmdReg);
111+
112+
///-----------------------------------------------------------------------------
96113
///
97114
/// @brief Utility function to check for a purge operation to be completed.
98115
/// This function polls the EX_PRD_PURGE_CMD_REG_BUSY bit of

src/import/chips/p9/procedures/xml/error_info/p9_l2_flush_errors.xml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!-- -->
66
<!-- OpenPOWER HostBoot Project -->
77
<!-- -->
8-
<!-- Contributors Listed Below - COPYRIGHT 2015,2017 -->
8+
<!-- Contributors Listed Below - COPYRIGHT 2015,2019 -->
99
<!-- [+] International Business Machines Corp. -->
1010
<!-- -->
1111
<!-- -->
@@ -100,5 +100,33 @@
100100
</callout>
101101
</hwpError>
102102
<!-- ********************************************************************* -->
103+
<hwpError>
104+
<rc>RC_P9_PURGE_READY_COMPLETE_TIMEOUT</rc>
105+
<ffdc>TARGET</ffdc>
106+
<ffdc>CMD_REG</ffdc>
107+
<ffdc>COUNT_THRESHOLD</ffdc>
108+
<description>
109+
Procedure: p9_l2_flush
110+
Timed out waiting for purge busy indication to clear in L2 Purge Engine
111+
Prior to issuing the L2 flush via register.
112+
</description>
113+
<collectRegisterFfdc>
114+
<id>REG_FFDC_PROC_L2_REGISTERS</id>
115+
<target>TARGET</target>
116+
<targetType>TARGET_TYPE_PROC_CHIP</targetType>
117+
</collectRegisterFfdc>
118+
<callout>
119+
<target>TARGET</target>
120+
<priority>HIGH</priority>
121+
</callout>
122+
<deconfigure>
123+
<target>TARGET</target>
124+
</deconfigure>
125+
<callout>
126+
<procedure>CODE</procedure>
127+
<priority>LOW</priority>
128+
</callout>
129+
</hwpError>
130+
<!-- ********************************************************************* -->
103131

104132
</hwpErrors>

0 commit comments

Comments
 (0)