diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-09-11 07:47:51 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-08-15 03:58:54 -0400 |
commit | 8b484c0b531b95fce024e101cdd204f1f8107c29 (patch) | |
tree | d55f5ab0ed32e8c45ecfb9fa639456eba5433de2 /drivers/gpu/nvgpu/common/fifo | |
parent | 758cb76e225775ba5ac3dd2cb9415cb40dc83810 (diff) |
gpu: nvgpu: support usermode submit buffers
Import userd and gpfifo buffers from userspace if provided via
NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX. Also supply the work submit token
(i.e., the hw channel id) to userspace.
To keep the buffers alive, store their dmabuf and attachment/sgt handles
in nvgpu_channel_linux. Our nvgpu_mem doesn't provide such data for
buffers that are mainly in kernel use. The buffers are freed via a new
API in the os_channel interface.
Fix a bug in gk20a_channel_free_usermode_buffers: also unmap the
usermode gpfifo buffer.
Bug 200145225
Bug 200541476
Change-Id: I8416af7085c91b044ac8ccd9faa38e2a6d0c3946
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1795821
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
(cherry picked from commit 99b1c6dcdf328efcfe47338ad1b71a114ab7f272
in dev-main)
Reviewed-on: https://git-master.nvidia.com/r/2170603
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/fifo')
-rw-r--r-- | drivers/gpu/nvgpu/common/fifo/channel.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index adb59ac4..6ebeb596 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c | |||
@@ -1228,7 +1228,9 @@ int nvgpu_channel_setup_bind(struct channel_gk20a *c, | |||
1228 | nvgpu_log_info(g, "channel %d : gpfifo_base 0x%016llx, size %d", | 1228 | nvgpu_log_info(g, "channel %d : gpfifo_base 0x%016llx, size %d", |
1229 | c->chid, gpfifo_gpu_va, c->gpfifo.entry_num); | 1229 | c->chid, gpfifo_gpu_va, c->gpfifo.entry_num); |
1230 | 1230 | ||
1231 | g->ops.fifo.setup_userd(c); | 1231 | if (!c->usermode_submit_enabled) { |
1232 | g->ops.fifo.setup_userd(c); | ||
1233 | } | ||
1232 | 1234 | ||
1233 | if (g->aggressive_sync_destroy_thresh == 0U) { | 1235 | if (g->aggressive_sync_destroy_thresh == 0U) { |
1234 | nvgpu_mutex_acquire(&c->sync_lock); | 1236 | nvgpu_mutex_acquire(&c->sync_lock); |
@@ -1326,7 +1328,10 @@ void gk20a_channel_free_usermode_buffers(struct channel_gk20a *c) | |||
1326 | nvgpu_dma_free(c->g, &c->usermode_userd); | 1328 | nvgpu_dma_free(c->g, &c->usermode_userd); |
1327 | } | 1329 | } |
1328 | if (nvgpu_mem_is_valid(&c->usermode_gpfifo)) { | 1330 | if (nvgpu_mem_is_valid(&c->usermode_gpfifo)) { |
1329 | nvgpu_dma_free(c->g, &c->usermode_gpfifo); | 1331 | nvgpu_dma_unmap_free(c->vm, &c->usermode_gpfifo); |
1332 | } | ||
1333 | if (c->g->os_channel.free_usermode_buffers != NULL) { | ||
1334 | c->g->os_channel.free_usermode_buffers(c); | ||
1330 | } | 1335 | } |
1331 | } | 1336 | } |
1332 | 1337 | ||