From: Michal Simek <michal.simek@amd.com>
To: <linux-kernel@vger.kernel.org>, <monstr@monstr.eu>,
<michal.simek@amd.com>, <git@amd.com>
Cc: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>,
"moderated list:ARM/ZYNQ ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH 3/6] firmware: xilinx: Add comments about number of arguments
Date: Thu, 19 Nov 2026 14:17:27 +0100 [thread overview]
Message-ID: <1c92abfbca19daa7da0310bfc85f9175db60429b.1795094242.git.michal.simek@amd.com> (raw)
In-Reply-To: <cover.1795094242.git.michal.simek@amd.com>
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@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
Signed-off-by: Michal Simek <michal.simek@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
next prev parent reply other threads:[~2026-11-19 13:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 13:17 [PATCH 0/6] firmware: xilinx: cleanups and debugfs fixes Michal Simek
2026-11-19 13:17 ` [PATCH 1/6] firmware: xilinx: Use late_initcall for pm_init_finalize Michal Simek
2026-11-19 13:17 ` [PATCH 2/6] firmware: xilinx: Call va_start after pm feature check Michal Simek
2026-11-19 13:17 ` Michal Simek [this message]
2026-11-19 13:17 ` [PATCH 4/6] firmware: xilinx: Call pm sysfs out of dev_groups Michal Simek
2026-11-19 13:17 ` [PATCH 5/6] firmware: xilinx: Change debugfs pm_api_ret size to PAYLOAD_ARG_CNT Michal Simek
2026-11-19 13:17 ` [PATCH 6/6] firmware: xilinx: Bound debugfs clock name formatting Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c92abfbca19daa7da0310bfc85f9175db60429b.1795094242.git.michal.simek@amd.com \
--to=michal.simek@amd.com \
--cc=git@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=monstr@monstr.eu \
--cc=senthilnathan.thangaraj@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®