All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask
@ 2021-06-09  7:56 Bin Meng
  2021-06-14  3:47 ` Bin Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Meng @ 2021-06-09  7:56 UTC (permalink / raw)
  To: Rick Chen, Leo Liang, U-Boot Mailing List

Current logic in riscv_get_ipi() for Andes PLICSW does not look good
to me. 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().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---
It looks there is no datasheet released from Andes that describes how
PLICSW works, and its register fields. I can only get an understanding
from current U-Boot and OpenSBI PLICSW driver.

This requires testing on Andes hardware, which I don't have access to.

 arch/riscv/lib/andes_plic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/lib/andes_plic.c b/arch/riscv/lib/andes_plic.c
index 221a5fe324..5e113ee8c9 100644
--- a/arch/riscv/lib/andes_plic.c
+++ b/arch/riscv/lib/andes_plic.c
@@ -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;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask
  2021-06-09  7:56 [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask Bin Meng
@ 2021-06-14  3:47 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA99D2@ATCPCS12.andestech.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Meng @ 2021-06-14  3:47 UTC (permalink / raw)
  To: Rick Chen, Leo Liang, U-Boot Mailing List

On Wed, Jun 9, 2021 at 3:55 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Current logic in riscv_get_ipi() for Andes PLICSW does not look good
> to me. 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().
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
> It looks there is no datasheet released from Andes that describes how
> PLICSW works, and its register fields. I can only get an understanding
> from current U-Boot and OpenSBI PLICSW driver.
>
> This requires testing on Andes hardware, which I don't have access to.
>
>  arch/riscv/lib/andes_plic.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

Ping?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA99D2@ATCPCS12.andestech.com>
@ 2021-06-15  3:08     ` Rick Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Rick Chen @ 2021-06-15  3:08 UTC (permalink / raw)
  To: Bin Meng; +Cc: U-Boot Mailing List, Leo Liang, rick

Hi Bin

> From: Bin Meng <bmeng.cn@gmail.com>
> Sent: Monday, June 14, 2021 11:48 AM
> To: Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com>; U-Boot Mailing List <u-boot@lists.denx.de>
> Subject: Re: [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask
>
> On Wed, Jun 9, 2021 at 3:55 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Current logic in riscv_get_ipi() for Andes PLICSW does not look good
> > to me. 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().
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > ---
> > It looks there is no datasheet released from Andes that describes how
> > PLICSW works, and its register fields. I can only get an understanding
> > from current U-Boot and OpenSBI PLICSW driver.
> >
> > This requires testing on Andes hardware, which I don't have access to.
> >
> >  arch/riscv/lib/andes_plic.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
>
> Ping?


Though there will be only one hart will jump to U-Boot proper currently,
and this delay loop seem to be unnecessary.
But it is still a good catch.

Thanks,
Rick

Tested-by: Rick Chen <rick@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-15  3:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  7:56 [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask Bin Meng
2021-06-14  3:47 ` Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA99D2@ATCPCS12.andestech.com>
2021-06-15  3:08     ` Rick Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.