Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 29 Mar 2017 10:30:50 +0200 (CEST) Received: from smtpbgau1.qq.com ([54.206.16.166]:51351 "EHLO smtpbgau1.qq.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23993871AbdC2IamTmavX (ORCPT ); Wed, 29 Mar 2017 10:30:42 +0200 X-QQ-mid: bizesmtp1t1490776213toywfab5r Received: from software.domain.org (unknown [222.92.8.142]) by esmtp4.qq.com (ESMTP) with id ; Wed, 29 Mar 2017 16:29:36 +0800 (CST) X-QQ-SSF: 01100000002000F0FK82000A0000000 X-QQ-FEAT: 46uEpRkUNoZAH9oNCc+iHcBwVzNL4NV7UFZ19Y78Vn+Gyf5JMUGfMlOvfvMdl n9QDXWauEcwpy3/snVSXtGxbN/NPAe6/MWikFb8U2avhBvEN2V6MShT355oUtEtArAbCZeu 5BUCaV2+MNBovpuegnI4EKXwAhWKITciBfuNHjHT85CXmDgo4KEvGF5W6VbwjiCSDHZhYny F62j+k491VZifUJ097S07O+awoohXIFMFubh3gDvEX2HhjObTCKhCKIw2hOnVyF31nxH5v+ 8f9oYJsiD+9RWZ+sJxSXyINLjwnLg3453JHtN6DduCrHSy X-QQ-GoodBg: 0 From: Huacai Chen To: Ralf Baechle Cc: John Crispin , "Steven J . Hill" , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen Subject: [PATCH V3 7/8] MIPS: Add __cpu_full_name[] to make CPU names more human-readable Date: Wed, 29 Mar 2017 16:24:35 +0800 Message-Id: <1490775876-29918-8-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1490775876-29918-1-git-send-email-chenhc@lemote.com> References: <1490775876-29918-1-git-send-email-chenhc@lemote.com> X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 57466 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: chenhc@lemote.com Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips In /proc/cpuinfo, we keep "cpu model" as is, since GCC should use it for -march=native. Besides, we add __cpu_full_name[] to describe the processor in a more human-readable manner. The full name is displayed as "model name" in cpuinfo, which is needed by some userspace tools such as gnome-system-monitor. This is only used by Loongson now. Signed-off-by: Huacai Chen --- arch/mips/include/asm/cpu-info.h | 2 ++ arch/mips/kernel/cpu-probe.c | 13 +++++++++++++ arch/mips/kernel/proc.c | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h index d43b304..af72f41 100644 --- a/arch/mips/include/asm/cpu-info.h +++ b/arch/mips/include/asm/cpu-info.h @@ -119,7 +119,9 @@ extern void cpu_probe(void); extern void cpu_report(void); extern const char *__cpu_name[]; +extern const char *__cpu_full_name[]; #define cpu_name_string() __cpu_name[raw_smp_processor_id()] +#define cpu_full_name_string() __cpu_full_name[raw_smp_processor_id()] struct seq_file; struct notifier_block; diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 1c94d4d..8434a0e 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1468,6 +1468,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) set_elf_platform(cpu, "loongson2e"); set_isa(c, MIPS_CPU_ISA_III); c->fpu_msk31 |= FPU_CSR_CONDX; + __cpu_full_name[cpu] = "ICT Loongson-2E"; break; case PRID_REV_LOONGSON2F: c->cputype = CPU_LOONGSON2; @@ -1475,19 +1476,28 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) set_elf_platform(cpu, "loongson2f"); set_isa(c, MIPS_CPU_ISA_III); c->fpu_msk31 |= FPU_CSR_CONDX; + __cpu_full_name[cpu] = "ICT Loongson-2F"; break; case PRID_REV_LOONGSON3A_R1: c->cputype = CPU_LOONGSON3; __cpu_name[cpu] = "ICT Loongson-3"; set_elf_platform(cpu, "loongson3a"); set_isa(c, MIPS_CPU_ISA_M64R1); + __cpu_full_name[cpu] = "ICT Loongson-3A R1 (Loongson-3A1000)"; break; case PRID_REV_LOONGSON3B_R1: + c->cputype = CPU_LOONGSON3; + __cpu_name[cpu] = "ICT Loongson-3"; + set_elf_platform(cpu, "loongson3b"); + set_isa(c, MIPS_CPU_ISA_M64R1); + __cpu_full_name[cpu] = "ICT Loongson-3B R1 (Loongson-3B1000)"; + break; case PRID_REV_LOONGSON3B_R2: c->cputype = CPU_LOONGSON3; __cpu_name[cpu] = "ICT Loongson-3"; set_elf_platform(cpu, "loongson3b"); set_isa(c, MIPS_CPU_ISA_M64R1); + __cpu_full_name[cpu] = "ICT Loongson-3B R2 (Loongson-3B1500)"; break; } @@ -1821,12 +1831,14 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu) __cpu_name[cpu] = "ICT Loongson-3"; set_elf_platform(cpu, "loongson3a"); set_isa(c, MIPS_CPU_ISA_M64R2); + __cpu_full_name[cpu] = "ICT Loongson-3A R2 (Loongson-3A2000)"; break; case PRID_REV_LOONGSON3A_R3: c->cputype = CPU_LOONGSON3; __cpu_name[cpu] = "ICT Loongson-3"; set_elf_platform(cpu, "loongson3a"); set_isa(c, MIPS_CPU_ISA_M64R2); + __cpu_full_name[cpu] = "ICT Loongson-3A R3 (Loongson-3A3000)"; break; } @@ -1946,6 +1958,7 @@ EXPORT_SYMBOL(__ua_limit); #endif const char *__cpu_name[NR_CPUS]; +const char *__cpu_full_name[NR_CPUS]; const char *__elf_platform; void cpu_probe(void) diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 4eff2ae..78db63a 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -14,6 +14,7 @@ #include #include #include +#include unsigned int vced_count, vcei_count; @@ -62,6 +63,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, fmt, __cpu_name[n], (version >> 4) & 0x0f, version & 0x0f, (fp_vers >> 4) & 0x0f, fp_vers & 0x0f); + if (__cpu_full_name[n]) + seq_printf(m, "model name\t\t: %s @ %uMHz\n", + __cpu_full_name[n], mips_hpt_frequency / 500000); seq_printf(m, "BogoMIPS\t\t: %u.%02u\n", cpu_data[n].udelay_val / (500000/HZ), (cpu_data[n].udelay_val / (5000/HZ)) % 100); -- 2.7.0