From: Robin Murphy <robin.murphy@arm.com>
To: Shouping Wang <allen.wang@hj-micro.com>, will@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, mark.rutland@arm.com,
peter.du@hj-micro.com, andy.xu@hj-micro.com
Subject: Re: [PATCH] perf/arm-cmn: Fix {wp_dev_sel2, wp_dev_sel} limited to 0/1 when MXP_MULTIPLE_DTM_EN is TRUE
Date: Wed, 9 Sep 2026 17:19:01 +0100 [thread overview]
Message-ID: <2fb3bda7-cd64-4dc0-99f8-c0fda8d42cf9@arm.com> (raw)
In-Reply-To: <20260819105443.668784-1-allen.wang@hj-micro.com>
On 19/08/2026 11:54 am, Shouping Wang wrote:
> When MXP_MULTIPLE_DTM_EN is TRUE, each DTM will monitor at most
> two device ports. In this case, {wp_dev_sel2, wp_dev_sel} will
> only use values 2'b00 and 2'b01 per DTM.
>
> Previously the setting allowed values beyond the supported range
> per DTM, which could cause each DTM to select invalid ports when
> MXP_MULTIPLE_DTM_EN is TRUE.
>
> Fix this by applying `dev %= 2` to clamp the selection value to
> the valid range when MXP_MULTIPLE_DTM_EN is TRUE.
>
> Fixes: 60d1504070c2 ("perf/arm-cmn: Support new IP features")
> Signed-off-by: Shouping Wang <allen.wang@hj-micro.com>
> ---
> drivers/perf/arm-cmn.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 40c05c519a1d..13ccbf2a7345 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1392,6 +1392,7 @@ static void arm_cmn_claim_wp_idx(struct arm_cmn_dtm *dtm,
>
> static u32 arm_cmn_wp_config(struct perf_event *event, int wp_idx)
> {
> + struct arm_cmn *cmn = to_cmn(event->pmu);
Nit: may as well refactor the is_cmn600 condition to reference cmn->part
directly too.
> u32 config;
> u32 dev = CMN_EVENT_WP_DEV_SEL(event);
> u32 chn = CMN_EVENT_WP_CHN_SEL(event);
> @@ -1404,6 +1405,9 @@ static u32 arm_cmn_wp_config(struct perf_event *event, int wp_idx)
> if (is_cmn600)
> grp &= 1;
>
> + if (cmn->multi_dtm)
> + dev %= 2;
> +
Let's just make the whole setting of CMN_DTM_WPn_CONFIG_WP_DEV_SEL2
conditional on !multi_dtm, like for exclusive and combine further down
(note that the CMN-600 "grp &= 1" is different, since that's more about
sanitising invalid input values rather than the register encoding itself.)
Thanks,
Robin.
> config = FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL, dev) |
> FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_CHN_SEL, chn) |
> FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_GRP, grp) |
next prev parent reply other threads:[~2026-09-09 16:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 10:54 Shouping Wang
2026-09-08 8:15 ` allen.wang
2026-09-08 15:04 ` Robin Murphy
2026-09-09 2:01 ` allen.wang
2026-09-09 16:19 ` Robin Murphy [this message]
2026-09-10 11:46 ` [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations Shouping Wang
2026-09-10 12:37 ` Robin Murphy
2026-09-11 13:44 ` Will Deacon
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=2fb3bda7-cd64-4dc0-99f8-c0fda8d42cf9@arm.com \
--to=robin.murphy@arm.com \
--cc=allen.wang@hj-micro.com \
--cc=andy.xu@hj-micro.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peter.du@hj-micro.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®