forked from Mirrors/opensbi
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>
This commit is contained in:
@@ -79,12 +79,13 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong hbase,
|
|||||||
u32 hartid = sbi_current_hartid();
|
u32 hartid = sbi_current_hartid();
|
||||||
unsigned long last_bit = __fls(mask);
|
unsigned long last_bit = __fls(mask);
|
||||||
|
|
||||||
|
if (hbase != -1UL) {
|
||||||
if (hbase > last_bit)
|
if (hbase > last_bit)
|
||||||
/* hart base is not available */
|
/* hart base is not available */
|
||||||
return SBI_EINVAL;
|
return SBI_EINVAL;
|
||||||
/**
|
/**
|
||||||
* FIXME: This check is valid only ULONG size. This is oka for now as
|
* FIXME: This check is valid only ULONG size. This is okay for
|
||||||
* avaialble hart mask can support upto ULONG size only.
|
* now as avaialble hart mask can support upto ULONG size only.
|
||||||
*/
|
*/
|
||||||
tempmask = hmask << hbase;
|
tempmask = hmask << hbase;
|
||||||
tempmask = ~mask & tempmask;
|
tempmask = ~mask & tempmask;
|
||||||
@@ -93,6 +94,8 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong hbase,
|
|||||||
return SBI_EINVAL;
|
return SBI_EINVAL;
|
||||||
|
|
||||||
mask &= (hmask << hbase);
|
mask &= (hmask << hbase);
|
||||||
|
}
|
||||||
|
|
||||||
/* Send IPIs to every other hart on the set */
|
/* Send IPIs to every other hart on the set */
|
||||||
for (i = 0, m = mask; m; i++, m >>= 1)
|
for (i = 0, m = mask; m; i++, m >>= 1)
|
||||||
if ((m & 1UL) && (i != hartid))
|
if ((m & 1UL) && (i != hartid))
|
||||||
|
Reference in New Issue
Block a user