* [PATCH] ARM: display machine model in cpuinfo
@ 2014-12-14 14:13 Rafał Miłecki
2014-12-15 10:45 ` Mark Rutland
0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2014-12-14 14:13 UTC (permalink / raw)
To: linux-arm-kernel
This may be useful to display hardware model in the /proc/cpuinfo. It
definitely helps to identify the device and there are some archs already
doing that (arm64, m32r, mips).
Use the model from DT and add it to the cpuinfo.
Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
arch/arm/kernel/setup.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index c031063..957d9ac 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -145,6 +145,7 @@ EXPORT_SYMBOL(elf_platform);
static const char *cpu_name;
static const char *machine_name;
+static const char *hardware;
static char __initdata cmd_line[COMMAND_LINE_SIZE];
const struct machine_desc *machine_desc __initdata;
@@ -899,7 +900,8 @@ void __init setup_arch(char **cmdline_p)
if (!mdesc)
mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type);
machine_desc = mdesc;
- machine_name = mdesc->name;
+ machine_name = of_flat_dt_get_machine_name();
+ hardware = mdesc->name;
if (mdesc->reboot_mode != REBOOT_HARD)
reboot_mode = mdesc->reboot_mode;
@@ -1077,7 +1079,8 @@ static int c_show(struct seq_file *m, void *v)
seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
}
- seq_printf(m, "Hardware\t: %s\n", machine_name);
+ seq_printf(m, "Machine\t\t: %s\n", machine_name);
+ seq_printf(m, "Hardware\t: %s\n", hardware);
seq_printf(m, "Revision\t: %04x\n", system_rev);
seq_printf(m, "Serial\t\t: %08x%08x\n",
system_serial_high, system_serial_low);
--
1.8.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: display machine model in cpuinfo
2014-12-14 14:13 [PATCH] ARM: display machine model in cpuinfo Rafał Miłecki
@ 2014-12-15 10:45 ` Mark Rutland
2014-12-15 10:50 ` Russell King - ARM Linux
0 siblings, 1 reply; 3+ messages in thread
From: Mark Rutland @ 2014-12-15 10:45 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Dec 14, 2014 at 02:13:07PM +0000, Rafa? Mi?ecki wrote:
> This may be useful to display hardware model in the /proc/cpuinfo. It
> definitely helps to identify the device and there are some archs already
> doing that (arm64, m32r, mips).
Not true for arm64, if you look in linux-next.
I'm rather wary of exposing this kind via cpuinfo because it's
completely arbitrary in nature and not guaranteed to be in any way
useful (I have seen dtbs where the model string is misleading due to
copy+paste and no modificiation).
Mark.
> Use the model from DT and add it to the cpuinfo.
>
> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
> ---
> arch/arm/kernel/setup.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index c031063..957d9ac 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -145,6 +145,7 @@ EXPORT_SYMBOL(elf_platform);
>
> static const char *cpu_name;
> static const char *machine_name;
> +static const char *hardware;
> static char __initdata cmd_line[COMMAND_LINE_SIZE];
> const struct machine_desc *machine_desc __initdata;
>
> @@ -899,7 +900,8 @@ void __init setup_arch(char **cmdline_p)
> if (!mdesc)
> mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type);
> machine_desc = mdesc;
> - machine_name = mdesc->name;
> + machine_name = of_flat_dt_get_machine_name();
> + hardware = mdesc->name;
>
> if (mdesc->reboot_mode != REBOOT_HARD)
> reboot_mode = mdesc->reboot_mode;
> @@ -1077,7 +1079,8 @@ static int c_show(struct seq_file *m, void *v)
> seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
> }
>
> - seq_printf(m, "Hardware\t: %s\n", machine_name);
> + seq_printf(m, "Machine\t\t: %s\n", machine_name);
> + seq_printf(m, "Hardware\t: %s\n", hardware);
> seq_printf(m, "Revision\t: %04x\n", system_rev);
> seq_printf(m, "Serial\t\t: %08x%08x\n",
> system_serial_high, system_serial_low);
> --
> 1.8.4.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: display machine model in cpuinfo
2014-12-15 10:45 ` Mark Rutland
@ 2014-12-15 10:50 ` Russell King - ARM Linux
0 siblings, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2014-12-15 10:50 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Dec 15, 2014 at 10:45:48AM +0000, Mark Rutland wrote:
> On Sun, Dec 14, 2014 at 02:13:07PM +0000, Rafa? Mi?ecki wrote:
> > This may be useful to display hardware model in the /proc/cpuinfo. It
> > definitely helps to identify the device and there are some archs already
> > doing that (arm64, m32r, mips).
>
> Not true for arm64, if you look in linux-next.
>
> I'm rather wary of exposing this kind via cpuinfo because it's
> completely arbitrary in nature and not guaranteed to be in any way
> useful (I have seen dtbs where the model string is misleading due to
> copy+paste and no modificiation).
I wonder what's wrong with reading it from
/sys/firmware/devicetree/base/model if that exists, if not falling back
to reading it from /proc/cpuinfo.
Even better of course to use /sys/firmware/devicetree/base/compatible
--
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-15 10:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-14 14:13 [PATCH] ARM: display machine model in cpuinfo Rafał Miłecki
2014-12-15 10:45 ` Mark Rutland
2014-12-15 10:50 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).