lib: Simplify the for-loop in sbi_ipi_send_many()

We don't need to separately call sbi_ipi_send() for current HART
in sbi_ipi_send_many(). Instead, we can simplify the for-loop in
sbi_ipi_send_many() and call sbi_ipi_send() for all HARTs in the
for-loop itself.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Anup Patel
2020-02-22 11:50:55 +05:30
committed by Anup Patel
parent 393624377a
commit f8b3bb826d

View File

@@ -76,7 +76,6 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong hbase,
ulong i, m; ulong i, m;
ulong mask = sbi_hart_available_mask(); ulong mask = sbi_hart_available_mask();
ulong tempmask; ulong tempmask;
u32 hartid = sbi_current_hartid();
unsigned long last_bit = __fls(mask); unsigned long last_bit = __fls(mask);
if (hbase != -1UL) { if (hbase != -1UL) {
@@ -98,16 +97,9 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong 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)
sbi_ipi_send(scratch, i, event, data); sbi_ipi_send(scratch, i, event, data);
/*
* If the current hart is on the set, send an IPI
* to it as well
*/
if (mask & (1UL << hartid))
sbi_ipi_send(scratch, hartid, event, data);
return 0; return 0;
} }