Devicetree
 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:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ 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] 6+ 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
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:32 ` [PATCH 08/15] dt-bindings: clock: versal: add " Gregory Williams
  2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
  2 siblings, 0 replies; 6+ 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] 6+ messages in thread

* [PATCH 08/15] dt-bindings: clock: versal: 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
  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:44   ` sashiko-bot
  2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
  2 siblings, 1 reply; 6+ messages in thread
From: Gregory Williams @ 2026-11-18 23:32 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Jerome Brunet, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek
  Cc: Naman Trivedi, Senthil Nathan Thangaraj, linux-clk, devicetree,
	linux-kernel

From: Naman Trivedi <naman.trivedimanojbhai@amd.com>

Add compatible string for Versal Gen 2 clock driver and validate
clock-names for xlnx,versal2-clk compatible.

Signed-off-by: Naman Trivedi <naman.trivedimanojbhai@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
 Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml b/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml
index 1f36ccc4cde1..e06f1ebc192a 100644
--- a/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml
+++ b/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml
@@ -17,10 +17,13 @@ description: |
 properties:
   compatible:
     oneOf:
-      - const: xlnx,versal-clk
+      - enum:
+          - xlnx,versal-clk
+          - xlnx,versal2-clk
       - items:
           - enum:
               - xlnx,versal-net-clk
+              - xlnx,versal2-clk
           - const: xlnx,versal-clk
 
   "#clock-cells":
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ 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
  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 ` [PATCH 08/15] dt-bindings: clock: versal: add " Gregory Williams
@ 2026-11-18 23:32 ` Gregory Williams
  2026-11-18 23:45   ` sashiko-bot
  2 siblings, 1 reply; 6+ 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] 6+ messages in thread

* Re: [PATCH 08/15] dt-bindings: clock: versal: add Versal Gen 2 compatible string
  2026-11-18 23:32 ` [PATCH 08/15] dt-bindings: clock: versal: add " Gregory Williams
@ 2026-11-18 23:44   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-18 23:44 UTC (permalink / raw)
  To: Gregory Williams; +Cc: linux-clk, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dt-bindings: clock: versal: duplicate xlnx,versal2-clk in
  compatible oneOf
- [Medium] dt-bindings: clock: versal: missing clock-names validation in
  allOf block
--

commit fd8a0b655d481ee627fd749c39ad8be1171d696f
Author: Naman Trivedi <naman.trivedimanojbhai@amd.com>

dt-bindings: clock: versal: add Versal Gen 2 compatible string

This commit adds the xlnx,versal2-clk compatible string to the Xilinx
Versal clock controller DT binding schema.

> Add compatible string for Versal Gen 2 clock driver and validate
> clock-names for xlnx,versal2-clk compatible.

[Severity: Medium]
Does this patch actually update the clock-names validation for
xlnx,versal2-clk?

The commit message says it validates clock-names for xlnx,versal2-clk, but
the allOf conditional block in xlnx,versal-clk.yaml only checks for
xlnx,versal-net-clk:

Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml {
    ...
allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - xlnx,versal-net-clk
    then:
      properties:
        clocks:
          minItems: 3
        clock-names:
          minItems: 3
    else:
      properties:
        clocks:
          maxItems: 2
        clock-names:
          maxItems: 2
    ...
}

Because xlnx,versal2-clk is not added to that enum, it falls into the else
branch (maxItems: 2), which will fail dtbs_check if Versal Gen 2 specifies
all three input clocks (ref, pl_alt_ref, alt_ref) like Versal NET.

> diff --git a/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml b/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml
> index 1f36ccc4cde1d..e06f1ebc192ab 100644
> --- a/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml
> +++ b/Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml
> @@ -17,10 +17,13 @@ description: |
>  properties:
>    compatible:
>      oneOf:
> -      - const: xlnx,versal-clk
> +      - enum:
> +          - xlnx,versal-clk
> +          - xlnx,versal2-clk
>        - items:
>            - enum:
>                - xlnx,versal-net-clk
> +              - xlnx,versal2-clk
>            - const: xlnx,versal-clk

[Severity: Medium]
Should xlnx,versal2-clk be listed in only one branch of compatible.oneOf?

Adding xlnx,versal2-clk to both branches permits it both as a standalone
compatible string without a fallback and with the xlnx,versal-clk
fallback.  Also, at this point in the series (prior to commit "clk:
zynqmp: add compatible string for Versal Gen 2"), zynqmp_clock_of_match[]
in drivers/clk/zynqmp/clkc.c only matches xlnx,zynqmp-clk and
xlnx,versal-clk.  It looks like the addition under xlnx,versal-net-clk may
have been intended for the allOf block below.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118233211.4121361-1-gregory.williams@amd.com?part=8

^ permalink raw reply	[flat|nested] 6+ 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-18 23:45   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-18 23:45 UTC (permalink / raw)
  To: Gregory Williams; +Cc: dri-devel, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dt-bindings: soc: xilinx: xlnx,firmware-device-id duplicates
  power-domains
- [Low] dt-bindings: soc: xilinx: DTS example fails dt-check-style in
  strict mode
--

commit b6e53e2eec4c5f256b86a96092363aef4bc4fe16
Author: Gregory Williams <gregory.williams@amd.com>

dt-bindings: soc: xilinx: Add Versal AI Engine DT binding

This commit adds the Device Tree binding schema for the AMD Versal AI Engine
tile array processor.

> 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 0000000000000..6c97b5f0fb036
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
> @@ -0,0 +1,61 @@

[ ... ]

> +  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

[Severity: Medium]
Should this binding use the standard power-domains property instead of a
custom xlnx,firmware-device-id property?

The value 0x18224072 in the example below is PM_DEV_AI from
arch/arm64/boot/dts/xilinx/xlnx-versal-power.h, which is the Versal firmware
power-domain node ID used by the xlnx,zynqmp-firmware power-domain provider
(drivers/pmdomain/xilinx/zynqmp-pm-domains.c).  Existing Versal drivers that
need the PM_DEV_* ID for firmware calls obtain it from power-domains (for
example, cqspi_of_get_pdata() in drivers/spi/spi-cadence-quadspi.c).
Omitting power-domains with additionalProperties: false also prevents DT
nodes from referencing the firmware power-domain provider.

> +
> +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>;
> +      };
> +    };

[Severity: Low]
This example triggers indent-unit-strict and unused-labels warnings under
scripts/dtc/dt-check-style --mode=strict because it uses 2-space indentation
instead of 4-space indentation and defines the unused label ai_engine.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118233211.4121361-1-gregory.williams@amd.com?part=11

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

end of thread, other threads:[~2026-11-18 23:45 UTC | newest]

Thread overview: 6+ 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:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
2026-11-18 23:32 ` [PATCH 08/15] dt-bindings: clock: versal: add " Gregory Williams
2026-11-18 23:44   ` sashiko-bot
2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
2026-11-18 23:45   ` sashiko-bot

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