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>
This commit is contained in:
Ilkka Koskinen 2024-11-08 20:29:46 +00:00 committed by Arnaldo Carvalho de Melo
parent ccdc9e9c5e
commit 9e7a00ec6a
2 changed files with 53 additions and 0 deletions

View File

@ -67,6 +67,15 @@ enum arm_spe_common_data_source {
ARM_SPE_COMMON_DS_DRAM = 0xe,
};
enum arm_spe_ampereone_data_source {
ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE = 0x0,
ARM_SPE_AMPEREONE_SLC = 0x3,
ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE = 0x5,
ARM_SPE_AMPEREONE_DDR = 0x7,
ARM_SPE_AMPEREONE_L1D = 0x8,
ARM_SPE_AMPEREONE_L2D = 0x9,
};
struct arm_spe_record {
enum arm_spe_sample_type type;
int err;

View File

@ -455,6 +455,11 @@ static const struct midr_range common_ds_encoding_cpus[] = {
{},
};
static const struct midr_range ampereone_ds_encoding_cpus[] = {
MIDR_ALL_VERSIONS(MIDR_AMPERE1A),
{},
};
static void arm_spe__sample_flags(struct arm_spe_queue *speq)
{
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
}
}
/*
* Source is IMPDEF. Here we convert the source code used on AmpereOne cores
* to the common (Neoverse, Cortex) to avoid duplicating the decoding code.
*/
static void arm_spe__synth_data_source_ampereone(const struct arm_spe_record *record,
union perf_mem_data_src *data_src)
{
struct arm_spe_record common_record;
switch (record->source) {
case ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE:
common_record.source = ARM_SPE_COMMON_DS_PEER_CORE;
break;
case ARM_SPE_AMPEREONE_SLC:
common_record.source = ARM_SPE_COMMON_DS_SYS_CACHE;
break;
case ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE:
common_record.source = ARM_SPE_COMMON_DS_REMOTE;
break;
case ARM_SPE_AMPEREONE_DDR:
common_record.source = ARM_SPE_COMMON_DS_DRAM;
break;
case ARM_SPE_AMPEREONE_L1D:
common_record.source = ARM_SPE_COMMON_DS_L1D;
break;
case ARM_SPE_AMPEREONE_L2D:
common_record.source = ARM_SPE_COMMON_DS_L2;
break;
default:
pr_warning_once("AmpereOne: Unknown data source (0x%x)\n",
record->source);
return;
}
common_record.op = record->op;
arm_spe__synth_data_source_common(&common_record, data_src);
}
static const struct data_source_handle data_source_handles[] = {
DS(common_ds_encoding_cpus, data_source_common),
DS(ampereone_ds_encoding_cpus, data_source_ampereone),
};
static void arm_spe__synth_memory_level(const struct arm_spe_record *record,