diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h index 5d6b9426..26612bf9 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h | |||
@@ -73,9 +73,35 @@ struct gk20a_allocator { | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * Allocator flags. | 76 | * These are the available allocator flags. |
77 | * | ||
78 | * GPU_ALLOC_GVA_SPACE | ||
79 | * | ||
80 | * This flag makes sense for the buddy allocator only. It specifies that the | ||
81 | * allocator will be used for managing a GVA space. When managing GVA spaces | ||
82 | * special care has to be taken to ensure that allocations of similar PTE | ||
83 | * sizes are placed in the same PDE block. This allows the higher level | ||
84 | * code to skip defining both small and large PTE tables for every PDE. That | ||
85 | * can save considerable memory for address spaces that have a lot of | ||
86 | * allocations. | ||
87 | * | ||
88 | * GPU_ALLOC_NO_ALLOC_PAGE | ||
89 | * | ||
90 | * For any allocator that needs to manage a resource in a latency critical | ||
91 | * path this flag specifies that the allocator should not use any kmalloc() | ||
92 | * or similar functions during normal operation. Initialization routines | ||
93 | * may still use kmalloc(). This prevents the possibility of long waits for | ||
94 | * pages when using alloc_page(). Currently only the bitmap allocator | ||
95 | * implements this functionality. | ||
96 | * | ||
97 | * Also note that if you accept this flag then you must also define the | ||
98 | * free_fixed() function. Since no meta-data is allocated to help free | ||
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 | ||
101 | * of the allocation). | ||
77 | */ | 102 | */ |
78 | #define GPU_ALLOC_GVA_SPACE 0x1 | 103 | #define GPU_ALLOC_GVA_SPACE 0x1 |
104 | #define GPU_ALLOC_NO_ALLOC_PAGE 0x2 | ||
79 | 105 | ||
80 | static inline void alloc_lock(struct gk20a_allocator *a) | 106 | static inline void alloc_lock(struct gk20a_allocator *a) |
81 | { | 107 | { |
@@ -98,6 +124,13 @@ int gk20a_buddy_allocator_init(struct gk20a_allocator *allocator, | |||
98 | const char *name, u64 base, u64 size, | 124 | const char *name, u64 base, u64 size, |
99 | u64 blk_size, u64 flags); | 125 | u64 blk_size, u64 flags); |
100 | 126 | ||
127 | /* | ||
128 | * Bitmap initializers. | ||
129 | */ | ||
130 | int gk20a_bitmap_allocator_init(struct gk20a_allocator *__a, | ||
131 | const char *name, u64 base, u64 length, | ||
132 | u64 blk_size, u64 flags); | ||
133 | |||
101 | #define GPU_BALLOC_MAX_ORDER 31 | 134 | #define GPU_BALLOC_MAX_ORDER 31 |
102 | 135 | ||
103 | /* | 136 | /* |