summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2023-11-08 18:57:17 -0800
committerPalmer Dabbelt <palmer@rivosinc.com>2023-11-08 18:57:17 -0800
commitf9a619eb603b6c8062e910cd994acc4b3ce032ba (patch)
tree7d5db2b5381f4c370c53c3c0ea4c1a11c6da2695 /arch/riscv
parent05942f780ac6a70e5859fc41d5700e2ca43c4867 (diff)
parentc5e4ce9db635fef5ebffdfba1e7d80710474b176 (diff)
downloadlwn-f9a619eb603b6c8062e910cd994acc4b3ce032ba.tar.gz
lwn-f9a619eb603b6c8062e910cd994acc4b3ce032ba.zip
Merge patch series "Linux RISC-V AIA Preparatory Series"
These two ended up in the AIA series, but they're really independent improvements. * b4-shazam-merge: of: property: Add fw_devlink support for msi-parent RISC-V: Don't fail in riscv_of_parent_hartid() for disabled HARTs Link: https://lore.kernel.org/r/20231027154254.355853-1-apatel@ventanamicro.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/kernel/cpu.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index bcfc0c8dfd01..d11d6320fb0d 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -125,13 +125,14 @@ old_interface:
*/
int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid)
{
- int rc;
-
for (; node; node = node->parent) {
if (of_device_is_compatible(node, "riscv")) {
- rc = riscv_of_processor_hartid(node, hartid);
- if (!rc)
- return 0;
+ *hartid = (unsigned long)of_get_cpu_hwid(node, 0);
+ if (*hartid == ~0UL) {
+ pr_warn("Found CPU without hart ID\n");
+ return -ENODEV;
+ }
+ return 0;
}
}