Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Huacai Chen <chenhc@lemote.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	John Crispin <john@phrozen.org>,
	"Steven J . Hill" <Steven.Hill@cavium.com>,
	<linux-mips@linux-mips.org>, Fuxin Zhang <zhangfx@lemote.com>,
	Zhangjin Wu <wuzhangjin@gmail.com>
Subject: Re: [PATCH V7 8/9] MIPS: Add __cpu_full_name[] to make CPU names more human-readable
Date: Fri, 23 Jun 2017 16:15:07 +0100	[thread overview]
Message-ID: <20170623151507.GC31455@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <1498144016-9111-9-git-send-email-chenhc@lemote.com>

[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]

On Thu, Jun 22, 2017 at 11:06:55PM +0800, Huacai Chen wrote:
> 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

> @@ -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);

If the core frequency is useful (I can imagine it being useful for
humans), maybe it should be on a separate line.

This also assumes that the mips_hpt_frequency is half the core
frequency, which may not universally be the case. Perhaps that should be
abstracted too (at some point, I suppose it doesn't matter right away).

> diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c
> index 1e8a955..9ee24ea 100644
> --- a/arch/mips/loongson64/common/env.c
> +++ b/arch/mips/loongson64/common/env.c
> @@ -25,6 +25,7 @@
>  
>  u32 cpu_clock_freq;
>  EXPORT_SYMBOL(cpu_clock_freq);
> +static char cpu_full_name[64];
>  struct efi_memory_map_loongson *loongson_memmap;
>  struct loongson_system_configuration loongson_sysconf;
>  
> @@ -151,6 +152,8 @@ 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, 64);

maybe sizeof(cpu_full_name) rather than 64.

>  
>  	loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr;
>  	loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr;
> @@ -212,3 +215,18 @@ void __init prom_init_env(void)
>  	}
>  	pr_info("CpuClock = %u\n", cpu_clock_freq);
>  }
> +
> +static int __init overwrite_cpu_fullname(void)
> +{
> +	int cpu;
> +
> +	if (cpu_full_name[0] == 0)
> +		return 0;
> +
> +	for(cpu = 0; cpu < NR_CPUS; cpu++)

space before open bracket please

> +		__cpu_full_name[cpu] = cpu_full_name;
> +
> +	return 0;
> +}
> +
> +core_initcall(overwrite_cpu_fullname);

Cheers
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: Huacai Chen <chenhc@lemote.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	John Crispin <john@phrozen.org>,
	"Steven J . Hill" <Steven.Hill@cavium.com>,
	linux-mips@linux-mips.org, Fuxin Zhang <zhangfx@lemote.com>,
	Zhangjin Wu <wuzhangjin@gmail.com>
Subject: Re: [PATCH V7 8/9] MIPS: Add __cpu_full_name[] to make CPU names more human-readable
Date: Fri, 23 Jun 2017 16:15:07 +0100	[thread overview]
Message-ID: <20170623151507.GC31455@jhogan-linux.le.imgtec.org> (raw)
Message-ID: <20170623151507.I04MMWGfV62v79K7JtF5YQ8c3bw3eS3d67-0DX7_4PQ@z> (raw)
In-Reply-To: <1498144016-9111-9-git-send-email-chenhc@lemote.com>

[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]

On Thu, Jun 22, 2017 at 11:06:55PM +0800, Huacai Chen wrote:
> 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

> @@ -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);

If the core frequency is useful (I can imagine it being useful for
humans), maybe it should be on a separate line.

This also assumes that the mips_hpt_frequency is half the core
frequency, which may not universally be the case. Perhaps that should be
abstracted too (at some point, I suppose it doesn't matter right away).

> diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c
> index 1e8a955..9ee24ea 100644
> --- a/arch/mips/loongson64/common/env.c
> +++ b/arch/mips/loongson64/common/env.c
> @@ -25,6 +25,7 @@
>  
>  u32 cpu_clock_freq;
>  EXPORT_SYMBOL(cpu_clock_freq);
> +static char cpu_full_name[64];
>  struct efi_memory_map_loongson *loongson_memmap;
>  struct loongson_system_configuration loongson_sysconf;
>  
> @@ -151,6 +152,8 @@ 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, 64);

maybe sizeof(cpu_full_name) rather than 64.

>  
>  	loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr;
>  	loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr;
> @@ -212,3 +215,18 @@ void __init prom_init_env(void)
>  	}
>  	pr_info("CpuClock = %u\n", cpu_clock_freq);
>  }
> +
> +static int __init overwrite_cpu_fullname(void)
> +{
> +	int cpu;
> +
> +	if (cpu_full_name[0] == 0)
> +		return 0;
> +
> +	for(cpu = 0; cpu < NR_CPUS; cpu++)

space before open bracket please

> +		__cpu_full_name[cpu] = cpu_full_name;
> +
> +	return 0;
> +}
> +
> +core_initcall(overwrite_cpu_fullname);

Cheers
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-06-23 15:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 15:06 [PATCH V7 0/9] MIPS: Loongson: feature and performance improvements Huacai Chen
2017-06-22 15:06 ` [PATCH V7 1/9] MIPS: Loongson: Add Loongson-3A R3 basic support Huacai Chen
2017-06-22 15:06 ` [PATCH V7 2/9] MIPS: c-r4k: Add r4k_blast_scache_node for Loongson-3 Huacai Chen
2017-06-28 14:30   ` James Hogan
2017-06-28 14:30     ` James Hogan
2017-06-29  1:33     ` Huacai Chen
2017-06-29  5:46       ` James Hogan
2017-06-29  5:46         ` James Hogan
2017-06-29 10:07         ` Huacai Chen
2017-06-29 10:23         ` Joshua Kinard
2017-06-30  7:03           ` Huacai Chen
2017-06-22 15:06 ` [PATCH V7 3/9] MIPS: Loongson: Add NMI handler support Huacai Chen
2017-06-22 15:06 ` [PATCH V7 4/9] MIPS: Loongson-3: Support 4 packages in CPU Hwmon driver Huacai Chen
2017-06-22 15:06 ` [PATCH V7 5/9] MIPS: Loongson-3: IRQ balancing for PCI devices Huacai Chen
2017-06-22 15:06 ` [PATCH V7 6/9] MIPS: Loongson-3: support irq_set_affinity() in i8259 chip Huacai Chen
2017-06-22 15:06 ` [PATCH V7 7/9] MIPS: Loogson: Make enum loongson_cpu_type more clear Huacai Chen
2017-06-22 15:06 ` [PATCH V7 8/9] MIPS: Add __cpu_full_name[] to make CPU names more human-readable Huacai Chen
2017-06-23 15:15   ` James Hogan [this message]
2017-06-23 15:15     ` James Hogan
2017-06-23 17:11     ` Ralf Baechle
2017-06-24  8:50       ` Huacai Chen
2017-06-22 15:06 ` [PATCH V7 9/9] MIPS: Loongson: Introduce and use LOONGSON_LLSC_WAR Huacai Chen
2017-06-23 14:54   ` James Hogan
2017-06-23 14:54     ` James Hogan
2017-06-24  8:55     ` Huacai Chen
2017-06-24  9:02       ` James Hogan
2017-06-24  9:02         ` James Hogan
2017-06-24  9:23         ` Huacai Chen
2017-06-26  8:26           ` James Hogan
2017-06-26  9:38             ` Huacai Chen

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=20170623151507.GC31455@jhogan-linux.le.imgtec.org \
    --to=james.hogan@imgtec.com \
    --cc=Steven.Hill@cavium.com \
    --cc=chenhc@lemote.com \
    --cc=john@phrozen.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /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