aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/arch/powerpc/util/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/arch/powerpc/util/header.c')
-rw-r--r--tools/perf/arch/powerpc/util/header.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
index 3b4cdfc5efd6..e8fe36b10d20 100644
--- a/tools/perf/arch/powerpc/util/header.c
+++ b/tools/perf/arch/powerpc/util/header.c
@@ -7,14 +7,9 @@
#include <string.h>
#include <linux/stringify.h>
#include "header.h"
-
-#define mfspr(rn) ({unsigned long rval; \
- asm volatile("mfspr %0," __stringify(rn) \
- : "=r" (rval)); rval; })
-
-#define SPRN_PVR 0x11F /* Processor Version Register */
-#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
-#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */
+#include "utils_header.h"
+#include "metricgroup.h"
+#include <api/fs/fs.h>
int
get_cpuid(char *buffer, size_t sz)
@@ -44,3 +39,12 @@ get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
return bufp;
}
+
+int arch_get_runtimeparam(const struct pmu_event *pe)
+{
+ int count;
+ char path[PATH_MAX] = "/devices/hv_24x7/interface/";
+
+ atoi(pe->aggr_mode) == PerChip ? strcat(path, "sockets") : strcat(path, "coresperchip");
+ return sysfs__read_int(path, &count) < 0 ? 1 : count;
+}