gpu: nvgpu: fix warnings for GPUs with real vidmem

Fix kernel warnings for GPUs with real vidmem:

- dma.c: in nvgpu_dma_alloc_flags, ignore incoming flags when using vidmem,
  since anything but NVGPU_DMA_NO_KERNEL_MAPPING will end up generating
  kernel warnings, and the vidmem mapping functions ignore the other flags
  anyway.

- gmmu.c: in __nvgpu_gmmu_update_page_table, use appropriate function for
  memory type to retrieve physical address

Bug 1967748

Change-Id: I6fc01fd5f2c5cd7b81cba70ab59cc3c8fe4cda19
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1530877
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Peter Daifuku
2017-08-01 13:51:56 -07:00
committed by mobile promotions
parent e1df72771b
commit c16797e35c
2 changed files with 17 additions and 2 deletions

View File

@@ -77,9 +77,13 @@ int nvgpu_dma_alloc_flags(struct gk20a *g, unsigned long flags, size_t size,
* the lack of it for vidmem - the user should not care when
* using nvgpu_gmmu_alloc_map and it's vidmem, or if there's a
* difference, the user should use the flag explicitly anyway.
*
* Incoming flags are ignored here, since bits other than the
* no-kernel-mapping flag are ignored by the vidmem mapping
* functions anyway.
*/
int err = nvgpu_dma_alloc_flags_vid(g,
flags | NVGPU_DMA_NO_KERNEL_MAPPING,
NVGPU_DMA_NO_KERNEL_MAPPING,
size, mem);
if (!err)

View File

@@ -637,6 +637,8 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm,
struct nvgpu_gmmu_attrs *attrs)
{
struct gk20a *g = gk20a_from_vm(vm);
struct nvgpu_page_alloc *alloc;
u64 phys_addr = 0;
u32 page_size;
int err;
@@ -662,6 +664,15 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm,
return err;
}
if (sgt) {
if (attrs->aperture == APERTURE_VIDMEM) {
alloc = get_vidmem_page_alloc(sgt->sgl);
phys_addr = alloc->base;
} else
phys_addr = g->ops.mm.get_iova_addr(g, sgt->sgl, 0);
}
__gmmu_dbg(g, attrs,
"vm=%s "
"%-5s GPU virt %#-12llx +%#-9llx phys %#-12llx "
@@ -671,7 +682,7 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm,
sgt ? "MAP" : "UNMAP",
virt_addr,
length,
sgt ? g->ops.mm.get_iova_addr(g, sgt->sgl, 0) : 0ULL,
phys_addr,
space_to_skip,
page_size >> 10,
nvgpu_gmmu_perm_str(attrs->rw_flag),