Skip to contentSkip to conversation

armv8/spin_table.c: fix spin table release address

PATCH New Tsung-Han Lin 2 participants 3 messages Nov 24, 2016 – Nov 26, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 armv8/spin_table.c: fix spin table release address

Since only the master core will relocate itself, the spin-table release address seen by master core and other slave cores is different. This commit fixes this issue by recalculating the spin-table release address' offset instead of leaving it to compiler.

---
 arch/arm/cpu/armv8/spin_table.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/cpu/armv8/spin_table.c +5 -1
index ec1c9b8ddb6f..1169e2df5f47 100644
@@ -11,12 +11,16 @@
 
 int spin_table_update_dt(void *fdt)
 {
+	extern unsigned long _start;
 	int cpus_offset, offset;
 	const char *prop;
 	int ret;
 	unsigned long rsv_addr = (unsigned long)&spin_table_reserve_begin;
 	unsigned long rsv_size = &spin_table_reserve_end -
 						&spin_table_reserve_begin;
+	unsigned long unreloc_spin_release_addr = CONFIG_SYS_TEXT_BASE +
+		(unsigned long)&spin_table_cpu_release_addr -
+		(unsigned long)&_start;
 
 	cpus_offset = fdt_path_offset(fdt, "/cpus");
 	if (cpus_offset < 0)
@@ -47,7 +51,7 @@ int spin_table_update_dt(void *fdt)
 			continue;
 
 		ret = fdt_setprop_u64(fdt, offset, "cpu-release-addr",
-				(unsigned long)&spin_table_cpu_release_addr);
+				unreloc_spin_release_addr);
 		if (ret)
 			return -ENOSPC;
 	}
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 armv8/spin_table.c: fix spin table release address

2016-11-25 7:38 GMT+09:00 Tsung-Han Lin <[email protected]>:

Quoted 4 lines

Since only the master core will relocate itself, the spin-table release address seen by master core and other slave cores is different. This commit fixes this issue by recalculating the spin-table release address' offset instead of leaving it to compiler.

No.
You should bring the slaves cores in after relocation so that the slaves enter the *relocated* _start.

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw

PATCH 1/1 armv8/spin_table.c: fix spin table release address

Oops,

Seems like I misunderstood this approach.
Thanks for the clarification!

Regards,

2016-11-26 11:17 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 14 lines

2016-11-25 7:38 GMT+09:00 Tsung-Han Lin <[email protected]>:

Quoted 4 lines

Since only the master core will relocate itself, the spin-table release address seen by master core and other slave cores is different. This commit fixes this issue by recalculating the spin-table release address' offset instead of leaving it to compiler.

No.
You should bring the slaves cores in after relocation so that the slaves enter the *relocated* _start.

--
Best Regards
Masahiro Yamada

Signature · 4 lines
Tsung-Han "*Johnny*" Lin

Page: http://tsunghanlin.github.com/
Email: tsunghan.tw at gmail.com