mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: Use our own vmap() for coherent DMA buffers
For some reason the GPU does not like the mappings created by the DMA API for coherent sysmem buffers. But a plain vmap() does seem to work. To work around this, when we are using coherent sysmem, force the NO_KERNEL_MAPPING flag to on and then make a vmap() in the nvgpu DMA API wrapper. The rest of the driver will be none the wiser but will work as expected. This problem is not understood yet but it is being tracked in bug 2040115. Once this bug is understood this WAR should either be determined as necessary or reverted with an appropriate fix. Bug 2040115 JIRA EVLR-2333 Change-Id: Idae7a0c92441f0309df572ac18697af49bb6ff2b Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1657568 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
1170687c33
commit
3fdd8e38b2
@@ -44,6 +44,14 @@ int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem)
|
||||
if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* WAR for bug 2040115: we already will always have a coherent vmap()
|
||||
* for all sysmem buffers. The prot settings are left alone since
|
||||
* eventually this should be deleted.
|
||||
*/
|
||||
if (nvgpu_is_enabled(g, NVGPU_USE_COHERENT_SYSMEM))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* A CPU mapping is implicitly made for all SYSMEM DMA allocations that
|
||||
* don't have NVGPU_DMA_NO_KERNEL_MAPPING. Thus we don't need to make
|
||||
@@ -73,6 +81,13 @@ void nvgpu_mem_end(struct gk20a *g, struct nvgpu_mem *mem)
|
||||
if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin)
|
||||
return;
|
||||
|
||||
/*
|
||||
* WAR for bug 2040115: skip this since the map will be taken care of
|
||||
* during the free in the DMA API.
|
||||
*/
|
||||
if (nvgpu_is_enabled(g, NVGPU_USE_COHERENT_SYSMEM))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Similar to nvgpu_mem_begin() we don't need to unmap the CPU mapping
|
||||
* already made by the DMA API.
|
||||
@@ -393,8 +408,12 @@ int nvgpu_mem_create_from_mem(struct gk20a *g,
|
||||
|
||||
/*
|
||||
* Re-use the CPU mapping only if the mapping was made by the DMA API.
|
||||
*
|
||||
* Bug 2040115: the DMA API wrapper makes the mapping that we should
|
||||
* re-use.
|
||||
*/
|
||||
if (!(src->priv.flags & NVGPU_DMA_NO_KERNEL_MAPPING))
|
||||
if (!(src->priv.flags & NVGPU_DMA_NO_KERNEL_MAPPING) ||
|
||||
nvgpu_is_enabled(g, NVGPU_USE_COHERENT_SYSMEM))
|
||||
dest->cpu_va = src->cpu_va + (PAGE_SIZE * start_page);
|
||||
|
||||
dest->priv.pages = src->priv.pages + start_page;
|
||||
|
||||
Reference in New Issue
Block a user