[PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp()

Namhyung Kim namhyung at kernel.org
Wed Nov 20 08:41:10 PST 2024


The portid_bits and deviceid_bits for XP type nodes are set in the
arm_cmn_discover() and it's copied to others in arm_cmn_init_dtcs().
But to get the XP from a node in the arm_cmn_init_dtcs(), it needs
the {port,device}id_bits.

This makes arm-cmn PMU failing to count events on my setup.  What we
need is the number of bits in total which is known by the cmn config.

Fixes: e79634b53e39 ("perf/arm-cmn: Refactor node ID handling. Again.")
Signed-off-by: Namhyung Kim <namhyung at kernel.org>
---
 drivers/perf/arm-cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 49bd811c6fd6efdd..0e0d2f5cfdaea890 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -386,7 +386,7 @@ static struct arm_cmn_nodeid arm_cmn_nid(const struct arm_cmn_node *dn)
 static struct arm_cmn_node *arm_cmn_node_to_xp(const struct arm_cmn *cmn,
 					       const struct arm_cmn_node *dn)
 {
-	int id = dn->id >> (dn->portid_bits + dn->deviceid_bits);
+	int id = dn->id >> (cmn->num_xps == 1 ? 5 : 3);
 	int bits = arm_cmn_xyidbits(cmn);
 	int x = id >> bits;
 	int y = id & ((1U << bits) - 1);

base-commit: bf9aa14fc523d2763fc9a10672a709224e8fcaf4
-- 
2.47.0.338.g60cca15819-goog




More information about the linux-arm-kernel mailing list