From c11228d48be1825e1ec84afd38c6938504fa4100 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 8 Mar 2017 16:51:33 -0800 Subject: 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 Reviewed-on: http://git-master/r/1318315 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/include/nvgpu/allocator.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/include') 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 @@ #include #include #include + #include /* #define ALLOCATOR_DEBUG */ @@ -78,6 +79,8 @@ struct nvgpu_allocator_ops { }; struct nvgpu_allocator { + struct gk20a *g; + char name[32]; struct nvgpu_mutex lock; @@ -238,13 +241,18 @@ void nvgpu_alloc_destroy(struct nvgpu_allocator *allocator); void nvgpu_alloc_print_stats(struct nvgpu_allocator *a, struct seq_file *s, int lock); +static inline struct gk20a *nvgpu_alloc_to_gpu(struct nvgpu_allocator *a) +{ + return a->g; +} + /* * Common functionality for the internals of the allocators. */ void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a); void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a); -int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, +int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g, const char *name, void *priv, bool dbg, const struct nvgpu_allocator_ops *ops); -- cgit v1.2.2