[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220929073623.7604-1-lvjianmin@loongson.cn>
Date: Thu, 29 Sep 2022 15:36:23 +0800
From: Jianmin Lv <lvjianmin@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>
Cc: linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev
Subject: [PATCH] LoongArch: Fix cpu name after s3/s4
On coming back from s3/s4, the cpu name will be overwritten
in cpu_probe path of seconary cpu, so we adjust the postion
of using cpu name existed in cpu hardware register, and only
use it while failing to get cpu name from SMBIOS.
Signed-off-by: Jianmin Lv <lvjianmin@...ngson.cn>
diff --git a/arch/loongarch/include/asm/cpu-info.h b/arch/loongarch/include/asm/cpu-info.h
index b6c4f96079df..937dce2a930a 100644
--- a/arch/loongarch/include/asm/cpu-info.h
+++ b/arch/loongarch/include/asm/cpu-info.h
@@ -64,6 +64,7 @@ extern void cpu_probe(void);
extern const char *__cpu_family[];
extern const char *__cpu_full_name[];
+extern char cpu_full_name[];
#define cpu_family_string() __cpu_family[raw_smp_processor_id()]
#define cpu_full_name_string() __cpu_full_name[raw_smp_processor_id()]
diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c
index 529ab8f44ec6..a548b2197224 100644
--- a/arch/loongarch/kernel/cpu-probe.c
+++ b/arch/loongarch/kernel/cpu-probe.c
@@ -180,14 +180,13 @@ static void cpu_probe_common(struct cpuinfo_loongarch *c)
#define VENDOR_OFFSET 0
#define CPUNAME_OFFSET 9
-static char cpu_full_name[MAX_NAME_LEN] = " - ";
+char cpu_full_name[MAX_NAME_LEN] = " - ";
static inline void cpu_probe_loongson(struct cpuinfo_loongarch *c, unsigned int cpu)
{
uint64_t *vendor = (void *)(&cpu_full_name[VENDOR_OFFSET]);
uint64_t *cpuname = (void *)(&cpu_full_name[CPUNAME_OFFSET]);
- __cpu_full_name[cpu] = cpu_full_name;
*vendor = iocsr_read64(LOONGARCH_IOCSR_VENDOR);
*cpuname = iocsr_read64(LOONGARCH_IOCSR_CPUNAME);
diff --git a/arch/loongarch/kernel/env.c b/arch/loongarch/kernel/env.c
index 82b478a5c665..955d82aa298e 100644
--- a/arch/loongarch/kernel/env.c
+++ b/arch/loongarch/kernel/env.c
@@ -44,6 +44,9 @@ static int __init init_cpu_fullname(void)
if (loongson_sysconf.cpuname && !strncmp(loongson_sysconf.cpuname, "Loongson", 8)) {
for (cpu = 0; cpu < NR_CPUS; cpu++)
__cpu_full_name[cpu] = loongson_sysconf.cpuname;
+ } else {
+ for (cpu = 0; cpu < NR_CPUS; cpu++)
+ __cpu_full_name[cpu] = cpu_full_name;
}
return 0;
}
--
2.31.1
Powered by blists - more mailing lists