From d9546dfd228a19dc21d999d677b7786aac77120f Mon Sep 17 00:00:00 2001 From: seteiro Date: Fri, 16 Oct 2026 12:56:19 +0800 Subject: [PATCH] [libcpu][risc-v] skip disabled CPU nodes in early FDT walk Rbb666 noted that rt_hw_fdt_install_early() walked every /cpus child without checking status, so disabled cores still joined hart registration and MMU capability probing. Skip nodes that are not okay/ok via rt_fdt_device_is_available() before reading reg or mmu-type. Signed-off-by: seteiro --- libcpu/risc-v/common/setup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libcpu/risc-v/common/setup.c b/libcpu/risc-v/common/setup.c index 316a6929851..140a8ed12db 100644 --- a/libcpu/risc-v/common/setup.c +++ b/libcpu/risc-v/common/setup.c @@ -136,7 +136,17 @@ void rt_hw_fdt_install_early(void *fdt) uint32_t hartid; #ifdef ARCH_MM_MMU int size; - const char *name = fdt_getprop(fdt, cpu, "mmu-type", RT_NULL); + const char *name; +#endif + + /* Skip status=disabled (and other non-okay) CPU nodes. */ + if (!rt_fdt_device_is_available(fdt, cpu)) + { + continue; + } + +#ifdef ARCH_MM_MMU + name = fdt_getprop(fdt, cpu, "mmu-type", RT_NULL); #endif if (fdt_getprop_u32(fdt, cpu, "reg", &hartid, RT_NULL))