* [PATCH 0/4] Driver updates to match frozen RPMI specification
@ 2025-05-12 8:38 Anup Patel
2025-05-12 8:38 ` [PATCH 1/4] lib: utils/mailbox: Update DT register name of A2P doorbell Anup Patel
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Anup Patel @ 2025-05-12 8:38 UTC (permalink / raw)
To: Atish Patra; +Cc: Andrew Jones, Anup Patel, opensbi, Anup Patel
The RPMI v1.0 specification is frozen and in public review so update
RPMI drivers to match last minute specification changes which were
based on ARC feedback.
These patches can also be found in the rpmi_fixes_v1 branch at:
https://github.com/avpatel/opensbi.git
To test these patches, use the dev-upstream branch of the following repos:
* https://github.com/ventanamicro/qemu.git
* https://github.com/ventanamicro/linux.git
To enable QEMU RPMI emulation (using librpmi) for virt machine, use
"virt,rpmi=on,aia=aplic-imsic" as the QEMU machine name.
Anup Patel (4):
lib: utils/mailbox: Update DT register name of A2P doorbell
lib: utils/mailbox: Parse P2A doorbell system MSI index from DT
lib: utils/mailbox: Parse A2P doorbell value from DT
lib: utils/mpxy: Remove p2a_db_index from RPMI system MSI attributes
include/sbi_utils/mailbox/rpmi_msgprot.h | 2 +-
lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c | 34 +++++++++++++++-------
lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c | 13 ++++++---
3 files changed, 34 insertions(+), 15 deletions(-)
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] lib: utils/mailbox: Update DT register name of A2P doorbell
2025-05-12 8:38 [PATCH 0/4] Driver updates to match frozen RPMI specification Anup Patel
@ 2025-05-12 8:38 ` Anup Patel
2025-05-12 8:38 ` [PATCH 2/4] lib: utils/mailbox: Parse P2A doorbell system MSI index from DT Anup Patel
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2025-05-12 8:38 UTC (permalink / raw)
To: Atish Patra; +Cc: Andrew Jones, Anup Patel, opensbi, Anup Patel
The latest device tree bindings define A2P doorbell register name as
"a2p-doorbell" so update rpmi_shmem_transport_init() accordingly.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c b/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
index 5b858d36..2faf51e4 100644
--- a/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
+++ b/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
@@ -651,7 +651,7 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
SPIN_LOCK_INIT(qctx->queue_lock);
}
- /* get the db-reg property name */
+ /* get the a2p-doorbell property name */
name = fdt_stringlist_get(fdt, nodeoff, "reg-names", qid, &len);
if (!name || (name && len < 0))
return len;
@@ -659,7 +659,7 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
/* fetch doorbell register address*/
ret = fdt_get_node_addr_size(fdt, nodeoff, qid, ®_addr,
®_size);
- if (!ret && !(strncmp(name, "db-reg", strlen("db-reg")))) {
+ if (!ret && !(strncmp(name, "a2p-doorbell", strlen("a2p-doorbell")))) {
mctl->mb_regs = (void *)(unsigned long)reg_addr;
ret = sbi_domain_root_add_memrange(reg_addr, reg_size, reg_size,
(SBI_DOMAIN_MEMREGION_MMIO |
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] lib: utils/mailbox: Parse P2A doorbell system MSI index from DT
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
2025-05-12 8:38 ` [PATCH 3/4] lib: utils/mailbox: Parse A2P doorbell value " Anup Patel
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2025-05-12 8:38 UTC (permalink / raw)
To: Atish Patra; +Cc: Andrew Jones, Anup Patel, opensbi, Anup Patel
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] lib: utils/mailbox: Parse A2P doorbell value from DT
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
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
4 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2025-05-12 8:38 UTC (permalink / raw)
To: Atish Patra; +Cc: Andrew Jones, Anup Patel, opensbi, Anup Patel
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] lib: utils/mpxy: Remove p2a_db_index from RPMI system MSI attributes
2025-05-12 8:38 [PATCH 0/4] Driver updates to match frozen RPMI specification Anup Patel
` (2 preceding siblings ...)
2025-05-12 8:38 ` [PATCH 3/4] lib: utils/mailbox: Parse A2P doorbell value " Anup Patel
@ 2025-05-12 8:38 ` Anup Patel
2025-05-20 5:49 ` [PATCH 0/4] Driver updates to match frozen RPMI specification Anup Patel
4 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2025-05-12 8:38 UTC (permalink / raw)
To: Atish Patra; +Cc: Andrew Jones, Anup Patel, opensbi, Anup Patel
The discovery of P2A doorbell system MSI index is now through RPMI
shared memory DT node so remove p2a_db_index from RPMI system MSI
attributes and access it as a mailbox channel attribute.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
include/sbi_utils/mailbox/rpmi_msgprot.h | 1 -
lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c | 13 +++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/sbi_utils/mailbox/rpmi_msgprot.h b/include/sbi_utils/mailbox/rpmi_msgprot.h
index 058b7e90..e0d73882 100644
--- a/include/sbi_utils/mailbox/rpmi_msgprot.h
+++ b/include/sbi_utils/mailbox/rpmi_msgprot.h
@@ -285,7 +285,6 @@ enum rpmi_sysmsi_service_id {
struct rpmi_sysmsi_get_attributes_resp {
s32 status;
u32 sys_num_msi;
- u32 p2a_db_index;
u32 flag0;
u32 flag1;
};
diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c b/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c
index 87e6aa53..b4bab85a 100644
--- a/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c
+++ b/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c
@@ -32,10 +32,9 @@ static int mpxy_rpmi_sysmis_xfer(void *context, struct mbox_chan *chan,
case RPMI_SYSMSI_SRV_GET_ATTRIBUTES:
((u32 *)xfer->rx)[0] = cpu_to_le32(RPMI_SUCCESS);
((u32 *)xfer->rx)[1] = cpu_to_le32(smg->sys_num_msi);
- ((u32 *)xfer->rx)[2] = -1U;
+ ((u32 *)xfer->rx)[2] = 0;
((u32 *)xfer->rx)[3] = 0;
- ((u32 *)xfer->rx)[4] = 0;
- args->rx_data_len = 5 * sizeof(u32);
+ args->rx_data_len = 4 * sizeof(u32);
break;
case RPMI_SYSMSI_SRV_GET_MSI_ATTRIBUTES:
case RPMI_SYSMSI_SRV_SET_MSI_STATE:
@@ -90,8 +89,14 @@ static int mpxy_rpmi_sysmsi_setup(void **context, struct mbox_chan *chan,
struct rpmi_sysmsi_get_msi_attributes_req gmareq;
struct rpmi_sysmsi_get_attributes_resp garesp;
struct mpxy_rpmi_sysmsi *smg;
+ u32 p2a_db_index;
int rc, i;
+ rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_P2A_DOORBELL_SYSMSI_INDEX,
+ &p2a_db_index);
+ if (rc)
+ return rc;
+
rc = rpmi_normal_request_with_status(chan, RPMI_SYSMSI_SRV_GET_ATTRIBUTES,
NULL, 0, 0, &garesp, rpmi_u32_count(garesp),
rpmi_u32_count(garesp));
@@ -122,7 +127,7 @@ static int mpxy_rpmi_sysmsi_setup(void **context, struct mbox_chan *chan,
return rc;
}
- if (garesp.p2a_db_index == i ||
+ if (p2a_db_index == i ||
(gmaresp.flag0 & RPMI_SYSMSI_MSI_ATTRIBUTES_FLAG0_PREF_PRIV))
bitmap_set(smg->sys_msi_denied_bmap, i, 1);
}
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] Driver updates to match frozen RPMI specification
2025-05-12 8:38 [PATCH 0/4] Driver updates to match frozen RPMI specification Anup Patel
` (3 preceding siblings ...)
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 ` Anup Patel
4 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2025-05-20 5:49 UTC (permalink / raw)
To: Anup Patel; +Cc: Atish Patra, Andrew Jones, opensbi
On Mon, May 12, 2025 at 2:08 PM Anup Patel <apatel@ventanamicro.com> wrote:
>
> The RPMI v1.0 specification is frozen and in public review so update
> RPMI drivers to match last minute specification changes which were
> based on ARC feedback.
>
> These patches can also be found in the rpmi_fixes_v1 branch at:
> https://github.com/avpatel/opensbi.git
>
> To test these patches, use the dev-upstream branch of the following repos:
> * https://github.com/ventanamicro/qemu.git
> * https://github.com/ventanamicro/linux.git
>
> To enable QEMU RPMI emulation (using librpmi) for virt machine, use
> "virt,rpmi=on,aia=aplic-imsic" as the QEMU machine name.
>
> Anup Patel (4):
> lib: utils/mailbox: Update DT register name of A2P doorbell
> lib: utils/mailbox: Parse P2A doorbell system MSI index from DT
> lib: utils/mailbox: Parse A2P doorbell value from DT
> lib: utils/mpxy: Remove p2a_db_index from RPMI system MSI attributes
Applied this series to the riscv/opensbi repo.
Regards,
Anup
>
> include/sbi_utils/mailbox/rpmi_msgprot.h | 2 +-
> lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c | 34 +++++++++++++++-------
> lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c | 13 ++++++---
> 3 files changed, 34 insertions(+), 15 deletions(-)
>
> --
> 2.43.0
>
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-20 5:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/4] lib: utils/mailbox: Parse A2P doorbell value " 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox