From ce206826f2731d2aeb48ce24ac652365a836529b Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 1 Feb 2021 15:52:46 +0530 Subject: [PATCH] gpu: nvgpu: use explicit timeout to wait for SM lock down gv11b_gr_wait_for_sm_lock_down() uses nvgpu_get_poll_timeout() to get timeout value for polling of SM lock down status. nvgpu_get_poll_timeout() returns -1 if timeouts are disabled by debugger, and if SM lock down fails, nvgpu lands in an infinite loop. Use g->poll_timeout_default instead of nvgpu_get_poll_timeout() so that explicit timeout value is always used. This also means that timeout value of ULONG_MAX will still be used on simulation platforms. Bug 200676073 Change-Id: I5777e98efcd63f24ade244384cf7b157dcea991d Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2478255 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Mikhail Filimonov Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c index 9aca32307..aeb4759b7 100644 --- a/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c @@ -1,7 +1,7 @@ /* * GV11b GPU GR * - * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2021, 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"), @@ -1260,7 +1260,7 @@ int gv11b_gr_wait_for_sm_lock_down(struct gk20a *g, nvgpu_log(g, gpu_dbg_intr | gpu_dbg_gpu_dbg, "GPC%d TPC%d: locking down SM%d", gpc, tpc, sm); - err = nvgpu_timeout_init(g, &timeout, nvgpu_get_poll_timeout(g), + err = nvgpu_timeout_init(g, &timeout, g->poll_timeout_default, NVGPU_TIMER_CPU_TIMER); if (err != 0) { nvgpu_err(g, "timeout_init failed: %d", err);