diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vidmem.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vidmem.c b/drivers/gpu/nvgpu/common/mm/vidmem.c index 37435f97..b6e1919f 100644 --- a/drivers/gpu/nvgpu/common/mm/vidmem.c +++ b/drivers/gpu/nvgpu/common/mm/vidmem.c | |||
@@ -39,6 +39,14 @@ | |||
39 | void nvgpu_vidmem_destroy(struct gk20a *g) | 39 | void nvgpu_vidmem_destroy(struct gk20a *g) |
40 | { | 40 | { |
41 | struct nvgpu_timeout timeout; | 41 | struct nvgpu_timeout timeout; |
42 | size_t size; | ||
43 | |||
44 | size = g->ops.mm.get_vidmem_size ? | ||
45 | g->ops.mm.get_vidmem_size(g) : 0; | ||
46 | |||
47 | /* Nothing to destroy if no vidmem */ | ||
48 | if (!size) | ||
49 | return; | ||
42 | 50 | ||
43 | nvgpu_timeout_init(g, &timeout, 100, NVGPU_TIMER_RETRY_TIMER); | 51 | nvgpu_timeout_init(g, &timeout, 100, NVGPU_TIMER_RETRY_TIMER); |
44 | 52 | ||
@@ -73,6 +81,9 @@ void nvgpu_vidmem_destroy(struct gk20a *g) | |||
73 | 81 | ||
74 | if (nvgpu_alloc_initialized(&g->mm.vidmem.allocator)) | 82 | if (nvgpu_alloc_initialized(&g->mm.vidmem.allocator)) |
75 | nvgpu_alloc_destroy(&g->mm.vidmem.allocator); | 83 | nvgpu_alloc_destroy(&g->mm.vidmem.allocator); |
84 | |||
85 | if (nvgpu_alloc_initialized(&g->mm.vidmem.bootstrap_allocator)) | ||
86 | nvgpu_alloc_destroy(&g->mm.vidmem.bootstrap_allocator); | ||
76 | } | 87 | } |
77 | 88 | ||
78 | static int __nvgpu_vidmem_do_clear_all(struct gk20a *g) | 89 | static int __nvgpu_vidmem_do_clear_all(struct gk20a *g) |
@@ -297,15 +308,16 @@ static int nvgpu_vidmem_clear_pending_allocs_thr(void *mm_ptr) | |||
297 | int nvgpu_vidmem_init(struct mm_gk20a *mm) | 308 | int nvgpu_vidmem_init(struct mm_gk20a *mm) |
298 | { | 309 | { |
299 | struct gk20a *g = mm->g; | 310 | struct gk20a *g = mm->g; |
300 | size_t size = g->ops.mm.get_vidmem_size ? | ||
301 | g->ops.mm.get_vidmem_size(g) : 0; | ||
302 | u64 bootstrap_base, bootstrap_size, base; | 311 | u64 bootstrap_base, bootstrap_size, base; |
303 | u64 default_page_size = SZ_64K; | 312 | u64 default_page_size = SZ_64K; |
313 | size_t size; | ||
304 | int err; | 314 | int err; |
305 | 315 | ||
306 | static struct nvgpu_alloc_carveout wpr_co = | 316 | static struct nvgpu_alloc_carveout wpr_co = |
307 | NVGPU_CARVEOUT("wpr-region", 0, SZ_16M); | 317 | NVGPU_CARVEOUT("wpr-region", 0, SZ_16M); |
308 | 318 | ||
319 | size = g->ops.mm.get_vidmem_size ? | ||
320 | g->ops.mm.get_vidmem_size(g) : 0; | ||
309 | if (!size) | 321 | if (!size) |
310 | return 0; | 322 | return 0; |
311 | 323 | ||