]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf arm_spe: Print remaining IMPDEF event numbers
authorJames Clark <james.clark@linaro.org>
Tue, 14 Apr 2026 12:48:04 +0000 (13:48 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 May 2026 01:04:28 +0000 (22:04 -0300)
Any IMPDEF events not printed out from a known core's IMPDEF list or for
a completely unknown core will still not be shown to the user. Fix this
by printing the remaining bits as comma separated raw numbers, e.g.
"IMPDEF:1,2,3,4".

Suggested-by: Al Grant <al.grant@arm.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c

index b74f887a48f2a13b1be165947b4e3293f9987bd4..600677318f84c06970e4e618280c39cc83ac5b1e 100644 (file)
@@ -8,6 +8,7 @@
 #include <string.h>
 #include <endian.h>
 #include <byteswap.h>
+#include <linux/bitmap.h>
 #include <linux/bitops.h>
 #include <stdarg.h>
 #include <linux/kernel.h>
@@ -365,6 +366,23 @@ static int arm_spe_pkt_desc_event(const struct arm_spe_pkt *packet,
                                                   payload);
        }
 
+       /*
+        * Print remaining IMPDEF bits that weren't printed above as raw
+        * "IMPDEF:1,2,3,4" etc.
+        */
+       if (payload) {
+               arm_spe_pkt_out_string(&err, &buf, &buf_len, " IMPDEF:");
+               for (int i = 0; i < 64; i++) {
+                       const char *sep = payload & (payload - 1) ? "," : "";
+
+                       if (payload & BIT_ULL(i)) {
+                               arm_spe_pkt_out_string(&err, &buf, &buf_len, "%d%s", i,
+                                               sep);
+                               payload &= ~BIT_ULL(i);
+                       }
+               }
+       }
+
        return err;
 }