All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Perry <charles.perry@microchip.com>
To: <u-boot@lists.denx.de>
Cc: Rahul Pathak <rahul@summations.net>,
	Anup Patel <anup@brainfault.org>,
	Charles Perry <charles.perry@microchip.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Romain Caritey <romain.caritey@microchip.com>,
	Mame Maria Mbaye <MameMaria.Mbaye@microchip.com>,
	Tom Rini <trini@konsulko.com>,
	"Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>,
	Rick Chen <rick@andestech.com>,
	Leo Yu-Chi Liang <ycliang@andestech.com>
Subject: [PATCH 0/7] Add support for RPMI to U-Boot
Date: Fri, 26 Jun 2026 13:15:41 -0700	[thread overview]
Message-ID: <20260626201613.1035208-1-charles.perry@microchip.com> (raw)

Hello,

This series adds support for RISC-V Platform Management Interface (RPMI) to
U-Boot. RPMI is an OS-agnostic protocol for communication between an
Application Processor (AP) and a Platform Microcontroller (PuC) [1]. The
goals and purpose of RPMI are similar to ARM's SCMI.

This patchset first adds an abstraction layer for the transport
(UCLASS_RPMI), then adds two transport layer (SBI MPXY and shared memory)
and finally adds two client, or service group in RPMI jargon: Clock and
device power service groups.

This series also include a sandbox mode for which the RPMI transport
doesn't attach to a firmware but contains a simulation of a firmware. This
reuses code from librpmi [2] to create the message responses.

Apart from the spec [1], this series reuses code from the Linux SBI MPXY
driver [3], OpenSBI shared memory transport [4] and Linux RPMI clock driver
[5].

This was tested on a PIC64-HPSC SoC which features an application cluster
and a system controller with isolated address spaces, hence the need for
RPMI.  I've tested the interoperability between RPMI clients and transports
with an S-Mode U-boot (using the MPXY transport) and M-Mode U-Boot (using
shared memory transport) and the following device tree fragment:

```
	firmware {
		rpmi: mailbox@7000000000 {
			compatible = "riscv,rpmi-shmem-mbox";
			reg = <0x70 0x00000000 0x0 0x3000>,
				<0x70 0x00003000 0x0 0x3000>,
				<0x70 0x00006000 0x0 0x1000>,
				<0x70 0x00007000 0x0 0x1000>;
			reg-names = "a2p-req", "p2a-ack", "p2a-req", "a2p-ack";
			riscv,slot-size = <64>;
			#mbox-cells = <1>;
		};

ifndef CONFIG_RISCV_MMODE
		clock-service {
			compatible = "riscv,rpmi-mpxy-clock";
			mboxes = <&rpmi 0x8>;
			riscv,sbi-mpxy-channel-id = <0x1000>;
		};

		device-power-service {
			compatible = "riscv,rpmi-mpxy-device-power";
			mboxes = <&rpmi 0x9>;
			riscv,sbi-mpxy-channel-id = <0x1001>;
		};

		mpxy_mbox: mailbox {
			compatible = "riscv,sbi-mpxy-mbox";
			#mbox-cells = <2>;
		};
endif

		sysc_clk: clock-controller {
			compatible = "riscv,rpmi-clock";
ifdef CONFIG_RISCV_MMODE
			mboxes = <&rpmi 0x8>;
else
			mboxes = <&mpxy_mbox 0x1000 0x0>;
endif
			#clock-cells = <1>;
		};

		sysc_dpwr: power-domain-controller {
			compatible = "riscv,rpmi-device-power";
ifdef CONFIG_RISCV_MMODE
			mboxes = <&rpmi 0x9>;
else
			mboxes = <&mpxy_mbox 0x1001 0x0>;
endif
			#power-domain-cells = <1>;
		};
	};
```

[1]: https://github.com/riscv-non-isa/riscv-rpmi
[2]: https://github.com/riscv-software-src/librpmi
[3]: https://elixir.bootlin.com/linux/v7.0.10/source/drivers/mailbox/riscv-sbi-mpxy-mbox.c
[4]: https://elixir.bootlin.com/opensbi/v1.8.1/source/lib/utils/mailbox/fdt_mailbox_rpmi_shmem.c
[5]: https://elixir.bootlin.com/linux/v7.0.10/source/drivers/clk/clk-rpmi.c

Cc: Rahul Pathak <rahul@summations.net>
Cc: Anup Patel <anup@brainfault.org>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Romain Caritey <romain.caritey@microchip.com>
Cc: Mame Maria Mbaye <MameMaria.Mbaye@microchip.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Leo Yu-Chi Liang <ycliang@andestech.com>

Charles Perry (7):
  firmware: add support for RPMI
  firmware: rpmi: add support for the SBI MPXY transport
  firmware: rpmi: add support for shared memory transport
  drivers: clk: add support for RPMI clocks
  drivers: power: add support for RPMI power domains
  firmware: rpmi: add a test and a sandbox driver
  firmware: rpmi: add a test and sandbox for device power

 MAINTAINERS                                |   9 +
 arch/riscv/include/asm/sbi.h               |  57 +++
 arch/sandbox/dts/test.dts                  |  23 +
 configs/sandbox_defconfig                  |   3 +
 drivers/clk/Kconfig                        |   7 +
 drivers/clk/Makefile                       |   1 +
 drivers/clk/clk_rpmi.c                     | 346 +++++++++++++++
 drivers/firmware/Kconfig                   |   1 +
 drivers/firmware/Makefile                  |   1 +
 drivers/firmware/rpmi/Kconfig              |  27 ++
 drivers/firmware/rpmi/Makefile             |   4 +
 drivers/firmware/rpmi/rpmi-sandbox-clock.c | 446 +++++++++++++++++++
 drivers/firmware/rpmi/rpmi-sandbox-power.c | 174 ++++++++
 drivers/firmware/rpmi/rpmi-sandbox.c       | 158 +++++++
 drivers/firmware/rpmi/rpmi-sandbox.h       |  48 +++
 drivers/firmware/rpmi/rpmi-sbi-mpxy.c      | 449 +++++++++++++++++++
 drivers/firmware/rpmi/rpmi-shmem.c         | 474 +++++++++++++++++++++
 drivers/firmware/rpmi/rpmi-uclass.c        | 138 ++++++
 drivers/power/domain/Kconfig               |   7 +
 drivers/power/domain/Makefile              |   1 +
 drivers/power/domain/rpmi-power-domain.c   | 229 ++++++++++
 include/dm/uclass-id.h                     |   1 +
 include/rpmi-uclass.h                      |  79 ++++
 include/rpmi.h                             | 159 +++++++
 include/rpmi_proto.h                       | 143 +++++++
 test/dm/Makefile                           |   1 +
 test/dm/rpmi.c                             |  69 +++
 27 files changed, 3055 insertions(+)
 create mode 100644 drivers/clk/clk_rpmi.c
 create mode 100644 drivers/firmware/rpmi/Kconfig
 create mode 100644 drivers/firmware/rpmi/Makefile
 create mode 100644 drivers/firmware/rpmi/rpmi-sandbox-clock.c
 create mode 100644 drivers/firmware/rpmi/rpmi-sandbox-power.c
 create mode 100644 drivers/firmware/rpmi/rpmi-sandbox.c
 create mode 100644 drivers/firmware/rpmi/rpmi-sandbox.h
 create mode 100644 drivers/firmware/rpmi/rpmi-sbi-mpxy.c
 create mode 100644 drivers/firmware/rpmi/rpmi-shmem.c
 create mode 100644 drivers/firmware/rpmi/rpmi-uclass.c
 create mode 100644 drivers/power/domain/rpmi-power-domain.c
 create mode 100644 include/rpmi-uclass.h
 create mode 100644 include/rpmi.h
 create mode 100644 include/rpmi_proto.h
 create mode 100644 test/dm/rpmi.c

-- 
2.47.3


             reply	other threads:[~2026-06-26 21:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 20:15 Charles Perry [this message]
2026-06-26 20:15 ` [PATCH 1/7] firmware: add support for RPMI Charles Perry
2026-06-27  1:09   ` Yao Zi
2026-06-26 20:15 ` [PATCH 2/7] firmware: rpmi: add support for the SBI MPXY transport Charles Perry
2026-06-27  1:30   ` Yao Zi
2026-06-26 20:15 ` [PATCH 3/7] firmware: rpmi: add support for shared memory transport Charles Perry
2026-06-26 20:15 ` [PATCH 4/7] drivers: clk: add support for RPMI clocks Charles Perry
2026-06-27  1:47   ` Yao Zi
2026-06-26 20:15 ` [PATCH 5/7] drivers: power: add support for RPMI power domains Charles Perry
2026-06-26 20:15 ` [PATCH 6/7] firmware: rpmi: add a test and a sandbox driver Charles Perry
2026-06-26 20:15 ` [PATCH 7/7] firmware: rpmi: add a test and sandbox for device power Charles Perry

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=20260626201613.1035208-1-charles.perry@microchip.com \
    --to=charles.perry@microchip.com \
    --cc=MameMaria.Mbaye@microchip.com \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rahul@summations.net \
    --cc=rick@andestech.com \
    --cc=romain.caritey@microchip.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.