linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo
@ 2018-09-12 14:38 Anup Patel
  2018-09-12 16:47 ` Atish Patra
  2018-09-29  1:46 ` Palmer Dabbelt
  0 siblings, 2 replies; 8+ messages in thread
From: Anup Patel @ 2018-09-12 14:38 UTC (permalink / raw)
  To: Palmer Dabbelt, Albert Ou
  Cc: Atish Patra, Christoph Hellwig, linux-riscv, linux-kernel, Anup Patel

Currently, /proc/cpuinfo show logical CPU ID as Hart ID which
is in-correct. This patch shows CPU ID and Hart ID separately
in /proc/cpuinfo using cpuid_to_hardid_map().

With this patch, contents of /proc/cpuinfo looks as follows:
cpu	: 0
hart	: 1
isa	: rv64imafdcsu
mmu	: sv48

cpu	: 1
hart	: 0
isa	: rv64imafdcsu
mmu	: sv48

cpu	: 2
hart	: 3
isa	: rv64imafdcsu
mmu	: sv48

cpu	: 3
hart	: 2
isa	: rv64imafdcsu
mmu	: sv48

Signed-off-by: Anup Patel <anup@brainfault.org>
---
 arch/riscv/kernel/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index f0f0ec2737b7..7c1342e242e6 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -87,7 +87,8 @@ static int c_show(struct seq_file *m, void *v)
 						   NULL);
 	const char *compat, *isa, *mmu;
 
-	seq_printf(m, "hart\t: %lu\n", cpu_id);
+	seq_printf(m, "cpu\t: %lu\n", cpu_id);
+	seq_printf(m, "hart\t: %lu\n", cpuid_to_hardid_map(cpu_id));
 	if (!of_property_read_string(node, "riscv,isa", &isa)
 	    && isa[0] == 'r'
 	    && isa[1] == 'v')
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-01 16:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12 14:38 [PATCH] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo Anup Patel
2018-09-12 16:47 ` Atish Patra
2018-09-13  3:39   ` Anup Patel
2018-09-17 14:10   ` Christoph Hellwig
2018-09-23 13:04     ` Anup Patel
2018-09-29  1:46 ` Palmer Dabbelt
2018-09-29  6:12   ` Anup Patel
2018-10-01 16:42     ` Palmer Dabbelt

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).