Skip to content

Commit aeb8595

Browse files
author
James Morse
committed
arm_mpam: Quirk CMN-650's CSU NRDY behaviour
CMN-650 is afflicted with an erratum where the CSU NRDY bit never clears. This tells us the monitor never finishes scanning the cache. The erratum document says to wait the maximum time, then ignore the field. Add a flag to indicate whether this is the final attempt to read the counter, and when this quirk is applied, ignore the NRDY field. This means accesses to this counter will always retry, even if the counter was previously programmed to the same values. The counter value is not expected to be stable, it drifts up and down with each allocation and eviction. The CSU register provides the value for a point in time. Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com> Tested-by: Gavin Shan <gshan@redhat.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Jesse Chick <jessechick@os.amperecomputing.com> Reviewed-by: Zeng Heng <zengheng4@huawei.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Co-developed-by: Ben Horgan <ben.horgan@arm.com> Signed-off-by: Ben Horgan <ben.horgan@arm.com> Signed-off-by: James Morse <james.morse@arm.com>
1 parent dc48eb1 commit aeb8595

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

Documentation/arch/arm64/silicon-errata.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ stable kernels.
214214
+----------------+-----------------+-----------------+-----------------------------+
215215
| ARM | SI L1 | #4311569 | ARM64_ERRATUM_4311569 |
216216
+----------------+-----------------+-----------------+-----------------------------+
217+
| ARM | CMN-650 | #3642720 | N/A |
218+
+----------------+-----------------+-----------------+-----------------------------+
219+
+----------------+-----------------+-----------------+-----------------------------+
217220
| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_845719 |
218221
+----------------+-----------------+-----------------+-----------------------------+
219222
| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_843419 |

drivers/resctrl/mpam_devices.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,12 @@ static const struct mpam_quirk mpam_quirks[] = {
691691
.iidr_mask = MPAM_IIDR_MATCH_ONE,
692692
.workaround = T241_MBW_COUNTER_SCALE_64,
693693
},
694+
{
695+
/* ARM CMN-650 CSU erratum 3642720 */
696+
.iidr = MPAM_IIDR_ARM_CMN_650,
697+
.iidr_mask = MPAM_IIDR_MATCH_ONE,
698+
.workaround = IGNORE_CSU_NRDY,
699+
},
694700
{ NULL } /* Sentinel */
695701
};
696702

@@ -1003,6 +1009,7 @@ struct mon_read {
10031009
enum mpam_device_features type;
10041010
u64 *val;
10051011
int err;
1012+
bool waited_timeout;
10061013
};
10071014

10081015
static bool mpam_ris_has_mbwu_long_counter(struct mpam_msc_ris *ris)
@@ -1249,6 +1256,10 @@ static void __ris_msmon_read(void *arg)
12491256
if (mpam_has_feature(mpam_feat_msmon_csu_hw_nrdy, rprops))
12501257
nrdy = now & MSMON___NRDY;
12511258
now = FIELD_GET(MSMON___VALUE, now);
1259+
1260+
if (mpam_has_quirk(IGNORE_CSU_NRDY, msc) && m->waited_timeout)
1261+
nrdy = false;
1262+
12521263
break;
12531264
case mpam_feat_msmon_mbwu_31counter:
12541265
case mpam_feat_msmon_mbwu_44counter:
@@ -1386,6 +1397,7 @@ int mpam_msmon_read(struct mpam_component *comp, struct mon_cfg *ctx,
13861397
.ctx = ctx,
13871398
.type = type,
13881399
.val = val,
1400+
.waited_timeout = true,
13891401
};
13901402
*val = 0;
13911403

drivers/resctrl/mpam_internal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ enum mpam_device_quirks {
226226
T241_SCRUB_SHADOW_REGS,
227227
T241_FORCE_MBW_MIN_TO_ONE,
228228
T241_MBW_COUNTER_SCALE_64,
229+
IGNORE_CSU_NRDY,
229230
MPAM_QUIRK_LAST
230231
};
231232

@@ -251,6 +252,11 @@ struct mpam_quirk {
251252
FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
252253
FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x36b))
253254

255+
#define MPAM_IIDR_ARM_CMN_650 (FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID, 0) | \
256+
FIELD_PREP_CONST(MPAMF_IIDR_VARIANT, 0) | \
257+
FIELD_PREP_CONST(MPAMF_IIDR_REVISION, 0) | \
258+
FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x43b))
259+
254260
/* The values for MSMON_CFG_MBWU_FLT.RWBW */
255261
enum mon_filter_options {
256262
COUNT_BOTH = 0,

0 commit comments

Comments
 (0)