firmware: xilinx: Add debugfs support for PM_GET_NODE_STATUS
PATCH 1/1 firmware: xilinx: Add debugfs support for PM_GET_NODE_STATUS
Add new debug interface to support PM_GET_NODE_STATUS to get the node information like requirements and usage.
The debugfs firmware driver interface is only meant for testing and debugging EEMI APIs. Hence, it is by-default disabled in production systems.
--- drivers/firmware/xilinx/zynqmp-debug.c | 13 ++++++++ drivers/firmware/xilinx/zynqmp.c | 41 +++++++++++++++++++++++++- include/linux/firmware/xlnx-zynqmp.h | 12 +++++++- 3 files changed, 64 insertions(+), 2 deletions(-)
drivers/firmware/xilinx/zynqmp-debug.c +13 -0
@@ -3,6 +3,7 @@* Xilinx Zynq MPSoC Firmware layer for debugfs APIs * * Copyright (C) 2014-2018 Xilinx, Inc. +* Copyright (C) 2022 - 2025 Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> * Davorin Mista <[email protected]>
@@ -38,6 +39,7 @@ static struct pm_api_info pm_api_list[] = {PM_API (PM_RELEASE_NODE ),PM_API (PM_SET_REQUIREMENT ),PM_API (PM_GET_API_VERSION ), +PM_API (PM_GET_NODE_STATUS ),PM_API (PM_REGISTER_NOTIFIER ),PM_API (PM_RESET_ASSERT ), PM_API(PM_RESET_GET_STATUS),
@@ -167,6 +169,17 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret) pm_api_arg[3 ] ? pm_api_arg[3 ] : ZYNQMP_PM_REQUEST_ACK_BLOCKING);break ; +case PM_GET_NODE_STATUS : + ret =zynqmp_pm_get_node_status (pm_api_arg[0 ], + &pm_api_ret[0 ], + &pm_api_ret[1 ], + &pm_api_ret[2 ]); +if (!ret) +sprintf (debugfs_buf, +"GET_NODE_STATUS:\n\tNodeId: %llu\n\tStatus: %u\n\tRequirements: %u\n\tUsage: %u\n" , + pm_api_arg[0 ], pm_api_ret[0 ], + pm_api_ret[1 ], pm_api_ret[2 ]); +break ;case PM_REGISTER_NOTIFIER : ret = zynqmp_pm_register_notifier(pm_api_arg[0], pm_api_arg[1] ?
drivers/firmware/xilinx/zynqmp.c +40 -1
53 lines not on this page · raw message
include/linux/firmware/xlnx-zynqmp.h +11 -1
@@ -3,7 +3,7 @@* Xilinx Zynq MPSoC Firmware layer * * Copyright (C) 2014-2021 Xilinx -* Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc. +* Copyright (C) 2022 - 2025 Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> * Davorin Mista <[email protected]>
@@ -164,6 +164,7 @@ enum pm_api_cb_id {enum pm_api_id {PM_API_FEATURES =0 ,PM_GET_API_VERSION =1 , +PM_GET_NODE_STATUS =3 ,PM_REGISTER_NOTIFIER =5 ,PM_FORCE_POWERDOWN =8 ,PM_REQUEST_WAKEUP =10 ,
@@ -630,6 +631,8 @@ int zynqmp_pm_request_wake(const u32 node,int zynqmp_pm_get_rpu_mode (u32 node_id,enum rpu_oper_mode *rpu_mode);int zynqmp_pm_set_rpu_mode (u32 node_id,enum rpu_oper_mode rpu_mode);int zynqmp_pm_set_tcm_config (u32 node_id,enum rpu_tcm_comb tcm_mode); +int zynqmp_pm_get_node_status (const u32 node,u32 *const status, +u32 *const requirements,u32 *const usage);int zynqmp_pm_set_sd_config (u32 node,enum pm_sd_config_type config,u32 value);int zynqmp_pm_set_gem_config (u32 node,enum pm_gem_config_type config,u32 value);
@@ -937,6 +940,13 @@ static inline int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_moreturn -ENODEV ; } +static inline int zynqmp_pm_get_node_status (const u32 node,u32 *const status, +u32 *const requirements, +u32 *const usage) +{ +return -ENODEV ; +} +static inline int zynqmp_pm_set_sd_config (u32 node,enum pm_sd_config_type config,u32 value)
Signature · 1 line
2.25.1
Quoted 145 lines · Madhav Bhatt
Add new debug interface to support
PM_GET_NODE_STATUSto get the node information like requirements and usage.The debugfs firmware driver interface is only meant for testing and debugging EEMI APIs. Hence, it is by-default disabled in production systems.
Signed-off-by Madhav Bhatt <[email protected]>--- drivers/firmware/xilinx/zynqmp-debug.c | 13 ++++++++ drivers/firmware/xilinx/zynqmp.c | 41 +++++++++++++++++++++++++- include/linux/firmware/xlnx-zynqmp.h | 12 +++++++- 3 files changed, 64 insertions(+), 2 deletions(-)drivers/firmware/xilinx/zynqmp-debug.c +13
-0@@ -3,6 +3,7 @@* Xilinx Zynq MPSoC Firmware layer for debugfs APIs * * Copyright (C) 2014-2018 Xilinx, Inc. +* Copyright (C) 2022 - 2025 Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> * Davorin Mista <[email protected]> @@ -38,6 +39,7 @@ static struct pm_api_info pm_api_list[] = {PM_API (PM_RELEASE_NODE ),PM_API (PM_SET_REQUIREMENT ),PM_API (PM_GET_API_VERSION ), +PM_API (PM_GET_NODE_STATUS ),PM_API (PM_REGISTER_NOTIFIER ),PM_API (PM_RESET_ASSERT ), PM_API(PM_RESET_GET_STATUS),@@ -167,6 +169,17 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret) pm_api_arg[3 ] ? pm_api_arg[3 ] : ZYNQMP_PM_REQUEST_ACK_BLOCKING);break ; +case PM_GET_NODE_STATUS : + ret =zynqmp_pm_get_node_status (pm_api_arg[0 ], + &pm_api_ret[0 ], + &pm_api_ret[1 ], + &pm_api_ret[2 ]); +if (!ret) +sprintf (debugfs_buf, +"GET_NODE_STATUS:\n\tNodeId: %llu\n\tStatus: %u\n\tRequirements: %u\n\tUsage: %u\n" , + pm_api_arg[0 ], pm_api_ret[0 ], + pm_api_ret[1 ], pm_api_ret[2 ]); +break ;case PM_REGISTER_NOTIFIER : ret = zynqmp_pm_register_notifier(pm_api_arg[0], pm_api_arg[1] ?drivers/firmware/xilinx/zynqmp.c +40
-1@@ -3,7 +3,7 @@* Xilinx Zynq MPSoC Firmware layer * * Copyright (C) 2014-2022 Xilinx, Inc. -* Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc. +* Copyright (C) 2022 - 2025 Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> * Davorin Mista <[email protected]> @@ -1413,6 +1413,45 @@ int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode) }EXPORT_SYMBOL_GPL (zynqmp_pm_set_tcm_config); +/** +* zynqmp_pm_get_node_status - PM call to request a node's current power state +* @node: ID of the component or sub-system in question +* @status: Current operating state of the requested node +* @requirements: Current requirements asserted on the node, +* used for slave nodes only. +* @usage: Usage information, used for slave nodes only: +* PM_USAGE_NO_MASTER - No master is currently using +* the node +* PM_USAGE_CURRENT_MASTER - Only requesting master is +* currently using the node +* PM_USAGE_OTHER_MASTER - Only other masters are +* currently using the node +* PM_USAGE_BOTH_MASTERS - Both the current and at least +* one other master is currently +* using the node +* +* Return: Returns status, either success or error+reason +*/ +int zynqmp_pm_get_node_status (const u32 node,u32 *const status, +u32 *const requirements,u32 *const usage) +{ +u32 ret_payload[PAYLOAD_ARG_CNT ]; +int ret; + +if (!status || !requirements || !usage) +return -EINVAL ; + + ret =zynqmp_pm_invoke_fn (PM_GET_NODE_STATUS , ret_payload,1 , node); +if (ret_payload[0 ] ==XST_PM_SUCCESS ) { + *status = ret_payload[1 ]; + *requirements = ret_payload[2 ]; + *usage = ret_payload[3 ]; + } + +return ret; +} +EXPORT_SYMBOL_GPL (zynqmp_pm_get_node_status); +/** * zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to * be powered down forcefully include/linux/firmware/xlnx-zynqmp.h +4
-1@@ -3,7 +3,7 @@* Xilinx Zynq MPSoC Firmware layer * * Copyright (C) 2014-2021 Xilinx -* Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc. +* Copyright (C) 2022 - 2025 Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> * Davorin Mista <[email protected]> @@ -164,6 +164,7 @@ enum pm_api_cb_id {enum pm_api_id {PM_API_FEATURES =0 ,PM_GET_API_VERSION =1 , +PM_GET_NODE_STATUS =3 ,PM_REGISTER_NOTIFIER =5 ,PM_FORCE_POWERDOWN =8 ,PM_REQUEST_WAKEUP =10 ,@@ -630,6 +631,8 @@ int zynqmp_pm_request_wake(const u32 node,int zynqmp_pm_get_rpu_mode (u32 node_id,enum rpu_oper_mode *rpu_mode);int zynqmp_pm_set_rpu_mode (u32 node_id,enum rpu_oper_mode rpu_mode);int zynqmp_pm_set_tcm_config (u32 node_id,enum rpu_tcm_comb tcm_mode); +int zynqmp_pm_get_node_status (const u32 node,u32 *const status, +u32 *const requirements,u32 *const usage);int zynqmp_pm_set_sd_config (u32 node,enum pm_sd_config_type config,u32 value);int zynqmp_pm_set_gem_config (u32 node,enum pm_gem_config_type config,u32 value);@@ -937,6 +940,13 @@ static inline int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_moreturn -ENODEV ; }
include/linux/firmware/xlnx-zynqmp.h static inline int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mo · line 952
Quoted 10 lines
include/linux/firmware/xlnx-zynqmp.h +7
-0+static inline int zynqmp_pm_get_node_status (const u32 node,u32 *const status, +u32 *const requirements, +u32 *const usage) +{ +return -ENODEV ; +} +static inline int zynqmp_pm_set_sd_config (u32 node,enum pm_sd_config_type config,u32 value)
Applied.
M