From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: will@kernel.org, mark.rutland@arm.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, ilkka@os.amperecomputing.com
Subject: Re: [PATCH 1/8] perf/arm-cmn: Refactor node ID handling. Again.
Date: Fri, 23 Aug 2024 18:00:33 -0700 (PDT) [thread overview]
Message-ID: <ab1b89c7-7bf-78d2-50ca-3411e511ec33@os.amperecomputing.com> (raw)
In-Reply-To: <998064aa2bdb0e39f91b4f1fea2f428689978ea9.1723229941.git.robin.murphy@arm.com>
On Fri, 9 Aug 2024, Robin Murphy wrote:
> It transpires that despite the explicit example to the contrary in the
> CMN-700 TRM, the "extra device ports" config is in fact a per-XP thing
> rather than a global one. To that end, rework node IDs yet again to
> carry around the additional data necessary to decode them properly. At
> this point the notion of fully decomposing an ID becomes more
> impractical than it's worth, so unabstracting the XY mesh coordinates
> (where 2/3 users were just debug anyway) ends up leaving things a bit
> simpler overall.
>
> Fixes: 60d1504070c2 ("perf/arm-cmn: Support new IP features")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/perf/arm-cmn.c | 94 ++++++++++++++++++------------------------
> 1 file changed, 40 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index c932d9d355cf..fd2122a37f22 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -357,49 +352,33 @@ struct arm_cmn {
> static int arm_cmn_hp_state;
>
> struct arm_cmn_nodeid {
> - u8 x;
> - u8 y;
> u8 port;
> u8 dev;
> };
>
> static int arm_cmn_xyidbits(const struct arm_cmn *cmn)
> {
> - return fls((cmn->mesh_x - 1) | (cmn->mesh_y - 1) | 2);
> + return fls((cmn->mesh_x - 1) | (cmn->mesh_y - 1));
> }
>
> -static struct arm_cmn_nodeid arm_cmn_nid(const struct arm_cmn *cmn, u16 id)
> +static struct arm_cmn_nodeid arm_cmn_nid(const struct arm_cmn_node *dn)
> {
> struct arm_cmn_nodeid nid;
>
> - if (cmn->num_xps == 1) {
> - nid.x = 0;
> - nid.y = 0;
> - nid.port = CMN_NODEID_1x1_PID(id);
> - nid.dev = CMN_NODEID_DEVID(id);
> - } else {
> - int bits = arm_cmn_xyidbits(cmn);
> -
> - nid.x = CMN_NODEID_X(id, bits);
> - nid.y = CMN_NODEID_Y(id, bits);
> - if (cmn->ports_used & 0xc) {
> - nid.port = CMN_NODEID_EXT_PID(id);
> - nid.dev = CMN_NODEID_EXT_DEVID(id);
> - } else {
> - nid.port = CMN_NODEID_PID(id);
> - nid.dev = CMN_NODEID_DEVID(id);
> - }
> - }
> + nid.dev = dn->id & ((1U << dn->deviceid_bits) - 1);
> + nid.port = (dn->id >> dn->deviceid_bits) & ((1U << dn->portid_bits) - 1);
> return nid;
> }
>
> static struct arm_cmn_node *arm_cmn_node_to_xp(const struct arm_cmn *cmn,
> const struct arm_cmn_node *dn)
> {
> - struct arm_cmn_nodeid nid = arm_cmn_nid(cmn, dn->id);
> - int xp_idx = cmn->mesh_x * nid.y + nid.x;
> + int id = dn->id >> (dn->portid_bits + dn->deviceid_bits);
> + int bits = arm_cmn_xyidbits(cmn);
> + int x = id > bits;
^^^
Instead of comparison, shouldn't that be bit shift?
Cheers, Ilkka
> + int y = id & ((1U << bits) - 1);
>
> - return cmn->xps + xp_idx;
> + return cmn->xps + cmn->mesh_x * y + x;
> }
> static struct arm_cmn_node *arm_cmn_node(const struct arm_cmn *cmn,
> enum cmn_node_type type)
>
next prev parent reply other threads:[~2024-08-24 1:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 19:15 [PATCH 0/8] perf/arm-cmn: Fixes and updates Robin Murphy
2024-08-09 19:15 ` [PATCH 1/8] perf/arm-cmn: Refactor node ID handling. Again Robin Murphy
2024-08-16 9:33 ` Mark Rutland
2024-08-16 11:56 ` Robin Murphy
2024-08-16 12:45 ` Mark Rutland
2024-08-16 13:21 ` Robin Murphy
2024-08-24 1:00 ` Ilkka Koskinen [this message]
2024-08-27 13:51 ` Robin Murphy
2024-08-09 19:15 ` [PATCH 2/8] perf/arm-cmn: Fix CCLA register offset Robin Murphy
2024-08-16 10:00 ` Mark Rutland
2024-08-16 18:33 ` Robin Murphy
2024-08-23 23:18 ` Ilkka Koskinen
2024-08-09 19:15 ` [PATCH 3/8] perf/arm-cmn: Ensure dtm_idx is big enough Robin Murphy
2024-08-16 10:14 ` Mark Rutland
2024-08-19 15:00 ` Robin Murphy
2024-08-20 9:27 ` Mark Rutland
2024-08-23 23:58 ` Ilkka Koskinen
2024-08-09 19:15 ` [PATCH 4/8] perf/arm-cmn: Improve build-time assertions Robin Murphy
2024-08-16 10:20 ` Mark Rutland
2024-08-09 19:15 ` [PATCH 5/8] perf/arm-cmn: Make cycle counts less surprising Robin Murphy
2024-08-16 10:25 ` Mark Rutland
2024-08-19 16:35 ` Robin Murphy
2024-08-09 19:15 ` [PATCH 6/8] perf/arm-cmn: Refactor DTC PMU register access Robin Murphy
2024-08-16 10:29 ` Mark Rutland
2024-08-19 16:41 ` Robin Murphy
2024-08-20 9:23 ` Mark Rutland
2024-08-23 23:46 ` Ilkka Koskinen
2024-08-09 19:15 ` [PATCH 7/8] dt-bindings: perf: arm-cmn: Add CMN S3 Robin Murphy
2024-08-15 15:20 ` Rob Herring (Arm)
2024-08-09 19:15 ` [PATCH 8/8] perf/arm-cmn: Support " Robin Murphy
2024-08-16 10:32 ` Mark Rutland
2024-08-23 23:38 ` Ilkka Koskinen
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=ab1b89c7-7bf-78d2-50ca-3411e511ec33@os.amperecomputing.com \
--to=ilkka@os.amperecomputing.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®