From c060e754fc63f9bfa04e0cfc80d4815861d35d30 Mon Sep 17 00:00:00 2001 From: Divya Singhatwaria Date: Fri, 6 Mar 2020 16:17:05 +0530 Subject: [PATCH] gpu: nvgpu: ELPG dump stats at shutdown ELPG_DISALLOW command fails during gk20a shutdown. It was due to nvgpu_can_busy() which was returning 0 before without acknowledging the ELPG_DISALLOW command. Since the system is shutting down so fix this issue by setting the ACK for disallow command without waiting for actual ACK from PMU. In doing so the state machine is also maintained properly and the driver does not dump fail stats. BUG 200588696 Change-Id: I943d8e6108fa0f9c418ccb1a7f061307823f1ec6 Signed-off-by: Divya Singhatwaria Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2308557 Reviewed-by: automaticguardword Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/pmu/fw/fw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/pmu/fw/fw.c b/drivers/gpu/nvgpu/common/pmu/fw/fw.c index 9bc5cb5d1..ce9682de7 100644 --- a/drivers/gpu/nvgpu/common/pmu/fw/fw.c +++ b/drivers/gpu/nvgpu/common/pmu/fw/fw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2020, 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"), @@ -118,6 +118,15 @@ int nvgpu_pmu_wait_fw_ack_status(struct gk20a *g, struct nvgpu_pmu *pmu, nvgpu_rmb(); if (nvgpu_can_busy(g) == 0) { + /* + * Since the system is shutting down so we don't + * wait for the ACK from PMU. + * Set ACK received so that state machine is maintained + * properly and falcon stats are not dumped due to + * PMU command failure + */ + + *(volatile u8 *)var = val; return 0; } @@ -132,6 +141,7 @@ int nvgpu_pmu_wait_fw_ack_status(struct gk20a *g, struct nvgpu_pmu *pmu, if (*(volatile u8 *)var == val) { return 0; } + } while (nvgpu_timeout_expired(&timeout) == 0); return -ETIMEDOUT;