All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Add support for RPMI to U-Boot
@ 2026-07-08 21:51 Charles Perry
  2026-07-08 21:51 ` [PATCH v2 1/5] firmware: add support for RPMI Charles Perry
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Charles Perry @ 2026-07-08 21:51 UTC (permalink / raw)
  To: u-boot
  Cc: Rahul Pathak, Anup Patel, Charles Perry, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Romain Caritey,
	Mame Maria Mbaye, Tom Rini, Heinrich Schuchardt, Rick Chen,
	Leo Yu-Chi Liang

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 one client or service group in RPMI jargon: the clock
service group.

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>;
		};

		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>;
		};
```

[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>

Changes in v2:
 - Drop the device-power service group as the DT bindings for it are not
   mainlined (was patch 5 and 7).
 - Reorder headers in all .c files.
 - Don't null check pointers before free().
 - Improve error messages in rpmi_check_versions() (patch 1).
 - Remove struct sbi_mpxy_rpmi_channel_attrs and struct
   sbi_mpxy_channel_attrs for simpler u32 arrays (patch 2).
 - Remove transition_latency from struct rpmi_clk_def as it's unused (patch 4).
 - Simplify last return path of _rpmi_clk_enable_disable() (patch 4).
 - Move the call to _rpmi_clk_get_rate() from _rpmi_clk_set_rate() to
   rpmi_clk_set_rate() (patch 4).

Charles Perry (5):
  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
  firmware: rpmi: add a test and a sandbox driver

 MAINTAINERS                                |   8 +
 arch/riscv/include/asm/sbi.h               |  57 +++
 arch/sandbox/dts/test.dts                  |  12 +
 configs/sandbox_defconfig                  |   2 +
 drivers/clk/Kconfig                        |   7 +
 drivers/clk/Makefile                       |   1 +
 drivers/clk/clk_rpmi.c                     | 344 +++++++++++++++
 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.c       | 156 +++++++
 drivers/firmware/rpmi/rpmi-sandbox.h       |  47 ++
 drivers/firmware/rpmi/rpmi-sbi-mpxy.c      | 410 ++++++++++++++++++
 drivers/firmware/rpmi/rpmi-shmem.c         | 473 +++++++++++++++++++++
 drivers/firmware/rpmi/rpmi-uclass.c        | 144 +++++++
 include/dm/uclass-id.h                     |   1 +
 include/rpmi-uclass.h                      |  79 ++++
 include/rpmi.h                             | 159 +++++++
 include/rpmi_proto.h                       | 125 ++++++
 test/dm/Makefile                           |   1 +
 test/dm/rpmi.c                             |  48 +++
 23 files changed, 2553 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.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 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-07-10  6:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 21:51 [PATCH v2 0/5] Add support for RPMI to U-Boot Charles Perry
2026-07-08 21:51 ` [PATCH v2 1/5] firmware: add support for RPMI Charles Perry
2026-07-08 21:51 ` [PATCH v2 2/5] firmware: rpmi: add support for the SBI MPXY transport Charles Perry
2026-07-08 21:51 ` [PATCH v2 3/5] firmware: rpmi: add support for shared memory transport Charles Perry
2026-07-08 21:51 ` [PATCH v2 4/5] drivers: clk: add support for RPMI clocks Charles Perry
2026-07-08 21:51 ` [PATCH v2 5/5] firmware: rpmi: add a test and a sandbox driver Charles Perry
2026-07-09 13:02 ` [PATCH v2 0/5] Add support for RPMI to U-Boot Michal Simek
2026-07-09 14:53   ` Heinrich Schuchardt
2026-07-09 14:54   ` Charles Perry
2026-07-09 15:20     ` Michal Simek
2026-07-09 16:57       ` Conor Dooley
2026-07-10  3:14         ` Anup Patel
2026-07-10  3:08       ` Anup Patel
2026-07-10  6:36         ` Michal Simek

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.