Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support)
@ 2026-11-18 23:31 Gregory Williams
  2026-11-18 23:31 ` [PATCH 01/15] firmware: xilinx: Separate TF-A checking Gregory Williams
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:31 UTC (permalink / raw)
  Cc: Stephen Boyd, Brian Masney, Jerome Brunet, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek, Oded Gabbay,
	kishore Manne, Izhar Ameer Shaikh, Greg Kroah-Hartman,
	Jay Buddhabhatti, Ronak Jain, linux-clk, devicetree, linux-kernel,
	linux-arm-kernel, dri-devel

This series adds a driver for the AMD AI Engine (AIE) found on Versal
devices, together with the firmware changes the driver depends on. AI Engine
is a tile array based accelerator used for applications such as beamforming and
machine learning inference. Tiles are organised in columns, and groups of
columns form partitions that an application requests, initialises and releases.

Several registers in the AI Engine array (column and shim resets, memory
zeroisation, tile clock gating, NoC and interrupt routing) are privileged
and can only be written by the trusted firmware. The driver therefore
packs operations into a DMA buffer and hands it to the platform firmware,
which executes them in order.

Firmware patches included
-------------------------
Patches 1-10 are not part of the AI Engine driver itself, but the driver
cannot work without them, so they are included here to keep the series
self-contained and reviewable in one place:

  - 1-5:  zynqmp firmware driver refactoring and a va_start()/va_end()
          fix (patch 2 carries Fixes: tags), preparing for the extended
          SMCCC call format.
  - 6-7:  Versal Gen 2 compatible string and firmware support, where all
          EEMI APIs use the extended SMCCC payload.
  - 8-9:  Versal Gen 2 clock binding and clk driver match entry.
  - 10:   firmware IOCTL support for the Versal Gen 2 AIE run time
          operations, used by the driver.

I am happy to split out or reorder the firmware and clock patches if the
maintainers prefer to take them through their own trees, and would
appreciate guidance on how the series should be merged.

AI Engine driver
----------------
  - 11:   devicetree binding for the AI Engine.
  - 12:   driver core: device probe, partition request and release.
  - 13:   pm ops: building and sending firmware operation packets.
  - 14:   enabling and disabling tile clocks.
  - 15:   partition initialize and teardown (reset operations).

Previous submission
-------------------
This driver was posted for review a little over a year ago:

  https://lore.kernel.org/dri-devel/20250702155630.1737227-1-gregory.williams@amd.com/

Since then the scope of what is proposed for upstream has changed, this series
is considerably different from that posting, in particular targeting only Versal
Gen 2 support. All comments received on the earlier posting have been addressed
or in this version.

Abhyuday Godhasara (1):
  drivers: firmware: xilinx: Add IOCTL support for the AIE run time
    operations

Gregory Williams (5):
  dt-bindings: soc: xilinx: Add Versal AI Engine DT binding
  accel/amd-ai-engine: Add AMD AI Engine device driver
  accel/amd-ai-engine: Add pm ops for firmware calls
  accel/amd-ai-engine: Add support to enable/disable tile clocks
  accel/amd-ai-engine: Add reset operations

Naman Trivedi (1):
  dt-bindings: clock: versal: add Versal Gen 2 compatible string

Senthil Nathan Thangaraj (8):
  firmware: xilinx: Separate TF-A checking
  firmware: xilinx: Call va_start after pm feature check
  firmware: xilinx: Add comments about number of arguments
  firmware: xilinx: Use match data for ZynqMP/Versal
  firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn()
  dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string
  firmware: xilinx: Add support for Versal Gen 2
  clk: zynqmp: Add Versal Gen 2 compatible string

 .../bindings/clock/xlnx,versal-clk.yaml       |   5 +-
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |   3 +
 .../bindings/soc/xilinx/xlnx,ai-engine.yaml   |  61 +++
 MAINTAINERS                                   |   9 +
 drivers/accel/Kconfig                         |   1 +
 drivers/accel/Makefile                        |   3 +-
 drivers/accel/amd-ai-engine/Kconfig           |  15 +
 drivers/accel/amd-ai-engine/Makefile          |  14 +
 .../accel/amd-ai-engine/ai-engine-aiemlv2.c   | 441 ++++++++++++++++
 drivers/accel/amd-ai-engine/ai-engine-clock.c | 154 ++++++
 drivers/accel/amd-ai-engine/ai-engine-dev.c   | 255 ++++++++++
 .../accel/amd-ai-engine/ai-engine-internal.h  | 377 ++++++++++++++
 drivers/accel/amd-ai-engine/ai-engine-part.c  | 140 ++++++
 drivers/accel/amd-ai-engine/ai-engine-pm.c    | 472 ++++++++++++++++++
 drivers/accel/amd-ai-engine/ai-engine-res.c   | 184 +++++++
 drivers/accel/amd-ai-engine/ai-engine-reset.c |  69 +++
 drivers/clk/zynqmp/clkc.c                     |   1 +
 drivers/firmware/xilinx/zynqmp.c              | 340 +++++++++++--
 include/linux/amd-ai-engine.h                 | 115 +++++
 include/linux/firmware/xlnx-zynqmp.h          |  65 ++-
 20 files changed, 2679 insertions(+), 45 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
 create mode 100644 drivers/accel/amd-ai-engine/Kconfig
 create mode 100644 drivers/accel/amd-ai-engine/Makefile
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-aiemlv2.c
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-clock.c
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-dev.c
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-internal.h
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-part.c
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-pm.c
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-res.c
 create mode 100644 drivers/accel/amd-ai-engine/ai-engine-reset.c
 create mode 100644 include/linux/amd-ai-engine.h

-- 
2.34.1



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/15] firmware: xilinx: Separate TF-A checking
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
@ 2026-11-18 23:31 ` Gregory Williams
  2026-11-18 23:31 ` [PATCH 02/15] firmware: xilinx: Call va_start after pm feature check Gregory Williams
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:31 UTC (permalink / raw)
  To: Michal Simek; +Cc: Senthil Nathan Thangaraj, linux-arm-kernel, linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

Feature check of TF-A APIs has special requirement to fill in specific
module/id and API ID based on the platform requirement.

This separation of TF-A feature checking facilitates a smoother transition
to extended SMCCC format.

Co-developed-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c | 105 +++++++++++++++++++++++++------
 1 file changed, 85 insertions(+), 20 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 727a9888a933..940306079a78 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -214,12 +214,65 @@ static noinline int do_fw_call_hvc(u32 *ret_payload, u32 num_args, ...)
 	return zynqmp_pm_ret_code((enum pm_ret_status)res.a0);
 }
 
-static int __do_feature_check_call(const u32 api_id, u32 *ret_payload)
+/**
+ * prep_pm_hdr_feature_check - Prepare SMC header for PM_FEATURE_CHECK.
+ *
+ * TF-A expects the module field of arg[0] to be PM_MODULE_ID for its feature
+ * check, independent of the queried API's module; hence no module_id arg.
+ *
+ * Return: SMC arg[0] header value.
+ */
+static u64 prep_pm_hdr_feature_check(void)
+{
+	return PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, PM_MODULE_ID) | PM_FEATURE_CHECK;
+}
+
+/**
+ * do_feature_check_for_tfa_apis - Perform feature check for TF-A APIs.
+ * @api_id: API ID to be checked.
+ * @ret_payload: Pointer to store the firmware's response payload.
+ *
+ * Prepares the command header and payload for TF-A APIs and makes the FW call.
+ *
+ * Return:
+ * - Feature status word from ret_payload[1] on success
+ * - -EOPNOTSUPP if the firmware call fails
+ */
+static int do_feature_check_for_tfa_apis(const u32 api_id, u32 *ret_payload)
 {
+	u64 smc_arg[2];
 	int ret;
+
+	smc_arg[0] = prep_pm_hdr_feature_check();
+	smc_arg[1] = api_id;
+
+	ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]);
+
+	if (ret)
+		return -EOPNOTSUPP;
+
+	return ret_payload[1];
+}
+
+/**
+ * do_feature_check_basic - Perform feature check for an API ID with
+ *			    basic SMC format.
+ * @api_id: API ID to be checked.
+ * @ret_payload: Pointer to store the firmware's response payload.
+ *
+ * Determines the appropriate API (PM_FEATURE_CHECK or PM_API_FEATURES) based on
+ * the module ID in the given API ID. Frames the SMC call arguments in the basic
+ * format, executes the firmware call, and processes the result.
+ *
+ * Return: Feature status word from ret_payload[1] on success; -EOPNOTSUPP if
+ * the firmware call fails.
+ */
+static int do_feature_check_basic(const u32 api_id, u32 *ret_payload)
+{
+	u32 feature_check_api_id;
 	u64 smc_arg[2];
 	u32 module_id;
-	u32 feature_check_api_id;
+	int ret;
 
 	module_id = FIELD_GET(MODULE_ID_MASK, api_id);
 
@@ -232,29 +285,41 @@ static int __do_feature_check_call(const u32 api_id, u32 *ret_payload)
 	else
 		feature_check_api_id = PM_API_FEATURES;
 
-	if (module_id == TF_A_MODULE_ID)
-		smc_arg[1] = api_id;
-	else
-		smc_arg[1] = (api_id & API_ID_MASK);
-
 	smc_arg[0] = PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, module_id) | feature_check_api_id;
+	smc_arg[1] = (api_id & API_ID_MASK);
 
 	ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]);
+	if (ret)
+		ret = -EOPNOTSUPP;
+	else
+		ret = ret_payload[1];
 
-	/*
-	 * For TF-A APIs, if the feature check with PM_API_FEATURES fails,
-	 * retry with the legacy PM_FEATURE_CHECK for backward compatibility.
-	 */
-	if (module_id == TF_A_MODULE_ID && ret) {
-		smc_arg[0] = PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, PM_MODULE_ID) |
-			     PM_FEATURE_CHECK;
-		ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]);
-	}
+	return ret;
+}
 
-	if (ret)
-		return ret;
+/**
+ * dispatch_feature_check - Dispatch feature check based on module ID.
+ * @api_id: API ID to be checked.
+ * @ret_payload: Pointer to store the firmware's response payload.
+ *
+ * Determines the appropriate feature check function to call based on the
+ * module ID extracted from the API ID. If the module ID corresponds to
+ * TF-A, it calls do_feature_check_for_tfa_apis(); otherwise, it calls
+ * do_feature_check_basic() which uses basic SMCCC format.
+ *
+ * Return: Feature status word from ret_payload[1] on success; negative error
+ * code on failure.
+ */
+static int dispatch_feature_check(const u32 api_id, u32 *ret_payload)
+{
+	u32 module_id;
 
-	return ret_payload[1];
+	module_id = FIELD_GET(MODULE_ID_MASK, api_id);
+
+	if (module_id == TF_A_MODULE_ID)
+		return do_feature_check_for_tfa_apis(api_id, ret_payload);
+
+	return do_feature_check_basic(api_id, ret_payload);
 }
 
 static int do_feature_check_call(const u32 api_id)
@@ -276,7 +341,7 @@ static int do_feature_check_call(const u32 api_id)
 		return -ENOMEM;
 
 	feature_data->pm_api_id = api_id;
-	ret = __do_feature_check_call(api_id, ret_payload);
+	ret = dispatch_feature_check(api_id, ret_payload);
 
 	feature_data->feature_status = ret;
 	hash_add(pm_api_features_map, &feature_data->hentry, api_id);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/15] firmware: xilinx: Call va_start after pm feature check
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
  2026-11-18 23:31 ` [PATCH 01/15] firmware: xilinx: Separate TF-A checking Gregory Williams
@ 2026-11-18 23:31 ` Gregory Williams
  2026-11-18 23:31 ` [PATCH 03/15] firmware: xilinx: Add comments about number of arguments Gregory Williams
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:31 UTC (permalink / raw)
  To: Michal Simek, Izhar Ameer Shaikh, Greg Kroah-Hartman,
	Jay Buddhabhatti, Ronak Jain
  Cc: Senthil Nathan Thangaraj, linux-arm-kernel, linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

zynqmp_pm_invoke_fw_fn() and zynqmp_pm_invoke_fn() call va_start() before
checking whether the PM API is supported. If the feature check fails, the
function returns early without a matching va_end().

Per the C standard, every va_start() must be paired with va_end() on every
exit path; calling va_start() and returning without va_end() is undefined
behavior.

Move va_start() to after the feature check so it is only invoked when the
va_list will actually be consumed.

Fixes: f922b16aa5fa ("firmware: xilinx: Update firmware call interface to support additional args")
Fixes: 92fb71333d57 ("firmware: xilinx: add support for new SMC call format")
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 940306079a78..e264a1914f06 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -457,13 +457,13 @@ int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	if (num_args > SMC_ARG_CNT_32)
 		return -EINVAL;
 
-	va_start(arg_list, num_args);
-
 	/* Check if feature is supported or not */
 	ret = zynqmp_pm_feature(pm_api_id);
 	if (ret < 0)
 		return ret;
 
+	va_start(arg_list, num_args);
+
 	for (i = 0; i < num_args; i++)
 		args[i] = va_arg(arg_list, u32);
 
@@ -520,13 +520,13 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	if (num_args > 14)
 		return -EINVAL;
 
-	va_start(arg_list, num_args);
-
 	/* Check if feature is supported or not */
 	ret = zynqmp_pm_feature(pm_api_id);
 	if (ret < 0)
 		return ret;
 
+	va_start(arg_list, num_args);
+
 	for (i = 0; i < num_args; i++)
 		args[i] = va_arg(arg_list, u32);
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/15] firmware: xilinx: Add comments about number of arguments
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
  2026-11-18 23:31 ` [PATCH 01/15] firmware: xilinx: Separate TF-A checking Gregory Williams
  2026-11-18 23:31 ` [PATCH 02/15] firmware: xilinx: Call va_start after pm feature check Gregory Williams
@ 2026-11-18 23:31 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 04/15] firmware: xilinx: Use match data for ZynqMP/Versal Gregory Williams
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:31 UTC (permalink / raw)
  To: Michal Simek; +Cc: Senthil Nathan Thangaraj, linux-arm-kernel, linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

The driver checks the number of arguments, but it is not clear what those
values reflect. Introduce the SMC_ARG_CNT_BASIC_32 macro and add comments
to clarify.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c     | 14 +++++++++++---
 include/linux/firmware/xlnx-zynqmp.h | 10 ++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index e264a1914f06..fb8ea7b9fdb1 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -454,6 +454,10 @@ 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;
 
+	/*
+	 * Of the 16 32-bit argument registers, the extended SMC header uses 3,
+	 * leaving at most SMC_ARG_CNT_32 (13) for arguments.
+	 */
 	if (num_args > SMC_ARG_CNT_32)
 		return -EINVAL;
 
@@ -512,12 +516,16 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	 * Added SIP service call Function Identifier
 	 * Make sure to stay in x0 register
 	 */
-	u64 smc_arg[8];
+	u64 smc_arg[SMC_ARG_CNT_64];
 	int ret, i;
 	va_list arg_list;
-	u32 args[14] = {0};
+	u32 args[SMC_ARG_CNT_BASIC_32] = {0};
 
-	if (num_args > 14)
+	/*
+	 * Of the 16 32-bit argument registers, the basic SMC header uses 2,
+	 * leaving at most SMC_ARG_CNT_BASIC_32 (14) 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..681ab99ceffc 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -79,8 +79,14 @@
 /* Number of 64bits arguments for SMC call */
 #define SMC_ARG_CNT_64	8U
 
-/* Number of 32bits arguments for SMC call */
-#define SMC_ARG_CNT_32	13U
+/*
+ * The SMC call provides 16 32-bit argument registers. The header consumes
+ * some of them, so the number left for arguments depends on the SMC format:
+ *  - Extended SMC: 3 used by the header, SMC_ARG_CNT_32 (13) for arguments.
+ *  - Basic SMC:    2 used by the header, SMC_ARG_CNT_BASIC_32 (14) for arguments.
+ */
+#define SMC_ARG_CNT_32		13U	/* Extended SMC 32-bit arg count */
+#define SMC_ARG_CNT_BASIC_32	14U	/* Basic SMC 32-bit arg count */
 
 /* Number of arguments for a callback */
 #define CB_ARG_CNT     4
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/15] firmware: xilinx: Use match data for ZynqMP/Versal
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (2 preceding siblings ...)
  2026-11-18 23:31 ` [PATCH 03/15] firmware: xilinx: Add comments about number of arguments Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 05/15] firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn() Gregory Williams
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Michal Simek; +Cc: Senthil Nathan Thangaraj, linux-arm-kernel, linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

Refactor the platform management (PM) firmware API invocation by
extending the existing `platform_fw_data` match data interface with
helpers for feature check and firmware call.

This allows platform-specific handling of feature checks and firmware
calls, and prepares the firmware driver to easily extend support for
the extended SMCCC firmware format.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c | 92 ++++++++++++++++++++++++++++----
 1 file changed, 82 insertions(+), 10 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index fb8ea7b9fdb1..f5ad99e0026c 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -74,6 +74,21 @@ struct pm_api_feature_data {
 };
 
 struct platform_fw_data {
+	/*
+	 * Invokes the platform-specific feature check PM FW API call.
+	 * Uses either the basic or extended SMCCC frame format based on the
+	 * platform.
+	 */
+	int (*do_feature_check)(const u32 api_id, u32 *ret_payload);
+
+	/*
+	 * Invokes all other platform-specific PM FW APIs.
+	 * Uses either the basic or extended SMCCC frame format based
+	 * on the platform.
+	 */
+	int (*zynqmp_pm_fw_call)(u32 pm_api_id, u32 *ret_payload,
+				 u32 num_args, va_list *arg_list);
+
 	/*
 	 * Family code for platform.
 	 */
@@ -319,7 +334,11 @@ static int dispatch_feature_check(const u32 api_id, u32 *ret_payload)
 	if (module_id == TF_A_MODULE_ID)
 		return do_feature_check_for_tfa_apis(api_id, ret_payload);
 
-	return do_feature_check_basic(api_id, ret_payload);
+	if (active_platform_fw_data)
+		return active_platform_fw_data->do_feature_check(api_id, ret_payload);
+
+	pr_err("%s: no platform firmware data; missing match data\n", __func__);
+	return -ENODEV;
 }
 
 static int do_feature_check_call(const u32 api_id)
@@ -489,11 +508,14 @@ int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 }
 
 /**
- * zynqmp_pm_invoke_fn() - Invoke the system-level platform management layer
- *			   caller function depending on the configuration
+ * __zynqmp_pm_fw_call_basic() - Invoke the system-level platform management layer
+ *				 supporting basic SMC format.
+ *
  * @pm_api_id:		Requested PM-API call
  * @ret_payload:	Returned value array
  * @num_args:		Number of arguments to requested PM-API call
+ * @arg_list:		va_list initialized with va_start, containing arguments passed
+ *			to the firmware.
  *
  * Invoke platform management function for SMC or HVC call, depending on
  * configuration.
@@ -510,7 +532,8 @@ int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
  *
  * Return: Returns status, either success or error+reason
  */
-int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
+static int __zynqmp_pm_fw_call_basic(u32 pm_api_id, u32 *ret_payload,
+				     u32 num_args, va_list *arg_list)
 {
 	/*
 	 * Added SIP service call Function Identifier
@@ -518,7 +541,6 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	 */
 	u64 smc_arg[SMC_ARG_CNT_64];
 	int ret, i;
-	va_list arg_list;
 	u32 args[SMC_ARG_CNT_BASIC_32] = {0};
 
 	/*
@@ -533,12 +555,8 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 	if (ret < 0)
 		return ret;
 
-	va_start(arg_list, num_args);
-
 	for (i = 0; i < num_args; i++)
-		args[i] = va_arg(arg_list, u32);
-
-	va_end(arg_list);
+		args[i] = va_arg(*arg_list, u32);
 
 	smc_arg[0] = PM_SIP_SVC | pm_api_id;
 	for (i = 0; i < 7; i++)
@@ -548,6 +566,54 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 			  smc_arg[4], smc_arg[5], smc_arg[6], smc_arg[7]);
 }
 
+/**
+ * zynqmp_pm_invoke_fn() - Invokes the platform-specific PM FW API.
+ * @pm_api_id:		Requested PM-API call
+ * @ret_payload:	Returned value array
+ * @num_args:		Number of arguments to requested PM-API call
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
+{
+	int ret = -ENODEV;
+	va_list arg_list;
+	u32 module_id;
+
+	/*
+	 * Of the 16 32-bit argument registers, the header consumes some,
+	 * leaving SMC_ARG_CNT_32 (13) for the extended format and
+	 * SMC_ARG_CNT_BASIC_32 (14) for the basic format.
+	 *
+	 * Impose the larger of the two limits (14) here so callers are not
+	 * rejected prematurely; the basic and extended handlers each further
+	 * validate the exact count required by their format.
+	 */
+	if (num_args > SMC_ARG_CNT_BASIC_32)
+		return -EINVAL;
+
+	va_start(arg_list, num_args);
+
+	module_id = FIELD_GET(MODULE_ID_MASK, pm_api_id);
+
+	/*
+	 * Invoke the platform-specific PM FW API based on the platform type.
+	 *
+	 * The only exception is the TF-A module, which supports the basic
+	 * SMC format only.
+	 */
+	if (module_id == TF_A_MODULE_ID)
+		ret = __zynqmp_pm_fw_call_basic(pm_api_id, ret_payload, num_args, &arg_list);
+	else if (active_platform_fw_data)
+		ret = active_platform_fw_data->zynqmp_pm_fw_call(pm_api_id, ret_payload,
+								 num_args, &arg_list);
+	else
+		pr_err("%s: no platform firmware data; missing match data\n", __func__);
+
+	va_end(arg_list);
+	return ret;
+}
+
 static u32 pm_api_version;
 static u32 pm_tz_version;
 
@@ -2457,14 +2523,20 @@ static void zynqmp_firmware_sync_state(struct device *dev)
 }
 
 static const struct platform_fw_data platform_fw_data_versal = {
+	.do_feature_check = do_feature_check_basic,
+	.zynqmp_pm_fw_call = __zynqmp_pm_fw_call_basic,
 	.family_code = PM_VERSAL_FAMILY_CODE,
 };
 
 static const struct platform_fw_data platform_fw_data_versal_net = {
+	.do_feature_check = do_feature_check_basic,
+	.zynqmp_pm_fw_call = __zynqmp_pm_fw_call_basic,
 	.family_code = PM_VERSAL_NET_FAMILY_CODE,
 };
 
 static const struct platform_fw_data platform_fw_data_zynqmp = {
+	.do_feature_check = do_feature_check_basic,
+	.zynqmp_pm_fw_call = __zynqmp_pm_fw_call_basic,
 	.family_code = PM_ZYNQMP_FAMILY_CODE,
 };
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/15] firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn()
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (3 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 04/15] firmware: xilinx: Use match data for ZynqMP/Versal Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Michal Simek; +Cc: Senthil Nathan Thangaraj, linux-arm-kernel, linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

The function name zynqmp_pm_invoke_fw_fn() doesn't really reflect what this
function does, so rename it to zynqmp_pm_fw_call_extended(), which reflects
which firmware format is used.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c     | 10 +++++-----
 include/linux/firmware/xlnx-zynqmp.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index f5ad99e0026c..709370933741 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -440,7 +440,7 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
 EXPORT_SYMBOL_GPL(zynqmp_pm_is_function_supported);
 
 /**
- * zynqmp_pm_invoke_fw_fn() - Invoke the system-level platform management layer
+ * zynqmp_pm_fw_call_extended() - Invoke the system-level platform management layer
  *			caller function depending on the configuration
  * @pm_api_id:		Requested PM-API call
  * @ret_payload:	Returned value array
@@ -461,7 +461,7 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_is_function_supported);
  *
  * Return: Returns status, either success or error+reason
  */
-int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
+int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
 {
 	/*
 	 * Added SIP service call Function Identifier
@@ -796,9 +796,9 @@ int zynqmp_pm_query_data(struct zynqmp_pm_query_data qdata, u32 *out)
 	u32 ret_payload[PAYLOAD_ARG_CNT] = {0};
 
 	if (sip_svc_version >= SIP_SVC_PASSTHROUGH_VERSION) {
-		ret = zynqmp_pm_invoke_fw_fn(PM_QUERY_DATA, ret_payload, 4,
-					     qdata.qid, qdata.arg1,
-					     qdata.arg2, qdata.arg3);
+		ret = zynqmp_pm_fw_call_extended(PM_QUERY_DATA, ret_payload, 4,
+						 qdata.qid, qdata.arg1,
+						 qdata.arg2, qdata.arg3);
 		/* To support backward compatibility */
 		if (!ret && !ret_payload[0]) {
 			/*
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 681ab99ceffc..58f2e3fddfaf 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -578,7 +578,7 @@ struct zynqmp_pm_query_data {
 };
 
 int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...);
-int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...);
+int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...);
 
 #if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
 int zynqmp_pm_get_api_version(u32 *version);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (4 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 05/15] firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn() Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-19 10:53   ` Krzysztof Kozlowski
  2026-11-18 23:32 ` [PATCH 07/15] firmware: xilinx: Add support for Versal Gen 2 Gregory Williams
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	kishore Manne
  Cc: Senthil Nathan Thangaraj, devicetree, linux-arm-kernel,
	linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

Add compatible string for Versal Gen 2 firmware driver.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 .../bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml         | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
index 72af37cdb103..60d1bd329d0e 100644
--- a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
@@ -32,6 +32,9 @@ properties:
               - xlnx,versal-net-firmware
           - const: xlnx,versal-firmware
 
+      - description: For implementations complying for Versal Gen 2.
+        const: xlnx,versal2-firmware
+
   method:
     description: |
                  The method of calling the PM-API firmware layer.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/15] firmware: xilinx: Add support for Versal Gen 2
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (5 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 09/15] clk: zynqmp: Add Versal Gen 2 compatible string Gregory Williams
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Michal Simek; +Cc: Senthil Nathan Thangaraj, linux-arm-kernel, linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

Until Versal, the extended SMCCC payload was supported only for QUERY_DATA,
while other APIs used the basic SMCCC format.

In Versal Gen 2, all EEMI APIs are supported with extended SMCCC payload
only, enabling a simplified and efficient pass-through implementation.

The TF-A feature check now tries PM_API_FEATURES first and falls back to
PM_FEATURE_CHECK so the same code path works on Versal Gen 2 (where TF-A
only exposes PM_API_FEATURES on the SiP service) and on the older
ZynqMP/Versal/Versal NET platforms (where TF-A exposes PM_FEATURE_CHECK).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c     | 117 ++++++++++++++++++++++++---
 include/linux/firmware/xlnx-zynqmp.h |   1 +
 2 files changed, 109 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 709370933741..a8c70e775ae3 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -242,12 +242,24 @@ static u64 prep_pm_hdr_feature_check(void)
 	return PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, PM_MODULE_ID) | PM_FEATURE_CHECK;
 }
 
+/**
+ * prep_pm_hdr_api_features - Prepare SMC header for PM_API_FEATURES.
+ * @module_id: Module ID of the API to be checked.
+ *
+ * Return: SMC arg[0] header value.
+ */
+static u64 prep_pm_hdr_api_features(u32 module_id)
+{
+	return PM_SIP_SVC | FIELD_PREP(MODULE_ID_MASK, module_id) | PM_API_FEATURES;
+}
+
 /**
  * do_feature_check_for_tfa_apis - Perform feature check for TF-A APIs.
  * @api_id: API ID to be checked.
  * @ret_payload: Pointer to store the firmware's response payload.
  *
  * Prepares the command header and payload for TF-A APIs and makes the FW call.
+ * Tries PM_API_FEATURES first, then falls back to PM_FEATURE_CHECK.
  *
  * Return:
  * - Feature status word from ret_payload[1] on success
@@ -256,13 +268,68 @@ static u64 prep_pm_hdr_feature_check(void)
 static int do_feature_check_for_tfa_apis(const u32 api_id, u32 *ret_payload)
 {
 	u64 smc_arg[2];
+	u32 module_id;
 	int ret;
 
-	smc_arg[0] = prep_pm_hdr_feature_check();
+	module_id = FIELD_GET(MODULE_ID_MASK, api_id);
+
+	smc_arg[0] = prep_pm_hdr_api_features(module_id);
 	smc_arg[1] = api_id;
 
 	ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]);
 
+	if (ret) {
+		smc_arg[0] = prep_pm_hdr_feature_check();
+		ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]);
+		if (ret)
+			return -EOPNOTSUPP;
+	}
+
+	return ret_payload[1];
+}
+
+/**
+ * do_feature_check_extended - Perform feature check for an API ID
+ *				 using extended SMCCC format.
+ * @api_id: API ID to be checked.
+ * @ret_payload: Pointer to store the firmware's response payload.
+ *
+ * Determines the appropriate API (PM_FEATURE_CHECK or PM_API_FEATURES) based on
+ * the module ID in the given API ID. Frames the arguments in the extended
+ * SMCCC format, executes the firmware call, and processes the result.
+ *
+ * Return:
+ * - 0 on success
+ * - -EOPNOTSUPP if the firmware call fails.
+ */
+static int do_feature_check_extended(const u32 api_id, u32 *ret_payload)
+{
+	u32 feature_check_api_id;
+	u64 smc_arg[2];
+	u32 module_id;
+	int ret;
+
+	module_id = FIELD_GET(MODULE_ID_MASK, api_id);
+
+	/*
+	 * Feature check of APIs belonging to PM and XSEM are handled by calling
+	 * PM_FEATURE_CHECK API. For other modules, call PM_API_FEATURES API.
+	 */
+	if (module_id == PM_MODULE_ID || module_id == XSEM_MODULE_ID)
+		feature_check_api_id = PM_FEATURE_CHECK;
+	else
+		feature_check_api_id = PM_API_FEATURES;
+
+	if (module_id == PM_MODULE_ID)
+		module_id = XPM_MODULE_ID;
+
+	/* Frame extended SMC format */
+	smc_arg[0] = PM_SIP_SVC | PASS_THROUGH_FW_CMD_ID;
+	smc_arg[1] = ((u64)(api_id & API_ID_MASK) << 32) |
+		      FIELD_PREP(MODULE_ID_MASK, module_id) |
+		      feature_check_api_id;
+
+	ret = do_fw_call(ret_payload, 2, smc_arg[0], smc_arg[1]);
 	if (ret)
 		return -EOPNOTSUPP;
 
@@ -440,11 +507,13 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
 EXPORT_SYMBOL_GPL(zynqmp_pm_is_function_supported);
 
 /**
- * zynqmp_pm_fw_call_extended() - Invoke the system-level platform management layer
+ * __zynqmp_pm_fw_call_extended() - Invoke the system-level platform management layer
  *			caller function depending on the configuration
  * @pm_api_id:		Requested PM-API call
  * @ret_payload:	Returned value array
  * @num_args:		Number of arguments to requested PM-API call
+ * @arg_list:		va_list initialized with va_start, containing arguments passed
+ *			to the firmware.
  *
  * Invoke platform management function for SMC or HVC call, depending on
  * configuration.
@@ -461,7 +530,8 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_is_function_supported);
  *
  * Return: Returns status, either success or error+reason
  */
-int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
+static int __zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload,
+					u32 num_args, va_list *arg_list)
 {
 	/*
 	 * Added SIP service call Function Identifier
@@ -469,7 +539,6 @@ int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ..
 	 */
 	u64 smc_arg[SMC_ARG_CNT_64];
 	int ret, i;
-	va_list arg_list;
 	u32 args[SMC_ARG_CNT_32] = {0};
 	u32 module_id;
 
@@ -485,12 +554,8 @@ int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ..
 	if (ret < 0)
 		return ret;
 
-	va_start(arg_list, num_args);
-
 	for (i = 0; i < num_args; i++)
-		args[i] = va_arg(arg_list, u32);
-
-	va_end(arg_list);
+		args[i] = va_arg(*arg_list, u32);
 
 	module_id = FIELD_GET(PLM_MODULE_ID_MASK, pm_api_id);
 
@@ -507,6 +572,33 @@ int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ..
 			  smc_arg[4], smc_arg[5], smc_arg[6], smc_arg[7]);
 }
 
+/**
+ * zynqmp_pm_fw_call_extended - Invoke a PM function with variable arguments
+ * @pm_api_id: ID of the PM API to be called
+ * @ret_payload: Pointer to the buffer for storing the return payload
+ * @num_args: Number of arguments to pass to the PM API function
+ *
+ * This function serves as a wrapper around __zynqmp_pm_fw_call_extended(),
+ * facilitating the invocation of platform management (PM) functions that
+ * require an extended SMC (Secure Monitor Call) format with variable
+ * arguments. Specifically, the PM_QUERY_DATA API necessitates this extended
+ * payload format, making it essential to retain zynqmp_pm_fw_call_extended
+ * with variable arguments.
+ *
+ * Return: 0 on success; a negative error code on failure.
+ */
+int zynqmp_pm_fw_call_extended(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
+{
+	va_list arg_list;
+	int ret;
+
+	va_start(arg_list, num_args);
+	ret = __zynqmp_pm_fw_call_extended(pm_api_id, ret_payload,
+					   num_args, &arg_list);
+	va_end(arg_list);
+	return ret;
+}
+
 /**
  * __zynqmp_pm_fw_call_basic() - Invoke the system-level platform management layer
  *				 supporting basic SMC format.
@@ -2522,6 +2614,12 @@ static void zynqmp_firmware_sync_state(struct device *dev)
 		dev_warn(dev, "failed to release power management to firmware\n");
 }
 
+static const struct platform_fw_data platform_fw_data_versal2 = {
+	.do_feature_check = do_feature_check_extended,
+	.zynqmp_pm_fw_call = __zynqmp_pm_fw_call_extended,
+	.family_code = PM_VERSAL2_FAMILY_CODE,
+};
+
 static const struct platform_fw_data platform_fw_data_versal = {
 	.do_feature_check = do_feature_check_basic,
 	.zynqmp_pm_fw_call = __zynqmp_pm_fw_call_basic,
@@ -2544,6 +2642,7 @@ static const struct of_device_id zynqmp_firmware_of_match[] = {
 	{.compatible = "xlnx,zynqmp-firmware", .data = &platform_fw_data_zynqmp},
 	{.compatible = "xlnx,versal-firmware", .data = &platform_fw_data_versal},
 	{.compatible = "xlnx,versal-net-firmware", .data = &platform_fw_data_versal_net},
+	{.compatible = "xlnx,versal2-firmware",	.data = &platform_fw_data_versal2},
 	{},
 };
 MODULE_DEVICE_TABLE(of, zynqmp_firmware_of_match);
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 58f2e3fddfaf..effa1a2445b3 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -58,6 +58,7 @@
 #define PM_ZYNQMP_FAMILY_CODE 0x1 /* ZynqMP family code */
 #define PM_VERSAL_FAMILY_CODE 0x2 /* Versal family code */
 #define PM_VERSAL_NET_FAMILY_CODE 0x3 /* Versal NET family code */
+#define PM_VERSAL2_FAMILY_CODE 0x4 /* Versal Gen 2 family code */
 
 #define API_ID_MASK		GENMASK(7, 0)
 #define MODULE_ID_MASK		GENMASK(11, 8)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/15] clk: zynqmp: Add Versal Gen 2 compatible string
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (6 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 07/15] firmware: xilinx: Add support for Versal Gen 2 Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 10/15] drivers: firmware: xilinx: Add IOCTL support for the AIE run time operations Gregory Williams
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Jerome Brunet, Michal Simek
  Cc: Senthil Nathan Thangaraj, linux-clk, linux-arm-kernel,
	linux-kernel

From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

The Versal Gen 2 PLM exposes its clocks through the same EEMI clock
API that ZynqMP and Versal use, so the existing zynqmp clock driver
already implements everything needed once it accepts the platform's
device-tree node.

Add the "xlnx,versal2-clk" compatible to the zynqmp_clock_of_match
table so the driver binds against Versal Gen 2 device trees in
addition to ZynqMP and Versal. No code changes are required beyond
the match-table entry; clock enumeration, gating and rate control
all reuse the existing implementation.

Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/clk/zynqmp/clkc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index d62f1901d0ab..ba8823e385e3 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -789,6 +789,7 @@ static int zynqmp_clock_probe(struct platform_device *pdev)
 static const struct of_device_id zynqmp_clock_of_match[] = {
 	{.compatible = "xlnx,zynqmp-clk"},
 	{.compatible = "xlnx,versal-clk"},
+	{.compatible = "xlnx,versal2-clk"},
 	{},
 };
 MODULE_DEVICE_TABLE(of, zynqmp_clock_of_match);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/15] drivers: firmware: xilinx: Add IOCTL support for the AIE run time operations
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (7 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 09/15] clk: zynqmp: Add Versal Gen 2 compatible string Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
  2026-11-19  8:19 ` [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Jerome Brunet
  10 siblings, 0 replies; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Michal Simek
  Cc: Abhyuday Godhasara, Naman Trivedi, Senthil Nathan Thangaraj,
	linux-arm-kernel, linux-kernel

From: Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>

Add IOCTL support for the Versal 2 AIE run time operations listed as below
- Column Reset
- Shim Reset
- Enabling of column clock buffer
- Zeroisation of Program and data memories
- Disabling of column clock buffer
- Enabling AXI-MM error event
- Set L2 controller NPI INTR

Signed-off-by: Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>
Co-developed-by: Gregory Williams <gregory.williams@amd.com>
Signed-off-by: Gregory Williams <gregory.williams@amd.com>
Signed-off-by: Naman Trivedi <naman.trivedimanojbhai@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c     | 16 +++++++++
 include/linux/firmware/xlnx-zynqmp.h | 52 ++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index a8c70e775ae3..995db401519c 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -1268,6 +1268,22 @@ int zynqmp_pm_set_boot_health_status(u32 value)
 	return zynqmp_pm_invoke_fn(PM_IOCTL, NULL, 3, 0, IOCTL_SET_BOOT_HEALTH_STATUS, value);
 }
 
+/**
+ * versal2_pm_aie2ps_operation - AIE2PS run time operations
+ * @node:	AI engine node id
+ * @size:	Size of the DMA addr
+ * @addr_high:	higher 32 bits of DMA addr
+ * @addr_low:	lower 32 bits of DMA addr
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int versal2_pm_aie2ps_operation(u32 node, u32 size, u32 addr_high, u32 addr_low)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, NULL, 5, node, IOCTL_AIE2PS_OPS,
+				   size, addr_high, addr_low);
+}
+EXPORT_SYMBOL_GPL(versal2_pm_aie2ps_operation);
+
 /**
  * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release)
  * @reset:		Reset to be configured
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index effa1a2445b3..042dcb164fc3 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -141,6 +141,16 @@
 #define SD_ITAPDLY	0xFF180314
 #define SD_OTAPDLYSEL	0xFF180318
 
+/**
+ * XPM_VERSAL_EVENT_ERROR_MASK_AIE_CR: Error event mask for ME Correctable Error.
+ */
+#define XPM_VERSAL_EVENT_ERROR_MASK_AIE_CR	BIT(16)
+
+/**
+ * XPM_VERSAL_EVENT_ERROR_MASK_AIE_NCR: Error event mask for ME Non-Correctable Error.
+ */
+#define XPM_VERSAL_EVENT_ERROR_MASK_AIE_NCR	BIT(17)
+
 /**
  * XPM_EVENT_ERROR_MASK_DDRMC_CR: Error event mask for DDRMC MC Correctable ECC Error.
  */
@@ -166,6 +176,37 @@ enum pm_module_id {
 	TF_A_MODULE_ID = 0xa,
 };
 
+/* AIE Operation */
+enum pm_aie_operations {
+	XILINX_AIE_OPS_MIN = 0U,
+	XILINX_AIE_OPS_COL_RST = 1U,
+	XILINX_AIE_OPS_SHIM_RST = 2U,
+	XILINX_AIE_OPS_UC_ZEROIZATION = 3U,
+	XILINX_AIE_OPS_ENB_COL_CLK_BUFF = 4U,
+	XILINX_AIE_OPS_HANDSHAKE = 5U,
+	XILINX_AIE_OPS_CLR_HW_ERR_STS = 6U,
+	XILINX_AIE_OPS_START_NUM_COL = 7U,
+	XILINX_AIE_OPS_ZEROISATION = 8U,
+	XILINX_AIE_OPS_AXIMM_ISOLATION = 9U,
+	XILINX_AIE_OPS_NMU_CONFIG = 10U,
+	XILINX_AIE_OPS_DIS_MEM_PRIV = 11U,
+	XILINX_AIE_OPS_DIS_MEM_INTERLEAVE = 12U,
+	XILINX_AIE_OPS_ENB_UC_DMA_PAUSE = 13U,
+	XILINX_AIE_OPS_ENB_NOC_DMA_PAUSE = 14U,
+	XILINX_AIE_OPS_SET_ECC_SCRUB_PERIOD = 15U,
+	XILINX_AIE_OPS_DIS_COL_CLK_BUFF = 16U,
+	XILINX_AIE_OPS_HW_ERR_INT = 17U,
+	XILINX_AIE_OPS_HW_ERR_MASK = 18U,
+	XILINX_AIE_OPS_ENB_MEM_PRIV = 19U,
+	XILINX_AIE_OPS_CTRL_PKT_TLAST_ERR = 20U,
+	XILINX_AIE_OPS_ENB_AXI_MM_ERR_EVENT = 32U,     /* Backward compatibility for AIE1/AIE2 */
+	XILINX_AIE_OPS_SET_L2_CTRL_NPI_INTR = 64U,     /* Backward compatibility for AIE1/AIE2 */
+	XILINX_AIE_OPS_PROG_MEM_ZEROIZATION = 128U,    /* Backward compatibility for AIE1/AIE2 */
+	XILINX_AIE_OPS_DATA_MEM_ZEROIZATION = 256U,    /* Backward compatibility for AIE1/AIE2 */
+	XILINX_AIE_OPS_MEM_TILE_ZEROIZATION = 512U,    /* Backward compatibility for AIE1/AIE2 */
+	XILINX_AIE_OPS_MAX = 1023U,                    /* Backward compatibility for AIE1/AIE2 */
+};
+
 enum pm_api_cb_id {
 	PM_INIT_SUSPEND_CB = 30,
 	PM_ACKNOWLEDGE_CB = 31,
@@ -257,8 +298,12 @@ enum pm_ioctl_id {
 	/* Dynamic SD/GEM configuration */
 	IOCTL_SET_SD_CONFIG = 30,
 	IOCTL_SET_GEM_CONFIG = 31,
+	/* AIE/AIEML Operations */
+	IOCTL_AIE_OPS = 33,
 	/* IOCTL to get default/current QoS */
 	IOCTL_GET_QOS = 34,
+	/* AIE2PS Operations */
+	IOCTL_AIE2PS_OPS = 39,
 };
 
 enum pm_query_id {
@@ -659,6 +704,7 @@ int zynqmp_pm_stop_rpu(const u32 node);
 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);
+int versal2_pm_aie2ps_operation(u32 node, u32 size, u32 addr_high, u32 addr_low);
 #else
 static inline int zynqmp_pm_get_api_version(u32 *version)
 {
@@ -996,6 +1042,12 @@ static inline int zynqmp_pm_set_gem_config(u32 node,
 	return -ENODEV;
 }
 
+static inline int versal2_pm_aie2ps_operation(u32 node, u32 size, u32 addr_high,
+					      u32 addr_low)
+{
+	return -ENODEV;
+}
+
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (8 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 10/15] drivers: firmware: xilinx: Add IOCTL support for the AIE run time operations Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-19 10:59   ` Krzysztof Kozlowski
  2026-11-19  8:19 ` [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Jerome Brunet
  10 siblings, 1 reply; 14+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Michal Simek
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel

Add documentation to describe Versal AI Engine device tree bindings. AI
Engine is a tile array based processor with many cores and local memory
cache. Data routing between the cores is done through internal switches,
interface tiles are used to connect to external sources such as memory
or PL. Configuration registers of the device are accessed through a
memory mapped AXI address space.

Signed-off-by: Gregory Williams <gregory.williams@amd.com>
---
 .../bindings/soc/xilinx/xlnx,ai-engine.yaml   | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml

diff --git a/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml b/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
new file mode 100644
index 000000000000..6c97b5f0fb03
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright(C) 2026 Advanced Micro Devices, Inc. All rights reserved.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/xilinx/xlnx,ai-engine.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AMD AI Engine for Versal SoCs
+
+maintainers:
+  - Gregory Williams <gregory.williams@amd.com>
+
+description:
+  The AMD AI Engine is a tile processor with many cores (up to 400) that
+  can run in parallel with some devices containing local cache (memory tiles).
+  The data routing between cores is configured through internal switches, and
+  shim tiles interface with external interconnect, such as memory or PL.
+
+properties:
+  compatible:
+    enum:
+      - xlnx,versal2-aieml
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: aclk0
+
+  xlnx,firmware-device-id:
+    description:
+      Device identifier as defined by Versal firmware interface. This value is
+      passed unchanged to firmware calls.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - xlnx,firmware-device-id
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ai_engine: ai-engine@20000000000 {
+        compatible = "xlnx,versal2-aieml";
+        reg = <0x200 0x00 0x01 0x00>;
+        clocks = <&aclk0>;
+        clock-names = "aclk0";
+        xlnx,firmware-device-id = <0x18224072>;
+      };
+    };
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support)
  2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
                   ` (9 preceding siblings ...)
  2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
@ 2026-11-19  8:19 ` Jerome Brunet
  10 siblings, 0 replies; 14+ messages in thread
From: Jerome Brunet @ 2026-11-19  8:19 UTC (permalink / raw)
  To: Gregory Williams
  Cc: Stephen Boyd, Brian Masney, Jerome Brunet, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek, Oded Gabbay,
	kishore Manne, Izhar Ameer Shaikh, Greg Kroah-Hartman,
	Jay Buddhabhatti, Ronak Jain, linux-clk, devicetree, linux-kernel,
	linux-arm-kernel, dri-devel

On mer. 18 nov. 2026 at 15:31, Gregory Williams <gregory.williams@amd.com> wrote:

> This series adds a driver for the AMD AI Engine (AIE) found on Versal
> devices, together with the firmware changes the driver depends on. AI Engine
> is a tile array based accelerator used for applications such as beamforming and
> machine learning inference. Tiles are organised in columns, and groups of
> columns form partitions that an application requests, initialises and releases.
>
> Several registers in the AI Engine array (column and shim resets, memory
> zeroisation, tile clock gating, NoC and interrupt routing) are privileged
> and can only be written by the trusted firmware. The driver therefore
> packs operations into a DMA buffer and hands it to the platform firmware,
> which executes them in order.
>
> Firmware patches included
> -------------------------
> Patches 1-10 are not part of the AI Engine driver itself, but the driver
> cannot work without them, so they are included here to keep the series
> self-contained and reviewable in one place:
>
>   - 1-5:  zynqmp firmware driver refactoring and a va_start()/va_end()
>           fix (patch 2 carries Fixes: tags), preparing for the extended
>           SMCCC call format.
>   - 6-7:  Versal Gen 2 compatible string and firmware support, where all
>           EEMI APIs use the extended SMCCC payload.
>   - 8-9:  Versal Gen 2 clock binding and clk driver match entry.
>   - 10:   firmware IOCTL support for the Versal Gen 2 AIE run time
>           operations, used by the driver.
>
> I am happy to split out or reorder the firmware and clock patches if the
> maintainers prefer to take them through their own trees, and would
> appreciate guidance on how the series should be merged.

For the clock, it would defenitely be prefered if you could split out
clock part, especially if you later need an immutable branch.

`b4` makes it very easy to handle series deps, please consider using the
related tags

https://b4.docs.kernel.org/en/latest/contributor/prep.html#working-with-series-dependencies

>
> AI Engine driver
> ----------------
>   - 11:   devicetree binding for the AI Engine.
>   - 12:   driver core: device probe, partition request and release.
>   - 13:   pm ops: building and sending firmware operation packets.
>   - 14:   enabling and disabling tile clocks.
>   - 15:   partition initialize and teardown (reset operations).
>
> Previous submission
> -------------------
> This driver was posted for review a little over a year ago:
>
>   https://lore.kernel.org/dri-devel/20250702155630.1737227-1-gregory.williams@amd.com/
>
> Since then the scope of what is proposed for upstream has changed, this series
> is considerably different from that posting, in particular targeting only Versal
> Gen 2 support. All comments received on the earlier posting have been addressed
> or in this version.
>
> Abhyuday Godhasara (1):
>   drivers: firmware: xilinx: Add IOCTL support for the AIE run time
>     operations
>
> Gregory Williams (5):
>   dt-bindings: soc: xilinx: Add Versal AI Engine DT binding
>   accel/amd-ai-engine: Add AMD AI Engine device driver
>   accel/amd-ai-engine: Add pm ops for firmware calls
>   accel/amd-ai-engine: Add support to enable/disable tile clocks
>   accel/amd-ai-engine: Add reset operations
>
> Naman Trivedi (1):
>   dt-bindings: clock: versal: add Versal Gen 2 compatible string
>
> Senthil Nathan Thangaraj (8):
>   firmware: xilinx: Separate TF-A checking
>   firmware: xilinx: Call va_start after pm feature check
>   firmware: xilinx: Add comments about number of arguments
>   firmware: xilinx: Use match data for ZynqMP/Versal
>   firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn()
>   dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string
>   firmware: xilinx: Add support for Versal Gen 2
>   clk: zynqmp: Add Versal Gen 2 compatible string
>
>  .../bindings/clock/xlnx,versal-clk.yaml       |   5 +-
>  .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |   3 +
>  .../bindings/soc/xilinx/xlnx,ai-engine.yaml   |  61 +++
>  MAINTAINERS                                   |   9 +
>  drivers/accel/Kconfig                         |   1 +
>  drivers/accel/Makefile                        |   3 +-
>  drivers/accel/amd-ai-engine/Kconfig           |  15 +
>  drivers/accel/amd-ai-engine/Makefile          |  14 +
>  .../accel/amd-ai-engine/ai-engine-aiemlv2.c   | 441 ++++++++++++++++
>  drivers/accel/amd-ai-engine/ai-engine-clock.c | 154 ++++++
>  drivers/accel/amd-ai-engine/ai-engine-dev.c   | 255 ++++++++++
>  .../accel/amd-ai-engine/ai-engine-internal.h  | 377 ++++++++++++++
>  drivers/accel/amd-ai-engine/ai-engine-part.c  | 140 ++++++
>  drivers/accel/amd-ai-engine/ai-engine-pm.c    | 472 ++++++++++++++++++
>  drivers/accel/amd-ai-engine/ai-engine-res.c   | 184 +++++++
>  drivers/accel/amd-ai-engine/ai-engine-reset.c |  69 +++
>  drivers/clk/zynqmp/clkc.c                     |   1 +
>  drivers/firmware/xilinx/zynqmp.c              | 340 +++++++++++--
>  include/linux/amd-ai-engine.h                 | 115 +++++
>  include/linux/firmware/xlnx-zynqmp.h          |  65 ++-
>  20 files changed, 2679 insertions(+), 45 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
>  create mode 100644 drivers/accel/amd-ai-engine/Kconfig
>  create mode 100644 drivers/accel/amd-ai-engine/Makefile
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-aiemlv2.c
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-clock.c
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-dev.c
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-internal.h
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-part.c
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-pm.c
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-res.c
>  create mode 100644 drivers/accel/amd-ai-engine/ai-engine-reset.c
>  create mode 100644 include/linux/amd-ai-engine.h
>
> -- 
> 2.34.1
>

-- 
Jerome


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string
  2026-11-18 23:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
@ 2026-11-19 10:53   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-19 10:53 UTC (permalink / raw)
  To: Gregory Williams, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Michal Simek, kishore Manne
  Cc: Senthil Nathan Thangaraj, devicetree, linux-arm-kernel,
	linux-kernel

On 19/11/2026 00:32, Gregory Williams wrote:
> From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
> 
> Add compatible string for Versal Gen 2 firmware driver.
> 
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>

Incomplete DCO

> ---
>  .../bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml         | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
> index 72af37cdb103..60d1bd329d0e 100644
> --- a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
> +++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
> @@ -32,6 +32,9 @@ properties:
>                - xlnx,versal-net-firmware
>            - const: xlnx,versal-firmware
>  
> +      - description: For implementations complying for Versal Gen 2.

Drop description, it duplicates the compatible. Or say something useful.
This should be rather enum with all such entries.

> +        const: xlnx,versal2-firmware
> +


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding
  2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
@ 2026-11-19 10:59   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-19 10:59 UTC (permalink / raw)
  To: Gregory Williams, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Michal Simek
  Cc: dri-devel, devicetree, linux-arm-kernel, linux-kernel

On 19/11/2026 00:32, Gregory Williams wrote:
> Add documentation to describe Versal AI Engine device tree bindings. AI
> Engine is a tile array based processor with many cores and local memory
> cache. Data routing between the cores is done through internal switches,
> interface tiles are used to connect to external sources such as memory
> or PL. Configuration registers of the device are accessed through a
> memory mapped AXI address space.
> 
> Signed-off-by: Gregory Williams <gregory.williams@amd.com>
> ---
>  .../bindings/soc/xilinx/xlnx,ai-engine.yaml   | 61 +++++++++++++++++++

Soc is dumping ground of things which do not have clear function. This
has a clear function, so place it with other DSP/accel/NPU.

Subject - you almost hit the bingo. Missing only schema and YAML for the
full one.

A nit, subject: drop second/last, redundant "DT bindings". The
"dt-bindings" prefix is already stating that these are bindings.
See also:
https://elixir.bootlin.com/linux/v7.1-rc7/source/Documentation/devicetree/bindings/submitting-patches.rst#L23

>  1 file changed, 61 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml b/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
> new file mode 100644
> index 000000000000..6c97b5f0fb03
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml

Please read writing bindings document. Filename must match compatible.

> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)

Why not using recommended license? Why doing this differently?

> +# Copyright(C) 2026 Advanced Micro Devices, Inc. All rights reserved.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/xilinx/xlnx,ai-engine.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: AMD AI Engine for Versal SoCs
> +
> +maintainers:
> +  - Gregory Williams <gregory.williams@amd.com>
> +
> +description:
> +  The AMD AI Engine is a tile processor with many cores (up to 400) that
> +  can run in parallel with some devices containing local cache (memory tiles).
> +  The data routing between cores is configured through internal switches, and
> +  shim tiles interface with external interconnect, such as memory or PL.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - xlnx,versal2-aieml
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  clock-names:
> +    const: aclk0

Drop clock name. If you have to use output clock name as input name,
then it's just incorrect or incomplete, thus just drop it.

> +
> +  xlnx,firmware-device-id:

You don't get device identifiers, sorry. See writing bindings.

> +    description:
> +      Device identifier as defined by Versal firmware interface. This value is
> +      passed unchanged to firmware calls.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - xlnx,firmware-device-id
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    soc {
> +      #address-cells = <2>;
> +      #size-cells = <2>;
> +
> +      ai_engine: ai-engine@20000000000 {

Don't use your own names. It is not an engine.

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
If you cannot find a name matching your device, please check in kernel
sources for similar cases or you can grow the spec (via pull request to
DT spec repo).

> +        compatible = "xlnx,versal2-aieml";
> +        reg = <0x200 0x00 0x01 0x00>;
> +        clocks = <&aclk0>;
> +        clock-names = "aclk0";
> +        xlnx,firmware-device-id = <0x18224072>;
> +      };
> +    };


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-19 10:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
2026-11-18 23:31 ` [PATCH 01/15] firmware: xilinx: Separate TF-A checking Gregory Williams
2026-11-18 23:31 ` [PATCH 02/15] firmware: xilinx: Call va_start after pm feature check Gregory Williams
2026-11-18 23:31 ` [PATCH 03/15] firmware: xilinx: Add comments about number of arguments Gregory Williams
2026-11-18 23:32 ` [PATCH 04/15] firmware: xilinx: Use match data for ZynqMP/Versal Gregory Williams
2026-11-18 23:32 ` [PATCH 05/15] firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn() Gregory Williams
2026-11-18 23:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
2026-11-19 10:53   ` Krzysztof Kozlowski
2026-11-18 23:32 ` [PATCH 07/15] firmware: xilinx: Add support for Versal Gen 2 Gregory Williams
2026-11-18 23:32 ` [PATCH 09/15] clk: zynqmp: Add Versal Gen 2 compatible string Gregory Williams
2026-11-18 23:32 ` [PATCH 10/15] drivers: firmware: xilinx: Add IOCTL support for the AIE run time operations Gregory Williams
2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
2026-11-19 10:59   ` Krzysztof Kozlowski
2026-11-19  8:19 ` [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Jerome Brunet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox