[PATCH 03/11] lib: utils/mpxy: Introduce get_attribute_group() for MPXY RPMI data

Pawandeep Oza pawandeep.oza at oss.qualcomm.com
Tue Oct 13 12:46:03 PDT 2026


On Tue, Sep 22, 2026 at 8:24 PM Anup Patel <anup.patel at oss.qualcomm.com> wrote:
>
> Fully emulated MPXY channels need a custom way to provide RPMI attributes
> so introduce optional get_attribute_group() callback in MPXY RPMI data
> for this purpose.
>
> Signed-off-by: Anup Patel <anup.patel at oss.qualcomm.com>
> ---
>  include/sbi_utils/mpxy/fdt_mpxy_rpmi.h |  5 ++++
>  lib/utils/mpxy/fdt_mpxy_rpmi.c         | 34 ++++++++++++++++++--------
>  2 files changed, 29 insertions(+), 10 deletions(-)
>
> diff --git a/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h b/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
> index d1f5f9ca..a3968e87 100644
> --- a/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
> +++ b/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
> @@ -67,6 +67,11 @@ struct mpxy_rpmi_data {
>         u32 num_services;
>         struct mpxy_rpmi_service_data *service_data;
>
> +       /** Get RPMI service group attribute */
> +       int (*get_attribute_group)(void *context, struct mbox_chan *chan,
> +                                  enum rpmi_channel_attribute_id attr_id,
> +                                  u32 *out_value);
> +
>         /** Transfer RPMI service group message */
>         int (*xfer_group)(void *context, struct mbox_chan *chan,
>                           struct mbox_xfer *xfer);
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi.c b/lib/utils/mpxy/fdt_mpxy_rpmi.c
> index bbeb7a79..9b8e69e1 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi.c
> @@ -204,6 +204,21 @@ static int mpxy_send_message_withoutresp(struct sbi_mpxy_channel *channel,
>                                    NULL, 0, NULL);
>  }
>
> +static int mpxy_rpmi_get_attribute(struct mpxy_rpmi *rmb,
> +                                  enum rpmi_channel_attribute_id attr_id,
> +                                  u32 *out_value)
> +{
> +       const struct mpxy_rpmi_data *data = rmb->data;
> +       struct mbox_chan *chan = rmb->chan;
> +       int rc;
> +
> +       if (data->get_attribute_group)
> +               rc = data->get_attribute_group(rmb->group_context, chan, attr_id, out_value);
> +       else
> +               rc = mbox_chan_get_attribute(chan, attr_id, out_value);
> +       return rc;
> +}
> +
>  int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *match)
>  {
>         u32 channel_id, servicegrp_ver, pro_ver, max_data_len, tx_tout, rx_tout;
> @@ -218,6 +233,7 @@ int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *mat
>         rmb = sbi_zalloc(sizeof(*rmb));
>         if (!rmb)
>                 return SBI_ENOMEM;
> +       rmb->data = data;
>
>         /*
>          * If channel request failed then other end does not support
> @@ -228,6 +244,7 @@ int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *mat
>                 rc = SBI_ENODEV;
>                 goto fail_free_client;
>         }
> +       rmb->chan = chan;
>
>         /* Match channel service group id */
>         if (data->servicegrp_id != chan->chan_args[0]) {
> @@ -243,43 +260,43 @@ int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *mat
>         }
>
>         /* Get channel protocol version */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_PROTOCOL_VERSION,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_PROTOCOL_VERSION,
>                                      &pro_ver);
>         if (rc)
>                 goto fail_cleanup_group;
>
>         /* Get channel maximum data length */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_MAX_DATA_LEN,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_MAX_DATA_LEN,
>                                      &max_data_len);
>         if (rc)
>                 goto fail_cleanup_group;
>
>         /* Get channel Tx timeout */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_TX_TIMEOUT,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_TX_TIMEOUT,
>                                      &tx_tout);
>         if (rc)
>                 goto fail_cleanup_group;
>
>         /* Get channel Rx timeout */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_RX_TIMEOUT,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_RX_TIMEOUT,
>                                      &rx_tout);
>         if (rc)
>                 goto fail_cleanup_group;
>
>         /* Get channel service group version */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_SERVICEGROUP_VERSION,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_SERVICEGROUP_VERSION,
>                                      &servicegrp_ver);
>         if (rc)
>                 goto fail_cleanup_group;
>
>         /* Get channel implementation id */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_IMPL_ID,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_IMPL_ID,
>                                      &impl_id);
>         if (rc)
>                 goto fail_cleanup_group;
>
>         /* Get channel implementation version */
> -       rc = mbox_chan_get_attribute(chan, RPMI_CHANNEL_ATTR_IMPL_VERSION,
> +       rc = mpxy_rpmi_get_attribute(rmb, RPMI_CHANNEL_ATTR_IMPL_VERSION,
>                                      &impl_ver);
>         if (rc)
>                 goto fail_cleanup_group;
> @@ -333,9 +350,6 @@ int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *mat
>         rmb->msgprot_attrs.impl_id = impl_id;
>         rmb->msgprot_attrs.impl_ver = impl_ver;
>
> -       rmb->data = data;
> -       rmb->chan = chan;
> -
>         /* Register RPMI service group */
>         rc = sbi_mpxy_register_channel(&rmb->channel);
>         if (rc)
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi

Reviewed-by: Pawandeep Oza <pawandeep.oza at oss.qualcomm.com>
Tested-by: Pawandeep Oza <pawandeep.oza at oss.qualcomm.com>



More information about the opensbi mailing list