FROMLIST: ARM: DMA: Use vm_pgoff for IOMMU mmap

arm_iommu_mmap_attrs() ignores the page offset in vma->vm_pgoff that was
specified in the mmap call. Any user of dma_mmap_* will get an
unexpected result when the device uses the IOMMU DMA ops.

Some DRM driver that use dma_mmap_* seems to depend on it ignoring
vma->vm_pgoff.  Both the Samsung Exynos DRM driver before v3.18, and the
current Rockchip DRM driver, use the page offset to pass GEM cookies
that are used to look up the GEM buffers and then call dma_mmap_attrs()
with the cookie value still in vma->vm_pgoff.

rockchip_gem_mmap_buf() in drivers/gpu/drm/rockchip/rockchip_drm_gem.c
still does this. It should be fixed before fixing
arm_iommu_mmap_attrs().

BUG=chrome-os-partner:53739

Change-Id: Id11e528fe7f1c6e3a0cccfe8e5e5919af265d344
Signed-off-by: rjan Eide <orjan.eide@arm.com>
(am from https://patchwork.kernel.org/patch/6226581/)
Reviewed-on: https://chromium-review.googlesource.com/265646
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
(cherry picked from commit 329a1f27694f40eac113eb9656957a93ece3d437)
Reviewed-on: https://chromium-review.googlesource.com/348323
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Tested-by: Ilja Friedel <ihf@chromium.org>
1 file changed