summary refs log tree commit diff stats
path: root/hw/misc/aspeed_scu.c
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2020-04-09 16:01:37 +0930
committerPeter Maydell <peter.maydell@linaro.org>2020-05-11 10:40:24 +0100
commit9bb6d14081ce0859480168b1c322b6a88706161e (patch)
tree1ff02767010312e6579b279322d00346ad78d3af /hw/misc/aspeed_scu.c
parentc88f1ffc19e38008a1c33ae039482a860aa7418c (diff)
downloadfocaccia-qemu-9bb6d14081ce0859480168b1c322b6a88706161e.tar.gz
focaccia-qemu-9bb6d14081ce0859480168b1c322b6a88706161e.zip
aspeed: Add boot stub for smp booting
This is a boot stub that is similar to the code u-boot runs, allowing
the kernel to boot the secondary CPU.

u-boot works as follows:

 1. Initialises the SMP mailbox area in the SCU at 0x1e6e2180 with default values

 2. Copies a stub named 'mailbox_insn' from flash to the SCU, just above the
    mailbox area

 3. Sets AST_SMP_MBOX_FIELD_READY to a magic value to indicate the
    secondary can begin execution from the stub

 4. The stub waits until the AST_SMP_MBOX_FIELD_GOSIGN register is set to
    a magic value

 5. Jumps to the address in AST_SMP_MBOX_FIELD_ENTRY, starting Linux

Linux indicates it is ready by writing the address of its entrypoint
function to AST_SMP_MBOX_FIELD_ENTRY and the 'go' magic number to
AST_SMP_MBOX_FIELD_GOSIGN. The secondary CPU sees this at step 4 and
breaks out of it's loop.

To be compatible, a fixed qemu stub is loaded into the mailbox area. As
qemu can ensure the stub is loaded before execution starts, we do not
need to emulate the AST_SMP_MBOX_FIELD_READY behaviour of u-boot. The
secondary CPU's program counter points to the beginning of the stub,
allowing qemu to start secondaries at step four.

Reboot behaviour is preserved by resetting AST_SMP_MBOX_FIELD_GOSIGN
when the secondaries are reset.

This is only configured when the system is booted with -kernel and qemu
does not execute u-boot first.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc/aspeed_scu.c')
0 files changed, 0 insertions, 0 deletions