Skip to content

Commit a5fdef4

Browse files
pathakraulavpatel
authored andcommitted
lib: utils: Add Implementation ID and Version as RPMI MPXY attributes
The latest frozen RPMI spec has added Implementation ID and Implementation Version as message protocol specific mpxy attributes. Add support for these. Signed-off-by: Rahul Pathak <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
1 parent 13abda5 commit a5fdef4

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

include/sbi_utils/mailbox/rpmi_msgprot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ enum rpmi_channel_attribute_id {
198198
RPMI_CHANNEL_ATTR_RX_TIMEOUT,
199199
RPMI_CHANNEL_ATTR_SERVICEGROUP_ID,
200200
RPMI_CHANNEL_ATTR_SERVICEGROUP_VERSION,
201+
RPMI_CHANNEL_ATTR_IMPL_ID,
202+
RPMI_CHANNEL_ATTR_IMPL_VERSION,
201203
RPMI_CHANNEL_ATTR_MAX,
202204
};
203205

include/sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
enum mpxy_msgprot_rpmi_attr_id {
2323
MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_ID = SBI_MPXY_ATTR_MSGPROTO_ATTR_START,
2424
MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_VERSION,
25-
MPXY_MSGPROT_RPMI_ATTR_MAX_ID,
25+
MPXY_MSGPROT_RPMI_ATTR_IMPL_ID,
26+
MPXY_MSGPROT_RPMI_ATTR_IMPL_VERSION,
27+
MPXY_MSGPROT_RPMI_ATTR_MAX_ID
2628
};
2729

2830
/**
@@ -33,6 +35,8 @@ enum mpxy_msgprot_rpmi_attr_id {
3335
struct mpxy_rpmi_channel_attrs {
3436
u32 servicegrp_id;
3537
u32 servicegrp_ver;
38+
u32 impl_id;
39+
u32 impl_ver;
3640
};
3741

3842
/** Make sure all attributes are packed for direct memcpy */
@@ -45,6 +49,8 @@ struct mpxy_rpmi_channel_attrs {
4549

4650
assert_field_offset(servicegrp_id, MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_ID);
4751
assert_field_offset(servicegrp_ver, MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_VERSION);
52+
assert_field_offset(impl_id, MPXY_MSGPROT_RPMI_ATTR_IMPL_ID);
53+
assert_field_offset(impl_ver, MPXY_MSGPROT_RPMI_ATTR_IMPL_VERSION);
4854

4955
/** MPXY RPMI service data for each service group */
5056
struct mpxy_rpmi_service_data {

lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,12 @@ static int rpmi_shmem_mbox_get_attribute(struct mbox_chan *chan,
523523
case RPMI_CHANNEL_ATTR_SERVICEGROUP_VERSION:
524524
*((u32 *)out_value) = srvgrp_chan->servicegroup_version;
525525
break;
526+
case RPMI_CHANNEL_ATTR_IMPL_ID:
527+
*((u32 *)out_value) = mctl->impl_id;
528+
break;
529+
case RPMI_CHANNEL_ATTR_IMPL_VERSION:
530+
*((u32 *)out_value) = mctl->impl_version;
531+
break;
526532
default:
527533
return SBI_ENOTSUPP;
528534
}

lib/utils/mpxy/fdt_mpxy_rpmi_mbox.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ static int mpxy_mbox_send_message_withoutresp(struct sbi_mpxy_channel *channel,
213213
int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *match)
214214
{
215215
u32 channel_id, servicegrp_ver, pro_ver, max_data_len, tx_tout, rx_tout;
216+
u32 impl_id, impl_ver;
216217
const struct mpxy_rpmi_mbox_data *data = match->data;
217218
struct mpxy_rpmi_mbox *rmb;
218219
struct mbox_chan *chan;
@@ -270,6 +271,18 @@ int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *ma
270271
if (rc)
271272
goto fail_free_chan;
272273

274+
/* Get channel implementation id */
275+
rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_IMPL_ID,
276+
&impl_id);
277+
if (rc)
278+
goto fail_free_chan;
279+
280+
/* Get channel implementation version */
281+
rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_IMPL_VERSION,
282+
&impl_ver);
283+
if (rc)
284+
goto fail_free_chan;
285+
273286
/*
274287
* The "riscv,sbi-mpxy-channel-id" DT property is mandatory
275288
* for MPXY RPMI mailbox client driver so if this is not
@@ -316,6 +329,8 @@ int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *ma
316329
/* RPMI service group attributes */
317330
rmb->msgprot_attrs.servicegrp_id = data->servicegrp_id;
318331
rmb->msgprot_attrs.servicegrp_ver = servicegrp_ver;
332+
rmb->msgprot_attrs.impl_id = impl_id;
333+
rmb->msgprot_attrs.impl_ver = impl_ver;
319334

320335
rmb->mbox_data = data;
321336
rmb->chan = chan;

0 commit comments

Comments
 (0)