From: Anup Patel <apatel@ventanamicro.com>
To: Atish Patra <atishp@rivosinc.com>
Cc: Andrew Jones <ajones@ventanamicro.com>,
Anup Patel <anup@brainfault.org>,
opensbi@lists.infradead.org, Anup Patel <apatel@ventanamicro.com>
Subject: [PATCH 3/4] lib: utils/mailbox: Parse A2P doorbell value from DT
Date: Mon, 12 May 2025 14:08:26 +0530 [thread overview]
Message-ID: <20250512083827.804151-4-apatel@ventanamicro.com> (raw)
In-Reply-To: <20250512083827.804151-1-apatel@ventanamicro.com>
The A2P doorbell value written to the 32-bit A2P doorbell value
must be discoverd from device tree instead of always using the
default value 1.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c b/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
index 164ae14d..aad68b5a 100644
--- a/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
+++ b/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
@@ -134,6 +134,7 @@ struct rpmi_shmem_mbox_controller {
u32 slot_size;
u32 queue_count;
u32 p2a_doorbell_sysmsi_index;
+ u32 a2p_doorbell_value;
struct rpmi_mb_regs *mb_regs;
struct smq_queue_ctx queue_ctx_tbl[RPMI_QUEUE_IDX_MAX_COUNT];
/* Mailbox framework related members */
@@ -248,7 +249,8 @@ static int __smq_rx(struct smq_queue_ctx *qctx, u32 slot_size,
}
static int __smq_tx(struct smq_queue_ctx *qctx, struct rpmi_mb_regs *mb_regs,
- u32 slot_size, u32 service_group_id, struct mbox_xfer *xfer)
+ u32 a2p_doorbell_value, u32 slot_size, u32 service_group_id,
+ struct mbox_xfer *xfer)
{
u32 i, tailidx;
void *dst, *src;
@@ -300,7 +302,7 @@ static int __smq_tx(struct smq_queue_ctx *qctx, struct rpmi_mb_regs *mb_regs,
/* Ring the RPMI doorbell if present */
if (mb_regs)
- writel(cpu_to_le32(1), &mb_regs->db_reg);
+ writel(a2p_doorbell_value, &mb_regs->db_reg);
return SBI_OK;
}
@@ -364,8 +366,8 @@ static int smq_tx(struct rpmi_shmem_mbox_controller *mctl,
*/
do {
spin_lock(&qctx->queue_lock);
- ret = __smq_tx(qctx, mctl->mb_regs, mctl->slot_size,
- service_group_id, xfer);
+ ret = __smq_tx(qctx, mctl->mb_regs, mctl->a2p_doorbell_value,
+ mctl->slot_size, service_group_id, xfer);
spin_unlock(&qctx->queue_lock);
if (!ret)
return 0;
@@ -604,6 +606,10 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
prop = fdt_getprop(fdt, nodeoff, "riscv,p2a-doorbell-sysmsi-index", &len);
mctl->p2a_doorbell_sysmsi_index = prop ? fdt32_to_cpu(*prop) : -1U;
+ /* get a2p doorbell value */
+ prop = fdt_getprop(fdt, nodeoff, "riscv,a2p-doorbell-value", &len);
+ mctl->a2p_doorbell_value = prop ? fdt32_to_cpu(*prop) : 1;
+
/*
* queue names count is taken as the number of queues
* supported which make it mandatory to provide the
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2025-05-12 8:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 8:38 [PATCH 0/4] Driver updates to match frozen RPMI specification Anup Patel
2025-05-12 8:38 ` [PATCH 1/4] lib: utils/mailbox: Update DT register name of A2P doorbell Anup Patel
2025-05-12 8:38 ` [PATCH 2/4] lib: utils/mailbox: Parse P2A doorbell system MSI index from DT Anup Patel
2025-05-12 8:38 ` Anup Patel [this message]
2025-05-12 8:38 ` [PATCH 4/4] lib: utils/mpxy: Remove p2a_db_index from RPMI system MSI attributes Anup Patel
2025-05-20 5:49 ` [PATCH 0/4] Driver updates to match frozen RPMI specification Anup Patel
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=20250512083827.804151-4-apatel@ventanamicro.com \
--to=apatel@ventanamicro.com \
--cc=ajones@ventanamicro.com \
--cc=anup@brainfault.org \
--cc=atishp@rivosinc.com \
--cc=opensbi@lists.infradead.org \
/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.