diff options
author | Jack Xiao <Jack.Xiao@amd.com> | 2020-03-27 16:36:43 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2022-05-04 17:43:52 +0300 |
commit | a22f760a02f80d140147de4b504bd7531b268e62 (patch) | |
tree | e6d3bdab4225021c28ab7bde22a2ee6db61cd556 /drivers/gpu | |
parent | 712ce872213c1d503c6e65deab91769d63f980d1 (diff) | |
download | linux-a22f760a02f80d140147de4b504bd7531b268e62.tar.xz |
drm/amdgpu/mes: map ctx metadata for mes self test
Map ctx metadata for mes self test.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index 6c01581e3a7b..b440b36dd98a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -882,3 +882,40 @@ void amdgpu_mes_ctx_free_meta_data(struct amdgpu_mes_ctx_data *ctx_data) if (ctx_data->meta_data_obj) amdgpu_bo_free_kernel(&ctx_data->meta_data_obj, NULL, NULL); } + +static int amdgpu_mes_test_map_ctx_meta_data(struct amdgpu_device *adev, + struct amdgpu_vm *vm, + struct amdgpu_mes_ctx_data *ctx_data) +{ + struct amdgpu_bo_va *meta_data_va = NULL; + uint64_t meta_data_addr = AMDGPU_VA_RESERVED_SIZE; + int r; + + r = amdgpu_map_static_csa(adev, vm, ctx_data->meta_data_obj, + &meta_data_va, meta_data_addr, + sizeof(struct amdgpu_mes_ctx_meta_data)); + if (r) + return r; + + r = amdgpu_vm_bo_update(adev, meta_data_va, false); + if (r) + goto error; + + r = amdgpu_vm_update_pdes(adev, vm, false); + if (r) + goto error; + + dma_fence_wait(vm->last_update, false); + dma_fence_wait(meta_data_va->last_pt_update, false); + + ctx_data->meta_data_gpu_addr = meta_data_addr; + ctx_data->meta_data_va = meta_data_va; + + return 0; + +error: + BUG_ON(amdgpu_bo_reserve(ctx_data->meta_data_obj, true)); + amdgpu_vm_bo_rmv(adev, meta_data_va); + amdgpu_bo_unreserve(ctx_data->meta_data_obj); + return r; +} |