From fbeca4a8414c03a1564d7a370964187be51a3e6c Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Wed, 28 Jun 2017 16:53:41 +0530 Subject: gpu: nvgpu: Falcon controller wait for halt - Added nvgpu_flcn_wait_for_halt() interface to wait for falcon halt, which block till falcon halt or timeout expire for selected falcon controller - Replaced falcon wait for halt code with method nvgpu_flcn_wait_for_halt() NVGPU JIRA-99 Change-Id: Ie1809dc29ff65bddc7ef2859a9ee9b4f0003b127 Signed-off-by: Mahantesh Kumbar Reviewed-on: https://git-master/r/1510201 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu --- drivers/gpu/nvgpu/common/falcon/falcon.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/falcon/falcon.c b/drivers/gpu/nvgpu/common/falcon/falcon.c index b6589bd1..ba2fb3fe 100644 --- a/drivers/gpu/nvgpu/common/falcon/falcon.c +++ b/drivers/gpu/nvgpu/common/falcon/falcon.c @@ -102,6 +102,26 @@ bool nvgpu_flcn_get_cpu_halted_status(struct nvgpu_falcon *flcn) return status; } +int nvgpu_flcn_wait_for_halt(struct nvgpu_falcon *flcn, unsigned int timeout) +{ + struct gk20a *g = flcn->g; + struct nvgpu_timeout to; + int status = 0; + + nvgpu_timeout_init(g, &to, timeout, NVGPU_TIMER_CPU_TIMER); + do { + if (nvgpu_flcn_get_cpu_halted_status(flcn)) + break; + + nvgpu_udelay(10); + } while (!nvgpu_timeout_expired(&to)); + + if (nvgpu_timeout_peek_expired(&to)) + status = -EBUSY; + + return status; +} + bool nvgpu_flcn_get_idle_status(struct nvgpu_falcon *flcn) { struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; -- cgit v1.2.2