perf arm_spe: Print remaining IMPDEF event numbers

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>
This commit is contained in:
James Clark 2026-04-14 13:48:04 +01:00 committed by Arnaldo Carvalho de Melo
parent b566a74041
commit e7ef461784

View 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;
}