From 820d2b4a2df0b629effaba99ac050791e0923ee9 Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Thu, 16 Dec 2021 11:16:09 -0800 Subject: [PATCH] gpu: nvgpu: keep gpu busy during vab reserve/flush ioctls VAB IOCTL for reserve and flush can take more than railgate_delay(500msec). To avoid gpu entering into railgate, set gpu busy hint during entry and set to idle at the end of ioctl. Bug 3468562 Change-Id: I9219e65004ad42028062ce09a315d9fde029a86c Signed-off-by: Seshendra Gadagottu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2643418 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/ioctl_prof.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_prof.c b/drivers/gpu/nvgpu/os/linux/ioctl_prof.c index a2d16654f..64615f71f 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_prof.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_prof.c @@ -789,11 +789,18 @@ static int nvgpu_prof_ioctl_vab_reserve(struct nvgpu_profiler_object *prof, return -EINVAL; } + err = gk20a_busy(g); + if (err != 0) { + nvgpu_err(g, "failed to poweron"); + return -EINVAL; + } + ckr = nvgpu_kzalloc(g, sizeof(struct nvgpu_vab_range_checker) * arg->num_range_checkers); if (copy_from_user(ckr, user_ckr, sizeof(struct nvgpu_vab_range_checker) * arg->num_range_checkers)) { + gk20a_idle(g); return -EFAULT; } @@ -801,6 +808,8 @@ static int nvgpu_prof_ioctl_vab_reserve(struct nvgpu_profiler_object *prof, nvgpu_kfree(g, ckr); + gk20a_idle(g); + return err; } @@ -811,6 +820,12 @@ static int nvgpu_prof_ioctl_vab_flush(struct nvgpu_profiler_object *prof, struct gk20a *g = prof->g; u64 *user_data = nvgpu_kzalloc(g, arg->buffer_size); + err = gk20a_busy(g); + if (err != 0) { + nvgpu_err(g, "failed to poweron"); + return -EINVAL; + } + err = g->ops.fb.vab.dump_and_clear(g, user_data, arg->buffer_size); if (err < 0) { goto fail; @@ -824,6 +839,7 @@ static int nvgpu_prof_ioctl_vab_flush(struct nvgpu_profiler_object *prof, fail: nvgpu_kfree(g, user_data); + gk20a_idle(g); return err; } #endif