Skip to contentSkip to conversation

Add RPMI/MPXY voltage, device power and performance service

PATCH Applied Joshua Yeong 4 participants 12 messages Oct 13, 2025 – Nov 7, 2025

lore
Share & tools
lore
#0 lore raw

cover Add RPMI/MPXY voltage, device power and performance service

Add RPMI/MPXY driver for voltage, device power and performance group based on RPMI specification v1.0.

https://github.com/riscv-non-isa/riscv-rpmi/releases/download/v1.0/riscv-rpmi.pdf

Joshua Yeong (3):
lib: utils: Add MPXY RPMI mailbox driver for voltage
lib: utils: Add MPXY RPMI mailbox driver for device power
lib: utils: Add MPXY RPMI mailbox driver for performance

 include/sbi_utils/mailbox/rpmi_msgprot.h    | 244 ++++++++++++++++++++
 lib/utils/mpxy/Kconfig                      |  12 +
 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c |  55 +++++
 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c  |  90 ++++++++
 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c      |  76 ++++++
 lib/utils/mpxy/objects.mk                   |   9 +
 platform/generic/configs/defconfig          |   3 +
 7 files changed, 489 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c

--
2.43.0

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#1 lore raw

PATCH 1/3 lib: utils: Add MPXY RPMI mailbox driver for voltage

Add voltage service group for RPMI/MPXY support

---
 include/sbi_utils/mailbox/rpmi_msgprot.h | 81 ++++++++++++++++++++++++
 lib/utils/mpxy/Kconfig                   |  4 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c   | 76 ++++++++++++++++++++++
 lib/utils/mpxy/objects.mk                |  3 +
 platform/generic/configs/defconfig       |  1 +
 5 files changed, 165 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c
include/sbi_utils/mailbox/rpmi_msgprot.h +81 -0
index a761b560..6b5a553c 100644
@@ -216,6 +216,7 @@ enum rpmi_servicegroup_id {
 	RPMI_SRVGRP_SYSTEM_SUSPEND = 0x0004,
 	RPMI_SRVGRP_HSM = 0x0005,
 	RPMI_SRVGRP_CPPC = 0x0006,
+	RPMI_SRVGRP_VOLTAGE = 0x00007,
 	RPMI_SRVGRP_CLOCK = 0x0008,
 	RPMI_SRVGRP_ID_MAX_COUNT,
 
@@ -611,6 +612,86 @@ struct rpmi_cppc_hart_list_resp {
 	u32 hartid[(RPMI_MSG_DATA_SIZE(RPMI_SLOT_SIZE_MIN) - (sizeof(u32) * 3)) / sizeof(u32)];
 };
 
+/** RPMI Voltage ServiceGroup Service IDs */
+enum rpmi_voltage_service_id {
+	RPMI_VOLTAGE_SRV_ENABLE_NOTIFICATION = 0x01,
+	RPMI_VOLTAGE_SRV_GET_NUM_DOMAINS = 0x02,
+	RPMI_VOLTAGE_SRV_GET_ATTRIBUTES = 0x03,
+	RPMI_VOLTAGE_SRV_GET_SUPPORTED_LEVELS = 0x04,
+	RPMI_VOLTAGE_SRV_SET_CONFIG = 0x05,
+	RPMI_VOLTAGE_SRV_GET_CONFIG = 0x06,
+	RPMI_VOLTAGE_SRV_SET_LEVEL = 0x07,
+	RPMI_VOLTAGE_SRV_GET_LEVEL = 0x08,
+	RPMI_VOLTAGE_SRV_MAX_COUNT,
+};
+
+struct rpmi_voltage_get_num_domains_resp {
+       s32 status;
+       u32 num_domains;
+};
+
+struct rpmi_voltage_get_attributes_req {
+        u32 domain_id;
+};
+
+struct rpmi_voltage_get_attributes_resp {
+        s32 status;
+        u32 flags;
+        u32 num_levels;
+        u32 transition_latency;
+        u8 name[16];
+};
+
+struct rpmi_voltage_get_supported_rate_req {
+        u32 domain_id;
+        u32 index;
+};
+
+struct rpmi_voltage_get_supported_rate_resp {
+        s32 status;
+        u32 flags;
+        u32 remaining;
+        u32 returned;
+	u32 level[0];
+};
+
+struct rpmi_voltage_set_config_req {
+        u32 domain_id;
+#define RPMI_CLOCK_CONFIG_ENABLE                (1U << 0)
+        u32 config;
+};
+
+struct rpmi_voltage_set_config_resp {
+        s32 status;
+};
+
+struct rpmi_voltage_get_config_req {
+        u32 domain_id;
+};
+
+struct rpmi_voltage_get_config_resp {
+        s32 status;
+        u32 config;
+};
+
+struct rpmi_voltage_set_level_req {
+        u32 domain_id;
+        s32 level;
+};
+
+struct rpmi_voltage_set_level_resp {
+        s32 status;
+};
+
+struct rpmi_voltage_get_level_req {
+        u32 domain_id;
+};
+
+struct rpmi_voltage_get_level_resp {
+        s32 status;
+        s32 level;
+};
+
 /** RPMI Clock ServiceGroup Service IDs */
 enum rpmi_clock_service_id {
 	RPMI_CLOCK_SRV_ENABLE_NOTIFICATION = 0x01,
lib/utils/mpxy/Kconfig +4 -0
index 8d1f5183..f720af2c 100644
@@ -22,6 +22,10 @@ config FDT_MPXY_RPMI_SYSMSI
 	bool "MPXY driver for RPMI system MSI service group"
 	default n
 
+config FDT_MPXY_RPMI_VOLTAGE
+	bool "MPXY driver for RPMI voltage service group"
+	default n
+
 endif
 
 endmenu
lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c new file +76 -0

76 lines not on this page · raw message

lib/utils/mpxy/objects.mk +3 -0
index 5b6e9bdf..a71c56af 100644
@@ -17,3 +17,6 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += mpxy/fdt_mpxy_rpmi_clock.o
 
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += fdt_mpxy_rpmi_sysmsi
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o
+
+carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += fdt_mpxy_rpmi_voltage
+libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += mpxy/fdt_mpxy_rpmi_voltage.o
platform/generic/configs/defconfig +1 -0
index fb90bb3e..10992619 100644
@@ -59,4 +59,5 @@ CONFIG_FDT_TIMER_PLMT=y
 CONFIG_FDT_MPXY=y
 CONFIG_FDT_MPXY_RPMI_MBOX=y
 CONFIG_FDT_MPXY_RPMI_CLOCK=y
+CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
 CONFIG_FDT_MPXY_RPMI_SYSMSI=y
Signature · 7 lines
2.43.0


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] lib: utils: Add MPXY RPMI mailbox driver for voltage

Quoted 4 lines · Joshua Yeong

Add voltage service group for RPMI/MPXY support

Quoted 9 lines
---
 include/sbi_utils/mailbox/rpmi_msgprot.h | 81 ++++++++++++++++++++++++
 lib/utils/mpxy/Kconfig                   |  4 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c   | 76 ++++++++++++++++++++++
 lib/utils/mpxy/objects.mk                |  3 +
 platform/generic/configs/defconfig       |  1 +
 5 files changed, 165 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c

LGTM

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Applied
#3 lore raw

Re: [PATCH 1/3] lib: utils: Add MPXY RPMI mailbox driver for voltage

In reply to Joshua Yeong
Quoted 4 lines · Joshua Yeong

Add voltage service group for RPMI/MPXY support

I have marked the driver as experimental until the DT compatible string is accepted on LKML.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 234 lines
---
 include/sbi_utils/mailbox/rpmi_msgprot.h | 81 ++++++++++++++++++++++++
 lib/utils/mpxy/Kconfig                   |  4 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c   | 76 ++++++++++++++++++++++
 lib/utils/mpxy/objects.mk                |  3 +
 platform/generic/configs/defconfig       |  1 +
 5 files changed, 165 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c
include/sbi_utils/mailbox/rpmi_msgprot.h +81 -0
index a761b560..6b5a553c 100644
@@ -216,6 +216,7 @@ enum rpmi_servicegroup_id {
        RPMI_SRVGRP_SYSTEM_SUSPEND = 0x0004,
        RPMI_SRVGRP_HSM = 0x0005,
        RPMI_SRVGRP_CPPC = 0x0006,
+       RPMI_SRVGRP_VOLTAGE = 0x00007,
        RPMI_SRVGRP_CLOCK = 0x0008,
        RPMI_SRVGRP_ID_MAX_COUNT,
 
@@ -611,6 +612,86 @@ struct rpmi_cppc_hart_list_resp {
        u32 hartid[(RPMI_MSG_DATA_SIZE(RPMI_SLOT_SIZE_MIN) - (sizeof(u32) * 3)) / sizeof(u32)];
 };
 
+/** RPMI Voltage ServiceGroup Service IDs */
+enum rpmi_voltage_service_id {
+       RPMI_VOLTAGE_SRV_ENABLE_NOTIFICATION = 0x01,
+       RPMI_VOLTAGE_SRV_GET_NUM_DOMAINS = 0x02,
+       RPMI_VOLTAGE_SRV_GET_ATTRIBUTES = 0x03,
+       RPMI_VOLTAGE_SRV_GET_SUPPORTED_LEVELS = 0x04,
+       RPMI_VOLTAGE_SRV_SET_CONFIG = 0x05,
+       RPMI_VOLTAGE_SRV_GET_CONFIG = 0x06,
+       RPMI_VOLTAGE_SRV_SET_LEVEL = 0x07,
+       RPMI_VOLTAGE_SRV_GET_LEVEL = 0x08,
+       RPMI_VOLTAGE_SRV_MAX_COUNT,
+};
+
+struct rpmi_voltage_get_num_domains_resp {
+       s32 status;
+       u32 num_domains;
+};
+
+struct rpmi_voltage_get_attributes_req {
+        u32 domain_id;
+};
+
+struct rpmi_voltage_get_attributes_resp {
+        s32 status;
+        u32 flags;
+        u32 num_levels;
+        u32 transition_latency;
+        u8 name[16];
+};
+
+struct rpmi_voltage_get_supported_rate_req {
+        u32 domain_id;
+        u32 index;
+};
+
+struct rpmi_voltage_get_supported_rate_resp {
+        s32 status;
+        u32 flags;
+        u32 remaining;
+        u32 returned;
+       u32 level[0];
+};
+
+struct rpmi_voltage_set_config_req {
+        u32 domain_id;
+#define RPMI_CLOCK_CONFIG_ENABLE                (1U << 0)
+        u32 config;
+};
+
+struct rpmi_voltage_set_config_resp {
+        s32 status;
+};
+
+struct rpmi_voltage_get_config_req {
+        u32 domain_id;
+};
+
+struct rpmi_voltage_get_config_resp {
+        s32 status;
+        u32 config;
+};
+
+struct rpmi_voltage_set_level_req {
+        u32 domain_id;
+        s32 level;
+};
+
+struct rpmi_voltage_set_level_resp {
+        s32 status;
+};
+
+struct rpmi_voltage_get_level_req {
+        u32 domain_id;
+};
+
+struct rpmi_voltage_get_level_resp {
+        s32 status;
+        s32 level;
+};
+
 /** RPMI Clock ServiceGroup Service IDs */
 enum rpmi_clock_service_id {
        RPMI_CLOCK_SRV_ENABLE_NOTIFICATION = 0x01,
lib/utils/mpxy/Kconfig +4 -0
index 8d1f5183..f720af2c 100644
@@ -22,6 +22,10 @@ config FDT_MPXY_RPMI_SYSMSI
        bool "MPXY driver for RPMI system MSI service group"
        default n
 
+config FDT_MPXY_RPMI_VOLTAGE
+       bool "MPXY driver for RPMI voltage service group"
+       default n
+
 endif
 
 endmenu
lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c new file +76 -0
new file mode 100644
index 00000000..a281924e
@@ -0,0 +1,76 @@
+#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
+
+static struct mpxy_rpmi_service_data voltage_services[] = {
+{
+       .id = RPMI_VOLTAGE_SRV_ENABLE_NOTIFICATION,
+       .min_tx_len = sizeof(struct rpmi_enable_notification_req),
+       .max_tx_len = sizeof(struct rpmi_enable_notification_req),
+       .min_rx_len = sizeof(struct rpmi_enable_notification_resp),
+       .max_rx_len = sizeof(struct rpmi_enable_notification_resp),
+},
+{
+       .id = RPMI_VOLTAGE_SRV_GET_NUM_DOMAINS,
+       .min_tx_len = 0,
+       .max_tx_len = 0,
+       .min_rx_len = sizeof(struct rpmi_voltage_get_num_domains_resp),
+       .max_rx_len = sizeof(struct rpmi_voltage_get_num_domains_resp),
+},
+{
+       .id = RPMI_VOLTAGE_SRV_GET_ATTRIBUTES,
+       .min_tx_len = sizeof(struct rpmi_voltage_get_attributes_req),
+       .max_tx_len = sizeof(struct rpmi_voltage_get_attributes_req),
+       .min_rx_len = sizeof(struct rpmi_voltage_get_attributes_resp),
+       .max_rx_len = sizeof(struct rpmi_voltage_get_attributes_resp),
+},
+{
+       .id = RPMI_VOLTAGE_SRV_GET_SUPPORTED_LEVELS,
+       .min_tx_len = sizeof(struct rpmi_voltage_get_supported_rate_req),
+       .max_tx_len = sizeof(struct rpmi_voltage_get_supported_rate_req),
+       .min_rx_len = sizeof(struct rpmi_voltage_get_supported_rate_resp),
+       .max_rx_len = -1U,
+},
+{
+       .id = RPMI_VOLTAGE_SRV_SET_CONFIG,
+       .min_tx_len = sizeof(struct rpmi_voltage_set_config_req),
+       .max_tx_len = sizeof(struct rpmi_voltage_set_config_req),
+       .min_rx_len = sizeof(struct rpmi_voltage_set_config_resp),
+       .max_rx_len = sizeof(struct rpmi_voltage_set_config_resp),
+},
+{
+       .id = RPMI_VOLTAGE_SRV_GET_CONFIG,
+       .min_tx_len = sizeof(struct rpmi_voltage_get_config_req),
+       .max_tx_len = sizeof(struct rpmi_voltage_get_config_req),
+       .min_rx_len = sizeof(struct rpmi_voltage_get_config_resp),
+       .max_rx_len = sizeof(struct rpmi_voltage_get_config_resp),
+},
+{
+       .id = RPMI_VOLTAGE_SRV_SET_LEVEL,
+       .min_tx_len = sizeof(struct rpmi_voltage_set_level_req),
+       .max_tx_len = sizeof(struct rpmi_voltage_set_level_req),
+       .min_rx_len = sizeof(struct rpmi_voltage_set_level_resp),
+       .max_rx_len = sizeof(struct rpmi_voltage_set_level_resp),
+},
+{
+       .id = RPMI_VOLTAGE_SRV_GET_LEVEL,
+       .min_tx_len = sizeof(struct rpmi_voltage_get_level_req),
+       .max_tx_len = sizeof(struct rpmi_voltage_get_level_req),
+       .min_rx_len = sizeof(struct rpmi_voltage_get_level_resp),
+       .max_rx_len = sizeof(struct rpmi_voltage_get_level_resp),
+},
+};
+
+static const struct mpxy_rpmi_mbox_data voltage_data = {
+       .servicegrp_id = RPMI_SRVGRP_VOLTAGE,
+       .num_services = RPMI_VOLTAGE_SRV_MAX_COUNT,
+       .service_data = voltage_services,
+};
+
+static const struct fdt_match voltage_match[] = {
+       { .compatible = "riscv,rpmi-mpxy-voltage", .data = &voltage_data },
+       { },
+};
+
+const struct fdt_driver fdt_mpxy_rpmi_voltage = {
+       .match_table = voltage_match,
+       .init = mpxy_rpmi_mbox_init,
+};
lib/utils/mpxy/objects.mk +3 -0
index 5b6e9bdf..a71c56af 100644
@@ -17,3 +17,6 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += mpxy/fdt_mpxy_rpmi_clock.o
 
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += fdt_mpxy_rpmi_sysmsi
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o
+
+carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += fdt_mpxy_rpmi_voltage
+libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += mpxy/fdt_mpxy_rpmi_voltage.o
platform/generic/configs/defconfig +1 -1
index fb90bb3e..10992619 100644
@@ -59,4 +59,5 @@ CONFIG_FDT_TIMER_PLMT=y
 CONFIG_FDT_MPXY=y
 CONFIG_FDT_MPXY_RPMI_MBOX=y
 CONFIG_FDT_MPXY_RPMI_CLOCK=y
+CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
 CONFIG_FDT_MPXY_RPMI_SYSMSI=y
--

2.43.0

--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#4 lore raw

PATCH 2/3 lib: utils: Add MPXY RPMI mailbox driver for device power

In reply to Joshua Yeong

Add MPXY RPMI mailbox driver for device power.

---
 include/sbi_utils/mailbox/rpmi_msgprot.h    | 45 +++++++++++++++++
 lib/utils/mpxy/Kconfig                      |  4 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c | 55 +++++++++++++++++++++
 lib/utils/mpxy/objects.mk                   |  3 ++
 platform/generic/configs/defconfig          |  1 +
 5 files changed, 108 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
include/sbi_utils/mailbox/rpmi_msgprot.h +45 -0
index 6b5a553c..4e915a08 100644
@@ -218,6 +218,7 @@ enum rpmi_servicegroup_id {
 	RPMI_SRVGRP_CPPC = 0x0006,
 	RPMI_SRVGRP_VOLTAGE = 0x00007,
 	RPMI_SRVGRP_CLOCK = 0x0008,
+	RPMI_SRVGRP_DEVICE_POWER = 0x0009,
 	RPMI_SRVGRP_ID_MAX_COUNT,
 
 	/* Reserved range for service groups */
@@ -784,4 +785,48 @@ struct rpmi_clock_get_rate_resp {
 	u32 clock_rate_high;
 };
 
+/** RPMI Device Power ServiceGroup Service IDs */
+enum rpmi_dpwr_service_id {
+	RPMI_DPWR_SRV_ENABLE_NOTIFICATION = 0x01,
+	RPMI_DPWR_SRV_GET_NUM_DOMAINS = 0x02,
+	RPMI_DPWR_SRV_GET_ATTRIBUTES = 0x03,
+	RPMI_DPWR_SRV_SET_STATE = 0x04,
+	RPMI_DPWR_SRV_GET_STATE = 0x05,
+	RPMI_DPWR_SRV_MAX_COUNT,
+};
+
+struct rpmi_dpwr_get_num_domain_resp {
+	s32 status;
+	u32 num_domain;
+};
+
+struct rpmi_dpwr_get_attrs_req {
+	u32 domain_id;
+};
+
+struct rpmi_dpwr_get_attrs_resp {
+	s32 status;
+	u32 flags;
+	u32 transition_latency;
+	u8 name[16];
+};
+
+struct rpmi_dpwr_set_state_req {
+	u32 domain_id;
+	u32 state;
+};
+
+struct rpmi_dpwr_set_state_resp {
+	s32 status;
+};
+
+struct rpmi_dpwr_get_state_req {
+	u32 domain_id;
+};
+
+struct rpmi_dpwr_get_state_resp {
+	s32 status;
+	u32 state;
+};
+
 #endif /* !__RPMI_MSGPROT_H__ */
lib/utils/mpxy/Kconfig +4 -0
index f720af2c..25288671 100644
@@ -26,6 +26,10 @@ config FDT_MPXY_RPMI_VOLTAGE
 	bool "MPXY driver for RPMI voltage service group"
 	default n
 
+config FDT_MPXY_RPMI_DEVICE_POWER
+	bool "MPXY driver for RPMI device power service group"
+	default n
+
 endif
 
 endmenu
lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c new file +55 -0

55 lines not on this page · raw message

lib/utils/mpxy/objects.mk +3 -0
index a71c56af..45b3281b 100644
@@ -20,3 +20,6 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o
 
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += fdt_mpxy_rpmi_voltage
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += mpxy/fdt_mpxy_rpmi_voltage.o
+
+carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_DEVICE_POWER) += fdt_mpxy_rpmi_device_power
+libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_DEVICE_POWER) += mpxy/fdt_mpxy_rpmi_device_power.o
platform/generic/configs/defconfig +1 -0
index 10992619..5e819b3b 100644
@@ -60,4 +60,5 @@ CONFIG_FDT_MPXY=y
 CONFIG_FDT_MPXY_RPMI_MBOX=y
 CONFIG_FDT_MPXY_RPMI_CLOCK=y
 CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
+CONFIG_FDT_MPXY_RPMI_DEVICE_POWER=y
 CONFIG_FDT_MPXY_RPMI_SYSMSI=y
Signature · 7 lines
2.43.0


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] lib: utils: Add MPXY RPMI mailbox driver for device power

Quoted 4 lines · Joshua Yeong

Add MPXY RPMI mailbox driver for device power.

Quoted 9 lines
---
 include/sbi_utils/mailbox/rpmi_msgprot.h    | 45 +++++++++++++++++
 lib/utils/mpxy/Kconfig                      |  4 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c | 55 +++++++++++++++++++++
 lib/utils/mpxy/objects.mk                   |  3 ++
 platform/generic/configs/defconfig          |  1 +
 5 files changed, 108 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c

LGTM

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Applied
#6 lore raw

Re: [PATCH 2/3] lib: utils: Add MPXY RPMI mailbox driver for device power

In reply to Joshua Yeong
Quoted 4 lines · Joshua Yeong

Add MPXY RPMI mailbox driver for device power.

I have marked the driver as experimental until the DT compatible string is accepted on LKML.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 175 lines
---
 include/sbi_utils/mailbox/rpmi_msgprot.h    | 45 +++++++++++++++++
 lib/utils/mpxy/Kconfig                      |  4 ++
 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c | 55 +++++++++++++++++++++
 lib/utils/mpxy/objects.mk                   |  3 ++
 platform/generic/configs/defconfig          |  1 +
 5 files changed, 108 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
include/sbi_utils/mailbox/rpmi_msgprot.h +45 -0
index 6b5a553c..4e915a08 100644
@@ -218,6 +218,7 @@ enum rpmi_servicegroup_id {
        RPMI_SRVGRP_CPPC = 0x0006,
        RPMI_SRVGRP_VOLTAGE = 0x00007,
        RPMI_SRVGRP_CLOCK = 0x0008,
+       RPMI_SRVGRP_DEVICE_POWER = 0x0009,
        RPMI_SRVGRP_ID_MAX_COUNT,
 
        /* Reserved range for service groups */
@@ -784,4 +785,48 @@ struct rpmi_clock_get_rate_resp {
        u32 clock_rate_high;
 };
 
+/** RPMI Device Power ServiceGroup Service IDs */
+enum rpmi_dpwr_service_id {
+       RPMI_DPWR_SRV_ENABLE_NOTIFICATION = 0x01,
+       RPMI_DPWR_SRV_GET_NUM_DOMAINS = 0x02,
+       RPMI_DPWR_SRV_GET_ATTRIBUTES = 0x03,
+       RPMI_DPWR_SRV_SET_STATE = 0x04,
+       RPMI_DPWR_SRV_GET_STATE = 0x05,
+       RPMI_DPWR_SRV_MAX_COUNT,
+};
+
+struct rpmi_dpwr_get_num_domain_resp {
+       s32 status;
+       u32 num_domain;
+};
+
+struct rpmi_dpwr_get_attrs_req {
+       u32 domain_id;
+};
+
+struct rpmi_dpwr_get_attrs_resp {
+       s32 status;
+       u32 flags;
+       u32 transition_latency;
+       u8 name[16];
+};
+
+struct rpmi_dpwr_set_state_req {
+       u32 domain_id;
+       u32 state;
+};
+
+struct rpmi_dpwr_set_state_resp {
+       s32 status;
+};
+
+struct rpmi_dpwr_get_state_req {
+       u32 domain_id;
+};
+
+struct rpmi_dpwr_get_state_resp {
+       s32 status;
+       u32 state;
+};
+
 #endif /* !__RPMI_MSGPROT_H__ */
lib/utils/mpxy/Kconfig +4 -0
index f720af2c..25288671 100644
@@ -26,6 +26,10 @@ config FDT_MPXY_RPMI_VOLTAGE
        bool "MPXY driver for RPMI voltage service group"
        default n
 
+config FDT_MPXY_RPMI_DEVICE_POWER
+       bool "MPXY driver for RPMI device power service group"
+       default n
+
 endif
 
 endmenu
lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c new file +55 -0
new file mode 100644
index 00000000..9978b727
@@ -0,0 +1,55 @@
+#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
+
+static struct mpxy_rpmi_service_data dpwr_services[] = {
+{
+       .id = RPMI_DPWR_SRV_ENABLE_NOTIFICATION,
+       .min_tx_len = sizeof(struct rpmi_enable_notification_req),
+       .max_tx_len = sizeof(struct rpmi_enable_notification_req),
+       .min_rx_len = sizeof(struct rpmi_enable_notification_resp),
+       .max_rx_len = sizeof(struct rpmi_enable_notification_resp),
+},
+{
+       .id = RPMI_DPWR_SRV_GET_NUM_DOMAINS,
+       .min_tx_len = 0,
+       .max_tx_len = 0,
+       .min_rx_len = sizeof(struct rpmi_dpwr_get_num_domain_resp),
+       .max_rx_len = sizeof(struct rpmi_dpwr_get_num_domain_resp),
+},
+{
+       .id = RPMI_DPWR_SRV_GET_ATTRIBUTES,
+       .min_tx_len = sizeof(struct rpmi_dpwr_get_attrs_req),
+       .max_tx_len = sizeof(struct rpmi_dpwr_get_attrs_req),
+       .min_rx_len = sizeof(struct rpmi_dpwr_get_attrs_resp),
+       .max_rx_len = sizeof(struct rpmi_dpwr_get_attrs_resp),
+},
+{
+       .id = RPMI_DPWR_SRV_SET_STATE,
+       .min_tx_len = sizeof(struct rpmi_dpwr_set_state_req),
+       .max_tx_len = sizeof(struct rpmi_dpwr_set_state_req),
+       .min_rx_len = sizeof(struct rpmi_dpwr_set_state_resp),
+       .max_rx_len = sizeof(struct rpmi_dpwr_set_state_resp),
+},
+{
+       .id = RPMI_DPWR_SRV_GET_STATE,
+       .min_tx_len = sizeof(struct rpmi_dpwr_get_state_req),
+       .max_tx_len = sizeof(struct rpmi_dpwr_get_state_req),
+       .min_rx_len = sizeof(struct rpmi_dpwr_get_state_resp),
+       .max_rx_len = sizeof(struct rpmi_dpwr_get_state_resp),
+},
+};
+
+static const struct mpxy_rpmi_mbox_data dpwr_data = {
+       .servicegrp_id = RPMI_SRVGRP_DEVICE_POWER,
+       .num_services = RPMI_DPWR_SRV_MAX_COUNT,
+       .service_data = dpwr_services,
+};
+
+static const struct fdt_match dpwr_match[] = {
+       { .compatible = "riscv,rpmi-mpxy-device-power", .data = &dpwr_data },
+       { },
+};
+
+const struct fdt_driver fdt_mpxy_rpmi_device_power = {
+       .match_table = dpwr_match,
+       .init = mpxy_rpmi_mbox_init,
+};
lib/utils/mpxy/objects.mk +3 -0
index a71c56af..45b3281b 100644
@@ -20,3 +20,6 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o
 
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += fdt_mpxy_rpmi_voltage
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += mpxy/fdt_mpxy_rpmi_voltage.o
+
+carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_DEVICE_POWER) += fdt_mpxy_rpmi_device_power
+libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_DEVICE_POWER) += mpxy/fdt_mpxy_rpmi_device_power.o
platform/generic/configs/defconfig +1 -1
index 10992619..5e819b3b 100644
@@ -60,4 +60,5 @@ CONFIG_FDT_MPXY=y
 CONFIG_FDT_MPXY_RPMI_MBOX=y
 CONFIG_FDT_MPXY_RPMI_CLOCK=y
 CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
+CONFIG_FDT_MPXY_RPMI_DEVICE_POWER=y
 CONFIG_FDT_MPXY_RPMI_SYSMSI=y
--

2.43.0

--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#7 lore raw

PATCH 3/3 lib: utils: Add MPXY RPMI mailbox driver for performance

In reply to Joshua Yeong

Add MPXY RPMI mailbox driver for performance.

---
 include/sbi_utils/mailbox/rpmi_msgprot.h   | 118 +++++++++++++++++++++
 lib/utils/mpxy/Kconfig                     |   4 +
 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c |  90 ++++++++++++++++
 lib/utils/mpxy/objects.mk                  |   3 +
 platform/generic/configs/defconfig         |   1 +
 5 files changed, 216 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
include/sbi_utils/mailbox/rpmi_msgprot.h +118 -0
index 4e915a08..f8b16753 100644
@@ -219,6 +219,7 @@ enum rpmi_servicegroup_id {
 	RPMI_SRVGRP_VOLTAGE = 0x00007,
 	RPMI_SRVGRP_CLOCK = 0x0008,
 	RPMI_SRVGRP_DEVICE_POWER = 0x0009,
+	RPMI_SRVGRP_PERFORMANCE = 0x0000A,
 	RPMI_SRVGRP_ID_MAX_COUNT,
 
 	/* Reserved range for service groups */
@@ -829,4 +830,121 @@ struct rpmi_dpwr_get_state_resp {
 	u32 state;
 };
 
+/** RPMI Performance ServiceGroup Service IDs */
+enum rpmi_performance_service_id {
+	RPMI_PERF_SRV_ENABLE_NOTIFICATION = 0x01,
+	RPMI_PERF_SRV_GET_NUM_DOMAINS = 0x02,
+	RPMI_PERF_SRV_GET_ATTRIBUTES = 0x03,
+	RPMI_PERF_SRV_GET_SUPPORTED_LEVELS = 0x04,
+	RPMI_PERF_SRV_GET_LEVEL = 0x05,
+	RPMI_PERF_SRV_SET_LEVEL = 0x06,
+	RPMI_PERF_SRV_GET_LIMIT = 0x07,
+	RPMI_PERF_SRV_SET_LIMIT = 0x08,
+	RPMI_PERF_SRV_GET_FAST_CHANNEL_REGION = 0x09,
+	RPMI_PERF_SRV_GET_FAST_CHANNEL_ATTRIBUTES = 0x0A,
+	RPMI_PERF_SRV_MAX_COUNT,
+};
+
+struct rpmi_perf_get_num_domain_resp {
+	s32 status;
+	u32 num_domains;
+};
+
+struct rpmi_perf_get_attrs_req {
+	u32 domain_id;
+};
+
+struct rpmi_perf_get_attrs_resp {
+	s32 status;
+	u32 flags;
+	u32 num_level;
+	u32 latency;
+	u8 name[16];
+};
+
+struct rpmi_perf_get_supported_level_req {
+	u32 domain_id;
+	u32 perf_level_index;
+};
+
+struct rpmi_perf_domain_level {
+	u32 level_index;
+	u32 opp_level;
+	u32 power_cost_uw;
+	u32 transition_latency_us;
+};
+
+struct rpmi_perf_get_supported_level_resp {
+	s32 status;
+	u32 reserve;
+	u32 remaining;
+	u32 returned;
+	struct rpmi_perf_domain_level level[0];
+};
+
+struct rpmi_perf_get_level_req {
+	u32 domain_id;
+};
+
+struct rpmi_perf_get_level_resp {
+	s32 status;
+	u32 level_index;
+};
+
+struct rpmi_perf_set_level_req {
+	u32 domain_id;
+	u32 level_index;
+};
+
+struct rpmi_perf_set_level_resp {
+	s32 status;
+};
+
+struct rpmi_perf_get_limit_req {
+	u32 domain_id;
+};
+
+struct rpmi_perf_get_limit_resp {
+	s32 status;
+	u32 level_index_max;
+	u32 level_index_min;
+};
+
+struct rpmi_perf_set_limit_req {
+	u32 domain_id;
+	u32 level_index_max;
+	u32 level_index_min;
+};
+
+struct rpmi_perf_set_limit_resp {
+	s32 status;
+};
+
+struct rpmi_perf_get_fast_chn_region_resp {
+	s32 status;
+	u32 region_phy_addr_low;
+	u32 region_phy_addr_high;
+	u32 region_size_low;
+	u32 region_size_high;
+};
+
+struct rpmi_perf_get_fast_chn_attr_req {
+	u32 domain_id;
+	u32 service_id;
+};
+
+struct rpmi_perf_get_fast_chn_attr_resp {
+	s32 status;
+	u32 flags;
+	u32 region_offset_low;
+	u32 region_offset_high;
+	u32 region_size;
+	u32 db_addr_low;
+	u32 db_addr_high;
+	u32 db_id_low;
+	u32 db_id_high;
+	u32 db_perserved_low;
+	u32 db_perserved_high;
+};
+
 #endif /* !__RPMI_MSGPROT_H__ */
lib/utils/mpxy/Kconfig +4 -0
index 25288671..507b8371 100644
@@ -30,6 +30,10 @@ config FDT_MPXY_RPMI_DEVICE_POWER
 	bool "MPXY driver for RPMI device power service group"
 	default n
 
+config FDT_MPXY_RPMI_PERFORMANCE
+	bool "MPXY driver for RPMI performance service group"
+	default n
+
 endif
 
 endmenu
lib/utils/mpxy/fdt_mpxy_rpmi_performance.c new file +90 -0

90 lines not on this page · raw message

lib/utils/mpxy/objects.mk +3 -0
index 45b3281b..bbc998af 100644
@@ -15,6 +15,9 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_MBOX) += mpxy/fdt_mpxy_rpmi_mbox.o
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += fdt_mpxy_rpmi_clock
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += mpxy/fdt_mpxy_rpmi_clock.o
 
+carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_PERFORMANCE) += fdt_mpxy_rpmi_performance
+libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_PERFORMANCE) += mpxy/fdt_mpxy_rpmi_performance.o
+
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += fdt_mpxy_rpmi_sysmsi
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o
 
platform/generic/configs/defconfig +1 -0
index 5e819b3b..387ce833 100644
@@ -61,4 +61,5 @@ CONFIG_FDT_MPXY_RPMI_MBOX=y
 CONFIG_FDT_MPXY_RPMI_CLOCK=y
 CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
 CONFIG_FDT_MPXY_RPMI_DEVICE_POWER=y
+CONFIG_FDT_MPXY_RPMI_PERFORMANCE=y
 CONFIG_FDT_MPXY_RPMI_SYSMSI=y
Signature · 7 lines
2.43.0


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] lib: utils: Add MPXY RPMI mailbox driver for performance

Quoted 4 lines · Joshua Yeong

Add MPXY RPMI mailbox driver for performance.

Quoted 9 lines
---
 include/sbi_utils/mailbox/rpmi_msgprot.h   | 118 +++++++++++++++++++++
 lib/utils/mpxy/Kconfig                     |   4 +
 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c |  90 ++++++++++++++++
 lib/utils/mpxy/objects.mk                  |   3 +
 platform/generic/configs/defconfig         |   1 +
 5 files changed, 216 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c

LGTM

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
Applied
#9 lore raw

Re: [PATCH 3/3] lib: utils: Add MPXY RPMI mailbox driver for performance

In reply to Joshua Yeong
Quoted 4 lines · Joshua Yeong

Add MPXY RPMI mailbox driver for performance.

I have marked the driver as experimental until the DT compatible string is accepted on LKML.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 286 lines
---
 include/sbi_utils/mailbox/rpmi_msgprot.h   | 118 +++++++++++++++++++++
 lib/utils/mpxy/Kconfig                     |   4 +
 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c |  90 ++++++++++++++++
 lib/utils/mpxy/objects.mk                  |   3 +
 platform/generic/configs/defconfig         |   1 +
 5 files changed, 216 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
include/sbi_utils/mailbox/rpmi_msgprot.h +118 -0
index 4e915a08..f8b16753 100644
@@ -219,6 +219,7 @@ enum rpmi_servicegroup_id {
        RPMI_SRVGRP_VOLTAGE = 0x00007,
        RPMI_SRVGRP_CLOCK = 0x0008,
        RPMI_SRVGRP_DEVICE_POWER = 0x0009,
+       RPMI_SRVGRP_PERFORMANCE = 0x0000A,
        RPMI_SRVGRP_ID_MAX_COUNT,
 
        /* Reserved range for service groups */
@@ -829,4 +830,121 @@ struct rpmi_dpwr_get_state_resp {
        u32 state;
 };
 
+/** RPMI Performance ServiceGroup Service IDs */
+enum rpmi_performance_service_id {
+       RPMI_PERF_SRV_ENABLE_NOTIFICATION = 0x01,
+       RPMI_PERF_SRV_GET_NUM_DOMAINS = 0x02,
+       RPMI_PERF_SRV_GET_ATTRIBUTES = 0x03,
+       RPMI_PERF_SRV_GET_SUPPORTED_LEVELS = 0x04,
+       RPMI_PERF_SRV_GET_LEVEL = 0x05,
+       RPMI_PERF_SRV_SET_LEVEL = 0x06,
+       RPMI_PERF_SRV_GET_LIMIT = 0x07,
+       RPMI_PERF_SRV_SET_LIMIT = 0x08,
+       RPMI_PERF_SRV_GET_FAST_CHANNEL_REGION = 0x09,
+       RPMI_PERF_SRV_GET_FAST_CHANNEL_ATTRIBUTES = 0x0A,
+       RPMI_PERF_SRV_MAX_COUNT,
+};
+
+struct rpmi_perf_get_num_domain_resp {
+       s32 status;
+       u32 num_domains;
+};
+
+struct rpmi_perf_get_attrs_req {
+       u32 domain_id;
+};
+
+struct rpmi_perf_get_attrs_resp {
+       s32 status;
+       u32 flags;
+       u32 num_level;
+       u32 latency;
+       u8 name[16];
+};
+
+struct rpmi_perf_get_supported_level_req {
+       u32 domain_id;
+       u32 perf_level_index;
+};
+
+struct rpmi_perf_domain_level {
+       u32 level_index;
+       u32 opp_level;
+       u32 power_cost_uw;
+       u32 transition_latency_us;
+};
+
+struct rpmi_perf_get_supported_level_resp {
+       s32 status;
+       u32 reserve;
+       u32 remaining;
+       u32 returned;
+       struct rpmi_perf_domain_level level[0];
+};
+
+struct rpmi_perf_get_level_req {
+       u32 domain_id;
+};
+
+struct rpmi_perf_get_level_resp {
+       s32 status;
+       u32 level_index;
+};
+
+struct rpmi_perf_set_level_req {
+       u32 domain_id;
+       u32 level_index;
+};
+
+struct rpmi_perf_set_level_resp {
+       s32 status;
+};
+
+struct rpmi_perf_get_limit_req {
+       u32 domain_id;
+};
+
+struct rpmi_perf_get_limit_resp {
+       s32 status;
+       u32 level_index_max;
+       u32 level_index_min;
+};
+
+struct rpmi_perf_set_limit_req {
+       u32 domain_id;
+       u32 level_index_max;
+       u32 level_index_min;
+};
+
+struct rpmi_perf_set_limit_resp {
+       s32 status;
+};
+
+struct rpmi_perf_get_fast_chn_region_resp {
+       s32 status;
+       u32 region_phy_addr_low;
+       u32 region_phy_addr_high;
+       u32 region_size_low;
+       u32 region_size_high;
+};
+
+struct rpmi_perf_get_fast_chn_attr_req {
+       u32 domain_id;
+       u32 service_id;
+};
+
+struct rpmi_perf_get_fast_chn_attr_resp {
+       s32 status;
+       u32 flags;
+       u32 region_offset_low;
+       u32 region_offset_high;
+       u32 region_size;
+       u32 db_addr_low;
+       u32 db_addr_high;
+       u32 db_id_low;
+       u32 db_id_high;
+       u32 db_perserved_low;
+       u32 db_perserved_high;
+};
+
 #endif /* !__RPMI_MSGPROT_H__ */
lib/utils/mpxy/Kconfig +4 -0
index 25288671..507b8371 100644
@@ -30,6 +30,10 @@ config FDT_MPXY_RPMI_DEVICE_POWER
        bool "MPXY driver for RPMI device power service group"
        default n
 
+config FDT_MPXY_RPMI_PERFORMANCE
+       bool "MPXY driver for RPMI performance service group"
+       default n
+
 endif
 
 endmenu
lib/utils/mpxy/fdt_mpxy_rpmi_performance.c new file +90 -0
new file mode 100644
index 00000000..f4f18831
@@ -0,0 +1,90 @@
+#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
+
+static struct mpxy_rpmi_service_data performance_services[] = {
+{
+       .id = RPMI_PERF_SRV_ENABLE_NOTIFICATION,
+       .min_tx_len = sizeof(struct rpmi_enable_notification_req),
+       .max_tx_len = sizeof(struct rpmi_enable_notification_req),
+       .min_rx_len = sizeof(struct rpmi_enable_notification_resp),
+       .max_rx_len = sizeof(struct rpmi_enable_notification_resp),
+},
+{
+       .id = RPMI_PERF_SRV_GET_NUM_DOMAINS,
+       .min_tx_len = 0,
+       .max_tx_len = 0,
+       .min_rx_len = sizeof(struct rpmi_perf_get_num_domain_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_get_num_domain_resp),
+},
+{
+       .id = RPMI_PERF_SRV_GET_ATTRIBUTES,
+       .min_tx_len = sizeof(struct rpmi_perf_get_attrs_req),
+       .max_tx_len = sizeof(struct rpmi_perf_get_attrs_req),
+       .min_rx_len = sizeof(struct rpmi_perf_get_attrs_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_get_attrs_resp),
+},
+{
+       .id = RPMI_PERF_SRV_GET_SUPPORTED_LEVELS,
+       .min_tx_len = sizeof(struct rpmi_perf_get_supported_level_req),
+       .max_tx_len = sizeof(struct rpmi_perf_get_supported_level_req),
+       .min_rx_len = sizeof(struct rpmi_perf_get_supported_level_resp),
+       .max_rx_len = -1U,
+},
+{
+       .id = RPMI_PERF_SRV_GET_LEVEL,
+       .min_tx_len = sizeof(struct rpmi_perf_get_level_req),
+       .max_tx_len = sizeof(struct rpmi_perf_get_level_req),
+       .min_rx_len = sizeof(struct rpmi_perf_get_level_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_get_level_resp),
+},
+{
+       .id = RPMI_PERF_SRV_SET_LEVEL,
+       .min_tx_len = sizeof(struct rpmi_perf_set_level_req),
+       .max_tx_len = sizeof(struct rpmi_perf_set_level_req),
+       .min_rx_len = sizeof(struct rpmi_perf_set_level_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_set_level_resp),
+},
+{
+       .id = RPMI_PERF_SRV_GET_LIMIT,
+       .min_tx_len = sizeof(struct rpmi_perf_get_limit_req),
+       .max_tx_len = sizeof(struct rpmi_perf_get_limit_req),
+       .min_rx_len = sizeof(struct rpmi_perf_get_limit_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_get_limit_resp),
+},
+{
+       .id = RPMI_PERF_SRV_SET_LIMIT,
+       .min_tx_len = sizeof(struct rpmi_perf_set_limit_req),
+       .max_tx_len = sizeof(struct rpmi_perf_set_limit_req),
+       .min_rx_len = sizeof(struct rpmi_perf_set_limit_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_set_limit_resp),
+},
+{
+       .id = RPMI_PERF_SRV_GET_FAST_CHANNEL_REGION,
+       .min_tx_len = 0,
+       .max_tx_len = 0,
+       .min_rx_len = sizeof(struct rpmi_perf_get_fast_chn_region_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_get_fast_chn_region_resp),
+},
+{
+       .id = RPMI_PERF_SRV_GET_FAST_CHANNEL_ATTRIBUTES,
+       .min_tx_len = sizeof(struct rpmi_perf_get_fast_chn_attr_req),
+       .max_tx_len = sizeof(struct rpmi_perf_get_fast_chn_attr_req),
+       .min_rx_len = sizeof(struct rpmi_perf_get_fast_chn_attr_resp),
+       .max_rx_len = sizeof(struct rpmi_perf_get_fast_chn_attr_resp),
+},
+};
+
+static const struct mpxy_rpmi_mbox_data performance_data = {
+       .servicegrp_id = RPMI_SRVGRP_PERFORMANCE ,
+       .num_services = RPMI_PERF_SRV_MAX_COUNT,
+       .service_data = performance_services,
+};
+
+static const struct fdt_match performance_match[] = {
+       { .compatible = "riscv,rpmi-mpxy-performance", .data = &performance_data },
+       { },
+};
+
+const struct fdt_driver fdt_mpxy_rpmi_performance = {
+       .match_table = performance_match,
+       .init = mpxy_rpmi_mbox_init,
+};
lib/utils/mpxy/objects.mk +3 -0
index 45b3281b..bbc998af 100644
@@ -15,6 +15,9 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_MBOX) += mpxy/fdt_mpxy_rpmi_mbox.o
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += fdt_mpxy_rpmi_clock
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += mpxy/fdt_mpxy_rpmi_clock.o
 
+carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_PERFORMANCE) += fdt_mpxy_rpmi_performance
+libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_PERFORMANCE) += mpxy/fdt_mpxy_rpmi_performance.o
+
 carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += fdt_mpxy_rpmi_sysmsi
 libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o
 
platform/generic/configs/defconfig +1 -1
index 5e819b3b..387ce833 100644
@@ -61,4 +61,5 @@ CONFIG_FDT_MPXY_RPMI_MBOX=y
 CONFIG_FDT_MPXY_RPMI_CLOCK=y
 CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
 CONFIG_FDT_MPXY_RPMI_DEVICE_POWER=y
+CONFIG_FDT_MPXY_RPMI_PERFORMANCE=y
 CONFIG_FDT_MPXY_RPMI_SYSMSI=y
--

2.43.0

--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#10 lore raw
In reply to Joshua Yeong

Hi Joshua,

It will help if you can also share your branches
for the Linux and Librpmi side changes for anyone
to test. If you already have Qemu based stubs implemented for this to test then that would be great and please share that too.

Thanks
Rahul

Quoted 30 lines · Joshua Yeong

Add RPMI/MPXY driver for voltage, device power and performance group based on RPMI specification v1.0.

https://github.com/riscv-non-isa/riscv-rpmi/releases/download/v1.0/riscv-rpmi.pdf

Joshua Yeong (3):
lib: utils: Add MPXY RPMI mailbox driver for voltage
lib: utils: Add MPXY RPMI mailbox driver for device power
lib: utils: Add MPXY RPMI mailbox driver for performance

 include/sbi_utils/mailbox/rpmi_msgprot.h    | 244 ++++++++++++++++++++
 lib/utils/mpxy/Kconfig                      |  12 +
 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c |  55 +++++
 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c  |  90 ++++++++
 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c      |  76 ++++++
 lib/utils/mpxy/objects.mk                   |   9 +
 platform/generic/configs/defconfig          |   3 +
 7 files changed, 489 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c

--
2.43.0

--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
#11 lore raw
Quoted 7 lines · Rahul Pathak

Hi Joshua,

It will help if you can also share your branches for the Linux and Librpmi side changes for anyone to test. If you already have Qemu based stubs implemented for this to test then that would be great and please share that too.

Thanks
Rahul

Hi Rahul,

I rebased the qemu/opensbi/linux recently. You can verify it using following branch
https://github.com/yeongjoshua/qemu/tree/rpmi-dev-upstream
https://github.com/yeongjoshua/opensbi/tree/rpmi
https://github.com/yeongjoshua/linux/tree/v6.18-rc3-rpmi

Quoted 32 lines · Joshua Yeong
Quoted 31 lines

Add RPMI/MPXY driver for voltage, device power and performance group based on RPMI specification v1.0.

https://github.com/riscv-non-isa/riscv-rpmi/releases/download/v1.0/ris
cv-rpmi.pdf

Joshua Yeong (3):
lib: utils: Add MPXY RPMI mailbox driver for voltage
lib: utils: Add MPXY RPMI mailbox driver for device power
lib: utils: Add MPXY RPMI mailbox driver for performance

 include/sbi_utils/mailbox/rpmi_msgprot.h    | 244 ++++++++++++++++++++
 lib/utils/mpxy/Kconfig                      |  12 +
 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c |  55 +++++  
lib/utils/mpxy/fdt_mpxy_rpmi_performance.c  |  90 ++++++++
 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c      |  76 ++++++
 lib/utils/mpxy/objects.mk                   |   9 +
 platform/generic/configs/defconfig          |   3 +
 7 files changed, 489 insertions(+)
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
 create mode 100644 lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c

--
2.43.0

--
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 3 lines
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi