]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Fix DMA mapped scatterlist walks
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 6 Oct 2020 09:25:07 +0000 (10:25 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 6 Oct 2020 11:49:07 +0000 (12:49 +0100)
commit4511902aabdf9f52309d3763c8ffbb782e165c37
tree88f40523da4eed82e95f7ec9730c39402751a960
parent402bf53f68c65d3ac474a9a54fb539f1ce8a6e81
drm/i915: Fix DMA mapped scatterlist walks

When walking DMA mapped scatterlists sg_dma_len has to be used since it
can be different (coalesced) from the backing store entry.

This also means we have to end the walk when encountering a zero length
DMA entry and cannot rely on the normal sg list end marker.

Both issues were there in theory for some time but were hidden by the fact
Intel IOMMU driver was never coalescing entries. As there are ongoing
efforts to change this we need to start handling it.

v2:
 * Use unsigned int for local storing sg_dma_len. (Logan)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
References: f3fadcb232a8 ("drm/i915: Introduce & use new lightweight SGL iterators")
References: 49623fa78517 ("drm/i915: Micro-optimise gen6_ppgtt_insert_entries()")
Reported-by: Tom Murphy <murphyt7@tcd.ie>
Suggested-by: Tom Murphy <murphyt7@tcd.ie> # __sgt_iter
Suggested-by: Logan Gunthorpe <logang@deltatee.com> # __sgt_iter
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006092508.1064287-1-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/gt/gen6_ppgtt.c
drivers/gpu/drm/i915/gt/gen8_ppgtt.c
drivers/gpu/drm/i915/gt/intel_gtt.h
drivers/gpu/drm/i915/i915_scatterlist.h