Re: [PATCH v2 1/4] drm/i915/dmabuf: fix sg_table handling in map_dma_buf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: Auld, Matthew <matthew.auld@xxxxxxxxx>
>Sent: Friday, October 28, 2022 11:50 AM
>To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>Cc: Landwerlin, Lionel G <lionel.g.landwerlin@xxxxxxxxx>; Tvrtko Ursulin
><tvrtko.ursulin@xxxxxxxxxxxxxxx>; Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>;
>Ruhl, Michael J <michael.j.ruhl@xxxxxxxxx>
>Subject: [PATCH v2 1/4] drm/i915/dmabuf: fix sg_table handling in
>map_dma_buf
>
>We need to iterate over the original entries here for the sg_table,
>pulling out the struct page for each one, to be remapped. However
>currently this incorrectly iterates over the final dma mapped entries,
>which is likely just one gigantic sg entry if the iommu is enabled,
>leading to us only mapping the first struct page (and any physically
>contiguous pages following it), even if there is potentially lots more
>data to follow.

I like this patch set a lot better. 😊

Reviewed-by: Michael J. Ruhl <michael.j.ruhl@xxxxxxxxx>

M

>Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/7306
>Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
>Cc: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
>Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx>
>Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>Cc: Michael J. Ruhl <michael.j.ruhl@xxxxxxxxx>
>---
> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>index 07eee1c09aaf..05ebbdfd3b3b 100644
>--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>@@ -40,13 +40,13 @@ static struct sg_table *i915_gem_map_dma_buf(struct
>dma_buf_attachment *attachme
> 		goto err;
> 	}
>
>-	ret = sg_alloc_table(st, obj->mm.pages->nents, GFP_KERNEL);
>+	ret = sg_alloc_table(st, obj->mm.pages->orig_nents, GFP_KERNEL);
> 	if (ret)
> 		goto err_free;
>
> 	src = obj->mm.pages->sgl;
> 	dst = st->sgl;
>-	for (i = 0; i < obj->mm.pages->nents; i++) {
>+	for (i = 0; i < obj->mm.pages->orig_nents; i++) {
> 		sg_set_page(dst, sg_page(src), src->length, 0);
> 		dst = sg_next(dst);
> 		src = sg_next(src);
>--
>2.37.3





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux