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 2/4] lib: utils/mailbox: Parse P2A doorbell system MSI index from DT
Date: Mon, 12 May 2025 14:08:25 +0530 [thread overview]
Message-ID: <20250512083827.804151-3-apatel@ventanamicro.com> (raw)
In-Reply-To: <20250512083827.804151-1-apatel@ventanamicro.com>
The P2A doorbell system MSI index is expected to be discovered from
device tree instead of RPMI system MSI service group attribute. This
is based on ARC feedback before RPMI spec was frozen.
Let's parse P2A doorbell system MSI index from device tree and also
expose it as rpmi channel attribute to RPMI client drivers.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
include/sbi_utils/mailbox/rpmi_msgprot.h | 1 +
lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c | 16 ++++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/sbi_utils/mailbox/rpmi_msgprot.h b/include/sbi_utils/mailbox/rpmi_msgprot.h
index 8d8fa5e5..058b7e90 100644
--- a/include/sbi_utils/mailbox/rpmi_msgprot.h
+++ b/include/sbi_utils/mailbox/rpmi_msgprot.h
@@ -193,6 +193,7 @@ struct rpmi_message_args {
enum rpmi_channel_attribute_id {
RPMI_CHANNEL_ATTR_PROTOCOL_VERSION = 0,
RPMI_CHANNEL_ATTR_MAX_DATA_LEN,
+ RPMI_CHANNEL_ATTR_P2A_DOORBELL_SYSMSI_INDEX,
RPMI_CHANNEL_ATTR_TX_TIMEOUT,
RPMI_CHANNEL_ATTR_RX_TIMEOUT,
RPMI_CHANNEL_ATTR_SERVICEGROUP_ID,
diff --git a/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c b/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
index 2faf51e4..164ae14d 100644
--- a/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
+++ b/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
@@ -133,6 +133,7 @@ struct rpmi_shmem_mbox_controller {
/* Driver specific members */
u32 slot_size;
u32 queue_count;
+ u32 p2a_doorbell_sysmsi_index;
struct rpmi_mb_regs *mb_regs;
struct smq_queue_ctx queue_ctx_tbl[RPMI_QUEUE_IDX_MAX_COUNT];
/* Mailbox framework related members */
@@ -505,6 +506,9 @@ static int rpmi_shmem_mbox_get_attribute(struct mbox_chan *chan,
case RPMI_CHANNEL_ATTR_MAX_DATA_LEN:
*((u32 *)out_value) = RPMI_MSG_DATA_SIZE(mctl->slot_size);
break;
+ case RPMI_CHANNEL_ATTR_P2A_DOORBELL_SYSMSI_INDEX:
+ *((u32 *)out_value) = mctl->p2a_doorbell_sysmsi_index;
+ break;
case RPMI_CHANNEL_ATTR_TX_TIMEOUT:
*((u32 *)out_value) = RPMI_DEF_TX_TIMEOUT;
break;
@@ -574,9 +578,9 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
const void *fdt, int nodeoff)
{
const char *name;
+ const fdt32_t *prop;
int count, len, ret, qid;
uint64_t reg_addr, reg_size;
- const fdt32_t *prop_slotsz;
struct smq_queue_ctx *qctx;
ret = fdt_node_check_compatible(fdt, nodeoff,
@@ -585,17 +589,21 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
return ret;
/* get queue slot size in bytes */
- prop_slotsz = fdt_getprop(fdt, nodeoff, "riscv,slot-size", &len);
- if (!prop_slotsz)
+ prop = fdt_getprop(fdt, nodeoff, "riscv,slot-size", &len);
+ if (!prop)
return SBI_ENOENT;
- mctl->slot_size = fdt32_to_cpu(*prop_slotsz);
+ mctl->slot_size = fdt32_to_cpu(*prop);
if (mctl->slot_size < RPMI_SLOT_SIZE_MIN) {
sbi_printf("%s: slot_size < mimnum required message size\n",
__func__);
mctl->slot_size = RPMI_SLOT_SIZE_MIN;
}
+ /* get p2a doorbell system MSI index */
+ prop = fdt_getprop(fdt, nodeoff, "riscv,p2a-doorbell-sysmsi-index", &len);
+ mctl->p2a_doorbell_sysmsi_index = prop ? fdt32_to_cpu(*prop) : -1U;
+
/*
* 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 ` Anup Patel [this message]
2025-05-12 8:38 ` [PATCH 3/4] lib: utils/mailbox: Parse A2P doorbell value from DT Anup Patel
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-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox