From c16797e35c2926bf34a61d5d8f37d5675ec23b1b Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Tue, 1 Aug 2017 13:51:56 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1530877 Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/linux/dma.c | 6 +++++- drivers/gpu/nvgpu/common/mm/gmmu.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 6473aed9..ea5b2837 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c @@ -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) diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index 2b579bdd..1be87c85 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c @@ -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), -- cgit v1.2.2