summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
diff options
context:
space:
mode:
authorKevin Huang <kevinh@nvidia.com>2014-04-14 19:53:09 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:59 -0400
commitda56b17de0b360cb020a8831ba82c202057c2968 (patch)
tree7e759f5ca412775001b00cc4211515c37b3c35ed /drivers/gpu/nvgpu/gk20a/mm_gk20a.h
parentd364553f7c94b4caa649f5e83f709c1c31bc45bb (diff)
gpu: nvgpu: add generic api for sparse memory
Bug 1442531 Change-Id: I97408b54e27f5ed6411792e73f079a6f86cbe5f6 Signed-off-by: Kevin Huang <kevinh@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
index 7f86710b..b0f3536e 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h
@@ -25,6 +25,7 @@
25#include <linux/dma-attrs.h> 25#include <linux/dma-attrs.h>
26#include <linux/iommu.h> 26#include <linux/iommu.h>
27#include <asm/dma-iommu.h> 27#include <asm/dma-iommu.h>
28#include <asm/cacheflush.h>
28#include "gk20a_allocator.h" 29#include "gk20a_allocator.h"
29 30
30/* This "address bit" in the gmmu ptes (and other gk20a accesses) 31/* This "address bit" in the gmmu ptes (and other gk20a accesses)
@@ -41,6 +42,17 @@
41#define NV_GMMU_VA_RANGE 35ULL 42#define NV_GMMU_VA_RANGE 35ULL
42#define NV_GMMU_VA_IS_UPPER(x) ((x) >= ((u64)0x1 << (NV_GMMU_VA_RANGE-1))) 43#define NV_GMMU_VA_IS_UPPER(x) ((x) >= ((u64)0x1 << (NV_GMMU_VA_RANGE-1)))
43 44
45#ifdef CONFIG_ARM64
46#define outer_flush_range(a, b)
47#define __cpuc_flush_dcache_area __flush_dcache_area
48#endif
49
50#define FLUSH_CPU_DCACHE(va, pa, size) \
51 do { \
52 __cpuc_flush_dcache_area((void *)(va), (size_t)(size)); \
53 outer_flush_range(pa, pa + (size_t)(size)); \
54 } while (0)
55
44struct mem_desc { 56struct mem_desc {
45 struct dma_buf *ref; 57 struct dma_buf *ref;
46 struct sg_table *sgt; 58 struct sg_table *sgt;
@@ -463,4 +475,21 @@ int gk20a_vm_map_buffer(struct gk20a_as_share *as_share,
463int gk20a_vm_unmap_buffer(struct gk20a_as_share *, u64 offset); 475int gk20a_vm_unmap_buffer(struct gk20a_as_share *, u64 offset);
464 476
465int gk20a_dmabuf_alloc_drvdata(struct dma_buf *dmabuf, struct device *dev); 477int gk20a_dmabuf_alloc_drvdata(struct dma_buf *dmabuf, struct device *dev);
478
479int map_gmmu_pages(void *handle, struct sg_table *sgt,
480 void **va, size_t size);
481void unmap_gmmu_pages(void *handle, struct sg_table *sgt, void *va);
482void pde_range_from_vaddr_range(struct vm_gk20a *vm,
483 u64 addr_lo, u64 addr_hi,
484 u32 *pde_lo, u32 *pde_hi);
485u32 *pde_from_index(struct vm_gk20a *vm, u32 i);
486u32 pte_index_from_vaddr(struct vm_gk20a *vm,
487 u64 addr, enum gmmu_pgsz_gk20a pgsz_idx);
488int validate_gmmu_page_table_gk20a_locked(struct vm_gk20a *vm,
489 u32 i, enum gmmu_pgsz_gk20a gmmu_pgsz_idx);
490int zalloc_gmmu_page_table_gk20a(struct vm_gk20a *vm,
491 enum gmmu_pgsz_gk20a gmmu_pgsz_idx,
492 struct page_table_gk20a *pte);
493struct gpu_ops;
494void gk20a_init_mm(struct gpu_ops *gops);
466#endif /*_MM_GK20A_H_ */ 495#endif /*_MM_GK20A_H_ */