Skip to content

Commit e3e73f5

Browse files
rmurphy-armwilldeacon
authored andcommitted
perf/arm-cmn: Fix DTC domain detection
It transpires that dtm_unit_info is another register which got shuffled in CMN-700 without me noticing. Fix that in a way which also proactively fixes the fragile laziness of its consumer, just in case any further fields ever get added alongside dtc_domain. Fixes: 23760a0 ("perf/arm-cmn: Add CMN-700 support") Signed-off-by: Robin Murphy <[email protected]> Reviewed-by: Ilkka Koskinen <[email protected]> Link: https://lore.kernel.org/r/3076ee83d0554f6939fbb6ee49ab2bdb28d8c7ee.1697824215.git.robin.murphy@arm.com Signed-off-by: Will Deacon <[email protected]>
1 parent 3b9a22d commit e3e73f5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/perf/arm-cmn.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@
112112

113113
#define CMN_DTM_PMEVCNTSR 0x240
114114

115-
#define CMN_DTM_UNIT_INFO 0x0910
115+
#define CMN650_DTM_UNIT_INFO 0x0910
116+
#define CMN_DTM_UNIT_INFO 0x0960
117+
#define CMN_DTM_UNIT_INFO_DTC_DOMAIN GENMASK_ULL(1, 0)
116118

117119
#define CMN_DTM_NUM_COUNTERS 4
118120
/* Want more local counters? Why not replicate the whole DTM! Ugh... */
@@ -2117,6 +2119,16 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn)
21172119
return 0;
21182120
}
21192121

2122+
static unsigned int arm_cmn_dtc_domain(struct arm_cmn *cmn, void __iomem *xp_region)
2123+
{
2124+
int offset = CMN_DTM_UNIT_INFO;
2125+
2126+
if (cmn->part == PART_CMN650 || cmn->part == PART_CI700)
2127+
offset = CMN650_DTM_UNIT_INFO;
2128+
2129+
return FIELD_GET(CMN_DTM_UNIT_INFO_DTC_DOMAIN, readl_relaxed(xp_region + offset));
2130+
}
2131+
21202132
static void arm_cmn_init_node_info(struct arm_cmn *cmn, u32 offset, struct arm_cmn_node *node)
21212133
{
21222134
int level;
@@ -2248,7 +2260,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
22482260
if (cmn->part == PART_CMN600)
22492261
xp->dtc = 0xf;
22502262
else
2251-
xp->dtc = 1 << readl_relaxed(xp_region + CMN_DTM_UNIT_INFO);
2263+
xp->dtc = 1 << arm_cmn_dtc_domain(cmn, xp_region);
22522264

22532265
xp->dtm = dtm - cmn->dtms;
22542266
arm_cmn_init_dtm(dtm++, xp, 0);

0 commit comments

Comments
 (0)