aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2012-09-10 13:55:21 -0400
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2012-11-19 09:51:12 -0500
commitb4b8f770eb10a1bccaf8aa0ec1956e2dd7ed1e0a (patch)
treeb8a7daa2b44a0d639323a6add79b548e0bb7f6c4 /arch/arm/kernel
parente8d432c9cf0a3d569b2d00877d12c9ffe9e55286 (diff)
ARM: kernel: update cpuinfo to print all online CPUs features
Currently, reading /proc/cpuinfo provides userspace with CPU ID of the CPU carrying out the read from the file. This is fine as long as all CPUs in the system are the same. With the advent of big.LITTLE and heterogenous ARM systems this approach provides user space with incorrect bits of information since CPU ids in the system might differ from the one provided by the CPU reading the file. This patch updates the cpuinfo show function so that a read from /proc/cpuinfo prints HW information for all online CPUs at once, mirroring x86 behaviour. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/setup.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index da1d1aa20ad9..a15848f8b0ff 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -841,12 +841,9 @@ static const char *hwcap_str[] = {
841 841
842static int c_show(struct seq_file *m, void *v) 842static int c_show(struct seq_file *m, void *v)
843{ 843{
844 int i; 844 int i, j;
845 845 u32 cpuid;
846 seq_printf(m, "Processor\t: %s rev %d (%s)\n",
847 cpu_name, read_cpuid_id() & 15, elf_platform);
848 846
849#if defined(CONFIG_SMP)
850 for_each_online_cpu(i) { 847 for_each_online_cpu(i) {
851 /* 848 /*
852 * glibc reads /proc/cpuinfo to determine the number of 849 * glibc reads /proc/cpuinfo to determine the number of
@@ -854,45 +851,48 @@ static int c_show(struct seq_file *m, void *v)
854 * "processor". Give glibc what it expects. 851 * "processor". Give glibc what it expects.
855 */ 852 */
856 seq_printf(m, "processor\t: %d\n", i); 853 seq_printf(m, "processor\t: %d\n", i);
857 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n", 854 cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id();
855 seq_printf(m, "model name\t: %s rev %d (%s)\n",
856 cpu_name, cpuid & 15, elf_platform);
857
858#if defined(CONFIG_SMP)
859 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
858 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), 860 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
859 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); 861 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
860 } 862#else
861#else /* CONFIG_SMP */ 863 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
862 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 864 loops_per_jiffy / (500000/HZ),
863 loops_per_jiffy / (500000/HZ), 865 (loops_per_jiffy / (5000/HZ)) % 100);
864 (loops_per_jiffy / (5000/HZ)) % 100);
865#endif 866#endif
867 /* dump out the processor features */
868 seq_puts(m, "Features\t: ");
866 869
867 /* dump out the processor features */ 870 for (j = 0; hwcap_str[j]; j++)
868 seq_puts(m, "Features\t: "); 871 if (elf_hwcap & (1 << j))
869 872 seq_printf(m, "%s ", hwcap_str[j]);
870 for (i = 0; hwcap_str[i]; i++)
871 if (elf_hwcap & (1 << i))
872 seq_printf(m, "%s ", hwcap_str[i]);
873 873
874 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); 874 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", cpuid >> 24);
875 seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]); 875 seq_printf(m, "CPU architecture: %s\n",
876 proc_arch[cpu_architecture()]);
876 877
877 if ((read_cpuid_id() & 0x0008f000) == 0x00000000) { 878 if ((cpuid & 0x0008f000) == 0x00000000) {
878 /* pre-ARM7 */ 879 /* pre-ARM7 */
879 seq_printf(m, "CPU part\t: %07x\n", read_cpuid_id() >> 4); 880 seq_printf(m, "CPU part\t: %07x\n", cpuid >> 4);
880 } else {
881 if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
882 /* ARM7 */
883 seq_printf(m, "CPU variant\t: 0x%02x\n",
884 (read_cpuid_id() >> 16) & 127);
885 } else { 881 } else {
886 /* post-ARM7 */ 882 if ((cpuid & 0x0008f000) == 0x00007000) {
887 seq_printf(m, "CPU variant\t: 0x%x\n", 883 /* ARM7 */
888 (read_cpuid_id() >> 20) & 15); 884 seq_printf(m, "CPU variant\t: 0x%02x\n",
885 (cpuid >> 16) & 127);
886 } else {
887 /* post-ARM7 */
888 seq_printf(m, "CPU variant\t: 0x%x\n",
889 (cpuid >> 20) & 15);
890 }
891 seq_printf(m, "CPU part\t: 0x%03x\n",
892 (cpuid >> 4) & 0xfff);
889 } 893 }
890 seq_printf(m, "CPU part\t: 0x%03x\n", 894 seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
891 (read_cpuid_id() >> 4) & 0xfff);
892 } 895 }
893 seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
894
895 seq_puts(m, "\n");
896 896
897 seq_printf(m, "Hardware\t: %s\n", machine_name); 897 seq_printf(m, "Hardware\t: %s\n", machine_name);
898 seq_printf(m, "Revision\t: %04x\n", system_rev); 898 seq_printf(m, "Revision\t: %04x\n", system_rev);