it is for large bar/xgmi which has cpu update function, for small bar that has sdma update function it will be done later. Signed-off-by: Eric Huang <jinhuieric.huang@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 21 ++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 10 +++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 67bba8462e7d..8a23de0e0abc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h @@ -247,6 +247,7 @@ struct amdgpu_vm_update_funcs { unsigned count, uint32_t incr, uint64_t flags); int (*commit)(struct amdgpu_vm_update_params *p, struct dma_fence **fence); + int (*get_pt_entry)(struct amdgpu_bo *bo, uint64_t pe, uint64_t *value); }; struct amdgpu_vm { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c index aefb3d2927d5..8a68a5c6326c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c @@ -116,9 +116,28 @@ static int amdgpu_vm_cpu_commit(struct amdgpu_vm_update_params *p, return 0; } +static int amdgpu_vm_get_pt_entry(struct amdgpu_bo *bo, + uint64_t pe, uint64_t *value) +{ + int r; + + if (bo->tbo.moving) { + r = dma_fence_wait(bo->tbo.moving, true); + if (r) + return r; + } + + pe += (unsigned long)amdgpu_bo_kptr(bo); + + *value = *((uint64_t *)pe); + + return 0; +} + const struct amdgpu_vm_update_funcs amdgpu_vm_cpu_funcs = { .map_table = amdgpu_vm_cpu_map_table, .prepare = amdgpu_vm_cpu_prepare, .update = amdgpu_vm_cpu_update, - .commit = amdgpu_vm_cpu_commit + .commit = amdgpu_vm_cpu_commit, + .get_pt_entry = amdgpu_vm_get_pt_entry }; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c index a83a646759c5..d8871fbddc76 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c @@ -274,9 +274,17 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p, return 0; } +static int amdgpu_vm_sdma_get_pt_entry(struct amdgpu_bo *bo, + uint64_t pe, uint64_t *value) +{ + /* TODO */ + return 0; +} + const struct amdgpu_vm_update_funcs amdgpu_vm_sdma_funcs = { .map_table = amdgpu_vm_sdma_map_table, .prepare = amdgpu_vm_sdma_prepare, .update = amdgpu_vm_sdma_update, - .commit = amdgpu_vm_sdma_commit + .commit = amdgpu_vm_sdma_commit, + .get_pt_entry = amdgpu_vm_sdma_get_pt_entry }; -- 2.25.1 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx