Skip to contentSkip to conversation

riscv: andes_plic: Fix riscv_get_ipi() mask

PATCH New Bin Meng 1 participant 1 message Jun 15, 2021 RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v2 1/1 riscv: andes_plic: Fix riscv_get_ipi() mask

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 8b3e97badf97 ("riscv: add functions for reading the IPI status")

---

Changes in v2:
- remove RFT tag
- update commit message with "Fixes" tag along with the commit id

 arch/riscv/lib/andes_plic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/riscv/lib/andes_plic.c +3 -1
index 221a5fe324..5e113ee8c9 100644
@@ -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;
 }
Signature · 1 line
2.25.1