From d4f7c90020271c1d401c4c99db176da1e22f68e5 Mon Sep 17 00:00:00 2001 From: Nitin Kumbhar Date: Thu, 14 Feb 2019 23:10:18 +0530 Subject: [PATCH] gpu: nvgpu: increase tu104 flush retries nvrm_gpu_tests uses dGPU detach/attach APIs to test GCOFF sequence. This results in a timeout on tu104 while detaching dGPU. ...snip... [start: NvRmGpuTest_Lib_AttachDevice] Detaching dGPU at index 2001... [ 89.933604] -- nvrm_gpu_tests: Ended subtest NvRmGpuTest_Device_ChooseKind_Color_Incompressible [ 91.473919] nvgpu: 0001:01:00.0 __nvgpu_timeout_expired_msg_retry:118 [ERR] No more retries @ gk20a_mm_fb_flush+0xd4/0x328 [nvgpu] [ 91.474280] nvgpu: 0001:01:00.0 gm20b_fb_dump_wpr_info:240 [ERR] WPR: 08000080 08000081 01c00002 01c01e03 1ffffe04 00000005 ...snip... Increase retries from 2000 to 2500 which seems to be sufficient. Bug 200491474 Change-Id: I7bab4e39c677361d3642e034f5bdb9ba75d4c450 Signed-off-by: Nitin Kumbhar Reviewed-on: https://git-master.nvidia.com/r/2019432 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile | 1 + drivers/gpu/nvgpu/Makefile.sources | 1 + drivers/gpu/nvgpu/tu104/hal_tu104.c | 4 +-- drivers/gpu/nvgpu/tu104/mm_tu104.c | 47 +++++++++++++++++++++++++++++ drivers/gpu/nvgpu/tu104/mm_tu104.h | 33 ++++++++++++++++++++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/nvgpu/tu104/mm_tu104.c create mode 100644 drivers/gpu/nvgpu/tu104/mm_tu104.h diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 9ac1b9029..e88bae156 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -478,6 +478,7 @@ nvgpu-y += \ gv100/hal_gv100.o \ gv100/gsp_gv100.o \ gv100/clk_gv100.o \ + tu104/mm_tu104.o \ tu104/hal_tu104.o \ tu104/fifo_tu104.o \ tu104/gr_tu104.o \ diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 45b8a1fe9..660851ac5 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -291,6 +291,7 @@ srcs += common/sim.c \ tu104/fbpa_tu104.c \ tu104/fifo_tu104.c \ tu104/gr_tu104.c \ + tu104/mm_tu104.c \ tu104/hal_tu104.c \ tu104/sec2_tu104.c \ tu104/func_tu104.c \ diff --git a/drivers/gpu/nvgpu/tu104/hal_tu104.c b/drivers/gpu/nvgpu/tu104/hal_tu104.c index 6bd52564d..d16dc6e80 100644 --- a/drivers/gpu/nvgpu/tu104/hal_tu104.c +++ b/drivers/gpu/nvgpu/tu104/hal_tu104.c @@ -137,8 +137,8 @@ #include "gv100/bios_gv100.h" #include "gv100/fifo_gv100.h" #include "gv100/gr_gv100.h" -#include "gv100/mm_gv100.h" +#include "tu104/mm_tu104.h" #include "tu104/fifo_tu104.h" #include "tu104/gr_tu104.h" #include "tu104/bios_tu104.h" @@ -929,7 +929,7 @@ static const struct gpu_ops tu104_ops = { .remove_bar2_vm = gp10b_remove_bar2_vm, .fault_info_mem_destroy = gv11b_mm_fault_info_mem_destroy, .mmu_fault_disable_hw = gv11b_mm_mmu_fault_disable_hw, - .get_flush_retries = gv100_mm_get_flush_retries, + .get_flush_retries = tu104_mm_get_flush_retries, .bar1_map_userd = NULL, }, .pramin = { diff --git a/drivers/gpu/nvgpu/tu104/mm_tu104.c b/drivers/gpu/nvgpu/tu104/mm_tu104.c new file mode 100644 index 000000000..a6f04aeef --- /dev/null +++ b/drivers/gpu/nvgpu/tu104/mm_tu104.c @@ -0,0 +1,47 @@ +/* + * TU104 memory management + * + * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include + +#include "tu104/mm_tu104.h" + +u32 tu104_mm_get_flush_retries(struct gk20a *g, enum nvgpu_flush_op op) +{ + u32 retries; + + switch (op) { + /* TU104 has a large FB so it needs larger timeouts */ + case NVGPU_FLUSH_FB: + retries = 2500; + break; + case NVGPU_FLUSH_L2_FLUSH: + retries = 2000; + break; + default: + retries = 200; /* Default retry timer */ + break; + } + + return retries; +} diff --git a/drivers/gpu/nvgpu/tu104/mm_tu104.h b/drivers/gpu/nvgpu/tu104/mm_tu104.h new file mode 100644 index 000000000..975ec1a71 --- /dev/null +++ b/drivers/gpu/nvgpu/tu104/mm_tu104.h @@ -0,0 +1,33 @@ +/* + * TU104 memory management + * + * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef MM_TU104_H +#define MM_TU104_H + +struct gk20a; +enum nvgpu_flush_op; + +u32 tu104_mm_get_flush_retries(struct gk20a *g, enum nvgpu_flush_op op); + +#endif