AMD AI Engine device driver for Versal
Subsystems (3)
cover AMD AI Engine device driver for Versal
Hi,
AI engine is a tile array based acceleration engine provided by AMD.
These engines provide high compute density for vector-based algorithms
and flexible custom compute and data movement. It has core tiles for compute, memory tiles for local storage, and shim tiles to interface the FPGA fabric and DDR. More details about the architecture can be found
here: https://www.amd.com/en/products/adaptive-socs-and-fpgas/technologies/ai-engine.html
This patchset introduces a driver for the AMD AI Engine in AMD Versal devices. The driver manages the AI Engine array and allows users to request an AI Engine partition (group of AI Engine tiles) for their application.
Note, two Versal firmware patches are included as they contain functionality for the AI Engines.
Thanks,
Gregory Williams
Gregory Williams (7):
dt-bindings: power: Add AMD Versal power domain bindings
dt-bindings: soc: xilinx: Add AI engine DT binding
accel: amd-ai-engine: Add AMD AI Engine device driver
accel: amd-ai-engine: Add support to enable/disable clocks and change
clock frequency
accel: amd-ai-engine: Add support for AIEML devices
accel: amd-ai-engine: Create tile memory information
accel: amd-ai-engine: Adds AI Engine reset operations
Ronak Jain (2):
firmware: xilinx: Add IOCTL support for the AIE run time operations
firmware: xilinx: Add IOCTL support to query QoS
.../bindings/soc/xilinx/xlnx,ai-engine.yaml | 151 +++++++ MAINTAINERS | 9 + drivers/accel/Kconfig | 1 + drivers/accel/Makefile | 1 + drivers/accel/amd-ai-engine/Kconfig | 15 + drivers/accel/amd-ai-engine/Makefile | 15 + drivers/accel/amd-ai-engine/ai-engine-aie.c | 423 ++++++++++++++++++ drivers/accel/amd-ai-engine/ai-engine-aieml.c | 362 +++++++++++++++ .../accel/amd-ai-engine/ai-engine-aperture.c | 195 ++++++++ drivers/accel/amd-ai-engine/ai-engine-clock.c | 326 ++++++++++++++ drivers/accel/amd-ai-engine/ai-engine-dev.c | 230 ++++++++++ .../accel/amd-ai-engine/ai-engine-internal.h | 360 +++++++++++++++ drivers/accel/amd-ai-engine/ai-engine-part.c | 167 +++++++ drivers/accel/amd-ai-engine/ai-engine-res.c | 184 ++++++++ drivers/accel/amd-ai-engine/ai-engine-reset.c | 300 +++++++++++++ drivers/firmware/xilinx/zynqmp.c | 46 ++ include/dt-bindings/power/xlnx-versal-power.h | 55 +++ include/linux/amd-ai-engine.h | 73 +++ include/linux/firmware/xlnx-zynqmp.h | 36 ++ 19 files changed, 2949 insertions(+) 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-aie.c create mode 100644 drivers/accel/amd-ai-engine/ai-engine-aieml.c create mode 100644 drivers/accel/amd-ai-engine/ai-engine-aperture.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-res.c create mode 100644 drivers/accel/amd-ai-engine/ai-engine-reset.c create mode 100644 include/dt-bindings/power/xlnx-versal-power.h create mode 100644 include/linux/amd-ai-engine.h
Signature · 1 line
2.34.1
PATCH 1/9 firmware: xilinx: Add IOCTL support for the AIE run time operations
From: Ronak Jain <[email protected]>
Add IOCTL support for the AIE run time operations listed 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
--- drivers/firmware/xilinx/zynqmp.c | 20 +++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 30 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+)
drivers/firmware/xilinx/zynqmp.c +20 -0
@@ -1039,6 +1039,26 @@ 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); } +/** +* zynqmp_pm_aie_operation - AI engine run time operations +* @node: AI engine node id +* @start_col: Starting column of AI partition +* @num_col: Number of column in AI partition +* @operation: ORed value of operations +* +* Return: Returns status, either success or error+reason +*/ +int zynqmp_pm_aie_operation (u32 node,u16 start_col,u16 num_col,u32 operation) +{ +u32 partition; + + partition = num_col; + partition = ((partition <<16U ) | start_col); +return zynqmp_pm_invoke_fn (PM_IOCTL ,NULL ,4 , node,IOCTL_AIE_OPS , + partition, operation); +} +EXPORT_SYMBOL_GPL (zynqmp_pm_aie_operation); +/** * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release) * @reset: Reset to be configured
include/linux/firmware/xlnx-zynqmp.h +30 -0
@@ -136,6 +136,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. */
@@ -155,6 +165,17 @@ enum pm_module_id { TF_A_MODULE_ID = 0xa, }; +/* AIE Operation */ +#define XILINX_AIE_OPS_COL_RST BIT(0) +#define XILINX_AIE_OPS_SHIM_RST BIT(1) +#define XILINX_AIE_OPS_ENB_COL_CLK_BUFF BIT(2) +#define XILINX_AIE_OPS_ZEROISATION BIT(3) +#define XILINX_AIE_OPS_DIS_COL_CLK_BUFF BIT(4) +#define XILINX_AIE_OPS_ENB_AXI_MM_ERR_EVENT BIT(5) +#define XILINX_AIE_OPS_SET_L2_CTRL_NPI_INTR BIT(6) +#define XILINX_AIE_OPS_DATA_MEM_ZEROIZATION BIT(8U) +#define XILINX_AIE_OPS_MEM_TILE_ZEROIZATION BIT(9U) +enum pm_api_cb_id {PM_INIT_SUSPEND_CB =30 ,PM_ACKNOWLEDGE_CB =31 ,
@@ -244,6 +265,8 @@ 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, };
@@ -633,6 +656,7 @@ int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode);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 zynqmp_pm_aie_operation (u32 node,u16 start_col,u16 num_col,u32 operation);#else static inline int zynqmp_pm_get_api_version (u32 *version) {
@@ -951,6 +975,12 @@ static inline int zynqmp_pm_set_gem_config(u32 node,return -ENODEV ; } +static inline int zynqmp_pm_aie_operation (u32 node,u16 start_col, +u16 num_col,u32 operation) +{ +return -ENODEV ; +} +#endif #endif /* __FIRMWARE_ZYNQMP_H__ */
Signature · 1 line
2.34.1
Re: [PATCH V1 1/9] firmware: xilinx: Add IOCTL support for the AIE run time operations
Quoted 11 lines · Gregory Williams
From: Ronak Jain <[email protected]>
Add IOCTL support for the AIE run time operations listed 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
Quoted 1 line
Signed-off-by Ronak Jain <[email protected]>
Incomplete chain. Read submitting patches.
Best regards,
Krzysztof
Re: [PATCH V1 1/9] firmware: xilinx: Add IOCTL support for the AIE run time operations
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Gregory Williams
From: Ronak Jain<[email protected]>
Add IOCTL support for the AIE run time operations listed 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
Quoted 2 lines
Quoted 1 line
Signed-off-by Ronak Jain<[email protected]>Incomplete chain. Read submitting patches.
Hi Krzysztof, thanks for the review I appreciate it! I will make sure to fix the chain when I send V2.
Thanks, Greg
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH V1 1/9] firmware: xilinx: Add IOCTL support for the AIE run time operations
In reply to Krzysztof KozlowskiOn 7/3/2025 12:50 AM, Krzysztof Kozlowski wrote:>
Quoted 13 lines · Gregory Williams
Quoted 11 lines
From: Ronak Jain <[email protected]>
Add IOCTL support for the AIE run time operations listed 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
Quoted 3 lines
Quoted 1 line
Signed-off-by Ronak Jain <[email protected]>Incomplete chain. Read submitting patches.
Hi Krzysztof, thanks for the review I appreciate it! I will make sure to fix the chain when I send V2.
Thanks,
Greg
Quoted 3 lines
Best regards,
Krzysztof
PATCH 2/9 firmware: xilinx: Add IOCTL support to query QoS
In reply to Gregory WilliamsFrom: Ronak Jain <[email protected]>
Add support to query the QoS value on a device by using the PM IOCTL EEMI API.
The caller only passes the node ID of the given device node and IOCTL API will return the default QoS value as well as the current QoS value.
--- drivers/firmware/xilinx/zynqmp.c | 26 ++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 6 ++++++ 2 files changed, 32 insertions(+)
drivers/firmware/xilinx/zynqmp.c +26 -0
@@ -1636,6 +1636,32 @@ int zynqmp_pm_get_feature_config(enum pm_feature_config_id id,return zynqmp_pm_invoke_fn (PM_IOCTL , payload,3 ,0 ,IOCTL_GET_FEATURE_CONFIG , id); } +/** +* zynqmp_pm_get_qos - PM call to query default and current QoS of the node +* @node: Node Id of the device +* @def_qos: Default QoS value +* @qos: Current QoS value +* +* Return: Returns 0 on success and the default and current QoS registers in +* @def_qos and @qos or error value on failure +*/ +int zynqmp_pm_get_qos (u32 node,u32 *const def_qos,u32 *const qos) +{ +u32 ret_payload[PAYLOAD_ARG_CNT ]; +int ret; + +if (!def_qos || !qos) +return -EINVAL ; + + ret =zynqmp_pm_invoke_fn (PM_IOCTL , ret_payload,2 , node,IOCTL_GET_QOS ); + + *def_qos = ret_payload[1 ]; + *qos = ret_payload[2 ]; + +return ret; +} +EXPORT_SYMBOL_GPL (zynqmp_pm_get_qos); +/** * zynqmp_pm_set_sd_config - PM call to set value of SD config registers * @node: SD node ID
include/linux/firmware/xlnx-zynqmp.h +6 -0
@@ -657,6 +657,7 @@ 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 zynqmp_pm_aie_operation (u32 node,u16 start_col,u16 num_col,u32 operation); +int zynqmp_pm_get_qos (u32 node,u32 *const def_qos,u32 *const qos);#else static inline int zynqmp_pm_get_api_version (u32 *version) {
@@ -981,6 +982,11 @@ static inline int zynqmp_pm_aie_operation(u32 node, u16 start_col,return -ENODEV ; } +static inline int zynqmp_pm_get_qos (u32 node,u32 *const def_qos,u32 *const qos) +{ +return -ENODEV ; +} +#endif #endif /* __FIRMWARE_ZYNQMP_H__ */
Signature · 1 line
2.34.1
PATCH 3/9 dt-bindings: power: Add AMD Versal power domain bindings
In reply to Gregory WilliamsDefine Versal power domain value macros.
--- include/dt-bindings/power/xlnx-versal-power.h | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 include/dt-bindings/power/xlnx-versal-power.h
include/dt-bindings/power/xlnx-versal-power.h new file +55 -0
@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ +/* +* Copyright (C) 2019 - 2021 Xilinx, Inc. +* Copyright (C) 2024 Advanced Micro Devices, Inc. +*/ + +#ifndef _DT_BINDINGS_VERSAL_POWER_H +#define _DT_BINDINGS_VERSAL_POWER_H + +#define PM_DEV_RPU0_0 (0x18110005U) +#define PM_DEV_RPU0_1 (0x18110006U) +#define PM_DEV_OCM_0 (0x18314007U) +#define PM_DEV_OCM_1 (0x18314008U) +#define PM_DEV_OCM_2 (0x18314009U) +#define PM_DEV_OCM_3 (0x1831400aU) +#define PM_DEV_TCM_0_A (0x1831800bU) +#define PM_DEV_TCM_0_B (0x1831800cU) +#define PM_DEV_TCM_1_A (0x1831800dU) +#define PM_DEV_TCM_1_B (0x1831800eU) +#define PM_DEV_USB_0 (0x18224018U) +#define PM_DEV_GEM_0 (0x18224019U) +#define PM_DEV_GEM_1 (0x1822401aU) +#define PM_DEV_SPI_0 (0x1822401bU) +#define PM_DEV_SPI_1 (0x1822401cU) +#define PM_DEV_I2C_0 (0x1822401dU) +#define PM_DEV_I2C_1 (0x1822401eU) +#define PM_DEV_CAN_FD_0 (0x1822401fU) +#define PM_DEV_CAN_FD_1 (0x18224020U) +#define PM_DEV_UART_0 (0x18224021U) +#define PM_DEV_UART_1 (0x18224022U) +#define PM_DEV_GPIO (0x18224023U) +#define PM_DEV_TTC_0 (0x18224024U) +#define PM_DEV_TTC_1 (0x18224025U) +#define PM_DEV_TTC_2 (0x18224026U) +#define PM_DEV_TTC_3 (0x18224027U) +#define PM_DEV_SWDT_LPD (0x18224028U) +#define PM_DEV_SWDT_FPD (0x18224029U) +#define PM_DEV_OSPI (0x1822402aU) +#define PM_DEV_QSPI (0x1822402bU) +#define PM_DEV_GPIO_PMC (0x1822402cU) +#define PM_DEV_I2C_PMC (0x1822402dU) +#define PM_DEV_SDIO_0 (0x1822402eU) +#define PM_DEV_SDIO_1 (0x1822402fU) +#define PM_DEV_RTC (0x18224034U) +#define PM_DEV_ADMA_0 (0x18224035U) +#define PM_DEV_ADMA_1 (0x18224036U) +#define PM_DEV_ADMA_2 (0x18224037U) +#define PM_DEV_ADMA_3 (0x18224038U) +#define PM_DEV_ADMA_4 (0x18224039U) +#define PM_DEV_ADMA_5 (0x1822403aU) +#define PM_DEV_ADMA_6 (0x1822403bU) +#define PM_DEV_ADMA_7 (0x1822403cU) +#define PM_DEV_AI (0x18224072U) + +#endif
Signature · 1 line
2.34.1
Re: [PATCH V1 3/9] dt-bindings: power: Add AMD Versal power domain bindings
Quoted 5 lines · Gregory Williams
Define Versal power domain value macros.
Signed-off-by Gregory Williams <[email protected]>--- include/dt-bindings/power/xlnx-versal-power.h | 55 +++++++++++++++++++
<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC (and consider --no-git-fallback argument, so you will not CC people just because they made one commit years ago). It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.
</form letter>
Quoted 10 lines
1 file changed, 55 insertions(+) create mode 100644 include/dt-bindings/power/xlnx-versal-power.hinclude/dt-bindings/power/xlnx-versal-power.h new file +1
-0@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
include/dt-bindings/power/xlnx-versal-power.h line 11
Quoted 10 lines
include/dt-bindings/power/xlnx-versal-power.h new file +10
-0+/* +* Copyright (C) 2019 - 2021 Xilinx, Inc. +* Copyright (C) 2024 Advanced Micro Devices, Inc. +*/ + +#ifndef _DT_BINDINGS_VERSAL_POWER_H +#define _DT_BINDINGS_VERSAL_POWER_H + +#define PM_DEV_RPU0_0 (0x18110005U) +#define PM_DEV_RPU0_1 (0x18110006U)
Bindings ID start from 0 or 1 and are decimal numbers. None of these are bindings (and commit msg does not explain here anything).
Also, where is the compatible using these? Why is this a separate patch?
Best regards,
Krzysztof
Re: [PATCH V1 3/9] dt-bindings: power: Add AMD Versal power domain bindings
Quoted 49 lines · Krzysztof Kozlowski
Quoted 5 lines · Gregory Williams
Define Versal power domain value macros.
Signed-off-by Gregory Williams <[email protected]>--- include/dt-bindings/power/xlnx-versal-power.h | 55 +++++++++++++++++++<form letter>
Please usescripts/get_maintainers.plto get a list of necessary people and lists to CC (and consider --no-git-fallback argument, so you will not CC people just because they made one commit years ago). It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.Tools like b4 or
scripts/get_maintainer.plprovide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember aboutb4 prep --auto-to-ccif you added new patches to the patchset.
</form letter>Quoted 10 lines
1 file changed, 55 insertions(+) create mode 100644 include/dt-bindings/power/xlnx-versal-power.hinclude/dt-bindings/power/xlnx-versal-power.h new file +1
-0@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ include/dt-bindings/power/xlnx-versal-power.h line 11
Quoted 10 lines
include/dt-bindings/power/xlnx-versal-power.h new file +10
-0+/* +* Copyright (C) 2019 - 2021 Xilinx, Inc. +* Copyright (C) 2024 Advanced Micro Devices, Inc. +*/ + +#ifndef _DT_BINDINGS_VERSAL_POWER_H +#define _DT_BINDINGS_VERSAL_POWER_H + +#define PM_DEV_RPU0_0 (0x18110005U) +#define PM_DEV_RPU0_1 (0x18110006U)Bindings ID start from 0 or 1 and are decimal numbers. None of these are bindings (and commit msg does not explain here anything).
Quoted 1 line
Also, where is the compatible using these? Why is this a separate patch?
In 'Submitting DT binding patches' it says: "The Documentation/ and include/dt-bindings/ portion of the patch should be a separate patch". This define was only used in the device tree binding example, I see the issue with this and will remove for V2.
Thanks,
Greg
Quoted 5 lines
Best regards,
Krzysztof
Re: [PATCH V1 3/9] dt-bindings: power: Add AMD Versal power domain bindings
Quoted 26 lines · Gregory
Quoted 26 lines
Quoted 12 lines
1 file changed, 55 insertions(+) create mode 100644 include/dt-bindings/power/xlnx-versal-power.hinclude/dt-bindings/power/xlnx-versal-power.h new file +1
-0@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ include/dt-bindings/power/xlnx-versal-power.h line 11
Quoted 10 lines
include/dt-bindings/power/xlnx-versal-power.h new file +10
-0+/* +* Copyright (C) 2019 - 2021 Xilinx, Inc. +* Copyright (C) 2024 Advanced Micro Devices, Inc. +*/ + +#ifndef _DT_BINDINGS_VERSAL_POWER_H +#define _DT_BINDINGS_VERSAL_POWER_H + +#define PM_DEV_RPU0_0 (0x18110005U) +#define PM_DEV_RPU0_1 (0x18110006U)Bindings ID start from 0 or 1 and are decimal numbers. None of these are bindings (and commit msg does not explain here anything).
Quoted 2 lines
Quoted 1 line
Also, where is the compatible using these? Why is this a separate patch?
In 'Submitting DT binding patches' it says: "The
Documentation/andinclude/dt-bindings/portion of the patch should be a separate patch".
Separate from the driver. But that's a single patch.
Best regards,
Krzysztof
PATCH 4/9 dt-bindings: soc: xilinx: Add AI engine DT binding
In reply to Gregory WilliamsIn the device tree, there will be device node for the AI engine device, and device nodes for the statically configured AI engine apertures. Apertures are an isolated set of columns with in the AI engine device with their own address space and interrupt.
--- .../bindings/soc/xilinx/xlnx,ai-engine.yaml | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +151 -0
@@ -0,0 +1,151 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%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 + +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured through + internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for an + AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0 + + reg: + maxItems: 1 + + '#address-cells': + const: 2 + + '#size-cells': + const: 2 + + power-domains: + description: + Platform management node id used to request power management services + from the firmware driver. + + xlnx,aie-gen: + $ref: /schemas/types.yaml#/definitions/uint8 + description: + Hardware generation of AI engine device. E.g. the current values supported + are 1 (AIE) and 2 (AIEML). + + xlnx,shim-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of SHIM tiles of the AI engine device + + xlnx,core-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of core tiles of the AI engine device + + xlnx,mem-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of memory tiles of the AI engine device + +required: + - compatible + - reg + - power-domains + - xlnx,aie-gen + - xlnx,shim-rows + - xlnx,core-rows + - xlnx,mem-rows + +patternProperties: + "^aperture@[0-9]+$": + type: object + description: + AI engine aperture which is a group of column based tiles of the + AI engine device. Each AI engine apertures isolated from the + other AI engine apertures. An AI engine aperture is defined by + AMD/Xilinx platform design tools. + + properties: + compatible: + const: xlnx,ai-engine-aperture + + reg: + description: + Physical base address and length of the aperture registers. + The AI engine address space assigned to Linux is defined by + Xilinx/AMD platform design tool. + + interrupts: + maxItems: 3 + + interrupt-names: + items: + - const: interrupt1 + - const: interrupt2 + - const: interrupt3 + + xlnx,columns: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: + It describes the location of the aperture. It specifies the start + column and the number of columns. E.g. an aperture starts from + column 0 and there are 50 columns, it will be presented as <0 50>. + + xlnx,node-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + AI engine aperture node ID, which is defined by AMD/Xilinx platform + design tool to identify the AI engine aperture in the firmware. + + required: + - compatible + - reg + - xlnx,columns + - xlnx,node-id + + additionalProperties: false + +additionalProperties: false + +examples: + - | + #include <dt-bindings/power/xlnx-versal-power.h> + bus { + #address-cells = <2>; + #size-cells = <2>; + ai_engine: ai-engine@20000000000 { + compatible = "xlnx,ai-engine-v2.0"; + reg = <0x200 0x00 0x01 0x00>; + #address-cells = <2>; + #size-cells = <2>; + power-domains = <&versal_firmware PM_DEV_AI>; + xlnx,aie-gen = /bits/ 8 <0x1>; + xlnx,core-rows = /bits/ 8 <1 8>; + xlnx,mem-rows = /bits/ 8 <0 0>; + xlnx,shim-rows = /bits/ 8 <0 1>; + + aperture0: aperture@200000000000 { + /* 50 columns and 8 core tile rows + 1 SHIM row */ + compatible = "xlnx,ai-engine-aperture"; + reg = <0x200 0x0 0x1 0x0>; + interrupts = <0x0 0x94 0x4>, + <0x0 0x95 0x4>, + <0x0 0x96 0x4>; + interrupt-names = "interrupt1", "interrupt2", "interrupt3"; + interrupt-parent = <&gic>; + xlnx,columns = <0 50>; + xlnx,node-id = <1>; + }; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH V1 4/9] dt-bindings: soc: xilinx: Add AI engine DT binding
Quoted 2 lines · Gregory Williams
In the device tree, there will be device node for the AI engine device, and device nodes for the statically configured AI engine apertures.
No, describe the hardware, not DTS.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Quoted 14 lines
Apertures are an isolated set of columns with in the AI engine device with their own address space and interrupt.
Signed-off-by Gregory Williams <[email protected]>--- .../bindings/soc/xilinx/xlnx,ai-engine.yaml | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yamlDocumentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +0
-0
Filename matching compatible.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 7
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0@@ -0,0 +1,151 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%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
That's really too generic...
Quoted 7 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured through
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 24
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for an + AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0
What does v2.0 stands for? Versioning is discouraged, unless mapping is well documented.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 35
Quoted 11 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +11
-0+ + reg: + maxItems: 1 + + '#address-cells': + const: 2 + + '#size-cells': + const: 2 + + power-domains:
Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 38
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Platform management node id used to request power management services + from the firmware driver.
Drop description, redundant.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 41
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ + xlnx,aie-gen: + $ref: /schemas/types.yaml#/definitions/uint8
Why uint8?
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 44
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Hardware generation of AI engine device. E.g. the current values supported + are 1 (AIE) and 2 (AIEML).
No clue what's that, but it is implied by compatible, isn't it?
Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 49
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ + xlnx,shim-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of SHIM tiles of the AI engine device
Implied by compatible.
Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 60
Quoted 11 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +11
-0+ + xlnx,core-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of core tiles of the AI engine device + + xlnx,mem-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of memory tiles of the AI engine device +
Same comments everywhere.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 70
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+required: + - compatible + - reg + - power-domains + - xlnx,aie-gen + - xlnx,shim-rows + - xlnx,core-rows + - xlnx,mem-rows + +patternProperties:
This goes after properties.
Quoted 7 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ "^aperture@[0-9]+$": + type: object + description: + AI engine aperture which is a group of column based tiles of the + AI engine device. Each AI engine apertures isolated from the + other AI engine apertures. An AI engine aperture is defined by + AMD/Xilinx platform design tools.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 87
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ + properties: + compatible: + const: xlnx,ai-engine-aperture + + reg: + description: + Physical base address and length of the aperture registers. + The AI engine address space assigned to Linux is defined by + Xilinx/AMD platform design tool.
Missing constraints. Description is redundant - can it be anything else?
Plus you clearly miss ranges.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 96
Quoted 9 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +9
-0+ + interrupts: + maxItems: 3 + + interrupt-names: + items: + - const: interrupt1 + - const: interrupt2 + - const: interrupt3
Useless names, drop entirely.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 103
Quoted 7 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ + xlnx,columns: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: + It describes the location of the aperture. It specifies the start + column and the number of columns. E.g. an aperture starts from + column 0 and there are 50 columns, it will be presented as <0 50>.
Same comments as before
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 109
Quoted 6 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +6
-0+ + xlnx,node-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + AI engine aperture node ID, which is defined by AMD/Xilinx platform + design tool to identify the AI engine aperture in the firmware.
No, you do not get node ID. Recently every day a patch comes for that...
Quoted 17 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +17
-0+ + required: + - compatible + - reg + - xlnx,columns + - xlnx,node-id + + additionalProperties: false + +additionalProperties: false + +examples: + - | + #include <dt-bindings/power/xlnx-versal-power.h> + bus { + #address-cells = <2>; + #size-cells = <2>;
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ ai_engine: ai-engine@20000000000 { + compatible = "xlnx,ai-engine-v2.0"; + reg = <0x200 0x00 0x01 0x00>; + #address-cells = <2>; + #size-cells = <2>; + power-domains = <&versal_firmware PM_DEV_AI>; + xlnx,aie-gen = /bits/ 8 <0x1>; + xlnx,core-rows = /bits/ 8 <1 8>; + xlnx,mem-rows = /bits/ 8 <0 0>; + xlnx,shim-rows = /bits/ 8 <0 1>
This cannot be without ranges... I am surprised it actually works, but for sure was not tested and produces warnings.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 144
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +8
-0+ + aperture0: aperture@200000000000 { + /* 50 columns and 8 core tile rows + 1 SHIM row */ + compatible = "xlnx,ai-engine-aperture"; + reg = <0x200 0x0 0x1 0x0>; + interrupts = <0x0 0x94 0x4>, + <0x0 0x95 0x4>, + <0x0 0x96 0x4>;
Use proper flags.
Best regards,
Krzysztof
Re: [PATCH V1 4/9] dt-bindings: soc: xilinx: Add AI engine DT binding
Quoted 46 lines · Krzysztof Kozlowski
Quoted 2 lines · Gregory Williams
In the device tree, there will be device node for the AI engine device, and device nodes for the statically configured AI engine apertures.
No, describe the hardware, not DTS.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Quoted 14 lines
Apertures are an isolated set of columns with in the AI engine device with their own address space and interrupt.
Signed-off-by Gregory Williams <[email protected]>--- .../bindings/soc/xilinx/xlnx,ai-engine.yaml | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yamlDocumentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +0
-0Filename matching compatible.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 7
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0@@ -0,0 +1,151 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%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 EngineThat's really too generic...
Quoted 12 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +12
-0+ +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured through + internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for an
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 24
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0What does v2.0 stands for? Versioning is discouraged, unless mapping is well documented.
Sure, I will remove the versioning in V2 patch.
Quoted 25 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 35
Quoted 12 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +11
-0+ + reg: + maxItems: 1 + + '#address-cells': + const: 2 + + '#size-cells': + const: 2 + + power-domains:Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 38
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Platform management node id used to request power management services + from the firmware driver.Drop description, redundant.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 41
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ + xlnx,aie-gen: + $ref: /schemas/types.yaml#/definitions/uint8
Quoted 7 lines
Why uint8?
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 44
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Hardware generation of AI engine device. E.g. the current values supported + are 1 (AIE) and 2 (AIEML).No clue what's that, but it is implied by compatible, isn't it?
The driver supports multiple hardware generations. During driver probe, this value is read from the device tree and hardware generation specific data structures are loaded based on this value. The compatible string is the same between devices.
Quoted 10 lines
Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 49
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ + xlnx,shim-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of SHIM tiles of the AI engine deviceImplied by compatible.
The AI Engine device can have different configurations for number of rows and column (even if it is the same hardware generation). This property tells the driver the size and layout of the array, this is not implied by compatible.
Quoted 124 lines
Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 60
Quoted 11 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +11
-0+ + xlnx,core-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of core tiles of the AI engine device + + xlnx,mem-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of memory tiles of the AI engine device +Same comments everywhere.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 70
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+required: + - compatible + - reg + - power-domains + - xlnx,aie-gen + - xlnx,shim-rows + - xlnx,core-rows + - xlnx,mem-rows + +patternProperties:This goes after properties.
Quoted 7 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ "^aperture@[0-9]+$": + type: object + description: + AI engine aperture which is a group of column based tiles of the + AI engine device. Each AI engine apertures isolated from the + other AI engine apertures. An AI engine aperture is defined by + AMD/Xilinx platform design tools.Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 87
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ + properties: + compatible: + const: xlnx,ai-engine-aperture + + reg: + description: + Physical base address and length of the aperture registers. + The AI engine address space assigned to Linux is defined by + Xilinx/AMD platform design tool.Missing constraints. Description is redundant - can it be anything else?
Plus you clearly miss ranges.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 96
Quoted 9 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +9
-0+ + interrupts: + maxItems: 3 + + interrupt-names: + items: + - const: interrupt1 + - const: interrupt2 + - const: interrupt3Useless names, drop entirely.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 103
Quoted 7 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ + xlnx,columns: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: + It describes the location of the aperture. It specifies the start + column and the number of columns. E.g. an aperture starts from + column 0 and there are 50 columns, it will be presented as <0 50>.Same comments as before
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 109
Quoted 6 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +6
-0+ + xlnx,node-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + AI engine aperture node ID, which is defined by AMD/Xilinx platform + design tool to identify the AI engine aperture in the firmware.No, you do not get node ID. Recently every day a patch comes for that...
Quoted 17 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +17
-0+ + required: + - compatible + - reg + - xlnx,columns + - xlnx,node-id + + additionalProperties: false + +additionalProperties: false + +examples: + - | + #include <dt-bindings/power/xlnx-versal-power.h> + bus { + #address-cells = <2>; + #size-cells = <2>;Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ ai_engine: ai-engine@20000000000 { + compatible = "xlnx,ai-engine-v2.0"; + reg = <0x200 0x00 0x01 0x00>; + #address-cells = <2>; + #size-cells = <2>; + power-domains = <&versal_firmware PM_DEV_AI>; + xlnx,aie-gen = /bits/ 8 <0x1>; + xlnx,core-rows = /bits/ 8 <1 8>; + xlnx,mem-rows = /bits/ 8 <0 0>; + xlnx,shim-rows = /bits/ 8 <0 1>This cannot be without ranges... I am surprised it actually works, but for sure was not tested and produces warnings.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 144
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +8
-0+ + aperture0: aperture@200000000000 { + /* 50 columns and 8 core tile rows + 1 SHIM row */ + compatible = "xlnx,ai-engine-aperture"; + reg = <0x200 0x0 0x1 0x0>; + interrupts = <0x0 0x94 0x4>, + <0x0 0x95 0x4>, + <0x0 0x96 0x4>;
Quoted 4 lines
Use proper flags.
Best regards,
Krzysztof
Thanks again for the review Krzysztof, I appreciate your time. I will address the remaining comments in a V2 patch.
Thanks,
Greg
Re: [PATCH V1 4/9] dt-bindings: soc: xilinx: Add AI engine DT binding
Quoted 24 lines · Gregory
Quoted 23 lines · Krzysztof Kozlowski
Quoted 2 lines · Gregory Williams
In the device tree, there will be device node for the AI engine device, and device nodes for the statically configured AI engine apertures.
No, describe the hardware, not DTS.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Quoted 14 lines
Apertures are an isolated set of columns with in the AI engine device with their own address space and interrupt.
Signed-off-by Gregory Williams <[email protected]>--- .../bindings/soc/xilinx/xlnx,ai-engine.yaml | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yamlDocumentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +0
-0Filename matching compatible.
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 7
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0@@ -0,0 +1,151 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%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 EngineThat's really too generic...
You did not answer to other comments here and other patches, so I just assume you did not ignore them.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +12
-0+ +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured through + internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for anQuoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 24
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0What does v2.0 stands for? Versioning is discouraged, unless mapping is well documented.
Quoted 1 line
Sure, I will remove the versioning in V2 patch.
This should be specific to product, so use the actual product/model name.
Is this part of a Soc? Then standard rules apply... but I could not deduce it from the descriptions or commit msgs.
Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 35
Quoted 13 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +11
-0+ + reg: + maxItems: 1 + + '#address-cells': + const: 2 + + '#size-cells': + const: 2 + + power-domains:Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 38
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Platform management node id used to request power management services + from the firmware driver.Drop description, redundant.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 41
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ + xlnx,aie-gen: + $ref: /schemas/types.yaml#/definitions/uint8Why uint8?
Quoted 7 lines
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 44
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Hardware generation of AI engine device. E.g. the current values supported + are 1 (AIE) and 2 (AIEML).No clue what's that, but it is implied by compatible, isn't it?
The driver supports multiple hardware generations. During driver probe, this value is read from the device tree and hardware generation specific
Bindings are about hardware, not driver, so your driver arguments are not valid.
Quoted 1 line
data structures are loaded based on this value. The compatible string is the same between devices.
No. See writing bindings.
Quoted 10 lines
Quoted 10 lines
Missing constraints.
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ + xlnx,shim-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of SHIM tiles of the AI engine device
Quoted 4 lines
Quoted 1 line
Implied by compatible.
The AI Engine device can have different configurations for number of rows and column (even if it is the same hardware generation). This property tells the driver the size and layout of the array, this is not implied by compatible.
Wrap your emails correctly.
Again driver.. no, please describe the hardware, not your drivers.
Best regards,
Krzysztof
Re: [PATCH V1 4/9] dt-bindings: soc: xilinx: Add AI engine DT binding
Quoted 36 lines · Krzysztof Kozlowski
Quoted 24 lines · Gregory
Quoted 23 lines · Krzysztof Kozlowski
Quoted 2 lines · Gregory Williams
In the device tree, there will be device node for the AI engine device, and device nodes for the statically configured AI engine apertures.
No, describe the hardware, not DTS.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml
Quoted 14 lines
Apertures are an isolated set of columns with in the AI engine device with their own address space and interrupt.
Signed-off-by Gregory Williams <[email protected]>--- .../bindings/soc/xilinx/xlnx,ai-engine.yaml | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yamlDocumentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +0
-0Filename matching compatible.
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 7
Quoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0@@ -0,0 +1,151 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%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 EngineThat's really too generic...
Quoted 2 lines
You did not answer to other comments here and other patches, so I just assume you did not ignore them.
No, they were not ignored. I will make sure to address in a V2 patch.
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 9 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured throughDocumentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 24
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for an + AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0What does v2.0 stands for? Versioning is discouraged, unless mapping is well documented.
Quoted 6 lines
Quoted 1 line
Sure, I will remove the versioning in V2 patch.
This should be specific to product, so use the actual product/model name.
Is this part of a Soc? Then standard rules apply... but I could not deduce it from the descriptions or commit msgs.
Yes this is part of an SoC. I will be more descriptive in V2 patch.
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +1
-0+Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ reg: + maxItems: 1 + + '#address-cells': + const: 2 + + '#size-cells': + const: 2 + + power-domains:Missing constraints.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 38
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Platform management node id used to request power management services + from the firmware driver.Drop description, redundant.
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 41
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ + xlnx,aie-gen: + $ref: /schemas/types.yaml#/definitions/uint8Why uint8?
Quoted 3 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +3
-0+ description: + Hardware generation of AI engine device. E.g. the current values supported + are 1 (AIE) and 2 (AIEML).
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
No clue what's that, but it is implied by compatible, isn't it?
The driver supports multiple hardware generations. During driver probe, this value is read from the device tree and hardware generation specific
Bindings are about hardware, not driver, so your driver arguments are not valid.
Understood.
Quoted 4 lines
Quoted 2 lines
data structures are loaded based on this value. The compatible string is the same between devices.
No. See writing bindings.
Ok so there should be a different compatible strings based on hardware generation. I will fix this for a V2 patch.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Missing constraints.
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ + xlnx,shim-rows: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + start row and the number of rows of SHIM tiles of the AI engine device
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Implied by compatible.
The AI Engine device can have different configurations for number of rows and column (even if it is the same hardware generation). This property tells the driver the size and layout of the array, this is not implied by compatible.
Wrap your emails correctly.
Again driver.. no, please describe the hardware, not your drivers.
I see in 'writing bindings' that I should use device-based compatible string. I will do this and remove these nodes for V2 patch.
Thanks again for your time,
Greg
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH V1 4/9] dt-bindings: soc: xilinx: Add AI engine DT binding
Quoted 21 lines · Gregory
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +7
-0+ +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured throughDocumentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 24
Quoted 10 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +10
-0+ internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for an + AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0What does v2.0 stands for? Versioning is discouraged, unless mapping is well documented.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Sure, I will remove the versioning in V2 patch.
This should be specific to product, so use the actual product/model name.
Is this part of a Soc? Then standard rules apply... but I could not deduce it from the descriptions or commit msgs.
Yes this is part of an SoC. I will be more descriptive in V2 patch.
Huh... so you MUST use SoC compatibles. Don't upstream things entirely different than everything else.
Best regards,
Krzysztof
Re: [PATCH V1 4/9] dt-bindings: soc: xilinx: Add AI engine DT binding
Quoted 26 lines · Krzysztof Kozlowski
Quoted 25 lines · Gregory
Quoted 25 lines
Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +12
-0+ +maintainers: + - Gregory Williams <[email protected]> + +description: + The AMD AI Engine is a tile processor with many cores (up to 400) that + can run in parallel. The data routing between cores is configured through + internal switches, and shim tiles interface with external interconnect, such + as memory or PL. One AI engine device can have multiple apertures, each + has its own address space and interrupt. At runtime application can create + multiple partitions within an aperture which are groups of columns of AI + engine tiles. Each AI engine partition is the minimum resetable unit for anQuoted 8 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml line 24
Quoted 5 lines
Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml new file +5
-0+ AI engine application. + +properties: + compatible: + const: xlnx,ai-engine-v2.0What does v2.0 stands for? Versioning is discouraged, unless mapping is well documented.
Quoted 1 line
Sure, I will remove the versioning in V2 patch.
This should be specific to product, so use the actual product/model name.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Is this part of a Soc? Then standard rules apply... but I could not deduce it from the descriptions or commit msgs.
Yes this is part of an SoC. I will be more descriptive in V2 patch.
Huh... so you MUST use SoC compatibles. Don't upstream things entirely different than everything else.
I will fix this in V2 patch.
Thanks,
Greg
Quoted 3 lines
Best regards,
Krzysztof
PATCH 5/9 accel: amd-ai-engine: Add AMD AI Engine device driver
In reply to Gregory WilliamsAdd support for AMD AI Engine on AMD Versal devices. AMD AI Engine is an array based accelerator for applications like beamforming and machine learning inference [1].
AI Engine device handle can have multiple apertures (groups of AI engine columns) that are isolated from one another. At runtime, applications can request for multiple partitions within an aperture.
The driver architecture:
+----------------------------------------+ | AIE Device | | +----------------+ +----------------+ | | | aperture_0 | | aperture_X | | | |----------------| |----------------| | | | partition_0 | | partition_0 | | | | ... | | ... | | | | partition_X | | partition_X | | | +----------------+ +----------------+ | +----------------------------------------+
The driver provides the following functionality:
- AI Engine device probe and aperture probe
- Partition request and release
- Setting partition frequency
- Partition setup and teardown
[1] https://www.amd.com/en/products/adaptive-socs-and-fpgas/technologies/ai-engine.html
--- MAINTAINERS | 9 + drivers/accel/Kconfig | 1 + drivers/accel/Makefile | 1 + drivers/accel/amd-ai-engine/Kconfig | 15 ++ drivers/accel/amd-ai-engine/Makefile | 12 + drivers/accel/amd-ai-engine/ai-engine-aie.c | 46 ++++ .../accel/amd-ai-engine/ai-engine-aperture.c | 195 +++++++++++++++ drivers/accel/amd-ai-engine/ai-engine-dev.c | 228 +++++++++++++++++ .../accel/amd-ai-engine/ai-engine-internal.h | 230 ++++++++++++++++++ drivers/accel/amd-ai-engine/ai-engine-part.c | 65 +++++ drivers/accel/amd-ai-engine/ai-engine-res.c | 114 +++++++++ include/linux/amd-ai-engine.h | 46 ++++ 12 files changed, 962 insertions(+) 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-aie.c create mode 100644 drivers/accel/amd-ai-engine/ai-engine-aperture.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-res.c create mode 100644 include/linux/amd-ai-engine.h
MAINTAINERS +9 -0
@@ -1007,6 +1007,15 @@ L: [email protected] S: Supported F: drivers/dma/amd/ae4dma/ +AMD AI ENGINE DRIVER +M: Gregory Williams <[email protected]> +L: [email protected] +S: Maintained +T: git https://gitlab.freedesktop.org/drm/misc/kernel.git +F: Documentation/devicetree/bindings/soc/xilinx/xlnx,ai-engine.yaml +F: drivers/accel/amd-ai-engine/ +F: include/linux/amd-ai-engine.h + AMD AXI W1 DRIVER M: Kris Chaplin <[email protected]> R: Thomas Delev <[email protected]>
drivers/accel/Kconfig +1 -0
@@ -24,6 +24,7 @@ menuconfig DRM_ACCEL different device files, called accel/accel* (in /dev, sysfs and debugfs). +source "drivers/accel/amd-ai-engine/Kconfig" source "drivers/accel/amdxdna/Kconfig" source "drivers/accel/habanalabs/Kconfig" source "drivers/accel/ivpu/Kconfig"
drivers/accel/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_DRM_ACCEL_AMDAIE) += amd-ai-engine/ obj-$(CONFIG_DRM_ACCEL_AMDXDNA) += amdxdna/ obj-$(CONFIG_DRM_ACCEL_HABANALABS) += habanalabs/ obj-$(CONFIG_DRM_ACCEL_IVPU) += ivpu/
drivers/accel/amd-ai-engine/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config DRM_ACCEL_AMDAIE + tristate "AMD Versal AI Engine" + depends on ARM64 || COMPILE_TEST + depends on ZYNQMP_FIRMWARE + depends on DRM_ACCEL + help + This option enables support for the AMD AI engine driver. + One AMD AI engine device can have multiple partitions (groups of + AI engine tiles). AMD AI engine device driver instance manages + AI engine partitions. Applications access its partitions through + AI engine partition device instance. + + If unsure, say N
drivers/accel/amd-ai-engine/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for AMD AI engine device driver + +obj-$(CONFIG_DRM_ACCEL_AMDAIE) += amd-aie.o + +amd-aie-$(CONFIG_DRM_ACCEL_AMDAIE) := \ + ai-engine-aie.o \ + ai-engine-aperture.o \ + ai-engine-dev.o \ + ai-engine-part.o \ + ai-engine-res.o
drivers/accel/amd-ai-engine/ai-engine-aie.c new file +46 -0
46 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-aperture.c new file +195 -0
195 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-dev.c new file +228 -0
228 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-internal.h new file +230 -0
230 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-part.c new file +65 -0
65 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-res.c new file +114 -0
114 lines not on this page · raw message
include/linux/amd-ai-engine.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 6/9 accel: amd-ai-engine: Add support to enable/disable clocks and change clock frequency
In reply to Gregory WilliamsAdds support for getting current and setting AI engine array frequency. Frequency values are validated by the driver then passed to the Versal firmware driver. Support is also added to request and release tiles. Requesting tiles will enable the clocks of the tiles requested, releasing tiles will disable the tile clocks.
--- drivers/accel/amd-ai-engine/Makefile | 1 + drivers/accel/amd-ai-engine/ai-engine-aie.c | 234 ++++++++++++ drivers/accel/amd-ai-engine/ai-engine-clock.c | 338 ++++++++++++++++++ .../accel/amd-ai-engine/ai-engine-internal.h | 46 +++ drivers/accel/amd-ai-engine/ai-engine-part.c | 28 +- drivers/accel/amd-ai-engine/ai-engine-res.c | 54 +++ include/linux/amd-ai-engine.h | 3 + 7 files changed, 703 insertions(+), 1 deletion(-) create mode 100644 drivers/accel/amd-ai-engine/ai-engine-clock.c
drivers/accel/amd-ai-engine/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_DRM_ACCEL_AMDAIE) += amd-aie.o amd-aie-$(CONFIG_DRM_ACCEL_AMDAIE) := \ ai-engine-aie.o \ ai-engine-aperture.o \ + ai-engine-clock.o \ ai-engine-dev.o \ ai-engine-part.o \ ai-engine-res.o
drivers/accel/amd-ai-engine/ai-engine-aie.c +234 -0
254 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-clock.c new file +338 -0
338 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-internal.h +46 -0
88 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-part.c +27 -1
@@ -20,12 +20,14 @@ void aie_part_release(struct aie_partition *apart) {struct aie_aperture *aperture = apart->aperture; +aie_part_set_freq (apart,0 );mutex_lock (&aperture->mlock); -aie_resource_put_region (&aperture->cols_res, apart->range.start.col - aperture->range.start.col, apart->range.size.col); +aie_resource_uninitialize (&apart->cores_clk_state); +aie_resource_uninitialize (&apart->tiles_inuse);list_del (&apart->node);devm_kfree (aperture->dev, apart);mutex_unlock (&aperture->mlock);
@@ -48,6 +50,7 @@ struct aie_partition *aie_part_create(struct aie_aperture *aperture, u8 start_col, u8 num_col) {struct aie_partition *apart; +int ret, num_tiles; apart =devm_kzalloc (aperture->dev,sizeof (*apart),GFP_KERNEL );if (!apart)
@@ -61,5 +64,28 @@ struct aie_partition *aie_part_create(struct aie_aperture *aperture, apart->range.start.row = aperture->range.start.row; apart->range.size.row = aperture->range.size.row; +/* SHIM row always enabled so it is not needed in the bitmap */ + num_tiles = apart->range.size.col * (apart->range.size.row -1 ); + ret =aie_resource_initialize (&apart->cores_clk_state, num_tiles); +if (ret) { +dev_err (aperture->dev,"failed to initialize clock state resource." ); +return ERR_PTR (ret); + } + + ret =aie_resource_initialize (&apart->tiles_inuse, num_tiles); +if (ret) { +dev_err (aperture->dev,"failed to initialize tiles in use resource." ); +aie_resource_uninitialize (&apart->cores_clk_state); +return ERR_PTR (ret); + } + + ret =aie_part_scan_clk_state (apart); +if (ret) { +dev_err (aperture->dev,"failed to scan clock state." ); +aie_resource_uninitialize (&apart->cores_clk_state); +aie_resource_uninitialize (&apart->tiles_inuse); +return ERR_PTR (ret); + } +return apart; }
drivers/accel/amd-ai-engine/ai-engine-res.c +54 -0
57 lines not on this page · raw message
include/linux/amd-ai-engine.h +3 -0
@@ -42,5 +42,8 @@ struct aie_location {void *aie_partition_request (struct device *dev,struct aie_partition_req *req);void aie_partition_release (void *apart); +int aie_partition_set_freq_req (void *apart,u64 freq); +int aie_partition_get_freq (void *apart,u64 *freq); +int aie_partition_get_freq_req (void *apart,u64 *freq);#endif
Signature · 1 line
2.34.1
PATCH 7/9 accel: amd-ai-engine: Add support for AIEML devices
In reply to Gregory WilliamsAdds driver support for AIEML generation devices. The following modules are enabled:
- Get tile type from location (support for new memory tile type)
- Clock state tracking and request and release of tiles
--- drivers/accel/amd-ai-engine/Makefile | 1 + drivers/accel/amd-ai-engine/ai-engine-aieml.c | 210 ++++++++++++++++++ drivers/accel/amd-ai-engine/ai-engine-dev.c | 2 + .../accel/amd-ai-engine/ai-engine-internal.h | 2 + 4 files changed, 215 insertions(+) create mode 100644 drivers/accel/amd-ai-engine/ai-engine-aieml.c
drivers/accel/amd-ai-engine/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_DRM_ACCEL_AMDAIE) += amd-aie.o amd-aie-$(CONFIG_DRM_ACCEL_AMDAIE) := \ ai-engine-aie.o \ + ai-engine-aieml.o \ ai-engine-aperture.o \ ai-engine-clock.o \ ai-engine-dev.o \
drivers/accel/amd-ai-engine/ai-engine-aieml.c new file +210 -0
210 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-dev.c +2 -0
@@ -154,6 +154,8 @@ static int amd_ai_engine_probe(struct platform_device *pdev) adev->dev_gen = aie_gen;if (aie_gen ==AIE_DEVICE_GEN_AIE ) {aie_device_init (adev); + }else if (aie_gen ==AIE_DEVICE_GEN_AIEML ) { +aieml_device_init (adev); }else {dev_err (&pdev->dev,"Invalid device generation" );return -EINVAL ;
drivers/accel/amd-ai-engine/ai-engine-internal.h +2 -0
@@ -19,6 +19,7 @@#include <linux/platform_device.h> #define AIE_DEVICE_GEN_AIE 1U +#define AIE_DEVICE_GEN_AIEML 2U#define KBYTES (n) ((n) * SZ_1K)
@@ -246,6 +247,7 @@ static inline u32 aie_cal_regoff(struct aie_device *adev, }void aie_device_init (struct aie_device *adev); +void aieml_device_init (struct aie_device *adev);struct aie_partition *aie_aperture_request_part (struct aie_aperture *aperture,struct aie_partition_req *req);
Signature · 1 line
2.34.1
PATCH 8/9 accel: amd-ai-engine: Create tile memory information
In reply to Gregory WilliamsCreates tile memory information structure to store size and offsets for core data and program memory and memory tile memory for AIEML.
--- drivers/accel/amd-ai-engine/ai-engine-aie.c | 39 +++++++++ drivers/accel/amd-ai-engine/ai-engine-aieml.c | 47 ++++++++++ .../accel/amd-ai-engine/ai-engine-internal.h | 85 +++++++++++++------ drivers/accel/amd-ai-engine/ai-engine-part.c | 45 ++++++++++ 4 files changed, 192 insertions(+), 24 deletions(-)
drivers/accel/amd-ai-engine/ai-engine-aie.c +39 -0
@@ -16,6 +16,8 @@#define AIE_COL_SHIFT 23U#define AIE_ROW_SHIFT 18U +#define NUM_TYPES_OF_MEM 2U +/* * Register offsets */
@@ -41,6 +43,42 @@ static u32 aie_get_tile_type(struct aie_device *adev, struct aie_location *loc)return AIE_TILE_TYPE_SHIMNOC ; } +static unsigned int aie_get_mem_info (struct aie_device *adev, +struct aie_range *range, +struct aie_part_mem *pmem) +{ +u8 start_row, num_rows; +unsigned int i; + +if (range->start.row + range->size.row <=1 ) { +/* SHIM row only, no memories in this range */ +return 0 ; + } +if (!pmem) +return NUM_TYPES_OF_MEM ; + +for (i =0 ; i <NUM_TYPES_OF_MEM ; i++) { +struct aie_mem *mem = &pmem[i].mem; + +memcpy (&mem->range, range,sizeof (*range)); + } + + start_row = adev->ttype_attr[AIE_TILE_TYPE_TILE ].start_row; + num_rows = adev->ttype_attr[AIE_TILE_TYPE_TILE ].num_rows; +/* Setup tile data memory information */ + pmem[0 ].mem.offset =0 ; + pmem[0 ].mem.size =KBYTES (32 ); + pmem[0 ].mem.range.start.row = start_row; + pmem[0 ].mem.range.size.row = num_rows; +/* Setup program memory information */ + pmem[1 ].mem.offset =0x20000 ; + pmem[1 ].mem.size =KBYTES (16 ); + pmem[1 ].mem.range.start.row = start_row; + pmem[1 ].mem.range.size.row = num_rows; + +return NUM_TYPES_OF_MEM ; +} +/* aie_scan_part_clocks() - scan clocks of a partition * @apart: AI engine partition *
@@ -258,6 +296,7 @@ static int aie_set_part_clocks(struct aie_partition *apart) }static const struct aie_tile_operations aie_ops = { .get_tile_type = aie_get_tile_type, + .get_mem_info = aie_get_mem_info, .scan_part_clocks = aie_scan_part_clocks, .set_part_clocks = aie_set_part_clocks, };
drivers/accel/amd-ai-engine/ai-engine-aieml.c +47 -0
59 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-internal.h +61 -24
115 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-part.c +45 -0
63 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 9/9 accel: amd-ai-engine: Adds AI Engine reset operations
In reply to Gregory WilliamsAdds AI Engine hardware reset functionality. Adds call to initialize and teardown partitions. Partition initialize resets columns, resets shim tiles, sets up AXIMM error reporting, ungates column clocks, sets up partition isolation, and zeroizes all tile memories. Teardown resets columns, resets shim tiles, zeroizes all tile memories, and gates column clocks.
--- drivers/accel/amd-ai-engine/Makefile | 3 +- drivers/accel/amd-ai-engine/ai-engine-aie.c | 104 ++++++ drivers/accel/amd-ai-engine/ai-engine-aieml.c | 105 ++++++ drivers/accel/amd-ai-engine/ai-engine-clock.c | 16 +- .../accel/amd-ai-engine/ai-engine-internal.h | 45 +++ drivers/accel/amd-ai-engine/ai-engine-part.c | 31 ++ drivers/accel/amd-ai-engine/ai-engine-res.c | 16 + drivers/accel/amd-ai-engine/ai-engine-reset.c | 300 ++++++++++++++++++ include/linux/amd-ai-engine.h | 24 ++ 9 files changed, 629 insertions(+), 15 deletions(-) create mode 100644 drivers/accel/amd-ai-engine/ai-engine-reset.c
drivers/accel/amd-ai-engine/Makefile +2 -1
@@ -11,4 +11,5 @@ amd-aie-$(CONFIG_DRM_ACCEL_AMDAIE) := \ ai-engine-clock.o \ ai-engine-dev.o \ ai-engine-part.o \ - ai-engine-res.o + ai-engine-res.o \ + ai-engine-reset.o
drivers/accel/amd-ai-engine/ai-engine-aie.c +104 -0
138 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-aieml.c +105 -0
138 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-clock.c +2 -14
@@ -81,9 +81,6 @@ bool aie_part_check_clk_enable_loc(struct aie_partition *apart,int aie_part_request_tiles (struct aie_partition *apart,int num_tiles,struct aie_location *locs) { -int ret; - -mutex_lock (&apart->mlock);if (num_tiles ==0 ) {aie_resource_set (&apart->tiles_inuse,0 , apart->tiles_inuse.total);
@@ -102,10 +99,7 @@ int aie_part_request_tiles(struct aie_partition *apart, int num_tiles,aie_resource_set (&apart->tiles_inuse, bit,1 ); } } - ret = apart->adev->ops->set_part_clocks (apart); -mutex_unlock (&apart->mlock); - -return ret; +return apart->adev->ops->set_part_clocks (apart); }/**
@@ -121,9 +115,6 @@ int aie_part_request_tiles(struct aie_partition *apart, int num_tiles,int aie_part_release_tiles (struct aie_partition *apart,int num_tiles,struct aie_location *locs) { -int ret; - -mutex_lock (&apart->mlock);if (num_tiles ==0 ) {aie_resource_clear (&apart->tiles_inuse,0 , apart->tiles_inuse.total);
@@ -143,10 +134,7 @@ int aie_part_release_tiles(struct aie_partition *apart, int num_tiles, } } - ret = apart->adev->ops->set_part_clocks (apart); -mutex_unlock (&apart->mlock); - -return ret; +return apart->adev->ops->set_part_clocks (apart); }/**
drivers/accel/amd-ai-engine/ai-engine-internal.h +45 -0
117 lines not on this page · raw message
drivers/accel/amd-ai-engine/ai-engine-part.c +31 -0
@@ -12,6 +12,35 @@#include "ai-engine-internal.h" +/* +* aie_partition_initialize() - Initialize AI engine partition +* @apart: AI engine partition instance +* @args: User initialization options +* +* Return: 0 for success, negative value for failure +*/ +int aie_partition_initialize (void *apart,struct aie_partition_init_args *args) +{ +if (!apart) +return -EINVAL ; +return aie_part_initialize ((struct aie_partition *)apart, args); +} +EXPORT_SYMBOL_GPL (aie_partition_initialize); + +/* +* aie_partition_reset() - Reset AI engine partition +* @apart: AI engine partition instance +* +* Return: 0 for success, negative value for failure +*/ +int aie_partition_teardown (void *apart) +{ +if (!apart) +return -EINVAL ; +return aie_part_teardown ((struct aie_partition *)apart); +} +EXPORT_SYMBOL_GPL (aie_partition_teardown); +/** * aie_part_create_mems_info() - creates array to store the AI engine partition * different memories types information
@@ -58,6 +87,8 @@ void aie_part_release(struct aie_partition *apart) {struct aie_aperture *aperture = apart->aperture; +/* aie_part_clean() will do hardware reset */ +aie_part_clean (apart);aie_part_set_freq (apart,0 );mutex_lock (&aperture->mlock); aie_resource_put_region(&aperture->cols_res,
drivers/accel/amd-ai-engine/ai-engine-res.c +16 -0
@@ -151,6 +151,22 @@ int aie_resource_clear(struct aie_resource *res, u32 start, u32 count)return 0 ; } +/** +* aie_resource_clear_all() - clear all the AI engine resource bits +* @res: pointer to AI engine resource +* @return: 0 for success and negative value for failure +* +* This function clears all the bits in the resource. +*/ +int aie_resource_clear_all (struct aie_resource *res) +{ +if (!res || !res->bitmap) +return -EINVAL ; + +bitmap_clear (res->bitmap,0 , res->total); +return 0 ; +} +/** * aie_resource_testbit() - test if a bit is set in a AI engine resource * @res: pointer to AI engine resource
drivers/accel/amd-ai-engine/ai-engine-reset.c new file +300 -0
300 lines not on this page · raw message
include/linux/amd-ai-engine.h +24 -0
@@ -12,6 +12,16 @@#include <linux/list.h> #include <linux/mutex.h> +/* +* AI engine partition initialize options +*/ +#define AIE_PART_INIT_OPT_COLUMN_RST BIT(0) +#define AIE_PART_INIT_OPT_SHIM_RST BIT(1) +#define AIE_PART_INIT_OPT_BLOCK_NOCAXIMMERR BIT(2) +#define AIE_PART_INIT_OPT_ISOLATE BIT(3) +#define AIE_PART_INIT_OPT_ZEROIZEMEM BIT(4) +#define AIE_PART_INIT_OPT_DEFAULT GENMASK(3, 0) +/** * struct aie_partition_req - AIE request partition arguments * @start_col: start column of the partition
@@ -40,8 +50,22 @@ struct aie_location {u32 row; }; +/** +* struct aie_partition_init_args - AIE partition initialization arguments +* @locs: Allocated array of tile locations that will be used +* @num_tiles: Number of tiles to use +* @init_opts: Partition initialization options +*/ +struct aie_partition_init_args { +struct aie_location *locs; +u32 num_tiles; +u32 init_opts; +}; +void *aie_partition_request (struct device *dev,struct aie_partition_req *req);void aie_partition_release (void *apart); +int aie_partition_initialize (void *apart,struct aie_partition_init_args *args); +int aie_partition_teardown (void *apart);int aie_partition_set_freq_req (void *apart,u64 freq);int aie_partition_get_freq (void *apart,u64 *freq);int aie_partition_get_freq_req (void *apart,u64 *freq);
Signature · 1 line
2.34.1