From 221eb465c6960b3e005b3a49d8a62ec481bb357b Mon Sep 17 00:00:00 2001 From: Tan En De Date: Tue, 11 Apr 2023 18:15:46 +0800 Subject: riscv: sim.cc: Consider cpu-map node in cpus node cpu-map node may be present in cpus node. https://github.com/torvalds/linux/commit/124e46a86580c71e0eee8459c5da7649318118db So this commit adds logic to consider that by skipping cpu-map node. Signed-off-by: Tan En De --- riscv/sim.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'riscv') diff --git a/riscv/sim.cc b/riscv/sim.cc index dcbd469..2ec1956 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -149,15 +149,19 @@ sim_t::sim_t(const cfg_t *cfg, bool halted, } //per core attribute - int cpu_offset = 0, rc; + int cpu_offset = 0, cpu_map_offset, rc; size_t cpu_idx = 0; cpu_offset = fdt_get_offset(fdt, "/cpus"); + cpu_map_offset = fdt_get_offset(fdt, "/cpus/cpu-map"); if (cpu_offset < 0) return; for (cpu_offset = fdt_get_first_subnode(fdt, cpu_offset); cpu_offset >= 0; cpu_offset = fdt_get_next_subnode(fdt, cpu_offset)) { + if (!(cpu_map_offset < 0) && cpu_offset == cpu_map_offset) + continue; + if (cpu_idx >= nprocs()) break; -- cgit v1.1