Commit cec0d657 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf header: Refactor get_cpuid to take a CPU for ARM



ARM BIG.little has no notion of a constant CPUID for both core
types. To reflect this reality, change the get_cpuid function to also
pass in a possibly unused logical cpu.

If the dummy value (-1) is passed in then ARM can, as currently happens,
select the first logical CPU's "CPUID".

The changes to ARM getcpuid happen in a follow up change.

Reviewed-by: default avatarJames Clark <james.clark@linaro.org>
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Tested-by: default avatarXu Yang <xu.yang_2@nxp.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ben Zong-You Xie <ben717@andestech.com>
Cc: Benjamin Gray <bgray@linux.ibm.com>
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Clément Le Goffic <clement.legoffic@foss.st.com>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
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: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/r/20241107162035.52206-4-irogers@google.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c6fafe36
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
	return ret;
}

int get_cpuid(char *buf, size_t sz)
int get_cpuid(char *buf, size_t sz, struct perf_cpu cpu __maybe_unused)
{
	struct perf_cpu_map *cpus = perf_cpu_map__new_online_cpus();
	int ret;
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static char *_get_cpuid(void)
	return cpuid;
}

int get_cpuid(char *buffer, size_t sz)
int get_cpuid(char *buffer, size_t sz, struct perf_cpu cpu __maybe_unused)
{
	int ret = 0;
	char *cpuid = _get_cpuid();
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ static bool is_compat_mode(void)
}

int
get_cpuid(char *buffer, size_t sz)
get_cpuid(char *buffer, size_t sz, struct perf_cpu cpu __maybe_unused)
{
	unsigned long pvr;
	int nb;
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ static char *_get_cpuid(void)
	return cpuid;
}

int get_cpuid(char *buffer, size_t sz)
int get_cpuid(char *buffer, size_t sz, struct perf_cpu cpu __maybe_unused)
{
	char *cpuid = _get_cpuid();
	int ret = 0;
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#define SYSINFO		"/proc/sysinfo"
#define SRVLVL		"/proc/service_levels"

int get_cpuid(char *buffer, size_t sz)
int get_cpuid(char *buffer, size_t sz, struct perf_cpu cpu __maybe_unused)
{
	char *cp, *line = NULL, *line2;
	char type[8], model[33], version[8], manufacturer[32], authorization[8];
Loading