summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/falcon/falcon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/falcon/falcon.c')
-rw-r--r--drivers/gpu/nvgpu/common/falcon/falcon.c20
1 files changed, 20 insertions, 0 deletions
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)
102 return status; 102 return status;
103} 103}
104 104
105int nvgpu_flcn_wait_for_halt(struct nvgpu_falcon *flcn, unsigned int timeout)
106{
107 struct gk20a *g = flcn->g;
108 struct nvgpu_timeout to;
109 int status = 0;
110
111 nvgpu_timeout_init(g, &to, timeout, NVGPU_TIMER_CPU_TIMER);
112 do {
113 if (nvgpu_flcn_get_cpu_halted_status(flcn))
114 break;
115
116 nvgpu_udelay(10);
117 } while (!nvgpu_timeout_expired(&to));
118
119 if (nvgpu_timeout_peek_expired(&to))
120 status = -EBUSY;
121
122 return status;
123}
124
105bool nvgpu_flcn_get_idle_status(struct nvgpu_falcon *flcn) 125bool nvgpu_flcn_get_idle_status(struct nvgpu_falcon *flcn)
106{ 126{
107 struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops; 127 struct nvgpu_falcon_ops *flcn_ops = &flcn->flcn_ops;