drm/amdgpu: fix contiguous handling for IB parsing v2
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix contiguous handling for IB parsing v2
Otherwise we won't get correct access to the IB.
v2: keep setting AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS to avoid problems in
the VRAM backend.
Signed-off-by Christian König <[email protected]>
Fixes e362b7c8f8c7 ("drm/amdgpu: Modify the contiguous flags behaviour")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8 -8
@@ -1763,7 +1763,7 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,struct ttm_operation_ctx ctx = { false, false };struct amdgpu_vm *vm = &fpriv->vm;struct amdgpu_bo_va_mapping *mapping; -int r; +int i, r; addr /=AMDGPU_GPU_PAGE_SIZE ;
@@ -1778,13 +1778,13 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,if (dma_resv_locking_ctx ((*bo)->tbo.base.resv) != &parser->exec.ticket)return -EINVAL ; -if (!((*bo)->flags &AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS )) { - (*bo)->flags |=AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS ; -amdgpu_bo_placement_from_domain (*bo, (*bo)->allowed_domains); - r =ttm_bo_validate (&(*bo)->tbo, &(*bo)->placement, &ctx); -if (r) -return r; - } + (*bo)->flags |=AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS ; +amdgpu_bo_placement_from_domain (*bo, (*bo)->allowed_domains); +for (i =0 ; i < (*bo)->placement.num_placement; i++) + (*bo)->placements[i].flags |=TTM_PL_FLAG_CONTIGUOUS ; + r =ttm_bo_validate (&(*bo)->tbo, &(*bo)->placement, &ctx); +if (r) +return r;return amdgpu_ttm_alloc_gart (&(*bo)->tbo); }
Signature · 1 line
2.34.1
Quoted 9 lines · Christian König
Otherwise we won't get correct access to the IB.
v2: keep setting
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSto avoid problems in
the VRAM backend.Signed-off-by Christian König <[email protected]>Fixes e362b7c8f8c7 ("drm/amdgpu: Modify the contiguous flags behaviour")
Cc stable
Reviewed-by Alex Deucher <[email protected]>
Quoted 41 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8
-9@@ -1763,7 +1763,7 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,struct ttm_operation_ctx ctx = { false, false };struct amdgpu_vm *vm = &fpriv->vm;struct amdgpu_bo_va_mapping *mapping; -int r; +int i, r; addr /=AMDGPU_GPU_PAGE_SIZE ;@@ -1778,13 +1778,13 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,if (dma_resv_locking_ctx ((*bo)->tbo.base.resv) != &parser->exec.ticket)return -EINVAL ; -if (!((*bo)->flags &AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS )) { - (*bo)->flags |=AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS ; -amdgpu_bo_placement_from_domain (*bo, (*bo)->allowed_domains); - r =ttm_bo_validate (&(*bo)->tbo, &(*bo)->placement, &ctx); -if (r) -return r; - } + (*bo)->flags |=AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS ; +amdgpu_bo_placement_from_domain (*bo, (*bo)->allowed_domains); +for (i =0 ; i < (*bo)->placement.num_placement; i++) + (*bo)->placements[i].flags |=TTM_PL_FLAG_CONTIGUOUS ; + r =ttm_bo_validate (&(*bo)->tbo, &(*bo)->placement, &ctx); +if (r) +return r;return amdgpu_ttm_alloc_gart (&(*bo)->tbo); } --2.34.1
Quoted 9 lines · Alex Deucher
Quoted 6 lines · Christian König
Otherwise we won't get correct access to the IB.
v2: keep setting
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUSto avoid problems in
the VRAM backend.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Christian König <[email protected]>Fixes e362b7c8f8c7 ("drm/amdgpu: Modify the contiguous flags behaviour")Cc stableReviewed-by Alex Deucher <[email protected]>
Tested-by Dave Airlie <[email protected]>
Dave.