Skip to content

Commit 62bf3ec

Browse files
xdavidzNishadSarafAdvaitNaikaktondakhoulz0507
authored
Npu3 done (#790)
* Unify DPT (Debug/Profile/Trace) firmware debug across generations (#733) - Introduce a single DPT-based infrastructure for firmware debug/profile/trace across current and future devices. Remove legacy event-trace/DRAM logging to cut redundancy. - Improve ring handling by extending 32-bit FW pointers to 64-bit in-driver, making wrap and tail tracking robust and transparent - Enable firmware logging by default at ERROR level. Simplify usage via a boolean debugfs node (dump_fw_log) to toggle printing to dmesg. - Provide module params for advanced control (fw_log_level, fw_log_size, poll_fw_log). - Establish common management-DMA helpers for buffer allocation/handling. More consolidation to follow. Signed-off-by: Nishad Saraf <[email protected]> * Fix coverity use after free (#744) Fix coverity use after free. Signed-off-by: Nishad Saraf <[email protected]> * shim changes for dump log pr (#738) Signed-off-by: advanaik <[email protected]> Signed-off-by: David Zhang <[email protected]> Co-authored-by: advanaik <[email protected]> * VTD submodule removal (#745) * VTD submod removal Signed-off-by: Akshay Tondak <[email protected]> * subdir removal Signed-off-by: Akshay Tondak <[email protected]> --------- Signed-off-by: Akshay Tondak <[email protected]> * Fix hangs while quering HW context report (#741) Fix hangs while quering HW context report on platforms that do not support app health. Signed-off-by: Nishad Saraf <[email protected]> * XRT, VTD submodule update and shim changes (#737) * XRT, VTD submodule update and shim changes Signed-off-by: Akshay Tondak <[email protected]> * VTD update Signed-off-by: Akshay Tondak <[email protected]> * use last firmware for verbose in-memory log (#739) Signed-off-by: David Zhang <[email protected]> * Unify DPT (Debug/Profile/Trace) firmware debug across generations (#733) - Introduce a single DPT-based infrastructure for firmware debug/profile/trace across current and future devices. Remove legacy event-trace/DRAM logging to cut redundancy. - Improve ring handling by extending 32-bit FW pointers to 64-bit in-driver, making wrap and tail tracking robust and transparent - Enable firmware logging by default at ERROR level. Simplify usage via a boolean debugfs node (dump_fw_log) to toggle printing to dmesg. - Provide module params for advanced control (fw_log_level, fw_log_size, poll_fw_log). - Establish common management-DMA helpers for buffer allocation/handling. More consolidation to follow. Signed-off-by: Nishad Saraf <[email protected]> * Fix coverity use after free (#744) Fix coverity use after free. Signed-off-by: Nishad Saraf <[email protected]> * shim changes for dump log pr (#738) Signed-off-by: advanaik <[email protected]> Signed-off-by: David Zhang <[email protected]> Co-authored-by: advanaik <[email protected]> * VTD submodule removal (#745) * VTD submod removal Signed-off-by: Akshay Tondak <[email protected]> * subdir removal Signed-off-by: Akshay Tondak <[email protected]> --------- Signed-off-by: Akshay Tondak <[email protected]> * Report addition Signed-off-by: Akshay Tondak <[email protected]> --------- Signed-off-by: Akshay Tondak <[email protected]> Signed-off-by: David Zhang <[email protected]> Signed-off-by: Nishad Saraf <[email protected]> Signed-off-by: advanaik <[email protected]> Co-authored-by: David Zhang <[email protected]> Co-authored-by: Nishad Saraf <[email protected]> Co-authored-by: advanaik <[email protected]> * fix ubuf failure when iommu_mode=1 (#742) Signed-off-by: Lizhi Hou <[email protected]> * Validate changes required for telluride (#736) Signed-off-by: Manoj Takasi <[email protected]> * Added proper cleanup function for imported bos (#743) Signed-off-by: Manoj Takasi <[email protected]> * General housekeeping (#749) General housekeeping. Signed-off-by: Nishad Saraf <[email protected]> * App health test wait forever and expect TDR (#751) App health test wait forever and expect TDR. Signed-off-by: Nishad Saraf <[email protected]> * Make FW log parser device specific (#752) FW log buffer format may vary based on the device generation. Make the parser logic device specific. Signed-off-by: Nishad Saraf <[email protected]> * add dbg bo sync (#753) Signed-off-by: Max Zhen <[email protected]> * Added bo export support in VE2 (#757) Signed-off-by: Bikash Singha <[email protected]> Co-authored-by: Bikash Singha <[email protected]> * Update XRT package to 202520.2.20.152 (#756) * Add <iostream> header when it is required Due to XRT package update, <iostream> include is removed from some XRT header files, we should not rely on XRT header to include <iostream> whenever it is required, we include <iostream> Signed-off-by: Wendy Liang <[email protected]> * xrt: update xrt version to 202520.2.20.152 Update XRT package version to 202520.2.20.152 Signed-off-by: Wendy Liang <[email protected]> --------- Signed-off-by: Wendy Liang <[email protected]> * Add xrt_test option for vf concurrency test (#732) Signed-off-by: Hayden Laccabue <[email protected]> * XDNA driver cache last async error and provide ioctl to enable user to get the async error (#740) * amdxdna: aie2_smu: remove busy wait until SMU_RESP_REG before submit commands As the aie2_smu_exec() function is the only funciton in XDNA driver to submit SMU commands and wait until it has finished. And the function does lock around the SMU registers access. And the NPU SMU is only used by xdna. Removed the need to poll the SMU_RESP_REG until it is cleared before commiting new SMU command. Signed-off-by: Wendy Liang <[email protected]> * xdna: driver: cache last async error and add ioctl to get last async error Cache the last async error received from device, and implement ioctl to returns the get last async error with the encoded error code defined in XRT layer and the timestamp in micro seconds on when driver received the event. Signed-off-by: Wendy Liang <[email protected]> * shim: implemnt xocl_errors query to get last async error Implement xocl_errors query to get the last async error from device through XDNA driver ioctl. Signed-off-by: Wendy Liang <[email protected]> * test: shim: add async error verification Add async error verification to test async event generated from hardware, and we can use get array ioctl to get the last async error. as phx firmware behaves differently on when to clear the async errors, limit the test to npu4. Signed-off-by: Wendy Liang <[email protected]> --------- Signed-off-by: Wendy Liang <[email protected]> * Change print to debug level (#758) Change print to debug level. Signed-off-by: Nishad Saraf <[email protected]> * driver: amdxdna: error: get last error add missing unlock (#760) Add missing unlock when there is no cached error. Signed-off-by: Wendy Liang <[email protected]> * moving to latest xrt for import/export bo issues across xdna & zocl (#761) Co-authored-by: Ch Vamshi Krishna <[email protected]> * Create support for FLR (#746) Signed-off-by: Hayden Laccabue <[email protected]> * switch to latest umq version (#759) Signed-off-by: David Zhang <[email protected]> * Updated bo allocation with AMDXDNA_BO_SHARE type (#763) Signed-off-by: Bikash Singha <[email protected]> Co-authored-by: Bikash Singha <[email protected]> * Fix return value for aie-partitions query (#766) Fix return value for aie-partitions query. (cherry picked from commit 86e76e6) Signed-off-by: Nishad Saraf <[email protected]> * create cma bo with carvedout fashion for ve2 (#748) Signed-off-by: Bikash Singha <[email protected]> Co-authored-by: Bikash Singha <[email protected]> * [XRT-SMI] Archive migration (#764) Signed-off-by: Akshay Tondak <[email protected]> * fix uninitialized varible (#769) Signed-off-by: Max Zhen <[email protected]> * Removing redundant files (#768) Signed-off-by: Akshay Tondak <[email protected]> * Remove device specific mgmt buffer APIs (#771) Remove device specific mgmt buffer APIs. Signed-off-by: Nishad Saraf <[email protected]> * test: shim: add read async error multi times in multi threads (#772) Add test case to read async errors multiple times in multiple threads. To test async error read when there is no errors, we will need to run the test after xdna module is probed and before any runs launched on the hardware. Signed-off-by: Wendy Liang <[email protected]> * Updated xdna_bo.cpp to maintain bo ref count if we creae on the same process (#774) Signed-off-by: Manoj Takasi <[email protected]> * Fix uninitialized app health report pointer (#775) Fix uninitialized app health report pointer. Signed-off-by: Nishad Saraf <[email protected]> * Free buffer on failure and minor fixes (#776) Free buffer on failure and minor fixes. Signed-off-by: Nishad Saraf <[email protected]> * test: shim: add instruction code invalid address access test (#773) Add test case to have instruction code access invalid address we should expect timeout and then, if we start a good run, the good run should finish properly. Signed-off-by: Wendy Liang <[email protected]> * Telluride opensrc (#770) * Adding temporal_sharing code and other latest chenges into xdna repo Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixed the review comments Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixed the review comments Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixing the codeing style issue Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixed code style issue for ve2_mgmt.c file Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed code style issue for ve2_mgmt.c file 1 Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed code style issue for ve2_hwctx.c file v1 Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed code style issue for ve2 file v1 Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed code style issue for ve2 file v1 Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed code style issue for ve2 file v2 Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed code style issue for ve2 file v3 Signed-off-by: Kaijar, Saifuddin <[email protected]> * Fixed coding style issues Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixed issues after amdxdna_cma memory allocation introduced Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixed review commets Signed-off-by: Saifuddin Kaijar <[email protected]> * Fixed one codingsty issue Signed-off-by: Saifuddin Kaijar <[email protected]> * Just a dummy changes in amdxdna files to force to build the driver again Signed-off-by: Saifuddin Kaijar <[email protected]> * Remove volatile keyword from ve2 driver Signed-off-by: Saifuddin Kaijar <[email protected]> * Removed another codingsty_check Signed-off-by: Saifuddin Kaijar <[email protected]> --------- Signed-off-by: Saifuddin Kaijar <[email protected]> Signed-off-by: Kaijar, Saifuddin <[email protected]> * Properly support exporting and importing BO in the same process (#778) Signed-off-by: Max Zhen <[email protected]> * fixing qos property in ve2 (#779) Co-authored-by: Ch Vamshi Krishna <[email protected]> * disable force preemption test in virtio environment (#782) Signed-off-by: Max Zhen <[email protected]> * Add debug prints and fix typo (#784) Add debug prints and fix typo. Signed-off-by: Nishad Saraf <[email protected]> * Update get async error ioctl to return only 0 for success case (#783) * amdxdna: get async error returns only 0 for success This patch has two changes: * returns 0 only in when get async error success * restruct aie2 get array ioctl implementation to split get async error information implementation and get other hardware context information implementation. * remove aie2_error get async error implementation as it is just a very thin wrapper which is not necessary. Signed-off-by: Wendy Liang <[email protected]> * shim: specify only one elment to get async error information As there is only last element in the information array for getting the last async error. Change the number of element to 1. --------- Signed-off-by: Wendy Liang <[email protected]> * Add debugfs node to dump raw fw log buffer (#785) Add debugfs node to dump raw fw log buffer. Signed-off-by: Nishad Saraf <[email protected]> * Fix NULL pointer dereference for invalid sequence number (#789) Fix NULL pointer dereference for invalid sequence number. Signed-off-by: Nishad Saraf <[email protected]> * Fix SMU power off issue (#787) * Fix SMU power off issue * Fix SMU power off issue * Fix SMU power off issue * Revert "Fix SMU power off issue" This reverts commit af1867a. * Fix SMU power off issue * update testcase timeout value and check (#777) * timeout value change; compare and dump ofm after timeout Signed-off-by: advanaik <[email protected]> * dump ofm to file after timeout Signed-off-by: advanaik <[email protected]> * yolov3 host code Signed-off-by: advanaik <[email protected]> --------- Signed-off-by: advanaik <[email protected]> * dophine pass Signed-off-by: David Zhang <[email protected]> * pasid fix Signed-off-by: David Zhang <[email protected]> --------- Signed-off-by: Nishad Saraf <[email protected]> Signed-off-by: advanaik <[email protected]> Signed-off-by: David Zhang <[email protected]> Signed-off-by: Akshay Tondak <[email protected]> Signed-off-by: Lizhi Hou <[email protected]> Signed-off-by: Manoj Takasi <[email protected]> Signed-off-by: Max Zhen <[email protected]> Signed-off-by: Bikash Singha <[email protected]> Signed-off-by: Wendy Liang <[email protected]> Signed-off-by: Hayden Laccabue <[email protected]> Signed-off-by: Saifuddin Kaijar <[email protected]> Signed-off-by: Kaijar, Saifuddin <[email protected]> Co-authored-by: Nishad Saraf <[email protected]> Co-authored-by: advanaik <[email protected]> Co-authored-by: Akshay Tondak <[email protected]> Co-authored-by: Lizhi Hou <[email protected]> Co-authored-by: Manoj Takasi <[email protected]> Co-authored-by: Max Zhen <[email protected]> Co-authored-by: Bikash Singha <[email protected]> Co-authored-by: Bikash Singha <[email protected]> Co-authored-by: Wendy Liang <[email protected]> Co-authored-by: Hayden Laccabue <[email protected]> Co-authored-by: Ch Vamshi Krishna <[email protected]> Co-authored-by: Ch Vamshi Krishna <[email protected]> Co-authored-by: Saifuddin Kaijar <[email protected]> Co-authored-by: amd-kirkirov <[email protected]> Co-authored-by: AdvaitNaik <[email protected]>
1 parent acfdd57 commit 62bf3ec

File tree

164 files changed

+4149
-68004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+4149
-68004
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "xrt"]
22
path = xrt
33
url = https://github.com/Xilinx/XRT.git
4-
[submodule "VTD"]
5-
path = VTD
6-
url = https://github.com/Xilinx/VTD.git

CMake/pkg.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,33 @@ install(DIRECTORY ${AMDXDNA_BINS_DIR}/download_raw/xbutil_validate/bins/
7373
PATTERN "*.yaml"
7474
)
7575

76+
include(FetchContent)
77+
78+
FetchContent_Declare(
79+
vtd_strx_archive
80+
URL "https://github.com/Xilinx/VTD/raw/403740c18e709f82b3880fae53d412331ed907b1/runner/strx/xrt_smi_strx.a"
81+
DOWNLOAD_NO_EXTRACT ON
82+
DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/vtd_downloads"
83+
)
84+
85+
FetchContent_Declare(
86+
vtd_phx_archive
87+
URL "https://github.com/Xilinx/VTD/raw/403740c18e709f82b3880fae53d412331ed907b1/runner/phx/xrt_smi_phx.a"
88+
DOWNLOAD_NO_EXTRACT ON
89+
DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/vtd_downloads"
90+
)
91+
92+
message(STATUS "Downloading VTD archives from GitHub...")
93+
FetchContent_MakeAvailable(vtd_strx_archive vtd_phx_archive)
94+
message(STATUS "VTD archives downloaded successfully")
95+
96+
install(FILES
97+
"${vtd_strx_archive_SOURCE_DIR}/xrt_smi_strx.a"
98+
"${vtd_phx_archive_SOURCE_DIR}/xrt_smi_phx.a"
99+
DESTINATION ${XDNA_PKG_DATA_DIR}/bins
100+
COMPONENT ${XDNA_COMPONENT}
101+
)
102+
76103
if(NOT SKIP_KMOD)
77104

78105
install(DIRECTORY ${AMDXDNA_BINS_DIR}/firmware/

VTD

Lines changed: 0 additions & 1 deletion
This file was deleted.

WHENCE

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,6 @@ distributed for use with the XRT plug-in for NPU device.
88
--------------------------------------------------------------------------
99

1010
File:
11-
tools/bins/1502_00/validate.xclbin
12-
tools/bins/17f1_10/validate_elf.xclbin
13-
tools/bins/17f0_10/validate.xclbin
14-
tools/bins/17f0_10/validate_elf.xclbin
15-
tools/bins/17f0_11/validate.xclbin
16-
tools/bins/17f0_11/validate_elf.xclbin
17-
tools/bins/17f0_20/validate.xclbin
18-
tools/bins/17f0_20/validate_elf.xclbin
19-
tools/bins/17f1_10/nop.elf
20-
tools/bins/17f0_10/nop.elf
21-
tools/bins/17f0_10/tct_1col.elf
22-
tools/bins/17f0_10/tct_4col.elf
23-
tools/bins/17f0_10/gemm_int8.elf
24-
tools/bins/17f0_11/nop.elf
25-
tools/bins/17f0_11/tct_1col.elf
26-
tools/bins/17f0_11/tct_4col.elf
27-
tools/bins/17f0_20/nop.elf
28-
tools/bins/17f0_20/tct_1col.elf
29-
tools/bins/17f0_20/tct_4col.elf
3011
tools/bins/17f0_10/mobilenet_4col.elf
3112
tools/bins/17f0_10/mobilenet_4col.xclbin
3213
tools/bins/17f0_11/mobilenet_4col.elf
@@ -35,59 +16,5 @@ File:
3516
tools/bins/17f0_20/mobilenet_4col.xclbin
3617
tools/bins/Mobilenet/mobilenet_ifm.bin
3718
tools/bins/Mobilenet/mobilenet_param.bin
38-
tools/bins/Runner/aie_reconfig_overhead/aie_reconfig_overhead_strx.elf
39-
tools/bins/Runner/aie_reconfig_overhead/profile_aie_reconfig_strx.json
40-
tools/bins/Runner/aie_reconfig_overhead/recipe_aie_reconfig_nop_strx.json
41-
tools/bins/Runner/aie_reconfig_overhead/recipe_aie_reconfig_strx.json
42-
tools/bins/Runner/aie_reconfig_overhead/validate_strx.xclbin
43-
tools/bins/Runner/cmd_chain_latency/profile_cmd_chain_latency_strx.json
44-
tools/bins/Runner/cmd_chain_latency/recipe_cmd_chain_latency_strx.json
45-
tools/bins/Runner/cmd_chain_latency/strx/recipe_cmd_chain_latency.json
46-
tools/bins/Runner/cmd_chain_latency/validate_strx.xclbin
47-
tools/bins/Runner/cmd_chain_throughput/profile_cmd_chain_throughput_strx.json
48-
tools/bins/Runner/cmd_chain_throughput/recipe_cmd_chain_throughput_strx.json
49-
tools/bins/Runner/cmd_chain_throughput/validate_strx.xclbin
50-
tools/bins/Runner/df_bandwidth/df_bw_phx.elf
51-
tools/bins/Runner/df_bandwidth/df_bw_strx.elf
52-
tools/bins/Runner/df_bandwidth/profile_df_bandwidth_phx.json
53-
tools/bins/Runner/df_bandwidth/profile_df_bandwidth_strx.json
54-
tools/bins/Runner/df_bandwidth/recipe_df_bandwidth_phx.json
55-
tools/bins/Runner/df_bandwidth/recipe_df_bandwidth_strx.json
56-
tools/bins/Runner/df_bandwidth/validate_phx.xclbin
57-
tools/bins/Runner/df_bandwidth/validate_strx.xclbin
58-
tools/bins/Runner/gemm/gemm_int8_strx.elf
59-
tools/bins/Runner/gemm/gemm_strx.xclbin
60-
tools/bins/Runner/gemm/profile_gemm_strx.json
61-
tools/bins/Runner/gemm/recipe_gemm_strx.json
62-
tools/bins/Runner/latency/profile_latency_phx.json
63-
tools/bins/Runner/latency/profile_latency_strx.json
64-
tools/bins/Runner/latency/recipe_latency_phx.json
65-
tools/bins/Runner/latency/recipe_latency_strx.json
66-
tools/bins/Runner/latency/validate_phx.xclbin
67-
tools/bins/Runner/latency/validate_strx.xclbin
68-
tools/bins/Runner/tct_all_column/profile_tct_all_column_phx.json
69-
tools/bins/Runner/tct_all_column/profile_tct_all_column_strx.json
70-
tools/bins/Runner/tct_all_column/recipe_tct_all_column_phx.json
71-
tools/bins/Runner/tct_all_column/recipe_tct_all_column_strx.json
72-
tools/bins/Runner/tct_all_column/tct_4col.elf
73-
tools/bins/Runner/tct_all_column/validate_phx.xclbin
74-
tools/bins/Runner/tct_all_column/validate_strx.xclbin
75-
tools/bins/Runner/tct_one_column/profile_tct_one_column_phx.json
76-
tools/bins/Runner/tct_one_column/profile_tct_one_column_strx.json
77-
tools/bins/Runner/tct_one_column/recipe_tct_one_column_phx.json
78-
tools/bins/Runner/tct_one_column/recipe_tct_one_column_strx.json
79-
tools/bins/Runner/tct_one_column/tct_1col.elf
80-
tools/bins/Runner/tct_one_column/validate_phx.xclbin
81-
tools/bins/Runner/tct_one_column/validate_strx.xclbin
82-
tools/bins/Runner/throughput/nop_phx.elf
83-
tools/bins/Runner/throughput/profile_throughput_phx.json
84-
tools/bins/Runner/throughput/profile_throughput_strx.json
85-
tools/bins/Runner/throughput/recipe_throughput_phx.json
86-
tools/bins/Runner/throughput/recipe_throughput_strx.json
87-
tools/bins/Runner/throughput/validate_phx.xclbin
88-
tools/bins/Runner/throughput/validate_strx.xclbin
89-
90-
Link:
91-
tools/bins/17f3_10 -> tools/bins/17f1_10
9219

9320
Licence: Redistributable. See LICENSE.amdnpu for details.

src/driver/amdxdna/Kbuild

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,29 @@ ccflags-y += -g -Werror
1717
obj-m += amdxdna.o
1818
amdxdna-y := \
1919
amdxdna_ctx.o \
20+
amdxdna_dpt.o \
2021
amdxdna_drm.o \
2122
amdxdna_pm.o \
2223
amdxdna_sysfs.o \
2324
amdxdna_mailbox.o \
2425
amdxdna_mailbox_helper.o \
26+
amdxdna_mgmt.o \
2527
amdxdna_tdr.o \
2628
amdxdna_ubuf.o \
27-
amdxdna_carvedout_buf.o
29+
amdxdna_carvedout_buf.o \
30+
amdxdna_error.o \
31+
amdxdna_gem.o \
32+
amdxdna_cma.o \
2833

2934
amdxdna-$(OFT_CONFIG_AMDXDNA_PCI) += \
30-
amdxdna_gem.o \
3135
aie2_smu.o \
3236
aie2_psp.o \
3337
aie2_ctx.o \
3438
aie2_hwctx.o \
3539
aie2_error.o \
3640
aie2_debugfs.o \
41+
aie2_dpt.o \
3742
aie2_message.o \
38-
aie2_logging.o \
39-
aie2_event_trace.o \
4043
aie2_ctx_runqueue.o \
4144
aie2_pm.o \
4245
aie2_pci.o \
@@ -48,7 +51,6 @@ amdxdna-$(OFT_CONFIG_AMDXDNA_PCI) += \
4851
amdxdna_pci_drv.o
4952

5053
amdxdna-$(OFT_CONFIG_AMDXDNA_OF) += \
51-
amdxdna_gem_of.o \
5254
ve2_of.o \
5355
ve2_regs.o \
5456
amdxdna_of_drv.o \

src/driver/amdxdna/aie2_ctx.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,31 @@ aie2_fence_state2str(struct dma_fence *fence)
5151
void aie2_dump_ctx(struct amdxdna_ctx *ctx)
5252
{
5353
struct amdxdna_dev *xdna = ctx->client->xdna;
54-
struct aie2_mgmt_dma_hdl mgmt_hdl;
54+
struct amdxdna_mgmt_dma_hdl *dma_hdl;
5555
struct amdxdna_dev_hdl *ndev;
5656
struct app_health_report *r;
5757
u64 comp = ctx->completed;
5858
u64 sub = ctx->submitted;
5959
size_t size = sizeof(*r);
60-
void *buff;
6160
int ret;
6261

6362
ndev = xdna->dev_handle;
6463
XDNA_ERR(xdna, "Dumping ctx %s, hwctx %d, sub=%lld, comp=%lld",
6564
ctx->name, ctx->priv->id, sub, comp);
66-
buff = aie2_mgmt_buff_alloc(ndev, &mgmt_hdl, size, DMA_FROM_DEVICE);
67-
if (!buff) {
65+
dma_hdl = amdxdna_mgmt_buff_alloc(xdna, size, DMA_FROM_DEVICE);
66+
if (IS_ERR(dma_hdl)) {
6867
XDNA_WARN(xdna, "Allocate memory failed, skip get app health");
6968
return;
7069
}
7170

72-
aie2_mgmt_buff_clflush(&mgmt_hdl);
71+
amdxdna_mgmt_buff_clflush(dma_hdl, 0, 0);
7372
mutex_lock(&ndev->aie2_lock);
74-
ret = aie2_get_app_health(ndev, &mgmt_hdl, ctx->priv->id, size);
73+
ret = aie2_get_app_health(ndev, dma_hdl, ctx->priv->id, size);
7574
mutex_unlock(&ndev->aie2_lock);
7675
if (!ret) {
77-
r = buff;
76+
r = amdxdna_mgmt_buff_get_cpu_addr(dma_hdl, 0);
7877

79-
print_hex_dump_debug("raw_report: ", DUMP_PREFIX_OFFSET, 16, 4, buff, size, false);
78+
print_hex_dump_debug("raw_report: ", DUMP_PREFIX_OFFSET, 16, 4, r, size, false);
8079

8180
XDNA_ERR(xdna, "Firmware timeout state capture:");
8281
XDNA_ERR(xdna, "\tVersion: %d.%d", r->major, r->minor);
@@ -100,7 +99,7 @@ void aie2_dump_ctx(struct amdxdna_ctx *ctx)
10099
ctx->health_data.version = 0;
101100
ctx->health_reported = false;
102101
}
103-
aie2_mgmt_buff_free(&mgmt_hdl);
102+
amdxdna_mgmt_buff_free(dma_hdl);
104103

105104
mutex_lock(&ctx->priv->io_lock);
106105
for (int i = 0; i < CTX_MAX_CMDS; i++) {
@@ -957,9 +956,8 @@ int aie2_cmd_submit(struct amdxdna_ctx *ctx, struct amdxdna_sched_job *job,
957956
int ret, i;
958957

959958
ret = down_killable(&ctx->priv->job_sem);
960-
if (ret) {
959+
if (ret)
961960
XDNA_ERR(xdna, "%s Grab job sem failed, ret %d", ctx->name, ret);
962-
}
963961

964962
ret = aie2_rq_submit_enter(&xdna->dev_handle->ctx_rq, ctx);
965963
if (ret) {
@@ -1089,13 +1087,20 @@ int aie2_cmd_wait(struct amdxdna_ctx *ctx, u64 seq, u32 timeout)
10891087
signed long remaining = MAX_SCHEDULE_TIMEOUT;
10901088
long ret;
10911089

1090+
if (!out_fence) {
1091+
XDNA_ERR(ctx->client->xdna, "Invalid syncobj or sequence number");
1092+
return -EINVAL;
1093+
}
1094+
10921095
if (timeout)
10931096
remaining = msecs_to_jiffies(timeout);
1097+
10941098
ret = dma_fence_wait_timeout(out_fence, true, remaining);
10951099
if (!ret)
10961100
ret = -ETIME;
10971101
else if (ret > 0)
10981102
ret = 0;
1103+
10991104
dma_fence_put(out_fence);
11001105
return ret;
11011106
}

0 commit comments

Comments
 (0)