From: Yao Zi <ziyao@disroot.org>
To: Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
Thomas Gleixner <tglx@linutronix.de>,
Tianyang Zhang <zhangtianyang@loongson.cn>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Jianmin Lv <lvjianmin@loongson.cn>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
Mingcong Bai <jeffbai@aosc.io>,
Kexy Biscuit <kexybiscuit@aosc.io>, Yao Zi <ziyao@disroot.org>
Subject: [PATCH] LoongArch: Use a fallback CPU model when IOCSR-based model probing fails
Date: Wed, 30 Apr 2025 05:40:43 +0000 [thread overview]
Message-ID: <20250430054042.24333-2-ziyao@disroot.org> (raw)
Reading vendor and cpuname IOCSRs yields 0x258000fff00 instead of
human-readable model strings on Loongson 2K0300 SoC, which messes up
format of /proc/cpuinfo since it represents as an empty string.
Let's consider IOCSR-based model probing fails if the result model is an
empty string. A fallback model name is set in such cases.
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
arch/loongarch/kernel/cpu-probe.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c
index fedaa67cde41..785513d43696 100644
--- a/arch/loongarch/kernel/cpu-probe.c
+++ b/arch/loongarch/kernel/cpu-probe.c
@@ -270,12 +270,13 @@ static inline void cpu_probe_loongson(struct cpuinfo_loongarch *c, unsigned int
if (!cpu_has_iocsr)
return;
- if (!__cpu_full_name[cpu])
- __cpu_full_name[cpu] = cpu_full_name;
-
*vendor = iocsr_read64(LOONGARCH_IOCSR_VENDOR);
*cpuname = iocsr_read64(LOONGARCH_IOCSR_CPUNAME);
+ if (!__cpu_full_name[cpu])
+ __cpu_full_name[cpu] = cpu_full_name[0] ? cpu_full_name :
+ "Loongson-Unknown";
+
config = iocsr_read32(LOONGARCH_IOCSR_FEATURES);
if (config & IOCSRF_CSRIPI)
c->options |= LOONGARCH_CPU_CSRIPI;
--
2.49.0
next reply other threads:[~2025-04-30 5:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 5:40 Yao Zi [this message]
2025-04-30 7:48 ` Huacai Chen
2025-05-01 1:04 ` Yao Zi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250430054042.24333-2-ziyao@disroot.org \
--to=ziyao@disroot.org \
--cc=chenhuacai@kernel.org \
--cc=jeffbai@aosc.io \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=kexybiscuit@aosc.io \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=lvjianmin@loongson.cn \
--cc=tglx@linutronix.de \
--cc=zhangtianyang@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®