2022-12-03 14:07:00

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH] LoongArch: Make lscpu show "Model name" and "CPU family"

When update the latest kernel on LoongArch, and then use lscpu command
to show cpuinfo, we can not see "Model name" and "CPU family", this is
because there are no matched patterns in /proc/cpuinfo, use small letter
of "Model Name" and "CPU Family" in show_cpuinfo() to fix it.

Here is the related code of lscpu:

static const struct cpuinfo_pattern type_patterns[] =
{
...
DEF_PAT_CPUTYPE( "cpu family", PAT_FAMILY, family),
...
DEF_PAT_CPUTYPE( "model name", PAT_MODEL_NAME, modelname),
...
};

Link: https://github.com/util-linux/util-linux/blob/master/sys-utils/lscpu-cputype.c
Fixes: 7153c3cbb5b9 ("LoongArch: Add misc common routines")
Signed-off-by: Tiezhu Yang <[email protected]>
---
arch/loongarch/kernel/proc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/loongarch/kernel/proc.c b/arch/loongarch/kernel/proc.c
index 5c67cc4..eafd1cf 100644
--- a/arch/loongarch/kernel/proc.c
+++ b/arch/loongarch/kernel/proc.c
@@ -49,8 +49,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "processor\t\t: %ld\n", n);
seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
- seq_printf(m, "CPU Family\t\t: %s\n", __cpu_family[n]);
- seq_printf(m, "Model Name\t\t: %s\n", __cpu_full_name[n]);
+ seq_printf(m, "cpu family\t\t: %s\n", __cpu_family[n]);
+ seq_printf(m, "model name\t\t: %s\n", __cpu_full_name[n]);
seq_printf(m, "CPU Revision\t\t: 0x%02x\n", version);
seq_printf(m, "FPU Revision\t\t: 0x%02x\n", fp_version);
seq_printf(m, "CPU MHz\t\t\t: %llu.%02llu\n",
--
2.1.0