diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/ltc.c')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ltc.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ltc.c b/drivers/gpu/nvgpu/os/linux/ltc.c index 1a58bc4e..8011f762 100644 --- a/drivers/gpu/nvgpu/os/linux/ltc.c +++ b/drivers/gpu/nvgpu/os/linux/ltc.c | |||
@@ -27,7 +27,8 @@ | |||
27 | #include "gk20a/gk20a.h" | 27 | #include "gk20a/gk20a.h" |
28 | #include "gk20a/gr_gk20a.h" | 28 | #include "gk20a/gr_gk20a.h" |
29 | 29 | ||
30 | int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) | 30 | int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size, |
31 | bool vidmem_alloc) | ||
31 | { | 32 | { |
32 | struct gr_gk20a *gr = &g->gr; | 33 | struct gr_gk20a *gr = &g->gr; |
33 | unsigned long flags = 0; | 34 | unsigned long flags = 0; |
@@ -35,11 +36,25 @@ int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) | |||
35 | if (nvgpu_mem_is_valid(&gr->compbit_store.mem)) | 36 | if (nvgpu_mem_is_valid(&gr->compbit_store.mem)) |
36 | return 0; | 37 | return 0; |
37 | 38 | ||
38 | if (!nvgpu_iommuable(g)) | 39 | if (vidmem_alloc) { |
39 | flags = NVGPU_DMA_FORCE_CONTIGUOUS; | 40 | /* |
41 | * Backing store MUST be physically contiguous and allocated in | ||
42 | * one chunk | ||
43 | * Vidmem allocation API does not support FORCE_CONTIGUOUS like | ||
44 | * flag to allocate contiguous memory | ||
45 | * But this allocation will happen in vidmem bootstrap allocator | ||
46 | * which always allocates contiguous memory | ||
47 | */ | ||
48 | return nvgpu_dma_alloc_vid(g, | ||
49 | compbit_backing_size, | ||
50 | &gr->compbit_store.mem); | ||
51 | } else { | ||
52 | if (!nvgpu_iommuable(g)) | ||
53 | flags = NVGPU_DMA_FORCE_CONTIGUOUS; | ||
40 | 54 | ||
41 | return nvgpu_dma_alloc_flags_sys(g, | 55 | return nvgpu_dma_alloc_flags_sys(g, |
42 | flags, | 56 | flags, |
43 | compbit_backing_size, | 57 | compbit_backing_size, |
44 | &gr->compbit_store.mem); | 58 | &gr->compbit_store.mem); |
59 | } | ||
45 | } | 60 | } |