summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2022-11-08 13:32:38 +0300
committerMatthew Auld <matthew.auld@intel.com>2022-11-09 13:07:22 +0300
commit8c94951560ef29c455043bf2dfa2275b011edc66 (patch)
treef6c9dc6fe66e250c83e561718c10e12bd4058a46 /drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
parentccb0e02787d0f80d0081c446aec3756dd8f7bfe0 (diff)
downloadlinux-8c94951560ef29c455043bf2dfa2275b011edc66.tar.xz
drm/i915: use i915_sg_dma_sizes() for all backends
We rely on page_sizes.sg in setup_scratch_page() reporting the correct value if the underlying sgl is not contiguous, however in get_pages_internal() we are only looking at the layout of the created pages when calculating the sg_page_sizes, and not the final sgl, which could in theory be completely different. In such a situation we might incorrectly think we have a 64K scratch page, when it is actually only 4K or similar split over multiple non-contiguous entries, which could lead to broken behaviour when touching the scratch space within the padding of a 64K GTT page-table. For most of the other backends we already just call i915_sg_dma_sizes() on the final mapping, so rather just move that into __i915_gem_object_set_pages() to avoid such issues coming back to bite us later. v2: Update missing conversion in gvt Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Stuart Summers <stuart.summers@intel.com> Cc: Andrzej Hajda <andrzej.hajda@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221108103238.165447-1-matthew.auld@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c')
-rw-r--r--drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index ec6f7ae47783..1df74f7aa3dc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -238,7 +238,6 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
{
struct drm_i915_private *i915 = to_i915(obj->base.dev);
struct sg_table *sgt;
- unsigned int sg_page_sizes;
assert_object_held(obj);
@@ -262,8 +261,7 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
(!HAS_LLC(i915) && !IS_DG1(i915)))
wbinvd_on_all_cpus();
- sg_page_sizes = i915_sg_dma_sizes(sgt->sgl);
- __i915_gem_object_set_pages(obj, sgt, sg_page_sizes);
+ __i915_gem_object_set_pages(obj, sgt);
return 0;
}