Commit aeb8595a authored by James Morse's avatar James Morse
Browse files

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: default avatarPunit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: default avatarGavin Shan <gshan@redhat.com>
Tested-by: default avatarShaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: default avatarJesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: default avatarZeng Heng <zengheng4@huawei.com>
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Co-developed-by: default avatarBen Horgan <ben.horgan@arm.com>
Signed-off-by: default avatarBen Horgan <ben.horgan@arm.com>
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
parent dc48eb1f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -214,6 +214,9 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| ARM            | SI L1           | #4311569        | ARM64_ERRATUM_4311569       |
+----------------+-----------------+-----------------+-----------------------------+
| ARM            | CMN-650         | #3642720        | N/A                         |
+----------------+-----------------+-----------------+-----------------------------+
+----------------+-----------------+-----------------+-----------------------------+
| Broadcom       | Brahma-B53      | N/A             | ARM64_ERRATUM_845719        |
+----------------+-----------------+-----------------+-----------------------------+
| Broadcom       | Brahma-B53      | N/A             | ARM64_ERRATUM_843419        |
+12 −0
Original line number Diff line number Diff line
@@ -691,6 +691,12 @@ static const struct mpam_quirk mpam_quirks[] = {
		.iidr_mask  = MPAM_IIDR_MATCH_ONE,
		.workaround = T241_MBW_COUNTER_SCALE_64,
	},
	{
	/* ARM CMN-650 CSU erratum 3642720 */
	.iidr       = MPAM_IIDR_ARM_CMN_650,
	.iidr_mask  = MPAM_IIDR_MATCH_ONE,
	.workaround = IGNORE_CSU_NRDY,
	},
	{ NULL } /* Sentinel */
};

@@ -1003,6 +1009,7 @@ struct mon_read {
	enum mpam_device_features	type;
	u64				*val;
	int				err;
	bool				waited_timeout;
};

static bool mpam_ris_has_mbwu_long_counter(struct mpam_msc_ris *ris)
@@ -1249,6 +1256,10 @@ static void __ris_msmon_read(void *arg)
		if (mpam_has_feature(mpam_feat_msmon_csu_hw_nrdy, rprops))
			nrdy = now & MSMON___NRDY;
		now = FIELD_GET(MSMON___VALUE, now);

		if (mpam_has_quirk(IGNORE_CSU_NRDY, msc) && m->waited_timeout)
			nrdy = false;

		break;
	case mpam_feat_msmon_mbwu_31counter:
	case mpam_feat_msmon_mbwu_44counter:
@@ -1386,6 +1397,7 @@ int mpam_msmon_read(struct mpam_component *comp, struct mon_cfg *ctx,
			.ctx = ctx,
			.type = type,
			.val = val,
			.waited_timeout = true,
		};
		*val = 0;

+6 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ enum mpam_device_quirks {
	T241_SCRUB_SHADOW_REGS,
	T241_FORCE_MBW_MIN_TO_ONE,
	T241_MBW_COUNTER_SCALE_64,
	IGNORE_CSU_NRDY,
	MPAM_QUIRK_LAST
};

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

#define MPAM_IIDR_ARM_CMN_650	(FIELD_PREP_CONST(MPAMF_IIDR_PRODUCTID,   0)	 | \
				 FIELD_PREP_CONST(MPAMF_IIDR_VARIANT,     0)	 | \
				 FIELD_PREP_CONST(MPAMF_IIDR_REVISION,    0)	 | \
				 FIELD_PREP_CONST(MPAMF_IIDR_IMPLEMENTER, 0x43b))

/* The values for MSMON_CFG_MBWU_FLT.RWBW */
enum mon_filter_options {
	COUNT_BOTH	= 0,