Skip to content

Commit

Permalink
riscv: andes_plic: Fix riscv_get_ipi() mask
Browse files Browse the repository at this point in the history
Current logic in riscv_get_ipi() for Andes PLICSW does not look
correct. The mask to test IPI pending bits for a hart should be
left shifted by (8 * gd->arch.boot_hart), just the same as what
is done in riscv_send_ipi().

Fixes: 8b3e97b ("riscv: add functions for reading the IPI status")
Signed-off-by: Bin Meng <[email protected]>
Reviewed-by: Rick Chen <[email protected]>
Tested-by: Rick Chen <[email protected]>
  • Loading branch information
lbmeng authored and Leo Yu-Chi Liang committed Jun 17, 2021
1 parent 279de75 commit 62ce0a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/riscv/lib/andes_plic.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ int riscv_clear_ipi(int hart)

int riscv_get_ipi(int hart, int *pending)
{
unsigned int ipi = (SEND_IPI_TO_HART(hart) << (8 * gd->arch.boot_hart));

*pending = readl((void __iomem *)PENDING_REG(gd->arch.plic,
gd->arch.boot_hart));
*pending = !!(*pending & SEND_IPI_TO_HART(hart));
*pending = !!(*pending & ipi);

return 0;
}
Expand Down

0 comments on commit 62ce0a0

Please sign in to comment.