Skip to content

Commit 9e7a00e

Browse files
ilkka-koskinenacmel
authored andcommitted
perf arm-spe: Add support for SPE Data Source packet on AmpereOne
Decode SPE Data Source packets on AmpereOne. The field is IMPDEF. Reviewed-by: Leo Yan <leo.yan@arm.com> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Graham Woodward <graham.woodward@arm.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kan Liang <kan.liang@linux.intel.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 Link: https://lore.kernel.org/r/20241108202946.16835-3-ilkka@os.amperecomputing.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent ccdc9e9 commit 9e7a00e

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

tools/perf/util/arm-spe-decoder/arm-spe-decoder.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ enum arm_spe_common_data_source {
6767
ARM_SPE_COMMON_DS_DRAM = 0xe,
6868
};
6969

70+
enum arm_spe_ampereone_data_source {
71+
ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE = 0x0,
72+
ARM_SPE_AMPEREONE_SLC = 0x3,
73+
ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE = 0x5,
74+
ARM_SPE_AMPEREONE_DDR = 0x7,
75+
ARM_SPE_AMPEREONE_L1D = 0x8,
76+
ARM_SPE_AMPEREONE_L2D = 0x9,
77+
};
78+
7079
struct arm_spe_record {
7180
enum arm_spe_sample_type type;
7281
int err;

tools/perf/util/arm-spe.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,11 @@ static const struct midr_range common_ds_encoding_cpus[] = {
455455
{},
456456
};
457457

458+
static const struct midr_range ampereone_ds_encoding_cpus[] = {
459+
MIDR_ALL_VERSIONS(MIDR_AMPERE1A),
460+
{},
461+
};
462+
458463
static void arm_spe__sample_flags(struct arm_spe_queue *speq)
459464
{
460465
const struct arm_spe_record *record = &speq->decoder->record;
@@ -544,8 +549,47 @@ static void arm_spe__synth_data_source_common(const struct arm_spe_record *recor
544549
}
545550
}
546551

552+
/*
553+
* Source is IMPDEF. Here we convert the source code used on AmpereOne cores
554+
* to the common (Neoverse, Cortex) to avoid duplicating the decoding code.
555+
*/
556+
static void arm_spe__synth_data_source_ampereone(const struct arm_spe_record *record,
557+
union perf_mem_data_src *data_src)
558+
{
559+
struct arm_spe_record common_record;
560+
561+
switch (record->source) {
562+
case ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE:
563+
common_record.source = ARM_SPE_COMMON_DS_PEER_CORE;
564+
break;
565+
case ARM_SPE_AMPEREONE_SLC:
566+
common_record.source = ARM_SPE_COMMON_DS_SYS_CACHE;
567+
break;
568+
case ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE:
569+
common_record.source = ARM_SPE_COMMON_DS_REMOTE;
570+
break;
571+
case ARM_SPE_AMPEREONE_DDR:
572+
common_record.source = ARM_SPE_COMMON_DS_DRAM;
573+
break;
574+
case ARM_SPE_AMPEREONE_L1D:
575+
common_record.source = ARM_SPE_COMMON_DS_L1D;
576+
break;
577+
case ARM_SPE_AMPEREONE_L2D:
578+
common_record.source = ARM_SPE_COMMON_DS_L2;
579+
break;
580+
default:
581+
pr_warning_once("AmpereOne: Unknown data source (0x%x)\n",
582+
record->source);
583+
return;
584+
}
585+
586+
common_record.op = record->op;
587+
arm_spe__synth_data_source_common(&common_record, data_src);
588+
}
589+
547590
static const struct data_source_handle data_source_handles[] = {
548591
DS(common_ds_encoding_cpus, data_source_common),
592+
DS(ampereone_ds_encoding_cpus, data_source_ampereone),
549593
};
550594

551595
static void arm_spe__synth_memory_level(const struct arm_spe_record *record,

0 commit comments

Comments
 (0)