summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2018-01-04 14:09:57 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-08 17:38:06 -0500
commit6dde9e67d91419d1e671a520571a2be9bde93999 (patch)
tree0471b3f8ef26bed5b3adf4c8ddc6c949e8651bf4 /drivers/gpu/nvgpu/common/linux/nvgpu_mem.c
parent82f253b7c14d7811a54f8187ff82f8d8befae529 (diff)
gpu: nvgpu: allocate from coherent pool
Maps memory coherently on devices that are connected to a coherent bus. (1) Add code to be able to get the platform device node. (2) Create a new flag to mark if the device is connected to a coherent bus (3) Map memory coherently on coherent devices. bug 2040331 Change-Id: Ide83a9261acdbbc6e9fef4fc5f38d6f9d0e5ab5b Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1633985 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> 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/nvgpu/common/linux/nvgpu_mem.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/nvgpu_mem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c
index 79098eca..e4b4be06 100644
--- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c
+++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c
@@ -61,6 +61,8 @@ u32 nvgpu_aperture_mask(struct gk20a *g, struct nvgpu_mem *mem,
61int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) 61int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem)
62{ 62{
63 void *cpu_va; 63 void *cpu_va;
64 pgprot_t prot = nvgpu_is_enabled(g, NVGPU_DMA_COHERENT) ? PAGE_KERNEL :
65 pgprot_writecombine(PAGE_KERNEL);
64 66
65 if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) 67 if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin)
66 return 0; 68 return 0;
@@ -80,7 +82,7 @@ int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem)
80 82
81 cpu_va = vmap(mem->priv.pages, 83 cpu_va = vmap(mem->priv.pages,
82 PAGE_ALIGN(mem->size) >> PAGE_SHIFT, 84 PAGE_ALIGN(mem->size) >> PAGE_SHIFT,
83 0, pgprot_writecombine(PAGE_KERNEL)); 85 0, prot);
84 86
85 if (WARN_ON(!cpu_va)) 87 if (WARN_ON(!cpu_va))
86 return -ENOMEM; 88 return -ENOMEM;