[PATCH 2/6] armv8: spin_table: add hook for booting cores

Sam Day me at samcday.com
Tue Jan 28 00:03:01 CET 2025


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.

Signed-off-by: Sam Day <me at samcday.com>
---
 arch/arm/cpu/armv8/spin_table.c   | 9 +++++++++
 arch/arm/include/asm/spin_table.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/cpu/armv8/spin_table.c b/arch/arm/cpu/armv8/spin_table.c
index 13b300f5c67a6dd257b2cb53350a7b5bafa3db96..f83ff456f26d41402b83f0e30a65f8fc48e42fbe 100644
--- a/arch/arm/cpu/armv8/spin_table.c
+++ b/arch/arm/cpu/armv8/spin_table.c
@@ -8,6 +8,11 @@
 #include <asm/spin_table.h>
 #include <errno.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;
@@ -45,6 +50,10 @@ int spin_table_update_dt(void *fdt)
 		if (!prop || strcmp(prop, "cpu"))
 			continue;
 
+		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)
diff --git a/arch/arm/include/asm/spin_table.h b/arch/arm/include/asm/spin_table.h
index 8fc61237e07559f267e1da1fbc8ee646ef08721f..3c422046b830a7a81d7de806ff0db92d346446d2 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.47.1




More information about the U-Boot mailing list