]> git.dujemihanovic.xyz Git - u-boot.git/commit
riscv: Use a valid bit to ignore already-pending IPIs
authorSean Anderson <seanga2@gmail.com>
Mon, 21 Sep 2020 11:51:37 +0000 (07:51 -0400)
committerAndes <uboot@andestech.com>
Wed, 30 Sep 2020 00:54:52 +0000 (08:54 +0800)
commitf760c9a1fd485beae7612e39576e5fbf77c5d96b
tree41e9a807d125707c4b5536a3e19aa63b7645aa5c
parentd4990a46485f2f6592ae29f2b822043dbdeae15d
riscv: Use a valid bit to ignore already-pending IPIs

Some IPIs may already be pending when U-Boot is started. This could be a
problem if a secondary hart tries to handle an IPI before the boot hart has
initialized the IPI device.

To be specific, the Kendryte K210 ROM-based bootloader does not clear IPIs
before passing control to U-Boot. Without this patch, the secondary hart
jumps to address 0x0 as soon as it enters secondary_hart_loop, and then
hangs in its trap handler.

This commit introduces a valid bit so secondary harts know when and IPI
originates from U-Boot, and it is safe to use the IPI API. The valid bit is
initialized to 0 by board_init_f_init_reserve. Before this, secondary harts
wait in wait_for_gd_init.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
arch/riscv/include/asm/smp.h
arch/riscv/lib/smp.c