lib: sbi: add check for ipi device for hsm start
authorBen Dooks <ben.dooks@sifive.com>
Mon, 11 Jul 2022 07:18:03 +0000 (08:18 +0100)
committerAnup Patel <anup@brainfault.org>
Mon, 11 Jul 2022 10:16:59 +0000 (15:46 +0530)
commitcaa5eeacacbc935090968e601716f66a6195ceef
tree8485b24961388fc16885ae81c409b828d854c70e
parent994c8cfb29d0b53bbcc774a728cad778aeece6ac
lib: sbi: add check for ipi device for hsm start

If the ecall SBI_EXT_HSM_HART_START is called it might try to wake the
secondary hart using sbi_ipi_raw_send() to send an IPI to the hart.
This can fail if there is no IPI device but no error is returned from
sbi_ipi_raw_send() so the ecall returns as if the action completed and
the caller continues without noticing (in the case of Linux it just hangs
waiting for the secondary hart to become active)

Fix this by changing sbi_ipi_raw_send() to return and error, and if an
error is returned, then return it via SBI_EXT_HSM_HART_START call.

Signed-off-by: Ben Dooks <ben.dooks@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
include/sbi/sbi_ipi.h
lib/sbi/sbi_hsm.c
lib/sbi/sbi_ipi.c