@@ -23,15 +23,6 @@ ASM_FUNC(start_bootmethod)
* Primary CPU (x0 = 0) jumps to kernel, the other ones wait for an
* address to appear in mbox
*/
- adr x3, mbox
- adr x4, kernel_address
- cmp x0, #0
- csel x1, x3, x4, ne
+ adr x1, mbox
mov x2, #0
bl first_spin
-
- .align 3
-kernel_address:
- .long 0
-
- .ltorg
@@ -27,7 +27,7 @@ const unsigned long id_table[] = { CPU_IDS };
* @invalid: value of an invalid address, 0 or -1 depending on the boot method
* @is_entry: when true, pass boot parameters to the kernel, instead of 0
*/
-void __noreturn spin(unsigned long *mbox, unsigned long invalid, int is_entry)
+void __noreturn spin(unsigned long *mbox, unsigned long invalid)
{
unsigned long addr = invalid;
@@ -36,13 +36,6 @@ void __noreturn spin(unsigned long *mbox, unsigned long invalid, int is_entry)
addr = *mbox;
}
- if (is_entry)
-#ifdef KERNEL_32
- jump_kernel(addr, 0, ~0, (unsigned long)&dtb, 0);
-#else
- jump_kernel(addr, (unsigned long)&dtb, 0, 0, 0);
-#endif
-
jump_kernel(addr, 0, 0, 0, 0);
unreachable();
@@ -60,12 +53,15 @@ void __noreturn first_spin(unsigned int cpu, unsigned long *mbox,
unsigned long invalid)
{
if (cpu == 0) {
- *mbox = (unsigned long)&entrypoint;
- sevl();
- spin(mbox, invalid, 1);
+ unsigned long addr = (unsigned long)&entrypoint;
+#ifdef KERNEL_32
+ jump_kernel(addr, 0, ~0, (unsigned long)&dtb, 0);
+#else
+ jump_kernel(addr, (unsigned long)&dtb, 0, 0, 0);
+#endif
} else {
*mbox = invalid;
- spin(mbox, invalid, 0);
+ spin(mbox, invalid);
}
unreachable();
@@ -57,7 +57,7 @@ static int psci_cpu_off(void)
branch_table[cpu] = PSCI_ADDR_INVALID;
- spin(branch_table + cpu, PSCI_ADDR_INVALID, 0);
+ spin(branch_table + cpu, PSCI_ADDR_INVALID);
unreachable();
}
@@ -12,7 +12,7 @@
#include <compiler.h>
#include <stdbool.h>
-void __noreturn spin(unsigned long *mbox, unsigned long invalid, int is_entry);
+void __noreturn spin(unsigned long *mbox, unsigned long invalid);
void __noreturn first_spin(unsigned int cpu, unsigned long *mbox,
unsigned long invalid_addr);
The logic for initial boot is more complicated than it needs to be, with both first_spin() having a special case for CPU0 that requires an additional argument to be passed to spin(). Simplify this by moving the special-case logic for CPU0 into first_spin(). This removes the need to provide a dummy mailbox for CPU0 to spin on, simplfiies callers of first_spin() and spin(), which no longer need to pass a dummy mailbox or 'is_entry' for CPU0. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Akos Denke <akos.denke@arm.com> Cc: Andre Przywara <andre.przywara@arm.com> Cc: Luca Fancellu <luca.fancellu@arm.com> Cc: Marc Zyngier <maz@kernel.org> --- arch/aarch64/spin.S | 11 +---------- common/boot.c | 20 ++++++++------------ common/psci.c | 2 +- include/boot.h | 2 +- 4 files changed, 11 insertions(+), 24 deletions(-)