[PATCH 0/5] RPMI REQUEST_FORWARD service group in OpenSBI

marouene.boubakri at oss.nxp.com marouene.boubakri at oss.nxp.com
Mon Sep 7 04:59:08 PDT 2026


From: Marouene Boubakri <marouene.boubakri at nxp.com>

Hi all,

I maintain the RISC-V port of OP-TEE. We are adding Management Mode
support to it so that a non-secure supervisor can invoke MM services
implemented in OP-TEE, and RPMI already defines the interface for that:
MANAGEMENT_MODE (0x000B) on the calling side, and REQUEST_FORWARD
(0x000D) on the side that serves the calls.

The piece in between is missing. OpenSBI serves MANAGEMENT_MODE today
only by passing MM_COMMUNICATE to a platform microcontroller over an RPMI
mailbox (lib/utils/mpxy/fdt_mpxy_rpmi_mm.c), and there is no
REQUEST_FORWARD support at all. When Management Mode runs in software on
the application processor there is no mailbox and no microcontroller, and
the SBI implementation itself has to be the forwarder. The OP-TEE side
cannot proceed until that exists upstream, which is what this series
adds.

The RPMI v1.0 specification calls out this exact arrangement in the
REQUEST_FORWARD service group: "This service group also allows an SBI
implementation to forward RPMI request messages from one system-level
partition (or domain) to another using the SBI MPXY extension."

How it works: an RPMI request that arrives on one MPXY channel is queued
and handed to software which pulls it off a second MPXY channel serving
REQUEST_FORWARD, answers it, and completes it. The response comes back as
the response of the original request. The queue and the REQUEST_FORWARD
channel know nothing about MM; the MANAGEMENT_MODE channel of patch 5 is
simply their first producer.

The series touches include/sbi_utils/ and lib/utils/mpxy/ only. There is
no change to lib/sbi/.

  1  the RPMI v1.0 REQUEST_FORWARD service group defines
  2  a prep patch moving the RPMI message protocol attributes out of the
     mailbox header, so a channel driver with no mailbox behind it does
     not have to include the mailbox headers. No functional change.
  3  the forwarded message queue
  4  the REQUEST_FORWARD channel driver
  5  the MANAGEMENT_MODE channel that forwards through it

Notes on what is deliberately not here:

* REQFWD_ENABLE_NOTIFICATION reports RPMI_ERR_NOTSUPP. REQFWD_NEW_MESSAGE
  is an RPMI notification message and SBI MPXY delivers those through an
  MSI or an SSE event, neither of which is wired up for these channels, so
  software polls REQFWD_RETRIEVE_CURRENT_MESSAGE.
* Both channels are owned by the root domain, like every other MPXY
  channel today. Making channel ownership follow the device tree needs the
  platform domains to exist when MPXY drivers are probed, which is an init
  order change worth its own discussion; it is not needed for the
  forwarder itself.

Tested on QEMU virt with two bare-metal S-mode payloads on two HARTs: one
calls MM_COMMUNICATE with a buffer in the MM shared memory, the other
serves the REQUEST_FORWARD channel and transforms it. The forwarded
message is retrieved in three chunks (the channel MSG_MAX_LEN is set to 20
bytes on purpose), a request outside the MM shared memory is refused, a
response claiming more output than the request allowed is refused, a
dropped request times out within MSG_COMPLETION_TIMEOUT, the late
completion is refused, and the queue is usable afterwards.

Marouene Boubakri (5):
  lib: utils: Add RPMI REQUEST_FORWARD service group defines
  lib: utils/mpxy: Split RPMI message protocol attributes out of the
    mailbox header
  lib: utils/mpxy: Add queue of forwarded RPMI messages
  lib: utils/mpxy: Add RPMI REQUEST_FORWARD channel driver
  lib: utils/mpxy: Add RPMI MANAGEMENT_MODE channel over request forward

 include/sbi_utils/mailbox/rpmi_msgprot.h    |  50 +++
 include/sbi_utils/mpxy/fdt_mpxy_rpmi.h      |  64 ++++
 include/sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h |  37 +-
 include/sbi_utils/mpxy/reqfwd_queue.h       | 157 ++++++++
 lib/utils/mpxy/Kconfig                      |  15 +
 lib/utils/mpxy/fdt_mpxy_rpmi.c              |  29 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_mbox.c         |  19 +-
 lib/utils/mpxy/fdt_mpxy_rpmi_mm_forward.c   | 391 ++++++++++++++++++++
 lib/utils/mpxy/fdt_mpxy_rpmi_reqfwd.c       | 280 ++++++++++++++
 lib/utils/mpxy/objects.mk                   |   9 +
 lib/utils/mpxy/reqfwd_queue.c               | 198 ++++++++++
 platform/generic/configs/defconfig          |   2 +
 12 files changed, 1198 insertions(+), 53 deletions(-)
 create mode 100644 include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
 create mode 100644 include/sbi_utils/mpxy/reqfwd_queue.h
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_mm_forward.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_reqfwd.c
 create mode 100644 lib/utils/mpxy/reqfwd_queue.c

-- 
2.43.0

Marouene Boubakri (5):
  lib: utils: Add RPMI REQUEST_FORWARD service group defines
  lib: utils/mpxy: Split RPMI message protocol attributes out of the
    mailbox header
  lib: utils/mpxy: Add queue of forwarded RPMI messages
  lib: utils/mpxy: Add RPMI REQUEST_FORWARD channel driver
  lib: utils/mpxy: Add RPMI MANAGEMENT_MODE channel over request forward

 include/sbi_utils/mailbox/rpmi_msgprot.h    |  50 +++
 include/sbi_utils/mpxy/fdt_mpxy_rpmi.h      |  64 ++++
 include/sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h |  37 +-
 include/sbi_utils/mpxy/reqfwd_queue.h       | 157 ++++++++
 lib/utils/mpxy/Kconfig                      |  15 +
 lib/utils/mpxy/fdt_mpxy_rpmi.c              |  29 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_mbox.c         |  19 +-
 lib/utils/mpxy/fdt_mpxy_rpmi_mm_forward.c   | 391 ++++++++++++++++++++
 lib/utils/mpxy/fdt_mpxy_rpmi_reqfwd.c       | 280 ++++++++++++++
 lib/utils/mpxy/objects.mk                   |   9 +
 lib/utils/mpxy/reqfwd_queue.c               | 198 ++++++++++
 platform/generic/configs/defconfig          |   2 +
 12 files changed, 1198 insertions(+), 53 deletions(-)
 create mode 100644 include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
 create mode 100644 include/sbi_utils/mpxy/reqfwd_queue.h
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_mm_forward.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_reqfwd.c
 create mode 100644 lib/utils/mpxy/reqfwd_queue.c

-- 
2.43.0




More information about the opensbi mailing list