Re: [PATCH 4/8] MIPS: Add __cpu_full_name[] to make CPU names more human-readable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 10, 2017 at 10:04:38AM +0800, Huacai Chen wrote:
> 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.
> 
> The CPU frequency in "model name" is the default value (highest), and
> there is also a "CPU MHz" whose value can be changed by cpufreq.
> 
> This is only used by Loongson now (ICT is dropped in cpu name, and cpu
> name can be overwritten by BIOS).
> 
> Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>

> diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
> index 70604c7..3200c0e 100644
> --- a/arch/mips/kernel/proc.c
> +++ b/arch/mips/kernel/proc.c

> @@ -62,6 +63,11 @@ 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\n", __cpu_full_name[n]);
> +	if (mips_cpu_frequency)
> +		seq_printf(m, "CPU MHz\t\t\t: %u.%02u\n",
> +		      mips_cpu_frequency / 1000000, (mips_cpu_frequency / 10000) % 100);

long line

> diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c
> index 1e8a955..6891780 100644
> --- a/arch/mips/loongson64/common/env.c
> +++ b/arch/mips/loongson64/common/env.c

> @@ -151,6 +154,10 @@ void __init prom_init_env(void)
>  	loongson_sysconf.nr_nodes = (loongson_sysconf.nr_cpus +
>  		loongson_sysconf.cores_per_node - 1) /
>  		loongson_sysconf.cores_per_node;
> +	if (!strncmp(ecpu->cpuname, "Loongson", 8))
> +		strncpy(cpu_full_name, ecpu->cpuname, sizeof(cpu_full_name));
> +	if (cpu_full_name[0] == 0)
> +		strncpy(cpu_full_name, __cpu_full_name[0], sizeof(cpu_full_name));

long line

Otherwise this looks reasonable I think:
Reviewed-by: James Hogan <jhogan@xxxxxxxxxx>

Cheers
James

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux