summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_allocator.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h
index f3b6dab3..9becf053 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h
@@ -99,9 +99,32 @@ struct gk20a_allocator {
99 * allocations you need to keep track of the meta-data yourself (in this 99 * allocations you need to keep track of the meta-data yourself (in this
100 * case the base and length of the allocation as opposed to just the base 100 * case the base and length of the allocation as opposed to just the base
101 * of the allocation). 101 * of the allocation).
102 *
103 * GPU_ALLOC_4K_VIDMEM_PAGES
104 *
105 * We manage vidmem pages at a large page granularity for performance
106 * reasons; however, this can lead to wasting memory. For page allocators
107 * setting this flag will tell the allocator to manage pools of 4K pages
108 * inside internally allocated large pages.
109 *
110 * GPU_ALLOC_FORCE_CONTIG
111 *
112 * Force allocations to be contiguous. Currently only relevant for page
113 * allocators since all other allocators are naturally contiguous.
114 *
115 * GPU_ALLOC_NO_SCATTER_GATHER
116 *
117 * The page allocator normally returns a scatter gather data structure for
118 * allocations (to handle discontiguous pages). However, at times that can
119 * be annoying so this flag forces the page allocator to return a u64
120 * pointing to the allocation base (requires GPU_ALLOC_FORCE_CONTIG to be
121 * set as well).
102 */ 122 */
103#define GPU_ALLOC_GVA_SPACE 0x1 123#define GPU_ALLOC_GVA_SPACE 0x1
104#define GPU_ALLOC_NO_ALLOC_PAGE 0x2 124#define GPU_ALLOC_NO_ALLOC_PAGE 0x2
125#define GPU_ALLOC_4K_VIDMEM_PAGES 0x4
126#define GPU_ALLOC_FORCE_CONTIG 0x8
127#define GPU_ALLOC_NO_SCATTER_GATHER 0x10
105 128
106static inline void alloc_lock(struct gk20a_allocator *a) 129static inline void alloc_lock(struct gk20a_allocator *a)
107{ 130{
@@ -131,6 +154,13 @@ int gk20a_bitmap_allocator_init(struct gk20a_allocator *__a,
131 const char *name, u64 base, u64 length, 154 const char *name, u64 base, u64 length,
132 u64 blk_size, u64 flags); 155 u64 blk_size, u64 flags);
133 156
157/*
158 * Page allocator initializers.
159 */
160int gk20a_page_allocator_init(struct gk20a_allocator *__a,
161 const char *name, u64 base, u64 length,
162 u64 blk_size, u64 flags);
163
134#define GPU_BALLOC_MAX_ORDER 31 164#define GPU_BALLOC_MAX_ORDER 31
135 165
136/* 166/*
@@ -199,7 +229,7 @@ void gk20a_alloc_debugfs_init(struct platform_device *pdev);
199 } while (0) 229 } while (0)
200 230
201#define __alloc_dbg(a, fmt, arg...) \ 231#define __alloc_dbg(a, fmt, arg...) \
202 pr_info("%-25s %25s() " fmt, (a)->name, __func__, ##arg) 232 pr_warn("%-25s %25s() " fmt, (a)->name, __func__, ##arg)
203 233
204#if defined(ALLOCATOR_DEBUG) 234#if defined(ALLOCATOR_DEBUG)
205/* 235/*