summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/ltc.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-11-07 13:50:49 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-08 20:11:30 -0500
commit016231c045bfaa9f21feed00b88ac507c4935ebc (patch)
treeca6f41e1dfd89005c9716c13f1e9eb9404979274 /drivers/gpu/nvgpu/common/ltc.c
parente7c45478895a359bd122b359c1f29b7e64116caf (diff)
gpu: nvgpu: Use only contig CBCs
Modify the LTC code to only use a contiguous CompBit Cache (CBC). The original code had two allocation schemes: "physical" and "virtual" - what they meant was virtually contiguous or physically contiguous. The CBC must appear contiguous to the GPU be it either from the IOMMU or from physical pages allocated contiguously. This change makes the CBC get allocated with the FORCE_CONTIGUOUS flag if the GPU is not IOMMU'able. If we can get contiguous mem with the IOMMU then no need to force the underlying pages to be contiguous. However, not all GPUs may be IOMMU'able so we do need to handle that case. Also delete the gk20a/ltc_gk20a.[ch] code. All that remained in these files was the CBC alloc functions which were completely chip agnostic. As a result these functions were consolidated and moved to common/ltc.c. Bug 2015747 Change-Id: I3f41961b4f94378b954e7502a6b27cf0bc627375 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1593666 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/nvgpu/common/ltc.c')
-rw-r--r--drivers/gpu/nvgpu/common/ltc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/ltc.c b/drivers/gpu/nvgpu/common/ltc.c
index 4fbdbe2e..006e2ed2 100644
--- a/drivers/gpu/nvgpu/common/ltc.c
+++ b/drivers/gpu/nvgpu/common/ltc.c
@@ -21,8 +21,10 @@
21 */ 21 */
22 22
23#include <nvgpu/ltc.h> 23#include <nvgpu/ltc.h>
24#include <nvgpu/dma.h>
24 25
25#include "gk20a/gk20a.h" 26#include "gk20a/gk20a.h"
27#include "gk20a/gr_gk20a.h"
26 28
27int nvgpu_init_ltc_support(struct gk20a *g) 29int nvgpu_init_ltc_support(struct gk20a *g)
28{ 30{
@@ -46,3 +48,17 @@ void nvgpu_ltc_sync_enabled(struct gk20a *g)
46 } 48 }
47 nvgpu_spinlock_release(&g->ltc_enabled_lock); 49 nvgpu_spinlock_release(&g->ltc_enabled_lock);
48} 50}
51
52int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size)
53{
54 struct gr_gk20a *gr = &g->gr;
55 unsigned long flags = 0;
56
57 if (!nvgpu_iommuable(g))
58 flags = NVGPU_DMA_FORCE_CONTIGUOUS;
59
60 return nvgpu_dma_alloc_flags_sys(g,
61 flags,
62 compbit_backing_size,
63 &gr->compbit_store.mem);
64}