Skip to contentSkip to conversation

riscv: Add generic SBI MPXY interface and MPXY command

PATCH In review Rahul Pathak 2 participants 14 messages Jul 10 – Jul 19 RISC-V

lore
Share & tools
lore
#0 lore raw

cover riscv: Add generic SBI MPXY interface and MPXY command

This patch series adds a generic SBI MPXY extension implementation which provides an interface to interact with platform via supported message protocol (eg. RPMI)

It also adds a mpxy command which uses the generic SBI MPXY interface and provides cli support to interact with supported message protocol. Currently it supports RISC-V RPMI message protocol.

Rahul Pathak (3):
riscv: Add SBI MPXY generic interface
cmd: Add mpxy command and add RISC-V RPMI driver
riscv: Enable SBI MPXY core interface and MPXY command

 arch/riscv/Kconfig                 |   9 +
 arch/riscv/include/asm/sbi.h       | 268 +++++++++++++++
 arch/riscv/lib/Makefile            |   1 +
 arch/riscv/lib/sbi_mpxy.c          | 529 +++++++++++++++++++++++++++++
 cmd/Kconfig                        |   8 +
 cmd/riscv/Makefile                 |   1 +
 cmd/riscv/sbi_mpxy_cmd.c           | 482 ++++++++++++++++++++++++++
 configs/qemu-riscv64_spl_defconfig |   2 +
 8 files changed, 1300 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c
 create mode 100644 cmd/riscv/sbi_mpxy_cmd.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 riscv: Add SBI MPXY generic interface

SBI MPXY interface implements the SBI MPXY
extension to interact with supported message
protocols for platform management and control

---
 arch/riscv/Kconfig           |   9 +
 arch/riscv/include/asm/sbi.h | 268 ++++++++++++++++++
 arch/riscv/lib/Makefile      |   1 +
 arch/riscv/lib/sbi_mpxy.c    | 529 +++++++++++++++++++++++++++++++++++
 4 files changed, 807 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c
arch/riscv/Kconfig +9 -0
index 265b5320777..e0efcd19ce5 100644
@@ -473,6 +473,15 @@ config SBI_IPI
 	default y if RISCV_SMODE || SPL_RISCV_SMODE
 	depends on SMP
 
+config SBI_MPXY
+	bool "SBI MPXY generic core"
+	depends on RISCV_SMODE || SPL_RISCV_SMODE
+	help
+	  Enable the generic SBI MPXY (Message Proxy Extension) core.
+	  Provides channel discovery, shared memory setup, attribute
+	  caching, and protocol driver registration. Required by
+	  CMD_MPXY and any driver that communicates via MPXY channels.
+
 config XIP
 	bool "XIP mode"
 	help
arch/riscv/include/asm/sbi.h +268 -0

307 lines not on this page · raw message

arch/riscv/lib/Makefile +1 -0
index f1f50918eff..32f8fb5dbbe 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_ANDES_PLICSW) += andes_plicsw.o
 else
 obj-$(CONFIG_SBI) += sbi.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
+obj-$(CONFIG_SBI_MPXY) += sbi_mpxy.o
 endif
 obj-y	+= interrupts.o
 ifeq ($(CONFIG_$(PHASE_)SYSRESET),)
arch/riscv/lib/sbi_mpxy.c new file +529 -0

529 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/3] riscv: Add SBI MPXY generic interface

Quoted 13 lines · Rahul Pathak

SBI MPXY interface implements the SBI MPXY
extension to interact with supported message
protocols for platform management and control

---
 arch/riscv/Kconfig           |   9 +
 arch/riscv/include/asm/sbi.h | 268 ++++++++++++++++++
 arch/riscv/lib/Makefile      |   1 +
 arch/riscv/lib/sbi_mpxy.c    | 529 +++++++++++++++++++++++++++++++++++
 4 files changed, 807 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c

...

Quoted 12 lines
arch/riscv/lib/sbi_mpxy.c new file +6 -0
new file mode 100644
index 00000000000..f95cedaabac
@@ -0,0 +1,529 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * SBI MPXY (Message Proxy) Generic Library
+ *
+ * Copyright (c) 2026, Rahul Pathak <[email protected]>
+ */

...

Quoted 50 lines
arch/riscv/lib/sbi_mpxy.c new file +50 -0
+
+/**
+ * sbi_mpxy_read_attrs() - Read a contiguous range of channel attributes
+ *
+ * @chan:		Target channel
+ * @base_attr_id:	First attribute ID in the range
+ * @attr_count:		Number of attributes to read
+ * @attrs_buf:		Output buffer (attr_count u32 words)
+ */
+int sbi_mpxy_read_attrs(struct mpxy_channel *chan, u32 base_attr_id,
+			u32 attr_count, u32 *attrs_buf)
+{
+	struct sbiret ret;
+	__le32 *shmem;
+	u32 end_id;
+	int i;
+
+	if (!chan || !attr_count || !attrs_buf)
+		return -EINVAL;
+
+	if (attr_count > mpxy_ctx.shmem_size / sizeof(u32))
+		return -EINVAL;
+
+	shmem = (__le32 *)shmem_base();
+	if (!shmem)
+		return -ENXIO;
+
+	end_id = base_attr_id + attr_count - 1;
+
+	if (base_attr_id < SBI_MPXY_ATTR_STD_ATTR_MAX_IDX) {
+		/* Standard attributes */
+		if (end_id >= SBI_MPXY_ATTR_STD_ATTR_MAX_IDX)
+			return -EINVAL;
+
+		ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+				chan->channel_id, base_attr_id, attr_count,
+				0, 0, 0);
+		if (ret.error)
+			return -EINVAL;
+
+		for (i = 0; i < attr_count; i++)
+			attrs_buf[i] = le32_to_cpu(shmem[i]);
+
+		return 0;
+	}
+
+	if (base_attr_id >= SBI_MPXY_ATTR_MSGPROTO_ATTR_START &&
+	    end_id < SBI_MPXY_ATTR_MSGPROTO_ATTR_END) {
+		/* Protocol-specific attributes */
+		if (!chan->proto || !chan->proto->readattr)

arch/riscv/lib/sbi_mpxy.c line 358

Quoted 10 lines
arch/riscv/lib/sbi_mpxy.c new file +10 -0
+			return -ENOSYS;
+
+		ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+				chan->channel_id, base_attr_id, attr_count,
+				0, 0, 0);
+		if (ret.error)
+			return -EINVAL;
+
+		for (i = 0; i < attr_count; i++)
+			attrs_buf[i] = le32_to_cpu(shmem[i]);

Shouldn't you call the ->readattr() callback here instead of manually doing the read?

Also, I'm not quite sure I understand what purpose those callbacks serve. From what I'm seeing, attributes are always read/write using SBI_EXT_MPXY_[READ|WRITE]_ATTRS because the transport layer is always mpxy. Would a non-RPMI protocol do something different?

Thanks,
Charles

#3 lore raw

Re: [PATCH 1/3] riscv: Add SBI MPXY generic interface

Quoted 97 lines · Charles Perry
Quoted 13 lines · Rahul Pathak

SBI MPXY interface implements the SBI MPXY
extension to interact with supported message
protocols for platform management and control

---
 arch/riscv/Kconfig           |   9 +
 arch/riscv/include/asm/sbi.h | 268 ++++++++++++++++++
 arch/riscv/lib/Makefile      |   1 +
 arch/riscv/lib/sbi_mpxy.c    | 529 +++++++++++++++++++++++++++++++++++
 4 files changed, 807 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c

...

Quoted 12 lines
arch/riscv/lib/sbi_mpxy.c new file +6 -0
new file mode 100644
index 00000000000..f95cedaabac
@@ -0,0 +1,529 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * SBI MPXY (Message Proxy) Generic Library
+ *
+ * Copyright (c) 2026, Rahul Pathak <[email protected]>
+ */

...

Quoted 50 lines
arch/riscv/lib/sbi_mpxy.c new file +50 -0
+
+/**
+ * sbi_mpxy_read_attrs() - Read a contiguous range of channel attributes
+ *
+ * @chan:            Target channel
+ * @base_attr_id:    First attribute ID in the range
+ * @attr_count:              Number of attributes to read
+ * @attrs_buf:               Output buffer (attr_count u32 words)
+ */
+int sbi_mpxy_read_attrs(struct mpxy_channel *chan, u32 base_attr_id,
+                     u32 attr_count, u32 *attrs_buf)
+{
+     struct sbiret ret;
+     __le32 *shmem;
+     u32 end_id;
+     int i;
+
+     if (!chan || !attr_count || !attrs_buf)
+             return -EINVAL;
+
+     if (attr_count > mpxy_ctx.shmem_size / sizeof(u32))
+             return -EINVAL;
+
+     shmem = (__le32 *)shmem_base();
+     if (!shmem)
+             return -ENXIO;
+
+     end_id = base_attr_id + attr_count - 1;
+
+     if (base_attr_id < SBI_MPXY_ATTR_STD_ATTR_MAX_IDX) {
+             /* Standard attributes */
+             if (end_id >= SBI_MPXY_ATTR_STD_ATTR_MAX_IDX)
+                     return -EINVAL;
+
+             ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+                             chan->channel_id, base_attr_id, attr_count,
+                             0, 0, 0);
+             if (ret.error)
+                     return -EINVAL;
+
+             for (i = 0; i < attr_count; i++)
+                     attrs_buf[i] = le32_to_cpu(shmem[i]);
+
+             return 0;
+     }
+
+     if (base_attr_id >= SBI_MPXY_ATTR_MSGPROTO_ATTR_START &&
+         end_id < SBI_MPXY_ATTR_MSGPROTO_ATTR_END) {
+             /* Protocol-specific attributes */
+             if (!chan->proto || !chan->proto->readattr)

arch/riscv/lib/sbi_mpxy.c line 358

Quoted 10 lines
arch/riscv/lib/sbi_mpxy.c new file +10 -0
+                     return -ENOSYS;
+
+             ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+                             chan->channel_id, base_attr_id, attr_count,
+                             0, 0, 0);
+             if (ret.error)
+                     return -EINVAL;
+
+             for (i = 0; i < attr_count; i++)
+                     attrs_buf[i] = le32_to_cpu(shmem[i]);

Shouldn't you call the ->readattr() callback here instead of manually doing the read?

Quoted 4 lines

Also, I'm not quite sure I understand what purpose those callbacks serve. From what I'm seeing, attributes are always read/write using SBI_EXT_MPXY_[READ|WRITE]_ATTRS because the transport layer is always mpxy. Would a non-RPMI protocol do something different?

Reading the attributes is simple and can be achieved with or without the callback but
writing the attributes may (or may not) require any further protocol specific validation
which is not assumed here and hence used the callback to keep things generic.

That's why I didn't use callback for read but for write. I am fine to use callback for attributes read but I would prefer to not assume anything and keep write attribute callback.

#4 lore raw

Re: [PATCH 1/3] riscv: Add SBI MPXY generic interface

Quoted 110 lines · Rahul Pathak
Quoted 97 lines · Charles Perry
Quoted 13 lines · Rahul Pathak

SBI MPXY interface implements the SBI MPXY
extension to interact with supported message
protocols for platform management and control

---
 arch/riscv/Kconfig           |   9 +
 arch/riscv/include/asm/sbi.h | 268 ++++++++++++++++++
 arch/riscv/lib/Makefile      |   1 +
 arch/riscv/lib/sbi_mpxy.c    | 529 +++++++++++++++++++++++++++++++++++
 4 files changed, 807 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c

...

Quoted 12 lines
arch/riscv/lib/sbi_mpxy.c new file +6 -0
new file mode 100644
index 00000000000..f95cedaabac
@@ -0,0 +1,529 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * SBI MPXY (Message Proxy) Generic Library
+ *
+ * Copyright (c) 2026, Rahul Pathak <[email protected]>
+ */

...

Quoted 50 lines
arch/riscv/lib/sbi_mpxy.c new file +50 -0
+
+/**
+ * sbi_mpxy_read_attrs() - Read a contiguous range of channel attributes
+ *
+ * @chan:            Target channel
+ * @base_attr_id:    First attribute ID in the range
+ * @attr_count:              Number of attributes to read
+ * @attrs_buf:               Output buffer (attr_count u32 words)
+ */
+int sbi_mpxy_read_attrs(struct mpxy_channel *chan, u32 base_attr_id,
+                     u32 attr_count, u32 *attrs_buf)
+{
+     struct sbiret ret;
+     __le32 *shmem;
+     u32 end_id;
+     int i;
+
+     if (!chan || !attr_count || !attrs_buf)
+             return -EINVAL;
+
+     if (attr_count > mpxy_ctx.shmem_size / sizeof(u32))
+             return -EINVAL;
+
+     shmem = (__le32 *)shmem_base();
+     if (!shmem)
+             return -ENXIO;
+
+     end_id = base_attr_id + attr_count - 1;
+
+     if (base_attr_id < SBI_MPXY_ATTR_STD_ATTR_MAX_IDX) {
+             /* Standard attributes */
+             if (end_id >= SBI_MPXY_ATTR_STD_ATTR_MAX_IDX)
+                     return -EINVAL;
+
+             ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+                             chan->channel_id, base_attr_id, attr_count,
+                             0, 0, 0);
+             if (ret.error)
+                     return -EINVAL;
+
+             for (i = 0; i < attr_count; i++)
+                     attrs_buf[i] = le32_to_cpu(shmem[i]);
+
+             return 0;
+     }
+
+     if (base_attr_id >= SBI_MPXY_ATTR_MSGPROTO_ATTR_START &&
+         end_id < SBI_MPXY_ATTR_MSGPROTO_ATTR_END) {
+             /* Protocol-specific attributes */
+             if (!chan->proto || !chan->proto->readattr)

arch/riscv/lib/sbi_mpxy.c line 358

Quoted 10 lines
arch/riscv/lib/sbi_mpxy.c new file +10 -0
+                     return -ENOSYS;
+
+             ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+                             chan->channel_id, base_attr_id, attr_count,
+                             0, 0, 0);
+             if (ret.error)
+                     return -EINVAL;
+
+             for (i = 0; i < attr_count; i++)
+                     attrs_buf[i] = le32_to_cpu(shmem[i]);

Shouldn't you call the ->readattr() callback here instead of manually doing the read?

Quoted 4 lines

Also, I'm not quite sure I understand what purpose those callbacks serve. From what I'm seeing, attributes are always read/write using SBI_EXT_MPXY_[READ|WRITE]_ATTRS because the transport layer is always mpxy. Would a non-RPMI protocol do something different?

Reading the attributes is simple and can be achieved with or without the callback but
writing the attributes may (or may not) require any further protocol specific validation
which is not assumed here and hence used the callback to keep things generic.

Quoted 3 lines

That's why I didn't use callback for read but for write. I am fine to use callback for attributes read but I would prefer to not assume anything and keep write attribute callback.

The only hard requirement that I have is that we shouldn't have dead code and the ->readattr() callback is dead code in this version. I don't have strong opinions on whether it needs to be called or removed.

Thanks,
Charles

#5 lore raw

Re: [PATCH 1/3] riscv: Add SBI MPXY generic interface

Quoted 112 lines · Charles Perry
Quoted 110 lines · Rahul Pathak
Quoted 97 lines · Charles Perry
Quoted 13 lines · Rahul Pathak

SBI MPXY interface implements the SBI MPXY
extension to interact with supported message
protocols for platform management and control

---
 arch/riscv/Kconfig           |   9 +
 arch/riscv/include/asm/sbi.h | 268 ++++++++++++++++++
 arch/riscv/lib/Makefile      |   1 +
 arch/riscv/lib/sbi_mpxy.c    | 529 +++++++++++++++++++++++++++++++++++
 4 files changed, 807 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c

...

Quoted 12 lines
arch/riscv/lib/sbi_mpxy.c new file +6 -0
new file mode 100644
index 00000000000..f95cedaabac
@@ -0,0 +1,529 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * SBI MPXY (Message Proxy) Generic Library
+ *
+ * Copyright (c) 2026, Rahul Pathak <[email protected]>
+ */

...

Quoted 50 lines
arch/riscv/lib/sbi_mpxy.c new file +50 -0
+
+/**
+ * sbi_mpxy_read_attrs() - Read a contiguous range of channel attributes
+ *
+ * @chan:            Target channel
+ * @base_attr_id:    First attribute ID in the range
+ * @attr_count:              Number of attributes to read
+ * @attrs_buf:               Output buffer (attr_count u32 words)
+ */
+int sbi_mpxy_read_attrs(struct mpxy_channel *chan, u32 base_attr_id,
+                     u32 attr_count, u32 *attrs_buf)
+{
+     struct sbiret ret;
+     __le32 *shmem;
+     u32 end_id;
+     int i;
+
+     if (!chan || !attr_count || !attrs_buf)
+             return -EINVAL;
+
+     if (attr_count > mpxy_ctx.shmem_size / sizeof(u32))
+             return -EINVAL;
+
+     shmem = (__le32 *)shmem_base();
+     if (!shmem)
+             return -ENXIO;
+
+     end_id = base_attr_id + attr_count - 1;
+
+     if (base_attr_id < SBI_MPXY_ATTR_STD_ATTR_MAX_IDX) {
+             /* Standard attributes */
+             if (end_id >= SBI_MPXY_ATTR_STD_ATTR_MAX_IDX)
+                     return -EINVAL;
+
+             ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+                             chan->channel_id, base_attr_id, attr_count,
+                             0, 0, 0);
+             if (ret.error)
+                     return -EINVAL;
+
+             for (i = 0; i < attr_count; i++)
+                     attrs_buf[i] = le32_to_cpu(shmem[i]);
+
+             return 0;
+     }
+
+     if (base_attr_id >= SBI_MPXY_ATTR_MSGPROTO_ATTR_START &&
+         end_id < SBI_MPXY_ATTR_MSGPROTO_ATTR_END) {
+             /* Protocol-specific attributes */
+             if (!chan->proto || !chan->proto->readattr)

arch/riscv/lib/sbi_mpxy.c line 358

Quoted 10 lines
arch/riscv/lib/sbi_mpxy.c new file +10 -0
+                     return -ENOSYS;
+
+             ret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
+                             chan->channel_id, base_attr_id, attr_count,
+                             0, 0, 0);
+             if (ret.error)
+                     return -EINVAL;
+
+             for (i = 0; i < attr_count; i++)
+                     attrs_buf[i] = le32_to_cpu(shmem[i]);

Shouldn't you call the ->readattr() callback here instead of manually doing the read?

Quoted 4 lines

Also, I'm not quite sure I understand what purpose those callbacks serve. From what I'm seeing, attributes are always read/write using SBI_EXT_MPXY_[READ|WRITE]_ATTRS because the transport layer is always mpxy. Would a non-RPMI protocol do something different?

Reading the attributes is simple and can be achieved with or without the callback but
writing the attributes may (or may not) require any further protocol specific validation
which is not assumed here and hence used the callback to keep things generic.

Quoted 7 lines
Quoted 3 lines

That's why I didn't use callback for read but for write. I am fine to use callback for attributes read but I would prefer to not assume anything and keep write attribute callback.

The only hard requirement that I have is that we shouldn't have dead code and the ->readattr() callback is dead code in this version. I don't have strong opinions on whether it needs to be called or removed.

If that's really bugging you then I suggest removing the RPMI implementation of readattr only and not the callback pointer field from the struct mpxy_proto_ops.

Quoted 4 lines

Thanks,
Charles

#6 lore raw

PATCH 2/3 cmd: Add mpxy command and add RISC-V RPMI driver

In reply to Rahul Pathak

The mpxy command is an interactive command which uses SBI MPXY interface to interact with supported message protocol through available MPXY channels.

The command helps if there is a custom RPMI service group or any other such message protocol implementation and that can be tested in some manner without requiring the S-Mode OS driver support.

---
 cmd/Kconfig              |   8 +
 cmd/riscv/Makefile       |   1 +
 cmd/riscv/sbi_mpxy_cmd.c | 482 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 491 insertions(+)
 create mode 100644 cmd/riscv/sbi_mpxy_cmd.c
cmd/Kconfig +8 -0
index 5b9c13d85e7..413f7787343 100644
@@ -264,6 +264,14 @@ config CMD_SBI
 	help
 	  Display information about the SBI implementation.
 
+config CMD_MPXY
+	bool "mpxy command"
+	depends on SBI_MPXY
+	help
+	  Enable the 'mpxy' U-Boot command for listing MPXY channels,
+	  reading/writing channel attributes, and sending raw messages.
+	  Includes the built-in RPMI protocol driver.
+
 config CMD_SMBIOS
 	bool "smbios"
 	depends on SMBIOS
cmd/riscv/Makefile +1 -0
index 1e6ac364e34..40caf68d0df 100644
@@ -2,3 +2,4 @@
 
 obj-$(CONFIG_CMD_EXCEPTION) += exception.o
 obj-$(CONFIG_CMD_SBI) += sbi.o
+obj-$(CONFIG_CMD_MPXY) += sbi_mpxy_cmd.o
cmd/riscv/sbi_mpxy_cmd.c new file +482 -0

482 lines not on this page · raw message

Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH 2/3] cmd: Add mpxy command and add RISC-V RPMI driver

Quoted 8 lines · Rahul Pathak

The mpxy command is an interactive command which uses SBI MPXY interface to interact with supported message protocol through available MPXY channels.

The command helps if there is a custom RPMI service group or any other such message protocol implementation and that can be tested in some manner without requiring the S-Mode OS driver support.

Does that mean the "mpxy" command would also work without the driver from patch #1 ? If yes, how?

Thanks,
Charles

#8 lore raw

Re: [PATCH 2/3] cmd: Add mpxy command and add RISC-V RPMI driver

Quoted 6 lines · Charles Perry
Quoted 4 lines · Rahul Pathak

The mpxy command is an interactive command which uses SBI MPXY interface to interact with supported message protocol through available MPXY channels.

Quoted 7 lines
Quoted 4 lines

The command helps if there is a custom RPMI service group or any other such message protocol implementation and that can be tested in some manner without requiring the S-Mode OS driver support.

Does that mean the "mpxy" command would also work without the driver from patch #1 ? If yes, how?

Here I meant S-Mode OS (Linux) mpxy infra/driver

#9 lore raw

PATCH 3/3 riscv: Enable SBI MPXY core interface and MPXY command

In reply to Rahul Pathak

Enable SBI MPXY interface implementation and
MPXY command for riscv platform.

---
 configs/qemu-riscv64_spl_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/qemu-riscv64_spl_defconfig +2 -0
index 04dec72ceac..5235b8a6cc6 100644
@@ -25,3 +25,5 @@ CONFIG_FLASH_SHOW_PROGRESS=0
 CONFIG_SYS_MAX_FLASH_BANKS=2
 # CONFIG_BINMAN_FDT is not set
 CONFIG_UNIT_TEST=y
+CONFIG_SBI_MPXY=y
+CONFIG_CMD_MPXY=y
Signature · 1 line
2.43.0
#10 lore raw
In reply to Rahul Pathak
Quoted 8 lines · Rahul Pathak

This patch series adds a generic SBI MPXY extension implementation which provides an interface to interact with platform via supported message protocol (eg. RPMI)

It also adds a mpxy command which uses the generic SBI MPXY interface and provides cli support to interact with supported message protocol. Currently it supports RISC-V RPMI message protocol.

Hello Rahul,

I'm happy to see that you're interested in RPMI support in U-Boot.

Can you share with us the context in which you developed those patches? i.e., what hardware are you using and how is the "mpxy" command used.

Is "mpxy" mostly just for debugging or is it expected that a bootscript would initialize the platform with calls to "mpxy"?

Thanks,
Charles

Quoted 21 lines

Rahul Pathak (3):
riscv: Add SBI MPXY generic interface
cmd: Add mpxy command and add RISC-V RPMI driver
riscv: Enable SBI MPXY core interface and MPXY command

 arch/riscv/Kconfig                 |   9 +
 arch/riscv/include/asm/sbi.h       | 268 +++++++++++++++
 arch/riscv/lib/Makefile            |   1 +
 arch/riscv/lib/sbi_mpxy.c          | 529 +++++++++++++++++++++++++++++
 cmd/Kconfig                        |   8 +
 cmd/riscv/Makefile                 |   1 +
 cmd/riscv/sbi_mpxy_cmd.c           | 482 ++++++++++++++++++++++++++
 configs/qemu-riscv64_spl_defconfig |   2 +
 8 files changed, 1300 insertions(+)
 create mode 100644 arch/riscv/lib/sbi_mpxy.c
 create mode 100644 cmd/riscv/sbi_mpxy_cmd.c
Signature · 1 line
2.43.0
#11 lore raw
Quoted 13 lines · Charles Perry
Quoted 8 lines · Rahul Pathak

This patch series adds a generic SBI MPXY extension implementation which provides an interface to interact with platform via supported message protocol (eg. RPMI)

It also adds a mpxy command which uses the generic SBI MPXY interface and provides cli support to interact with supported message protocol. Currently it supports RISC-V RPMI message protocol.

Hello Rahul,

Quoted 8 lines

I'm happy to see that you're interested in RPMI support in U-Boot.

Can you share with us the context in which you developed those patches? i.e., what hardware are you using and how is the "mpxy" command used.

Is "mpxy" mostly just for debugging or is it expected that a bootscript would initialize the platform with calls to "mpxy"?

Hi Charles,

I have used QEMU RISC-V Virt platform (with OpenSBI + librpmi providing the RPMI firmware side) for its development, and in terms of use cases its both actually which you outlined - debugging and configuration.

Debugging is the pretty obvious usecase where mpxy command allows anyone to access message protocol in case of RPMI, it lets you access any custom service group implemented without changing u-boot.

Boot time tweaking of any attribute or any platform state changes via scripts is also possible as you mentioned. The configuration can be board specific and expressed in uboot environment scripts instead of compiled in driver code.

Thanks
Rahul

#12 lore raw
Quoted 30 lines · Rahul Pathak
Quoted 13 lines · Charles Perry
Quoted 8 lines · Rahul Pathak

This patch series adds a generic SBI MPXY extension implementation which provides an interface to interact with platform via supported message protocol (eg. RPMI)

It also adds a mpxy command which uses the generic SBI MPXY interface and provides cli support to interact with supported message protocol. Currently it supports RISC-V RPMI message protocol.

Hello Rahul,

Quoted 8 lines

I'm happy to see that you're interested in RPMI support in U-Boot.

Can you share with us the context in which you developed those patches? i.e., what hardware are you using and how is the "mpxy" command used.

Is "mpxy" mostly just for debugging or is it expected that a bootscript would initialize the platform with calls to "mpxy"?

Hi Charles,

I have used QEMU RISC-V Virt platform (with OpenSBI + librpmi providing the RPMI firmware side) for its development, and in terms of use cases its both actually which you outlined - debugging and configuration.

Quoted 8 lines

Debugging is the pretty obvious usecase where mpxy command allows anyone to access message protocol in case of RPMI, it lets you access any custom service group implemented without changing u-boot.

Boot time tweaking of any attribute or any platform state changes via scripts is also possible as you mentioned. The configuration can be board specific and expressed in uboot environment scripts instead of compiled in driver code.

Most people will want the later, i.e. compiled code.

That doesn't mean you need to modify all the drivers being used on your machine because U-Boot already has an abstraction layers for clocks, power-domains, resets, and other which are relevant to RPMI.

If you make a driver that implements the clock, power-domain, etc. API and implement it so that it delegates to RPMI, you can leverage the existing drivers and you don't have to add "mpxy" commands to your bootscript. Need to use the network? you call "tftpboot" which calls your network device driver which calls your clock driver which calls your RPMI driver. Need to use the NOR? you call "mtd" and the same magic happens.

I posted an implementation of this, please have a look at it:

https://lore.kernel.org/all/[email protected]/

If you want, we can combine our two patchsets into something that takes the best of both.

I can take your patch that adds the "mpxy" command and add it to my patchset with a few adjustments.

Thanks,
Charles

#13 lore raw

Hi Charles,

Quoted 7 lines
Quoted 5 lines

Boot time tweaking of any attribute or any platform state changes via scripts is also possible as you mentioned. The configuration can be board specific and expressed in uboot environment scripts instead of compiled in driver code.

Most people will want the later, i.e. compiled code.

It's an assumption and we should not assume what people will want. That's the thing with infra related support which can be used to cater in many forms.

Quoted 12 lines

That doesn't mean you need to modify all the drivers being used on your machine because U-Boot already has an abstraction layers for clocks, power-domains, resets, and other which are relevant to RPMI.

If you make a driver that implements the clock, power-domain, etc. API and implement it so that it delegates to RPMI, you can leverage the existing drivers and you don't have to add "mpxy" commands to your bootscript. Need to use the network? you call "tftpboot" which calls your network device driver which calls your clock driver which calls your RPMI driver. Need to use the NOR? you call "mtd" and the same magic happens.

Quoted 6 lines

I posted an implementation of this, please have a look at it:

https://lore.kernel.org/all/[email protected]/

If you want, we can combine our two patchsets into something that takes the best of both.

I have no problem with that.

Quoted 3 lines

I can take your patch that adds the "mpxy" command and add it to my patchset with a few adjustments.

Sure

Quoted 3 lines

Thanks,
Charles