summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-09-17 14:18:51 +1000
committerDave Airlie <airlied@redhat.com>2020-09-17 16:07:11 +1000
commitb40be05ed255d9a0257fb66ab2728ecca2c9d597 (patch)
treebf69d734e4413c24ce2e60f273d1de637a4aea5e /samples
parent818280d5adf1d80e78f95821815148abe9407e14 (diff)
parentbe0704beb229431f206fee3ddd65fa2c5eebdce3 (diff)
Merge branch 'for-5.10-drm-sg-fix' of https://github.com/mszyprow/linux into drm-next
Please pull a set of fixes for various DRM drivers that finally resolve incorrect usage of the scatterlists (struct sg_table nents and orig_nents entries), what causes issues when IOMMU is used. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200910080505.24456-1-m.szyprowski@samsung.com
Diffstat (limited to 'samples')
-rw-r--r--samples/vfio-mdev/mbochs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index 3cc5e5921682..e03068917273 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -846,7 +846,7 @@ static struct sg_table *mbochs_map_dmabuf(struct dma_buf_attachment *at,
if (sg_alloc_table_from_pages(sg, dmabuf->pages, dmabuf->pagecount,
0, dmabuf->mode.size, GFP_KERNEL) < 0)
goto err2;
- if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
+ if (dma_map_sgtable(at->dev, sg, direction, 0))
goto err3;
return sg;
@@ -868,6 +868,7 @@ static void mbochs_unmap_dmabuf(struct dma_buf_attachment *at,
dev_dbg(dev, "%s: %d\n", __func__, dmabuf->id);
+ dma_unmap_sgtable(at->dev, sg, direction, 0);
sg_free_table(sg);
kfree(sg);
}