From: Sam Day <[email protected]> Introduce the weak symbol spin_table_boot_cpu, which is called by spin_table_update_dt during pre-boot FDT fixup phase for each CPU that has enable-method="spin-table".
This saves the board/arch code from needing to scan the DT looking for CPUs to boot, and also makes it easier to bring the secondary CPUs online as late as possible. Reviewed-by: Tom Rini <[email protected]> Signed-off-by: Sam Day <[email protected]> --- arch/arm/cpu/armv8/spin_table.c | 20 ++++++++++++++++++++ arch/arm/include/asm/spin_table.h | 1 + 2 files changed, 21 insertions(+) diff --git a/arch/arm/cpu/armv8/spin_table.c b/arch/arm/cpu/armv8/spin_table.c index 5ba20efa33b..32bf680f02c 100644 --- a/arch/arm/cpu/armv8/spin_table.c +++ b/arch/arm/cpu/armv8/spin_table.c @@ -8,11 +8,18 @@ #include <linux/libfdt.h> #include <asm/spin_table.h> +int __weak spin_table_boot_cpu(void *fdt, int cpu_offset) +{ + return 0; +} + int spin_table_update_dt(void *fdt) { int cpus_offset, offset; const char *prop; + const void *release_addr; int ret; + int found_cpus = 0; unsigned long rsv_addr = (unsigned long)&spin_table_reserve_begin; unsigned long rsv_size = &spin_table_reserve_end - &spin_table_reserve_begin; @@ -45,12 +52,25 @@ int spin_table_update_dt(void *fdt) if (!prop || strcmp(prop, "cpu")) continue; + release_addr = fdt_getprop(fdt, offset, "cpu-release-addr", NULL); + if (release_addr) + continue; + + found_cpus = 1; + + ret = spin_table_boot_cpu(fdt, offset); + if (ret) + return ret; + ret = fdt_setprop_u64(fdt, offset, "cpu-release-addr", (unsigned long)&spin_table_cpu_release_addr); if (ret) return -ENOSPC; } + if (!found_cpus) + return 0; + ret = fdt_add_mem_rsv(fdt, rsv_addr, rsv_size); if (ret) return -ENOSPC; diff --git a/arch/arm/include/asm/spin_table.h b/arch/arm/include/asm/spin_table.h index 8fc61237e07..3c422046b83 100644 --- a/arch/arm/include/asm/spin_table.h +++ b/arch/arm/include/asm/spin_table.h @@ -10,5 +10,6 @@ extern char spin_table_reserve_begin; extern char spin_table_reserve_end; int spin_table_update_dt(void *fdt); +int spin_table_boot_cpu(void *fdt, int cpu_offset); #endif /* __ASM_SPIN_TABLE_H__ */ -- 2.54.0

