video: tegra: nvmap: move dmabuf code to dmabuf unit

Move dmabuf code to dmabuf unit. This will help to deprecate
nvmap_priv.h.

JIRA TMM-5721

Change-Id: I5fc2a6e0d8ff1939df5e5623fc9d12fa3592e3bd
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3234588
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Pritesh Raithatha
2024-10-22 06:52:33 +00:00
committed by Jon Hunter
parent c79fe58101
commit cfda55996f
7 changed files with 38 additions and 39 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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

View File

@@ -17,7 +17,6 @@
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/atomic.h>
#include <linux/dma-buf.h>
#include <linux/syscalls.h>
#include <linux/mm.h>
#include <linux/miscdevice.h>
@@ -27,8 +26,6 @@
#include <linux/version.h>
#include <linux/workqueue.h>
#include <linux/dma-mapping.h>
#include <linux/dma-direction.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_reserved_mem.h>
@@ -41,23 +38,6 @@
#include <linux/fdtable.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)
#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);