Skip to content

Commit f3572db

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
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]> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3501 Fixes: e362b7c ("drm/amdgpu: Modify the contiguous flags behaviour") Reviewed-by: Alex Deucher <[email protected]> Cc: [email protected] Tested-by: Dave Airlie <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit fbfb5f0)
1 parent fe26546 commit f3572db

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
17781778
struct ttm_operation_ctx ctx = { false, false };
17791779
struct amdgpu_vm *vm = &fpriv->vm;
17801780
struct amdgpu_bo_va_mapping *mapping;
1781-
int r;
1781+
int i, r;
17821782

17831783
addr /= AMDGPU_GPU_PAGE_SIZE;
17841784

@@ -1793,13 +1793,13 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
17931793
if (dma_resv_locking_ctx((*bo)->tbo.base.resv) != &parser->exec.ticket)
17941794
return -EINVAL;
17951795

1796-
if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {
1797-
(*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
1798-
amdgpu_bo_placement_from_domain(*bo, (*bo)->allowed_domains);
1799-
r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, &ctx);
1800-
if (r)
1801-
return r;
1802-
}
1796+
(*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
1797+
amdgpu_bo_placement_from_domain(*bo, (*bo)->allowed_domains);
1798+
for (i = 0; i < (*bo)->placement.num_placement; i++)
1799+
(*bo)->placements[i].flags |= TTM_PL_FLAG_CONTIGUOUS;
1800+
r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, &ctx);
1801+
if (r)
1802+
return r;
18031803

18041804
return amdgpu_ttm_alloc_gart(&(*bo)->tbo);
18051805
}

0 commit comments

Comments
 (0)