[PATCH 3/6] firmware: xilinx: Add comments about number of arguments

Michal Simek michal.simek at amd.com
Thu Nov 19 05:17:27 PST 2026


The driver is checking number of arguments where it is not exactly clear
what that values are reflecting that's why introduce SMC_ARG_CNT_BASIC_32
macro and add comment to the code.

Co-developed-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj at amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj at amd.com>
Signed-off-by: Michal Simek <michal.simek at amd.com>
---

 drivers/firmware/xilinx/zynqmp.c     | 18 ++++++++++++++++--
 include/linux/firmware/xlnx-zynqmp.h |  3 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index a0ec904b1819..597393d5ea69 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -388,6 +388,13 @@ int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	u32 args[SMC_ARG_CNT_32] = {0};
 	u32 module_id;
 
+	/*
+	 * According to the SMCCC: The total number of registers available for
+	 * arguments is 16.
+	 *
+	 * In the Extended SMC format, 3 registers are used for headers, leaving
+	 * up to 13 registers for arguments.
+	 */
 	if (num_args > SMC_ARG_CNT_32)
 		return -EINVAL;
 
@@ -449,9 +456,16 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	u64 smc_arg[8];
 	int ret, i;
 	va_list arg_list;
-	u32 args[14] = {0};
+	u32 args[SMC_ARG_CNT_BASIC_32] = {0};
 
-	if (num_args > 14)
+	/*
+	 * According to the SMCCC: The total number of registers available for
+	 * arguments is 16.
+	 *
+	 * In the Basic SMC format, 2 registers are used for headers, leaving
+	 * up to 14 registers for arguments.
+	 */
+	if (num_args > SMC_ARG_CNT_BASIC_32)
 		return -EINVAL;
 
 	/* Check if feature is supported or not */
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 41a1cd810bda..b489fbd21bd2 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -82,6 +82,9 @@
 /* Number of 32bits arguments for SMC call */
 #define SMC_ARG_CNT_32	13U
 
+/* Number of 32bits arguments for Basic SMC call */
+#define SMC_ARG_CNT_BASIC_32	14U
+
 /* Number of arguments for a callback */
 #define CB_ARG_CNT     4
 
-- 
2.43.0




More information about the linux-arm-kernel mailing list