summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/ltc/ltc_gm20b.c2
-rw-r--r--drivers/gpu/nvgpu/common/ltc/ltc_gp10b.c2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/ltc.h3
-rw-r--r--drivers/gpu/nvgpu/os/linux/ltc.c23
-rw-r--r--drivers/gpu/nvgpu/os/posix/stubs.c3
5 files changed, 25 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/common/ltc/ltc_gm20b.c b/drivers/gpu/nvgpu/common/ltc/ltc_gm20b.c
index 623b0935..205b712d 100644
--- a/drivers/gpu/nvgpu/common/ltc/ltc_gm20b.c
+++ b/drivers/gpu/nvgpu/common/ltc/ltc_gm20b.c
@@ -93,7 +93,7 @@ int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
93 nvgpu_log_info(g, "max comptag lines : %d", 93 nvgpu_log_info(g, "max comptag lines : %d",
94 max_comptag_lines); 94 max_comptag_lines);
95 95
96 err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size); 96 err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size, false);
97 if (err) { 97 if (err) {
98 return err; 98 return err;
99 } 99 }
diff --git a/drivers/gpu/nvgpu/common/ltc/ltc_gp10b.c b/drivers/gpu/nvgpu/common/ltc/ltc_gp10b.c
index b72346ee..f4edbdb2 100644
--- a/drivers/gpu/nvgpu/common/ltc/ltc_gp10b.c
+++ b/drivers/gpu/nvgpu/common/ltc/ltc_gp10b.c
@@ -117,7 +117,7 @@ int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
117 nvgpu_log_info(g, "gobs_per_comptagline_per_slice: %d", 117 nvgpu_log_info(g, "gobs_per_comptagline_per_slice: %d",
118 gobs_per_comptagline_per_slice); 118 gobs_per_comptagline_per_slice);
119 119
120 err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size); 120 err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size, false);
121 if (err) { 121 if (err) {
122 return err; 122 return err;
123 } 123 }
diff --git a/drivers/gpu/nvgpu/include/nvgpu/ltc.h b/drivers/gpu/nvgpu/include/nvgpu/ltc.h
index 60aa5424..21edcba7 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/ltc.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/ltc.h
@@ -29,6 +29,7 @@ struct gk20a;
29 29
30int nvgpu_init_ltc_support(struct gk20a *g); 30int nvgpu_init_ltc_support(struct gk20a *g);
31void nvgpu_ltc_sync_enabled(struct gk20a *g); 31void nvgpu_ltc_sync_enabled(struct gk20a *g);
32int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size); 32int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size,
33 bool vidmem_alloc);
33 34
34#endif 35#endif
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
30int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) 30int 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}
diff --git a/drivers/gpu/nvgpu/os/posix/stubs.c b/drivers/gpu/nvgpu/os/posix/stubs.c
index 1e50930a..279f4daa 100644
--- a/drivers/gpu/nvgpu/os/posix/stubs.c
+++ b/drivers/gpu/nvgpu/os/posix/stubs.c
@@ -43,7 +43,8 @@ void nvgpu_ecc_sysfs_remove(struct gk20a *g)
43{ 43{
44} 44}
45 45
46int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) 46int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size,
47 bool vidmem_alloc)
47{ 48{
48 return 0; 49 return 0;
49} 50}