diff options
author | Alexey Gladkov <legion@kernel.org> | 2024-01-11 12:12:37 +0000 |
---|---|---|
committer | Alexey Gladkov <legion@kernel.org> | 2024-01-17 13:03:02 +0000 |
commit | 53069bf893afe218a36b81bd43474d874bc61719 (patch) | |
tree | 130e00e8792ccc72d63ed2547fe2051d62ba2329 | |
parent | b42ef43eaa1d046ebdc96e60610dc94de7a9e72e (diff) | |
download | linux-patchset/meminfo/v2.1.tar.gz |
PARISC: Show information about one cpu at each iterationpatchset/meminfo/v2.1
Signed-off-by: Alexey Gladkov <legion@kernel.org>
-rw-r--r-- | arch/parisc/kernel/processor.c | 103 | ||||
-rw-r--r-- | arch/parisc/kernel/setup.c | 9 |
2 files changed, 55 insertions, 57 deletions
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c index 1fc89fa2c2d214..206af1770b3a4a 100644 --- a/arch/parisc/kernel/processor.c +++ b/arch/parisc/kernel/processor.c @@ -379,7 +379,7 @@ int init_per_cpu(int cpunum) int show_cpuinfo (struct seq_file *m, void *v) { - unsigned long cpu; + unsigned long cpu = (unsigned long) v - 1; char cpu_name[60], *p; /* strip PA path from CPU name to not confuse lscpu */ @@ -388,71 +388,70 @@ show_cpuinfo (struct seq_file *m, void *v) if (p) *(--p) = 0; - for_each_online_cpu(cpu) { #ifdef CONFIG_SMP - const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu); + const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu); - if (0 == cpuinfo->hpa) - continue; + if (0 == cpuinfo->hpa) + return 0; #endif - seq_printf(m, "processor\t: %lu\n" - "cpu family\t: PA-RISC %s\n", - cpu, boot_cpu_data.family_name); + seq_printf(m, "processor\t: %lu\n" + "cpu family\t: PA-RISC %s\n", + cpu, boot_cpu_data.family_name); - seq_printf(m, "cpu\t\t: %s\n", boot_cpu_data.cpu_name ); + seq_printf(m, "cpu\t\t: %s\n", boot_cpu_data.cpu_name ); - /* cpu MHz */ - seq_printf(m, "cpu MHz\t\t: %d.%06d\n", - boot_cpu_data.cpu_hz / 1000000, - boot_cpu_data.cpu_hz % 1000000 ); + /* cpu MHz */ + seq_printf(m, "cpu MHz\t\t: %d.%06d\n", + boot_cpu_data.cpu_hz / 1000000, + boot_cpu_data.cpu_hz % 1000000 ); #ifdef CONFIG_GENERIC_ARCH_TOPOLOGY - seq_printf(m, "physical id\t: %d\n", - topology_physical_package_id(cpu)); - seq_printf(m, "siblings\t: %d\n", - cpumask_weight(topology_core_cpumask(cpu))); - seq_printf(m, "core id\t\t: %d\n", topology_core_id(cpu)); + seq_printf(m, "physical id\t: %d\n", + topology_physical_package_id(cpu)); + seq_printf(m, "siblings\t: %d\n", + cpumask_weight(topology_core_cpumask(cpu))); + seq_printf(m, "core id\t\t: %d\n", topology_core_id(cpu)); #endif - seq_printf(m, "capabilities\t:"); - if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32) - seq_puts(m, " os32"); - if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64) - seq_puts(m, " os64"); - if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC) - seq_puts(m, " iopdir_fdc"); - switch (boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) { - case PDC_MODEL_NVA_SUPPORTED: - seq_puts(m, " nva_supported"); - break; - case PDC_MODEL_NVA_SLOW: - seq_puts(m, " nva_slow"); - break; - case PDC_MODEL_NVA_UNSUPPORTED: - seq_puts(m, " needs_equivalent_aliasing"); - break; - } - seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); + seq_printf(m, "capabilities\t:"); + if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32) + seq_puts(m, " os32"); + if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64) + seq_puts(m, " os64"); + if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC) + seq_puts(m, " iopdir_fdc"); + switch (boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) { + case PDC_MODEL_NVA_SUPPORTED: + seq_puts(m, " nva_supported"); + break; + case PDC_MODEL_NVA_SLOW: + seq_puts(m, " nva_slow"); + break; + case PDC_MODEL_NVA_UNSUPPORTED: + seq_puts(m, " needs_equivalent_aliasing"); + break; + } + seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); - seq_printf(m, "model\t\t: %s - %s\n", - boot_cpu_data.pdc.sys_model_name, - cpu_name); + seq_printf(m, "model\t\t: %s - %s\n", + boot_cpu_data.pdc.sys_model_name, + cpu_name); - seq_printf(m, "hversion\t: 0x%08x\n" - "sversion\t: 0x%08x\n", - boot_cpu_data.hversion, - boot_cpu_data.sversion ); + seq_printf(m, "hversion\t: 0x%08x\n" + "sversion\t: 0x%08x\n", + boot_cpu_data.hversion, + boot_cpu_data.sversion ); - /* print cachesize info */ - show_cache_info(m); + /* print cachesize info */ + show_cache_info(m); - seq_printf(m, "bogomips\t: %lu.%02lu\n", - loops_per_jiffy / (500000 / HZ), - loops_per_jiffy / (5000 / HZ) % 100); + seq_printf(m, "bogomips\t: %lu.%02lu\n", + loops_per_jiffy / (500000 / HZ), + loops_per_jiffy / (5000 / HZ) % 100); + + seq_printf(m, "software id\t: %ld\n\n", + boot_cpu_data.pdc.model.sw_id); - seq_printf(m, "software id\t: %ld\n\n", - boot_cpu_data.pdc.model.sw_id); - } return 0; } diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c index 2f434f2da18514..1c76a42c948f6c 100644 --- a/arch/parisc/kernel/setup.c +++ b/arch/parisc/kernel/setup.c @@ -156,12 +156,11 @@ void __init setup_arch(char **cmdline_p) static void * c_start (struct seq_file *m, loff_t *pos) { - /* Looks like the caller will call repeatedly until we return + unsigned long i = *pos; + /* Looks like the caller will call repeatedly until we return * 0, signaling EOF perhaps. This could be used to sequence - * through CPUs for example. Since we print all cpu info in our - * show_cpuinfo() disregarding 'pos' (which I assume is 'v' above) - * we only allow for one "position". */ - return ((long)*pos < 1) ? (void *)1 : NULL; + * through CPUs for example. */ + return i < nr_cpu_ids ? (void *)(i + 1) : NULL; } static void * |