diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-03-08 19:51:33 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-26 12:55:10 -0400 |
commit | c11228d48be1825e1ec84afd38c6938504fa4100 (patch) | |
tree | ea8bb9c874ba14b7c06a4de11d6619f88e2a4104 /drivers/gpu/nvgpu/include | |
parent | e0f2afe5eb43fb32490ccabd504879c3e3e54623 (diff) |
gpu: nvgpu: Use new kmem API functions (common/*)
Use the new kmem API functions in common/* and common/mm/*.
Add a struct gk20a pointer to struct nvgpu_allocator in order
to store the gk20a pointer used for allocating memory.
Bug 1799159
Bug 1823380
Change-Id: I881ea9545e8a8f0b75d77a1e35dd1812e0bb654e
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1318315
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/allocator.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h index 16fe2641..1bde290f 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/debugfs.h> | 20 | #include <linux/debugfs.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | |||
23 | #include <nvgpu/lock.h> | 24 | #include <nvgpu/lock.h> |
24 | 25 | ||
25 | /* #define ALLOCATOR_DEBUG */ | 26 | /* #define ALLOCATOR_DEBUG */ |
@@ -78,6 +79,8 @@ struct nvgpu_allocator_ops { | |||
78 | }; | 79 | }; |
79 | 80 | ||
80 | struct nvgpu_allocator { | 81 | struct nvgpu_allocator { |
82 | struct gk20a *g; | ||
83 | |||
81 | char name[32]; | 84 | char name[32]; |
82 | struct nvgpu_mutex lock; | 85 | struct nvgpu_mutex lock; |
83 | 86 | ||
@@ -238,13 +241,18 @@ void nvgpu_alloc_destroy(struct nvgpu_allocator *allocator); | |||
238 | void nvgpu_alloc_print_stats(struct nvgpu_allocator *a, | 241 | void nvgpu_alloc_print_stats(struct nvgpu_allocator *a, |
239 | struct seq_file *s, int lock); | 242 | struct seq_file *s, int lock); |
240 | 243 | ||
244 | static inline struct gk20a *nvgpu_alloc_to_gpu(struct nvgpu_allocator *a) | ||
245 | { | ||
246 | return a->g; | ||
247 | } | ||
248 | |||
241 | /* | 249 | /* |
242 | * Common functionality for the internals of the allocators. | 250 | * Common functionality for the internals of the allocators. |
243 | */ | 251 | */ |
244 | void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a); | 252 | void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a); |
245 | void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a); | 253 | void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a); |
246 | 254 | ||
247 | int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, | 255 | int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g, |
248 | const char *name, void *priv, bool dbg, | 256 | const char *name, void *priv, bool dbg, |
249 | const struct nvgpu_allocator_ops *ops); | 257 | const struct nvgpu_allocator_ops *ops); |
250 | 258 | ||