From 6365040db35fd01c8ebff39bd9dbc6c73c48fb17 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 23 Aug 2017 17:25:27 -0700 Subject: gpu: vgpu: gp10b: Add map failure debugging The vGPU mapping code in gp10b gives very little debugging info when there's a failure. This change adds much more detail to the error printing so that thee failures can more easily be debugged without needing to run the virtual guest locally. Change-Id: Ibb4412fd4ab322b366f0e08eaa399b7b90ea22c7 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1544506 Reviewed-by: svc-mobile-coverity Reviewed-by: Konsta Holtta GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c') diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c index 347f27a5..85c436e5 100644 --- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c +++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c @@ -63,7 +63,7 @@ static u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm, u32 page_size = vm->gmmu_page_sizes[pgsz_idx]; u64 space_to_skip = buffer_offset; u64 buffer_size = 0; - u32 mem_desc_count = 0; + u32 mem_desc_count = 0, i; struct scatterlist *sgl; void *handle = NULL; size_t oob_size; @@ -79,6 +79,8 @@ static u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm, if (space_to_skip & (page_size - 1)) return 0; + memset(&msg, 0, sizeof(msg)); + /* Allocate (or validate when map_offset != 0) the virtual address. */ if (!map_offset) { map_offset = __nvgpu_vm_alloc_va(vm, size, pgsz_idx); @@ -172,7 +174,19 @@ static u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm, fail: if (handle) tegra_gr_comm_oob_put_ptr(handle); - nvgpu_err(g, "%s: failed with err=%d", __func__, err); + nvgpu_err(g, "Failed: err=%d, msg.ret=%d", err, msg.ret); + nvgpu_err(g, + " Map: %-5s GPU virt %#-12llx +%#-9llx " + "phys offset: %#-4llx; pgsz: %3dkb perm=%-2s | " + "kind=%#02x APT=%-6s", + vm->name, map_offset, buffer_size, buffer_offset, + vm->gmmu_page_sizes[pgsz_idx] >> 10, + nvgpu_gmmu_perm_str(rw_flag), + kind_v, "SYSMEM"); + for (i = 0; i < mem_desc_count; i++) + nvgpu_err(g, " > 0x%010llx + 0x%llx", + mem_desc[i].addr, mem_desc[i].length); + return 0; } -- cgit v1.2.2