mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Enable IO coherency on GV100
This reverts commit 848af2ce6d.
This is a revert of a revert, etc, etc. It re-enables IO coherence again.
JIRA EVLR-2333
Change-Id: Ibf97dce2f892e48a1200a06cd38a1c5d9603be04
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1669722
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
f85a0d3e00
commit
418f31cd91
@@ -34,39 +34,24 @@
|
||||
#include "gk20a/gk20a.h"
|
||||
#include "gk20a/mm_gk20a.h"
|
||||
|
||||
u32 __nvgpu_aperture_mask(struct gk20a *g, enum nvgpu_aperture aperture,
|
||||
u32 sysmem_mask, u32 vidmem_mask)
|
||||
{
|
||||
switch (aperture) {
|
||||
case APERTURE_SYSMEM:
|
||||
/* some igpus consider system memory vidmem */
|
||||
return nvgpu_is_enabled(g, NVGPU_MM_HONORS_APERTURE)
|
||||
? sysmem_mask : vidmem_mask;
|
||||
case APERTURE_VIDMEM:
|
||||
/* for dgpus only */
|
||||
return vidmem_mask;
|
||||
case APERTURE_INVALID:
|
||||
WARN_ON("Bad aperture");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 nvgpu_aperture_mask(struct gk20a *g, struct nvgpu_mem *mem,
|
||||
u32 sysmem_mask, u32 vidmem_mask)
|
||||
{
|
||||
return __nvgpu_aperture_mask(g, mem->aperture,
|
||||
sysmem_mask, vidmem_mask);
|
||||
}
|
||||
|
||||
int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem)
|
||||
{
|
||||
void *cpu_va;
|
||||
pgprot_t prot = nvgpu_is_enabled(g, NVGPU_DMA_COHERENT) ? PAGE_KERNEL :
|
||||
pgprot_t prot = nvgpu_is_enabled(g, NVGPU_USE_COHERENT_SYSMEM) ?
|
||||
PAGE_KERNEL :
|
||||
pgprot_writecombine(PAGE_KERNEL);
|
||||
|
||||
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
|
||||
@@ -96,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.
|
||||
@@ -315,7 +307,8 @@ void nvgpu_memset(struct gk20a *g, struct nvgpu_mem *mem, u32 offset,
|
||||
*/
|
||||
u64 nvgpu_mem_get_addr_sgl(struct gk20a *g, struct scatterlist *sgl)
|
||||
{
|
||||
if (!nvgpu_iommuable(g))
|
||||
if (nvgpu_is_enabled(g, NVGPU_MM_USE_PHYSICAL_SG) ||
|
||||
!nvgpu_iommuable(g))
|
||||
return g->ops.mm.gpu_phys_addr(g, NULL, sg_phys(sgl));
|
||||
|
||||
if (sg_dma_address(sgl) == 0)
|
||||
@@ -415,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