aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Auld <[email protected]>2025-04-07 14:18:25 +0000
committerAlex Deucher <[email protected]>2025-04-07 18:31:45 +0000
commitc0dd8a9253fadfb8e5357217d085f1989da4ef0a (patch)
treed3df4e3b9123408e2005370d62941a5f589ca1e8
parentdrm/amdgpu: immediately use GTT for new allocations (diff)
downloadkernel-c0dd8a9253fadfb8e5357217d085f1989da4ef0a.tar.gz
kernel-c0dd8a9253fadfb8e5357217d085f1989da4ef0a.zip
drm/amdgpu/dma_buf: fix page_link check
The page_link lower bits of the first sg could contain something like SG_END, if we are mapping a single VRAM page or contiguous blob which fits into one sg entry. Rather pull out the struct page, and use that in our check to know if we mapped struct pages vs VRAM. Fixes: f44ffd677fb3 ("drm/amdgpu: add support for exporting VRAM using DMA-buf v3") Signed-off-by: Matthew Auld <[email protected]> Cc: Christian König <[email protected]> Cc: [email protected] Cc: <[email protected]> # v5.8+ Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 9f627caedc3f..c9842a0e2a1c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -184,7 +184,7 @@ static void amdgpu_dma_buf_unmap(struct dma_buf_attachment *attach,
struct sg_table *sgt,
enum dma_data_direction dir)
{
- if (sgt->sgl->page_link) {
+ if (sg_page(sgt->sgl)) {
dma_unmap_sgtable(attach->dev, sgt, dir, 0);
sg_free_table(sgt);
kfree(sgt);