summaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_hsm.c
diff options
context:
space:
mode:
authorBen Dooks <ben.dooks@sifive.com>2022-07-11 10:18:03 +0300
committerAnup Patel <anup@brainfault.org>2022-07-11 13:16:59 +0300
commitcaa5eeacacbc935090968e601716f66a6195ceef (patch)
tree8485b24961388fc16885ae81c409b828d854c70e /lib/sbi/sbi_hsm.c
parent994c8cfb29d0b53bbcc774a728cad778aeece6ac (diff)
downloadopensbi-caa5eeacacbc935090968e601716f66a6195ceef.tar.xz
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>
Diffstat (limited to 'lib/sbi/sbi_hsm.c')
-rw-r--r--lib/sbi/sbi_hsm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index 1165acc..836008f 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -289,7 +289,9 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,
(hsm_device_has_hart_secondary_boot() && !init_count)) {
return hsm_device_hart_start(hartid, scratch->warmboot_addr);
} else {
- sbi_ipi_raw_send(hartid);
+ int rc = sbi_ipi_raw_send(hartid);
+ if (rc)
+ return rc;
}
return 0;