All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Rick Chen <rick@andestech.com>, Leo Liang <ycliang@andestech.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask
Date: Wed,  9 Jun 2021 15:56:02 +0800	[thread overview]
Message-ID: <20210609075602.157709-1-bmeng.cn@gmail.com> (raw)

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


             reply	other threads:[~2021-06-09  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  7:56 Bin Meng [this message]
2021-06-14  3:47 ` [RFT PATCH] riscv: andes_plic: Fix riscv_get_ipi() mask Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA99D2@ATCPCS12.andestech.com>
2021-06-15  3:08     ` Rick Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210609075602.157709-1-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=rick@andestech.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.