gpu: nvgpu: Check for timeout and indicate error

For every copy_back enabled PMU cmd sent by NVGPU
we are waiting for PMU response but not checking
for timeout error. This will result in copying invalid
data which causes errors. Implemented timeout check
and return error if timedout.

NVBUG-200530426

Change-Id: I32eba16eeb6f7a56724329ab6d85fae062c6fa3f
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2258947
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
rmylavarapu
2020-02-25 14:07:36 +05:30
committed by Alex Waterman
parent ed33c465d5
commit a23d0c1c19
2 changed files with 15 additions and 6 deletions

View File

@@ -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"),
@@ -723,8 +723,13 @@ int nvgpu_pmu_rpc_execute(struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc,
*/
if (is_copy_back) {
/* wait till RPC execute in PMU & ACK */
pmu_wait_message_cond(pmu, nvgpu_get_poll_timeout(g),
&rpc_payload->complete, 1);
if (nvgpu_pmu_wait_fw_ack_status(g, pmu,
nvgpu_get_poll_timeout(g),
&rpc_payload->complete, 1U) != 0) {
nvgpu_err(g, "PMU wait timeout expired.");
status = -ETIMEDOUT;
goto cleanup;
}
/* copy back data to caller */
nvgpu_memcpy((u8 *)rpc, (u8 *)rpc_buff, size_rpc);
/* free allocated memory */

View File

@@ -332,9 +332,13 @@ int nvgpu_pmu_perf_changeseq_set_clks(struct gk20a *g,
/* Wait for sync change to complete. */
if ((rpc.change.flags & CTRL_PERF_CHANGE_SEQ_CHANGE_ASYNC) == 0U) {
pmu_wait_message_cond(g->pmu,
nvgpu_get_poll_timeout(g),
&change_seq_pmu->change_state, 1U);
/* wait till RPC execute in PMU & ACK */
if (nvgpu_pmu_wait_fw_ack_status(g, pmu,
nvgpu_get_poll_timeout(g),
&change_seq_pmu->change_state, 1U) != 0) {
nvgpu_err(g, "PMU wait timeout expired.");
status = -ETIMEDOUT;
}
}
change_seq_pmu->stop_time = nvgpu_current_time_us();
return status;