Skip to content

Commit

Permalink
From patchwork series 427553
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox Snowpatch committed Oct 11, 2024
1 parent f85c105 commit aefac12
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tools/perf/arch/powerpc/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
#include "utils_header.h"
#include "metricgroup.h"
#include <api/fs/fs.h>
#include <sys/auxv.h>

static bool is_compat_mode(void)
{
u64 base_platform = getauxval(AT_BASE_PLATFORM);
u64 platform = getauxval(AT_PLATFORM);

if (!strcmp((char *)platform, (char *)base_platform))
return false;

return true;
}

int
get_cpuid(char *buffer, size_t sz)
Expand All @@ -33,8 +45,26 @@ char *
get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
{
char *bufp;
unsigned long pvr;

/*
* IBM Power System supports compatible mode. That is
* Nth generation platform can support previous generation
* OS in a mode called compatibile mode. For ex. LPAR can be
* booted in a Power9 mode when the system is a Power10.
*
* In the compatible mode, care must be taken when generating
* PVR value. When read, PVR will be of the AT_BASE_PLATFORM
* To support generic events, return 0x00ffffff as pvr when
* booted in compat mode. Based on this pvr value, json will
* pick events from pmu-events/arch/powerpc/compat
*/
if (!is_compat_mode())
pvr = mfspr(SPRN_PVR);
else
pvr = 0x00ffffff;

if (asprintf(&bufp, "0x%.8lx", mfspr(SPRN_PVR)) < 0)
if (asprintf(&bufp, "0x%.8lx", pvr) < 0)
bufp = NULL;

return bufp;
Expand Down
117 changes: 117 additions & 0 deletions tools/perf/pmu-events/arch/powerpc/compat/generic-events.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
[
{
"EventCode": "0x600F4",
"EventName": "PM_CYC",
"BriefDescription": "Processor cycles."
},
{
"EventCode": "0x100F2",
"EventName": "PM_CYC_INST_CMPL",
"BriefDescription": "1 or more ppc insts finished"
},
{
"EventCode": "0x100f4",
"EventName": "PM_FLOP_CMPL",
"BriefDescription": "Floating Point Operations Finished."
},
{
"EventCode": "0x100F6",
"EventName": "PM_L1_ITLB_MISS",
"BriefDescription": "Number of I-ERAT reloads."
},
{
"EventCode": "0x100F8",
"EventName": "PM_NO_INST_AVAIL",
"BriefDescription": "Number of cycles the ICT has no itags assigned to this thread."
},
{
"EventCode": "0x100fc",
"EventName": "PM_LD_CMPL",
"BriefDescription": "Load instruction completed."
},
{
"EventCode": "0x200F0",
"EventName": "PM_ST_CMPL",
"BriefDescription": "Stores completed from S2Q (2nd-level store queue)."
},
{
"EventCode": "0x200F2",
"EventName": "PM_INST_DISP",
"BriefDescription": "PowerPC instruction dispatched."
},
{
"EventCode": "0x200F4",
"EventName": "PM_RUN_CYC",
"BriefDescription": "Processor cycles gated by the run latch."
},
{
"EventCode": "0x200F6",
"EventName": "PM_L1_DTLB_RELOAD",
"BriefDescription": "DERAT Reloaded due to a DERAT miss."
},
{
"EventCode": "0x200FA",
"EventName": "PM_BR_TAKEN_CMPL",
"BriefDescription": "Branch Taken instruction completed."
},
{
"EventCode": "0x200FC",
"EventName": "PM_L1_ICACHE_MISS",
"BriefDescription": "Demand instruction cache miss."
},
{
"EventCode": "0x200FE",
"EventName": "PM_L1_RELOAD_FROM_MEM",
"BriefDescription": "L1 Dcache reload from memory"
},
{
"EventCode": "0x300F0",
"EventName": "PM_ST_MISS_L1",
"BriefDescription": "Store Missed L1"
},
{
"EventCode": "0x300FC",
"EventName": "PM_DTLB_MISS",
"BriefDescription": "Data PTEG reload"
},
{
"EventCode": "0x300FE",
"EventName": "PM_DATA_FROM_L3MISS",
"BriefDescription": "Demand LD - L3 Miss (not L2 hit and not L3 hit)"
},
{
"EventCode": "0x400F0",
"EventName": "PM_LD_MISS_L1",
"BriefDescription": "L1 Dcache load miss"
},
{
"EventCode": "0x400F2",
"EventName": "PM_CYC_INST_DISP",
"BriefDescription": "Cycle when instruction(s) dispatched."
},
{
"EventCode": "0x400F6",
"EventName": "PM_BR_MPRED_CMPL",
"BriefDescription": "A mispredicted branch completed. Includes direction and target."
},
{
"EventCode": "0x400FA",
"EventName": "PM_RUN_INST_CMPL",
"BriefDescription": "PowerPC instruction completed while the run latch is set."
},
{
"EventCode": "0x400FC",
"EventName": "PM_ITLB_MISS",
"BriefDescription": "Instruction TLB reload (after a miss), all page sizes. Includes only demand misses."
},
{
"EventCode": "0x400fe",
"EventName": "PM_LD_NOT_CACHED",
"BriefDescription": "Load data not cached."
},
{
"EventCode": "0x500fa",
"EventName": "PM_INST_CMPL",
"BriefDescription": "Instructions."
}
]
1 change: 1 addition & 0 deletions tools/perf/pmu-events/arch/powerpc/mapfile.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
0x004e[[:xdigit:]]{4},1,power9,core
0x0080[[:xdigit:]]{4},1,power10,core
0x0082[[:xdigit:]]{4},1,power10,core
0x00ffffff,1,compat,core

0 comments on commit aefac12

Please sign in to comment.