diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2018-08-23 07:16:15 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-06 19:12:24 -0400 |
commit | c3e18d9474f2bbbbd941c1941f86ad0df2ae3cf4 (patch) | |
tree | eea2cf335372b0f51843b8972000158a230f11fd /drivers/gpu | |
parent | 8e66c5816dfea8e321c4745e6a4385770b62c9d0 (diff) |
gpu: nvgpu: support allocating CBC in vidmem
Update nvgpu_ltc_alloc_cbc() API to accept a flag for vidmem allocation
and allocate CBC memory into vidmem if flag is set
Bug 2180284
Jira NVGPUT-12
Change-Id: Ia6b9bb670c9fab6b5787de15526fcc753d702a73
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1805468
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/ltc/ltc_gm20b.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/ltc/ltc_gp10b.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/ltc.h | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ltc.c | 23 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/posix/stubs.c | 3 |
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 | ||
30 | int nvgpu_init_ltc_support(struct gk20a *g); | 30 | int nvgpu_init_ltc_support(struct gk20a *g); |
31 | void nvgpu_ltc_sync_enabled(struct gk20a *g); | 31 | void nvgpu_ltc_sync_enabled(struct gk20a *g); |
32 | int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size); | 32 | int 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 | ||
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 | } |
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 | ||
46 | int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) | 46 | int 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 | } |