* [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations [not found] <2fb3bda7-cd64-4dc0-99f8-c0fda8d42cf9@arm.com> @ 2026-09-10 11:46 ` Shouping Wang 2026-09-10 11:54 ` sashiko-bot ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Shouping Wang @ 2026-09-10 11:46 UTC (permalink / raw) To: robin.murphy, will Cc: mark.rutland, linux-arm-kernel, linux-perf-users, linux-kernel, peter.du, andy.xu, allen.wang 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 only setting CMN_DTM_WPn_CONFIG_WP_DEV_SEL2 when !multi_dtm. Fixes: 60d1504070c2 ("perf/arm-cmn: Support new IP features") Signed-off-by: Shouping Wang <allen.wang@hj-micro.com> --- Changes in v2: - Made the setting of CMN_DTM_WPn_CONFIG_WP_DEV_SEL2 conditional on !multi_dtm, instead of clamping with dev %= 2. - Refactored is_cmn600 to use cmn->part directly. - Updated the commit message. Link to v1: https://lore.kernel.org/lkml/20260819105443.668784-1-allen.wang@hj-micro.com/ drivers/perf/arm-cmn.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 6e5cc4086a9e..7e7590381171 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1393,13 +1393,14 @@ 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); u32 config; u32 dev = CMN_EVENT_WP_DEV_SEL(event); u32 chn = CMN_EVENT_WP_CHN_SEL(event); u32 grp = CMN_EVENT_WP_GRP(event); u32 exc = CMN_EVENT_WP_EXCLUSIVE(event); u32 combine = CMN_EVENT_WP_COMBINE(event); - bool is_cmn600 = to_cmn(event->pmu)->part == PART_CMN600; + bool is_cmn600 = cmn->part == PART_CMN600; /* CMN-600 supports only primary and secondary matching groups */ if (is_cmn600) @@ -1407,8 +1408,11 @@ static u32 arm_cmn_wp_config(struct perf_event *event, int wp_idx) 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) | - FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >> 1); + FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_GRP, grp); + + if (!cmn->multi_dtm) + config |= FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >> 1); + if (exc) config |= is_cmn600 ? CMN600_WPn_CONFIG_WP_EXCLUSIVE : CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE; -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations 2026-09-10 11:46 ` [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations Shouping Wang @ 2026-09-10 11:54 ` sashiko-bot 2026-09-10 12:37 ` Robin Murphy 2026-09-11 13:44 ` Will Deacon 2 siblings, 0 replies; 4+ messages in thread From: sashiko-bot @ 2026-09-10 11:54 UTC (permalink / raw) To: Shouping Wang; +Cc: linux-perf-users > 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 only setting CMN_DTM_WPn_CONFIG_WP_DEV_SEL2 when > !multi_dtm. > > Fixes: 60d1504070c2 ("perf/arm-cmn: Support new IP features") > Signed-off-by: Shouping Wang <allen.wang@hj-micro.com> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/20260910114601.165237-1-allen.wang@hj-micro.com?part=1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations 2026-09-10 11:46 ` [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations Shouping Wang 2026-09-10 11:54 ` sashiko-bot @ 2026-09-10 12:37 ` Robin Murphy 2026-09-11 13:44 ` Will Deacon 2 siblings, 0 replies; 4+ messages in thread From: Robin Murphy @ 2026-09-10 12:37 UTC (permalink / raw) To: Shouping Wang, will Cc: mark.rutland, linux-arm-kernel, linux-perf-users, linux-kernel, peter.du, andy.xu On 10/09/2026 12:46 pm, 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. Poor documentation strikes again! > 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 only setting CMN_DTM_WPn_CONFIG_WP_DEV_SEL2 when > !multi_dtm. Reviewed-by: Robin Murphy <robin.murphy@arm.com> Thanks for the fix! Robin. > Fixes: 60d1504070c2 ("perf/arm-cmn: Support new IP features") > Signed-off-by: Shouping Wang <allen.wang@hj-micro.com> > --- > > Changes in v2: > - Made the setting of CMN_DTM_WPn_CONFIG_WP_DEV_SEL2 conditional on > !multi_dtm, instead of clamping with dev %= 2. > - Refactored is_cmn600 to use cmn->part directly. > - Updated the commit message. > > Link to v1: https://lore.kernel.org/lkml/20260819105443.668784-1-allen.wang@hj-micro.com/ > > drivers/perf/arm-cmn.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c > index 6e5cc4086a9e..7e7590381171 100644 > --- a/drivers/perf/arm-cmn.c > +++ b/drivers/perf/arm-cmn.c > @@ -1393,13 +1393,14 @@ 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); > u32 config; > u32 dev = CMN_EVENT_WP_DEV_SEL(event); > u32 chn = CMN_EVENT_WP_CHN_SEL(event); > u32 grp = CMN_EVENT_WP_GRP(event); > u32 exc = CMN_EVENT_WP_EXCLUSIVE(event); > u32 combine = CMN_EVENT_WP_COMBINE(event); > - bool is_cmn600 = to_cmn(event->pmu)->part == PART_CMN600; > + bool is_cmn600 = cmn->part == PART_CMN600; > > /* CMN-600 supports only primary and secondary matching groups */ > if (is_cmn600) > @@ -1407,8 +1408,11 @@ static u32 arm_cmn_wp_config(struct perf_event *event, int wp_idx) > > 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) | > - FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >> 1); > + FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_GRP, grp); > + > + if (!cmn->multi_dtm) > + config |= FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >> 1); > + > if (exc) > config |= is_cmn600 ? CMN600_WPn_CONFIG_WP_EXCLUSIVE : > CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations 2026-09-10 11:46 ` [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations Shouping Wang 2026-09-10 11:54 ` sashiko-bot 2026-09-10 12:37 ` Robin Murphy @ 2026-09-11 13:44 ` Will Deacon 2 siblings, 0 replies; 4+ messages in thread From: Will Deacon @ 2026-09-11 13:44 UTC (permalink / raw) To: robin.murphy, Shouping Wang Cc: catalin.marinas, mark.rutland, kernel-team, Will Deacon, linux-arm-kernel, linux-perf-users, linux-kernel, peter.du, andy.xu On Thu, 10 Sep 2026 19:46:01 +0800, 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. > > [...] Applied to arm64 (for-next/fixes), thanks! [1/1] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations https://git.kernel.org/arm64/c/49daa3d668b6 Cheers, -- Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-11 13:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2fb3bda7-cd64-4dc0-99f8-c0fda8d42cf9@arm.com>
2026-09-10 11:46 ` [PATCH v2] perf/arm-cmn: Fix wp_dev_sel2 setting for multi-DTM configurations Shouping Wang
2026-09-10 11:54 ` sashiko-bot
2026-09-10 12:37 ` Robin Murphy
2026-09-11 13:44 ` Will Deacon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).