The use of msm_obj->pages _mostly_ served to mark that the obj is resident in memory. Mapping to the GPU, etc, all works in terms of the sgt.
The exception was the fault path. Resolve this by using dma_buf_mmap() for mmap'ing imported buffers, like we are supposed to. With that and a bit more cleanup we can drop the use of drm_prime_sg_to_page_array(). This doesn't solve the issues with DMABUF_DEBUG, mapping to the GPU, either via iommu_map_sgtable() (display, and TTBR1 for GPU, aka the kernel managed mappings), or msm_iommu_pagetable_map() (userspace managed mappings), still requires pages under the hood. That will be harder to solve. But this is a step along the way. Lightly tested.. in that I don't actually have a good way to test importing buffers that weren't first exported by drm/msm. And I'm headed to XDC soon. Rob Clark (6): drm/msm/gem: Add helper to check if resident drm/msm/gem: Mmap imported dma-bufs via the exporter drm/msm/gem: Use get_pages() directly in vmap path drm/msm/gem: Stop exposing a page array drm/msm/gem: Stop calling get_pages() for imported dma-bufs drm/msm/gem: Drop use of drm_prime_sg_to_page_array() drivers/gpu/drm/msm/msm_gem.c | 107 +++++++++++++++++----------- drivers/gpu/drm/msm/msm_gem.h | 10 ++- drivers/gpu/drm/msm/msm_gem_prime.c | 5 +- drivers/gpu/drm/msm/msm_gem_vma.c | 8 +-- 4 files changed, 78 insertions(+), 52 deletions(-) -- 2.55.0
