Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf/arm-cmn: Sanity-check DTC discovery
@ 2026-11-09 17:38 Robin Murphy
  2026-11-09 17:51 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Murphy @ 2026-11-09 17:38 UTC (permalink / raw)
  To: will; +Cc: mark.rutland, linux-arm-kernel, linux-perf-users

With the device isolation feature, the control registers reset to
the "all ports disabled" value and so require explicit programming
by pre-boot firmware. Apparently if firmware forgets to do this,
we can end up skipping all leaf nodes in the discovery walk due to
the CMN_CHILD_NODE_ISOLATED flag, and thus dereferencing dtc[0]
uninitialised in arm_cmn_set_state(). While this should only ever
be an "early platform bringup" kind of issue, it's not too hard to
fail a bit more politely in this case, so we may as well.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/perf/arm-cmn.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 4779472ecfb8..d88339ecf672 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2779,6 +2779,11 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
 		}
 	}
 
+	if (cmn->num_dtcs == 0) {
+		dev_err(cmn->dev, "No DTCs found! Has firmware failed to program device isolation registers?\n");
+		return -ENODEV;
+	}
+
 	/* Correct for any nodes we added or skipped */
 	cmn->num_dns = dn - cmn->dns;
 
-- 
2.54.0.dirty


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf/arm-cmn: Sanity-check DTC discovery
  2026-11-09 17:38 [PATCH] perf/arm-cmn: Sanity-check DTC discovery Robin Murphy
@ 2026-11-09 17:51 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-09 17:51 UTC (permalink / raw)
  To: Robin Murphy; +Cc: linux-perf-users

> With the device isolation feature, the control registers reset to
> the "all ports disabled" value and so require explicit programming
> by pre-boot firmware. Apparently if firmware forgets to do this,
> we can end up skipping all leaf nodes in the discovery walk due to
> the CMN_CHILD_NODE_ISOLATED flag, and thus dereferencing dtc[0]
> uninitialised in arm_cmn_set_state(). While this should only ever
> be an "early platform bringup" kind of issue, it's not too hard to
> fail a bit more politely in this case, so we may as well.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/a1abc2ce99b91db64948cfc3b639c878f896858c.1794245895.git.robin.murphy@arm.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-09 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 17:38 [PATCH] perf/arm-cmn: Sanity-check DTC discovery Robin Murphy
2026-11-09 17:51 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox