]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
drm/i915/dmabuf: fix sg_table handling in map_dma_buf
authorMatthew Auld <matthew.auld@intel.com>
Fri, 28 Oct 2022 15:50:26 +0000 (16:50 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 12:59:06 +0000 (13:59 +0100)
commit6001e120a447e19be41f4720e2b101afe93fc61b
treedde179a2f3eb9502e700dd3acf2ef98e6aefea7f
parent8ce563bbc1c8e508bf13dc81206e9b28bc5ca2b3
drm/i915/dmabuf: fix sg_table handling in map_dma_buf

commit f90daa975911961b65070ec72bd7dd8d448f9ef7 upstream.

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.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/7306
Fixes: 1286ff739773 ("i915: add dmabuf/prime buffer sharing support.")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Michael J. Ruhl <michael.j.ruhl@intel.com>
Cc: <stable@vger.kernel.org> # v3.5+
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221028155029.494736-1-matthew.auld@intel.com
(cherry picked from commit 28d52f99bbca7227008cf580c9194c9b3516968e)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit dc066a78500a52bbfd57d4909d4596dbb11b5249)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c