diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-07-24 21:10:03 +0200 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-21 19:13:43 +0900 |
commit | 4972f3aff1f3c8d989ac956573eb892df77a1c91 (patch) | |
tree | 349ddce5487e51363c6de404cb348cc56ec988d5 /include | |
parent | 04e417d574f411f7d059a51c45bdb35727b4f637 (diff) | |
download | linux-3.10-4972f3aff1f3c8d989ac956573eb892df77a1c91.tar.gz linux-3.10-4972f3aff1f3c8d989ac956573eb892df77a1c91.tar.bz2 linux-3.10-4972f3aff1f3c8d989ac956573eb892df77a1c91.zip |
drm/vma: provide drm_vma_node_unmap() helper
Instead of unmapping the nodes in TTM and GEM users manually, we provide
a generic wrapper which does the correct thing for all vma-nodes.
v2: remove bdev->dev_mapping test in ttm_bo_unmap_virtual_unlocked() as
ttm_mem_io_free_vm() does nothing in that case (io_reserved_vm is 0).
v4: Fix docbook comments
v5: use drm_vma_node_size()
Cc: Dave Airlie <airlied@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@gmail.com>
Conflicts:
drivers/gpu/drm/ttm/ttm_bo.c
Change-Id: I4be1eeef8e5b4e81b5966449e2bf3691d8270aae
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm_vma_manager.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h index 7ee8c4babeb..22eedac046a 100644 --- a/include/drm/drm_vma_manager.h +++ b/include/drm/drm_vma_manager.h @@ -24,6 +24,7 @@ */ #include <drm/drm_mm.h> +#include <linux/mm.h> #include <linux/module.h> #include <linux/rbtree.h> #include <linux/spinlock.h> @@ -199,4 +200,25 @@ static inline __u64 drm_vma_node_offset_addr(struct drm_vma_offset_node *node) return ((__u64)node->vm_node.start) << PAGE_SHIFT; } +/** + * drm_vma_node_unmap() - Unmap offset node + * @node: Offset node + * @file_mapping: Address space to unmap @node from + * + * Unmap all userspace mappings for a given offset node. The mappings must be + * associated with the @file_mapping address-space. If no offset exists or + * the address-space is invalid, nothing is done. + * + * This call is unlocked. The caller must guarantee that drm_vma_offset_remove() + * is not called on this node concurrently. + */ +static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, + struct address_space *file_mapping) +{ + if (file_mapping && drm_vma_node_has_offset(node)) + unmap_mapping_range(file_mapping, + drm_vma_node_offset_addr(node), + drm_vma_node_size(node) << PAGE_SHIFT, 1); +} + #endif /* __DRM_VMA_MANAGER_H__ */ |