Previouly drivers have their own way of mapping range of kernel pages/memory into user vma and this was done by invoking vm_insert_page() within a loop. As this pattern is common across different drivers, it can be generalized by creating a new function and use it across the drivers. vm_insert_range is the new API which will be used to map a range of kernel memory/pages to user vma. All the applicable places are converted to use new vm_insert_range in this patch series. v1 -> v2: Address review comment on mm/memory.c. Add EXPORT_SYMBOL for vm_insert_range and corrected the documentation part for this API. In drivers/gpu/drm/xen/xen_drm_front_gem.c, replace err with ret as suggested. In drivers/iommu/dma-iommu.c, handle the scenario of partial mmap() of large buffer by passing *pages + vma->vm_pgoff* to vm_insert_range(). v2 -> v3: Declaration of vm_insert_range() moved to include/linux/mm.h v3 -> v4: Address review comments. In mm/memory.c. Added error check. In arch/arm/mm/dma-mapping.c, remove part of error check as the similar is checked inside vm_insert_range. In rockchip/rockchip_drm_gem.c, vma->vm_pgoff is respected as this might be passed as non zero value considering partial mapping of large buffer. In iommu/dma-iommu.c, count is modifed as (count - vma->vm_pgoff) to handle partial mapping scenario in v2. Souptick Joarder (9): mm: Introduce new vm_insert_range API arch/arm/mm/dma-mapping.c: Convert to use vm_insert_range drivers/firewire/core-iso.c: Convert to use vm_insert_range drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range drm/xen/xen_drm_front_gem.c: Convert to use vm_insert_range iommu/dma-iommu.c: Convert to use vm_insert_range videobuf2/videobuf2-dma-sg.c: Convert to use vm_insert_range xen/gntdev.c: Convert to use vm_insert_range xen/privcmd-buf.c: Convert to use vm_insert_range arch/arm/mm/dma-mapping.c | 21 ++++-------- drivers/firewire/core-iso.c | 15 ++------- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 ++--------- drivers/gpu/drm/xen/xen_drm_front_gem.c | 20 ++++------- drivers/iommu/dma-iommu.c | 13 ++----- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 23 ++++--------- drivers/xen/gntdev.c | 11 +++--- drivers/xen/privcmd-buf.c | 8 ++--- include/linux/mm.h | 2 ++ mm/memory.c | 41 +++++++++++++++++++++++ mm/nommu.c | 7 ++++ 11 files changed, 83 insertions(+), 97 deletions(-) -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel