From ed33c465d572b7a8437bafa41004dc883b30a524 Mon Sep 17 00:00:00 2001 From: rmylavarapu Date: Tue, 10 Dec 2019 10:46:05 +0530 Subject: [PATCH] gpu: nvgpu: Check for ACK from PMU before timeout At present in NVGPU for every get_status cmd we wait for a response from PMU else timeout. In present code we look for the ACK very early then after processing the interrupts, this may result in timeout with valid response from PMU. To avoid this timeout a check for ACK is implemented before every timeout check. NVBUG-200530426 Change-Id: I6f8df51ab73066953ef7c9c05c61aaf543e53b52 Signed-off-by: rmylavarapu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2258899 Tested-by: mobile promotions Reviewed-by: Alex Waterman Reviewed-by: Mahantesh Kumbar Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/pmu/fw/fw.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/common/pmu/fw/fw.c b/drivers/gpu/nvgpu/common/pmu/fw/fw.c index cbc78d229..9bc5cb5d1 100644 --- a/drivers/gpu/nvgpu/common/pmu/fw/fw.c +++ b/drivers/gpu/nvgpu/common/pmu/fw/fw.c @@ -117,10 +117,6 @@ int nvgpu_pmu_wait_fw_ack_status(struct gk20a *g, struct nvgpu_pmu *pmu, do { nvgpu_rmb(); - if (*(volatile u8 *)var == val) { - return 0; - } - if (nvgpu_can_busy(g) == 0) { return 0; } @@ -131,6 +127,11 @@ int nvgpu_pmu_wait_fw_ack_status(struct gk20a *g, struct nvgpu_pmu *pmu, nvgpu_usleep_range(delay, delay * 2U); delay = min_t(u32, delay << 1, POLL_DELAY_MAX_US); + + /* Confirm ACK from PMU before timeout check */ + if (*(volatile u8 *)var == val) { + return 0; + } } while (nvgpu_timeout_expired(&timeout) == 0); return -ETIMEDOUT;