1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/stringify.h>
10 #include "utils_header.h"
11 #include "metricgroup.h"
12 #include <api/fs/fs.h>
15 get_cpuid(char *buffer, size_t sz)
20 pvr = mfspr(SPRN_PVR);
22 nb = scnprintf(buffer, sz, "%lu,%lu$", PVR_VER(pvr), PVR_REV(pvr));
24 /* look for end marker to ensure the entire data fit */
25 if (strchr(buffer, '$')) {
33 get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
37 if (asprintf(&bufp, "0x%.8lx", mfspr(SPRN_PVR)) < 0)
43 int arch_get_runtimeparam(const struct pmu_metric *pm)
46 char path[PATH_MAX] = "/devices/hv_24x7/interface/";
48 strcat(path, pm->aggr_mode == PerChip ? "sockets" : "coresperchip");
49 return sysfs__read_int(path, &count) < 0 ? 1 : count;