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>
This commit is contained in:
committed by
Palmer Dabbelt
parent
6825c7a80f
commit
f99fb607fb
@@ -15,6 +15,7 @@
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/smp.h>
|
||||
|
||||
/*
|
||||
* This driver implements a version of the RISC-V PLIC with the actual layout
|
||||
@@ -218,7 +219,7 @@ static int __init plic_init(struct device_node *node,
|
||||
struct of_phandle_args parent;
|
||||
struct plic_handler *handler;
|
||||
irq_hw_number_t hwirq;
|
||||
int cpu;
|
||||
int cpu, hartid;
|
||||
|
||||
if (of_irq_parse_one(node, i, &parent)) {
|
||||
pr_err("failed to parse parent for context %d.\n", i);
|
||||
@@ -229,12 +230,13 @@ static int __init plic_init(struct device_node *node,
|
||||
if (parent.args[0] == -1)
|
||||
continue;
|
||||
|
||||
cpu = plic_find_hart_id(parent.np);
|
||||
if (cpu < 0) {
|
||||
hartid = plic_find_hart_id(parent.np);
|
||||
if (hartid < 0) {
|
||||
pr_warn("failed to parse hart ID for context %d.\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
cpu = riscv_hartid_to_cpuid(hartid);
|
||||
handler = per_cpu_ptr(&plic_handlers, cpu);
|
||||
handler->present = true;
|
||||
handler->ctxid = i;
|
||||
|
||||
Reference in New Issue
Block a user