Skip to content

Commit c4676f8

Browse files
avpatelpalmer-dabbelt
authored andcommitted
RISC-V: Don't fail in riscv_of_parent_hartid() for disabled HARTs
The riscv_of_processor_hartid() used by riscv_of_parent_hartid() fails for HARTs disabled in the DT. This results in the following warning thrown by the RISC-V INTC driver for the E-core on SiFive boards: [ 0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller The riscv_of_parent_hartid() is only expected to read the hartid from the DT so we directly call of_get_cpu_hwid() instead of calling riscv_of_processor_hartid(). Fixes: ad635e7 ("riscv: cpu: Add 64bit hartid support on RV64") Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 0bb80ec commit c4676f8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

arch/riscv/kernel/cpu.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,14 @@ int __init riscv_early_of_processor_hartid(struct device_node *node, unsigned lo
125125
*/
126126
int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid)
127127
{
128-
int rc;
129-
130128
for (; node; node = node->parent) {
131129
if (of_device_is_compatible(node, "riscv")) {
132-
rc = riscv_of_processor_hartid(node, hartid);
133-
if (!rc)
134-
return 0;
130+
*hartid = (unsigned long)of_get_cpu_hwid(node, 0);
131+
if (*hartid == ~0UL) {
132+
pr_warn("Found CPU without hart ID\n");
133+
return -ENODEV;
134+
}
135+
return 0;
135136
}
136137
}
137138

0 commit comments

Comments
 (0)