lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4fe4f01a-09f0-40a1-b020-97ac6d835256@amd.com>
Date: Tue, 10 Jun 2025 09:59:12 +0200
From: Michal Simek <michal.simek@....com>
To: Madhav Bhatt <madhav.bhatt@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] firmware: xilinx: Add debugfs support for
 PM_GET_NODE_STATUS



On 4/17/25 11:45, Madhav Bhatt wrote:
> 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.
> 
> Signed-off-by: Madhav Bhatt <madhav.bhatt@....com>
> ---
>   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(-)
> 
> diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
> index 22853ae0efdf..36efb827f3da 100644
> --- a/drivers/firmware/xilinx/zynqmp-debug.c
> +++ b/drivers/firmware/xilinx/zynqmp-debug.c
> @@ -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 <michal.simek@....com>
>    *  Davorin Mista <davorin.mista@...ios.com>
> @@ -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] ?
> diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
> index 7356e860e65c..dea6c53511ab 100644
> --- a/drivers/firmware/xilinx/zynqmp.c
> +++ b/drivers/firmware/xilinx/zynqmp.c
> @@ -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 <michal.simek@....com>
>    *  Davorin Mista <davorin.mista@...ios.com>
> @@ -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
> diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
> index 6d4dbc196b93..54fa85f2cf73 100644
> --- a/include/linux/firmware/xlnx-zynqmp.h
> +++ b/include/linux/firmware/xlnx-zynqmp.h
> @@ -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 <michal.simek@....com>
>    *  Davorin Mista <davorin.mista@...ios.com>
> @@ -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_mo
>   	return -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)

Applied.
M

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ