diff mbox series

perf/arm-cmn: Decode CAL devices properly in debugfs

Message ID 6a13a6128a28cfe2eec6d09cf372a167ec9c3b65.1652274773.git.robin.murphy@arm.com (mailing list archive)
State New, archived
Headers show
Series perf/arm-cmn: Decode CAL devices properly in debugfs | expand

Commit Message

Robin Murphy May 11, 2022, 1:12 p.m. UTC
The debugfs code is lazy, and since it only keeps the bottom byte of
each connect_info register to save space, it also treats the whole thing
as the device_type since the other bits were reserved anyway. Upon
closer inspection, though, this is no longer true on newer IP versions,
so let's be good and decode the exact field properly. This should help
it not get confused when a Component Aggregation Layer is present (which
is already implied if Node IDs are found for both device addresses
represented by the next two lines of the table).

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

Comments

Will Deacon May 12, 2022, 1:05 p.m. UTC | #1
On Wed, 11 May 2022 14:12:53 +0100, Robin Murphy wrote:
> The debugfs code is lazy, and since it only keeps the bottom byte of
> each connect_info register to save space, it also treats the whole thing
> as the device_type since the other bits were reserved anyway. Upon
> closer inspection, though, this is no longer true on newer IP versions,
> so let's be good and decode the exact field properly. This should help
> it not get confused when a Component Aggregation Layer is present (which
> is already implied if Node IDs are found for both device addresses
> represented by the next two lines of the table).
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/1] perf/arm-cmn: Decode CAL devices properly in debugfs
      https://git.kernel.org/will/c/c5781212985a

Cheers,
diff mbox series

Patch

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 282d2f874ec1..036f88f8508e 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -63,6 +63,7 @@ 
 #define CMN_MXP__CONNECT_INFO_P3	0x0030
 #define CMN_MXP__CONNECT_INFO_P4	0x0038
 #define CMN_MXP__CONNECT_INFO_P5	0x0040
+#define CMN__CONNECT_INFO_DEVICE_TYPE	GENMASK_ULL(4, 0)
 
 /* PMU registers occupy the 3rd 4KB page of each node's region */
 #define CMN_PMU_OFFSET			0x2000
@@ -400,7 +401,7 @@  static struct dentry *arm_cmn_debugfs;
 #ifdef CONFIG_DEBUG_FS
 static const char *arm_cmn_device_type(u8 type)
 {
-	switch(type) {
+	switch(FIELD_GET(CMN__CONNECT_INFO_DEVICE_TYPE, type)) {
 		case 0x00: return "        |";
 		case 0x01: return "  RN-I  |";
 		case 0x02: return "  RN-D  |";