mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Robin Murphy <robin.murphy@arm.com>
Cc: Stephane Eranian <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp()
Date: Wed, 20 Nov 2024 08:41:10 -0800	[thread overview]
Message-ID: <20241120164110.266297-1-namhyung@kernel.org> (raw)

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@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


             reply	other threads:[~2024-11-20 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 16:41 Namhyung Kim [this message]
2024-11-20 16:55 ` Robin Murphy
2024-11-20 18:44   ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241120164110.266297-1-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=eranian@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®