diff --git a/drivers/video/tegra/nvmap/nvmap_alloc.h b/drivers/video/tegra/nvmap/nvmap_alloc.h index 804cdf43..27fa4d18 100644 --- a/drivers/video/tegra/nvmap/nvmap_alloc.h +++ b/drivers/video/tegra/nvmap/nvmap_alloc.h @@ -4,6 +4,8 @@ #ifndef __NVMAP_ALLOC_H #define __NVMAP_ALLOC_H +#define DMA_MEMORY_NOMAP 0x02 + struct nvmap_heap; struct debugfs_info; struct nvmap_carveout_node; diff --git a/drivers/video/tegra/nvmap/nvmap_cache.c b/drivers/video/tegra/nvmap/nvmap_cache.c index bc1cc7a0..7ed8df8a 100644 --- a/drivers/video/tegra/nvmap/nvmap_cache.c +++ b/drivers/video/tegra/nvmap/nvmap_cache.c @@ -23,6 +23,7 @@ __weak struct arm64_ftr_reg arm64_ftr_reg_ctrel0; #include "nvmap_alloc.h" #include "nvmap_alloc_int.h" #include "nvmap_handle.h" +#include "nvmap_dmabuf.h" extern void __clean_dcache_area_poc(void *addr, size_t len); diff --git a/drivers/video/tegra/nvmap/nvmap_debug.c b/drivers/video/tegra/nvmap/nvmap_debug.c index 4f0fc9e7..4e67c85e 100644 --- a/drivers/video/tegra/nvmap/nvmap_debug.c +++ b/drivers/video/tegra/nvmap/nvmap_debug.c @@ -14,6 +14,7 @@ #include "nvmap_debug.h" #include "nvmap_alloc.h" #include "nvmap_stats.h" +#include "nvmap_dmabuf.h" struct debugfs_info *iovmm_debugfs_info; diff --git a/drivers/video/tegra/nvmap/nvmap_dmabuf.h b/drivers/video/tegra/nvmap/nvmap_dmabuf.h index 40d910a0..af496370 100644 --- a/drivers/video/tegra/nvmap/nvmap_dmabuf.h +++ b/drivers/video/tegra/nvmap/nvmap_dmabuf.h @@ -3,6 +3,23 @@ #ifndef __NVMAP_DMABUF_H #define __NVMAP_DMABUF_H +#define __DMA_ATTR(attrs) attrs +#define DEFINE_DMA_ATTRS(attrs) unsigned long attrs = 0 + +/** + * dma_set_attr - set a specific attribute + * @attr: attribute to set + * @attrs: struct dma_attrs (may be NULL) + */ +#define dma_set_attr(attr, attrs) (attrs |= attr) + +/** + * dma_get_attr - check for a specific attribute + * @attr: attribute to set + * @attrs: struct dma_attrs (may be NULL) + */ +#define dma_get_attr(attr, attrs) (attrs & attr) + int nvmap_dmabuf_stash_init(void); void nvmap_dmabuf_stash_deinit(void); @@ -25,4 +42,18 @@ int is_nvmap_dmabuf_fd_ro(int fd, bool *is_ro); int nvmap_dmabuf_duplicate_gen_fd(struct nvmap_client *client, struct dma_buf *dmabuf); +struct nvmap_vma_list { + struct list_head list; + struct vm_area_struct *vma; + unsigned long save_vm_flags; + pid_t pid; + atomic_t ref; +}; + +int is_nvmap_vma(struct vm_area_struct *vma); + +void nvmap_vma_open(struct vm_area_struct *vma); + +extern struct vm_operations_struct nvmap_vma_ops; + #endif /* __NVMAP_DMABUF_H */ diff --git a/drivers/video/tegra/nvmap/nvmap_fault.c b/drivers/video/tegra/nvmap/nvmap_fault.c index d7bf3e29..35079c3e 100644 --- a/drivers/video/tegra/nvmap/nvmap_fault.c +++ b/drivers/video/tegra/nvmap/nvmap_fault.c @@ -12,6 +12,7 @@ #include "nvmap_dev.h" #include "nvmap_alloc.h" #include "nvmap_handle.h" +#include "nvmap_dmabuf.h" static void nvmap_vma_close(struct vm_area_struct *vma); diff --git a/drivers/video/tegra/nvmap/nvmap_heap.c b/drivers/video/tegra/nvmap/nvmap_heap.c index 8e4a4293..c2c252dd 100644 --- a/drivers/video/tegra/nvmap/nvmap_heap.c +++ b/drivers/video/tegra/nvmap/nvmap_heap.c @@ -30,6 +30,8 @@ #include "nvmap_handle.h" #include "nvmap_alloc.h" #include "nvmap_alloc_int.h" +#include "nvmap_dmabuf.h" + #include "include/linux/nvmap_exports.h" #ifdef CONFIG_ARM_DMA_IOMMU_ALIGNMENT diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h index 1417f198..c23c8da0 100644 --- a/drivers/video/tegra/nvmap/nvmap_priv.h +++ b/drivers/video/tegra/nvmap/nvmap_priv.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -27,8 +26,6 @@ #include #include -#include -#include #include #include #include @@ -41,23 +38,6 @@ #include -#define __DMA_ATTR(attrs) attrs -#define DEFINE_DMA_ATTRS(attrs) unsigned long attrs = 0 - -/** - * dma_set_attr - set a specific attribute - * @attr: attribute to set - * @attrs: struct dma_attrs (may be NULL) - */ -#define dma_set_attr(attr, attrs) (attrs |= attr) - -/** - * dma_get_attr - check for a specific attribute - * @attr: attribute to set - * @attrs: struct dma_attrs (may be NULL) - */ -#define dma_get_attr(attr, attrs) (attrs & attr) - #define NVMAP_TAG_LABEL_MAXLEN (63 - sizeof(struct nvmap_tag_entry)) #define NVMAP_TAG_TRACE(x, ...) \ @@ -69,8 +49,6 @@ do { \ } \ } while (0) -#define DMA_MEMORY_NOMAP 0x02 - #define ACCESS_OK(type, addr, size) access_ok(addr, size) #define SYS_CLOSE(arg) close_fd(arg) @@ -80,22 +58,12 @@ struct nvmap_device; extern bool nvmap_convert_iovmm_to_carveout; extern bool nvmap_convert_carveout_to_iovmm; -extern struct vm_operations_struct nvmap_vma_ops; - #ifdef CONFIG_ARM64 #define PG_PROT_KERNEL PAGE_KERNEL #else #define PG_PROT_KERNEL pgprot_kernel #endif -struct nvmap_vma_list { - struct list_head list; - struct vm_area_struct *vma; - unsigned long save_vm_flags; - pid_t pid; - atomic_t ref; -}; - #ifdef NVMAP_CONFIG_DEBUG_MAPS struct nvmap_device_list { struct rb_node node; @@ -179,8 +147,6 @@ struct nvmap_carveout_node; void outer_cache_maint(unsigned int op, phys_addr_t paddr, size_t size); -int is_nvmap_vma(struct vm_area_struct *vma); - void *__nvmap_mmap(struct nvmap_handle *h); void __nvmap_munmap(struct nvmap_handle *h, void *addr); @@ -205,8 +171,6 @@ static inline bool nvmap_page_mkclean(struct page **page) return true; } -void nvmap_vma_open(struct vm_area_struct *vma); - struct nvmap_tag_entry *nvmap_search_tag_entry(struct rb_root *root, u32 tag); int nvmap_define_tag(struct nvmap_device *dev, u32 tag, @@ -223,9 +187,6 @@ static inline char *__nvmap_tag_name(struct nvmap_device *dev, u32 tag) return entry ? (char *)(entry + 1) : ""; } -void *nvmap_dmabuf_get_drv_data(struct dma_buf *dmabuf, - struct device *dev); - #ifdef NVMAP_CONFIG_DEBUG_MAPS struct nvmap_device_list *nvmap_is_device_present(char *device_name, u32 heap_type); void nvmap_add_device_name(char *device_name, u64 dma_mask, u32 heap_type);