Skip to content

Commit 0199172

Browse files
BuzzBumbleBeealexdeucher
authored andcommitted
drm/amdgpu: fix scatter-gather mapping with user pages
Calls to dma_map_sg may return less segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Fixes: be62dbf ("iommu/amd: Convert AMD iommu driver to the dma-iommu api") Bug: https://bugzilla.kernel.org/show_bug.cgi?id=206461 Bug: https://bugzilla.kernel.org/show_bug.cgi?id=206895 Bug: https://gitlab.freedesktop.org/drm/amd/issues/1056 Signed-off-by: Shane Francis <[email protected]> Reviewed-by: Michael J. Ruhl <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Cc: [email protected]
1 parent 42e67b4 commit 0199172

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
974974
/* Map SG to device */
975975
r = -ENOMEM;
976976
nents = dma_map_sg(adev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
977-
if (nents != ttm->sg->nents)
977+
if (nents == 0)
978978
goto release_sg;
979979

980980
/* convert SG to linear array of pages and dma addresses */

0 commit comments

Comments
 (0)