Skip to content

Commit 50b8f1d

Browse files
Leo-Yannamhyung
authored andcommitted
perf arm-spe: Rename the common data source encoding
The Neoverse CPUs follow the common data source encoding, and other CPU variants can share the same format. Rename the CPU list and data source definitions as common data source names. This change prepares for appending more CPU variants. Signed-off-by: Leo Yan <[email protected]> Reviewed-by: James Clark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent fb98fa3 commit 50b8f1d

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ enum arm_spe_op_type {
5656
ARM_SPE_OP_BR_INDIRECT = 1 << 17,
5757
};
5858

59-
enum arm_spe_neoverse_data_source {
60-
ARM_SPE_NV_L1D = 0x0,
61-
ARM_SPE_NV_L2 = 0x8,
62-
ARM_SPE_NV_PEER_CORE = 0x9,
63-
ARM_SPE_NV_LOCAL_CLUSTER = 0xa,
64-
ARM_SPE_NV_SYS_CACHE = 0xb,
65-
ARM_SPE_NV_PEER_CLUSTER = 0xc,
66-
ARM_SPE_NV_REMOTE = 0xd,
67-
ARM_SPE_NV_DRAM = 0xe,
59+
enum arm_spe_common_data_source {
60+
ARM_SPE_COMMON_DS_L1D = 0x0,
61+
ARM_SPE_COMMON_DS_L2 = 0x8,
62+
ARM_SPE_COMMON_DS_PEER_CORE = 0x9,
63+
ARM_SPE_COMMON_DS_LOCAL_CLUSTER = 0xa,
64+
ARM_SPE_COMMON_DS_SYS_CACHE = 0xb,
65+
ARM_SPE_COMMON_DS_PEER_CLUSTER = 0xc,
66+
ARM_SPE_COMMON_DS_REMOTE = 0xd,
67+
ARM_SPE_COMMON_DS_DRAM = 0xe,
6868
};
6969

7070
struct arm_spe_record {

tools/perf/util/arm-spe.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,15 @@ static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq,
413413
return arm_spe_deliver_synth_event(spe, speq, event, &sample);
414414
}
415415

416-
static const struct midr_range neoverse_spe[] = {
416+
static const struct midr_range common_ds_encoding_cpus[] = {
417417
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1),
418418
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
419419
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1),
420420
{},
421421
};
422422

423-
static void arm_spe__synth_data_source_neoverse(const struct arm_spe_record *record,
424-
union perf_mem_data_src *data_src)
423+
static void arm_spe__synth_data_source_common(const struct arm_spe_record *record,
424+
union perf_mem_data_src *data_src)
425425
{
426426
/*
427427
* Even though four levels of cache hierarchy are possible, no known
@@ -443,17 +443,17 @@ static void arm_spe__synth_data_source_neoverse(const struct arm_spe_record *rec
443443
}
444444

445445
switch (record->source) {
446-
case ARM_SPE_NV_L1D:
446+
case ARM_SPE_COMMON_DS_L1D:
447447
data_src->mem_lvl = PERF_MEM_LVL_L1 | PERF_MEM_LVL_HIT;
448448
data_src->mem_lvl_num = PERF_MEM_LVLNUM_L1;
449449
data_src->mem_snoop = PERF_MEM_SNOOP_NONE;
450450
break;
451-
case ARM_SPE_NV_L2:
451+
case ARM_SPE_COMMON_DS_L2:
452452
data_src->mem_lvl = PERF_MEM_LVL_L2 | PERF_MEM_LVL_HIT;
453453
data_src->mem_lvl_num = PERF_MEM_LVLNUM_L2;
454454
data_src->mem_snoop = PERF_MEM_SNOOP_NONE;
455455
break;
456-
case ARM_SPE_NV_PEER_CORE:
456+
case ARM_SPE_COMMON_DS_PEER_CORE:
457457
data_src->mem_lvl = PERF_MEM_LVL_L2 | PERF_MEM_LVL_HIT;
458458
data_src->mem_lvl_num = PERF_MEM_LVLNUM_L2;
459459
data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
@@ -462,16 +462,16 @@ static void arm_spe__synth_data_source_neoverse(const struct arm_spe_record *rec
462462
* We don't know if this is L1, L2 but we do know it was a cache-2-cache
463463
* transfer, so set SNOOPX_PEER
464464
*/
465-
case ARM_SPE_NV_LOCAL_CLUSTER:
466-
case ARM_SPE_NV_PEER_CLUSTER:
465+
case ARM_SPE_COMMON_DS_LOCAL_CLUSTER:
466+
case ARM_SPE_COMMON_DS_PEER_CLUSTER:
467467
data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT;
468468
data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
469469
data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
470470
break;
471471
/*
472472
* System cache is assumed to be L3
473473
*/
474-
case ARM_SPE_NV_SYS_CACHE:
474+
case ARM_SPE_COMMON_DS_SYS_CACHE:
475475
data_src->mem_lvl = PERF_MEM_LVL_L3 | PERF_MEM_LVL_HIT;
476476
data_src->mem_lvl_num = PERF_MEM_LVLNUM_L3;
477477
data_src->mem_snoop = PERF_MEM_SNOOP_HIT;
@@ -480,13 +480,13 @@ static void arm_spe__synth_data_source_neoverse(const struct arm_spe_record *rec
480480
* We don't know what level it hit in, except it came from the other
481481
* socket
482482
*/
483-
case ARM_SPE_NV_REMOTE:
483+
case ARM_SPE_COMMON_DS_REMOTE:
484484
data_src->mem_lvl = PERF_MEM_LVL_REM_CCE1;
485485
data_src->mem_lvl_num = PERF_MEM_LVLNUM_ANY_CACHE;
486486
data_src->mem_remote = PERF_MEM_REMOTE_REMOTE;
487487
data_src->mem_snoopx = PERF_MEM_SNOOPX_PEER;
488488
break;
489-
case ARM_SPE_NV_DRAM:
489+
case ARM_SPE_COMMON_DS_DRAM:
490490
data_src->mem_lvl = PERF_MEM_LVL_LOC_RAM | PERF_MEM_LVL_HIT;
491491
data_src->mem_lvl_num = PERF_MEM_LVLNUM_RAM;
492492
data_src->mem_snoop = PERF_MEM_SNOOP_NONE;
@@ -522,7 +522,7 @@ static void arm_spe__synth_memory_level(const struct arm_spe_record *record,
522522
static u64 arm_spe__synth_data_source(const struct arm_spe_record *record, u64 midr)
523523
{
524524
union perf_mem_data_src data_src = { .mem_op = PERF_MEM_OP_NA };
525-
bool is_neoverse = is_midr_in_range_list(midr, neoverse_spe);
525+
bool is_common = is_midr_in_range_list(midr, common_ds_encoding_cpus);
526526

527527
if (record->op & ARM_SPE_OP_LD)
528528
data_src.mem_op = PERF_MEM_OP_LOAD;
@@ -531,8 +531,8 @@ static u64 arm_spe__synth_data_source(const struct arm_spe_record *record, u64 m
531531
else
532532
return 0;
533533

534-
if (is_neoverse)
535-
arm_spe__synth_data_source_neoverse(record, &data_src);
534+
if (is_common)
535+
arm_spe__synth_data_source_common(record, &data_src);
536536
else
537537
arm_spe__synth_memory_level(record, &data_src);
538538

0 commit comments

Comments
 (0)