diff options
author | Atish Patra <atish.patra@wdc.com> | 2020-02-21 15:47:54 -0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-02-22 10:06:51 +0530 |
commit | 393624377a45d0fc20a376db60fb136a3b1fd685 (patch) | |
tree | 1027ee9ec99df45e19c91571e7fdd54a895accd5 /lib/sbi/sbi_ipi.c | |
parent | c3b3b8f43b49e4fa8fde5e916cd8d573687e3626 (diff) |
lib: Use available hart mask for correct hbase value
As per the latest SBI specification, all online harts should receive
IPI if hbase is set to -1.
Set the target mask to all available hart mask if hbase is -1.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_ipi.c')
-rw-r--r-- | lib/sbi/sbi_ipi.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 206931c..62eba87 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -79,20 +79,23 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong hbase, u32 hartid = sbi_current_hartid(); unsigned long last_bit = __fls(mask); - if (hbase > last_bit) - /* hart base is not available */ - return SBI_EINVAL; - /** - * FIXME: This check is valid only ULONG size. This is oka for now as - * avaialble hart mask can support upto ULONG size only. - */ - tempmask = hmask << hbase; - tempmask = ~mask & tempmask; - if (tempmask) - /* at least one of the hart in hmask is not available */ - return SBI_EINVAL; + if (hbase != -1UL) { + if (hbase > last_bit) + /* hart base is not available */ + return SBI_EINVAL; + /** + * FIXME: This check is valid only ULONG size. This is okay for + * now as avaialble hart mask can support upto ULONG size only. + */ + tempmask = hmask << hbase; + tempmask = ~mask & tempmask; + if (tempmask) + /* at least one of the hart in hmask is not available */ + return SBI_EINVAL; + + mask &= (hmask << hbase); + } - mask &= (hmask << hbase); /* Send IPIs to every other hart on the set */ for (i = 0, m = mask; m; i++, m >>= 1) if ((m & 1UL) && (i != hartid)) |