diff options
author | Yong Zhao <yong.zhao@amd.com> | 2017-09-15 18:20:37 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-09-26 15:14:21 -0400 |
commit | 7bdc53f925af085ffa0580f10489f82b36cc2f1c (patch) | |
tree | 8b760f772a29969ecce509371d55e22111a19627 /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
parent | dfe5c2b76b2a32cd37283809737e55f9208f8346 (diff) |
drm/amdgpu: Fix a bug in amdgpu_fill_buffer()
When max_bytes is not 8 bytes aligned and bo size is larger than
max_bytes, the last 8 bytes in a ttm node may be left unchanged.
For example, on pre SDMA 4.0, max_bytes = 0x1fffff, and the bo size
is 0x200000, the problem will happen.
In order to fix the problem, we separately store the max nums of
PTEs/PDEs a single operation can set in amdgpu_vm_pte_funcs
structure, rather than inferring it from bytes limit of SDMA
constant fill, i.e. fill_max_bytes.
Together with the fix, we replace the hard code value "10" in
amdgpu_vm_bo_update_mapping() with the corresponding values from
structure amdgpu_vm_pte_funcs.
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index ce435dbbb398..1086f039d8e3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1527,8 +1527,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, | |||
1527 | struct dma_fence **fence) | 1527 | struct dma_fence **fence) |
1528 | { | 1528 | { |
1529 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | 1529 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); |
1530 | /* max_bytes applies to SDMA_OP_PTEPDE as well as SDMA_OP_CONST_FILL*/ | 1530 | uint32_t max_bytes = 8 * |
1531 | uint32_t max_bytes = adev->mman.buffer_funcs->fill_max_bytes; | 1531 | adev->vm_manager.vm_pte_funcs->set_max_nums_pte_pde; |
1532 | struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; | 1532 | struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; |
1533 | 1533 | ||
1534 | struct drm_mm_node *mm_node; | 1534 | struct drm_mm_node *mm_node; |
@@ -1560,8 +1560,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, | |||
1560 | ++mm_node; | 1560 | ++mm_node; |
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | /* 10 double words for each SDMA_OP_PTEPDE cmd */ | 1563 | /* num of dwords for each SDMA_OP_PTEPDE cmd */ |
1564 | num_dw = num_loops * 10; | 1564 | num_dw = num_loops * adev->vm_manager.vm_pte_funcs->set_pte_pde_num_dw; |
1565 | 1565 | ||
1566 | /* for IB padding */ | 1566 | /* for IB padding */ |
1567 | num_dw += 64; | 1567 | num_dw += 64; |