aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/cpu.c
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2018-10-02 15:15:05 -0400
committerPalmer Dabbelt <palmer@sifive.com>2018-10-22 20:03:37 -0400
commitf99fb607fb2bc0d4ce6b9adb764c65e37f40a92b (patch)
tree082100e81815f6c2fa5d152821d24351aa16a871 /arch/riscv/kernel/cpu.c
parent6825c7a80f1863b975a00042abe140ea24813af2 (diff)
RISC-V: Use Linux logical CPU number instead of hartid
Setup the cpu_logical_map during boot. Moreover, every SBI call and PLIC context are based on the physical hartid. Use the logical CPU to hartid mapping to pass correct hartid to respective functions. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch/riscv/kernel/cpu.c')
-rw-r--r--arch/riscv/kernel/cpu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index 4723e235dcaa..cccc6f61c538 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/seq_file.h> 15#include <linux/seq_file.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <asm/smp.h>
17 18
18/* 19/*
19 * Returns the hart ID of the given device tree node, or -1 if the device tree 20 * Returns the hart ID of the given device tree node, or -1 if the device tree
@@ -138,11 +139,12 @@ static void c_stop(struct seq_file *m, void *v)
138 139
139static int c_show(struct seq_file *m, void *v) 140static int c_show(struct seq_file *m, void *v)
140{ 141{
141 unsigned long hart_id = (unsigned long)v - 1; 142 unsigned long cpu_id = (unsigned long)v - 1;
142 struct device_node *node = of_get_cpu_node(hart_id, NULL); 143 struct device_node *node = of_get_cpu_node(cpuid_to_hartid_map(cpu_id),
144 NULL);
143 const char *compat, *isa, *mmu; 145 const char *compat, *isa, *mmu;
144 146
145 seq_printf(m, "hart\t: %lu\n", hart_id); 147 seq_printf(m, "hart\t: %lu\n", cpu_id);
146 if (!of_property_read_string(node, "riscv,isa", &isa)) 148 if (!of_property_read_string(node, "riscv,isa", &isa))
147 print_isa(m, isa); 149 print_isa(m, isa);
148 if (!of_property_read_string(node, "mmu-type", &mmu)) 150 if (!of_property_read_string(node, "mmu-type", &mmu))