From 58ee7561f72653aea8acece9f5d33ff8fe6fb99d Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Wed, 7 Aug 2019 11:57:28 +0530 Subject: gpu: nvgpu: Add CHANNEL_SETUP_BIND IOCTL For a long time now, the ALLOC_GPFIFO_EX channel IOCTL has done much more than just gpfifo allocation, and its signature does not match support that's needed soon. Add a new one called SETUP_BIND to hopefully cover our future needs and deprecate ALLOC_GPFIFO_EX. Change nvgpu internals to match this new naming as well. Bug 200145225 Bug 200541476 Change-Id: I766f9283a064e140656f6004b2b766db70bd6cad Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1835186 Signed-off-by: Debarshi Dutta (cherry-picked from e0c8a16c8d474eac6723fea3980833873ab921a6 in dev-main) Reviewed-on: https://git-master.nvidia.com/r/2169882 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'drivers/gpu/nvgpu/common/fifo') diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index fefd90d8..adb59ac4 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -1131,8 +1131,8 @@ static void channel_gk20a_free_prealloc_resources(struct channel_gk20a *c) c->joblist.pre_alloc.enabled = false; } -int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, - struct nvgpu_gpfifo_args *gpfifo_args) +int nvgpu_channel_setup_bind(struct channel_gk20a *c, + struct nvgpu_setup_bind_args *args) { struct gk20a *g = c->g; struct vm_gk20a *ch_vm; @@ -1141,14 +1141,14 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, int err = 0; unsigned long acquire_timeout; - gpfifo_size = gpfifo_args->num_entries; + gpfifo_size = args->num_gpfifo_entries; gpfifo_entry_size = nvgpu_get_gpfifo_entry_size(); - if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_VPR) { + if (args->flags & NVGPU_SETUP_BIND_FLAGS_SUPPORT_VPR) { c->vpr = true; } - if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC) { + if (args->flags & NVGPU_SETUP_BIND_FLAGS_SUPPORT_DETERMINISTIC) { nvgpu_rwsem_down_read(&g->deterministic_busy); /* * Railgating isn't deterministic; instead of disallowing @@ -1172,8 +1172,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, /* an address space needs to have been bound at this point. */ if (!gk20a_channel_as_bound(c)) { nvgpu_err(g, - "not bound to an address space at time of gpfifo" - " allocation."); + "not bound to an address space at time of setup_bind"); err = -EINVAL; goto clean_up_idle; } @@ -1187,10 +1186,9 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, goto clean_up_idle; } - if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_USERMODE_SUPPORT) { + if (args->flags & NVGPU_SETUP_BIND_FLAGS_USERMODE_SUPPORT) { if (g->os_channel.alloc_usermode_buffers) { - err = g->os_channel.alloc_usermode_buffers(c, - gpfifo_args); + err = g->os_channel.alloc_usermode_buffers(c, args); if (err) { nvgpu_err(g, "Usermode buffer alloc failed"); goto clean_up; @@ -1258,23 +1256,23 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, err = g->ops.fifo.setup_ramfc(c, gpfifo_gpu_va, c->gpfifo.entry_num, - acquire_timeout, gpfifo_args->flags); + acquire_timeout, args->flags); if (err) { goto clean_up_sync; } /* TBD: setup engine contexts */ - if (c->deterministic && gpfifo_args->num_inflight_jobs != 0U) { + if (c->deterministic && args->num_inflight_jobs != 0U) { err = channel_gk20a_prealloc_resources(c, - gpfifo_args->num_inflight_jobs); + args->num_inflight_jobs); if (err) { goto clean_up_sync; } } err = channel_gk20a_alloc_priv_cmdbuf(c, - gpfifo_args->num_inflight_jobs); + args->num_inflight_jobs); if (err) { goto clean_up_prealloc; } @@ -1292,7 +1290,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, clean_up_priv_cmd: channel_gk20a_free_priv_cmdbuf(c); clean_up_prealloc: - if (c->deterministic && gpfifo_args->num_inflight_jobs != 0U) { + if (c->deterministic && args->num_inflight_jobs != 0U) { channel_gk20a_free_prealloc_resources(c); } clean_up_sync: -- cgit v1.2.2