From 733fb79b39869665addcd80ccdf1c15f4a5aaa29 Mon Sep 17 00:00:00 2001 From: Sachit Kadle Date: Mon, 15 Aug 2016 14:32:39 -0700 Subject: gpu: nvgpu: add support for pre-allocated resources Add support for pre-allocation of job tracking resources w/ new (extended) ioctl. Goal is to avoid dynamic memory allocation in the submit path. This patch does the following: 1) Intoduces a new ioctl, NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX, which enables pre-allocation of tracking resources per job: a) 2x priv_cmd_entry b) 2x gk20a_fence 2) Implements circular ring buffer for job tracking to avoid lock contention between producer (submitter) and consumer (clean-up) Bug 1795076 Change-Id: I6b52e5c575871107ff380f9a5790f440a6969347 Signed-off-by: Sachit Kadle Reviewed-on: http://git-master/r/1203300 (cherry picked from commit 9fd270c22b860935dffe244753dabd87454bef39) Reviewed-on: http://git-master/r/1223934 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/ce2_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c index 109ec240..bfd183fb 100644 --- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c @@ -126,9 +126,9 @@ static void gk20a_ce_finished_ctx_cb(struct channel_gk20a *ch, void *data) bool channel_idle; u32 event; - spin_lock(&ch->jobs_lock); - channel_idle = list_empty(&ch->jobs); - spin_unlock(&ch->jobs_lock); + channel_gk20a_joblist_lock(ch); + channel_idle = channel_gk20a_joblist_is_empty(ch); + channel_gk20a_joblist_unlock(ch); if (!channel_idle) return; @@ -462,7 +462,7 @@ u32 gk20a_ce_create_context_with_cb(struct device *dev, /* allocate gpfifo (1024 should be more than enough) */ err = gk20a_alloc_channel_gpfifo(ce_ctx->ch, - &(struct nvgpu_alloc_gpfifo_args){1024, 0}); + &(struct nvgpu_alloc_gpfifo_ex_args){1024, 0, 0, {}}); if (err) { gk20a_err(ce_ctx->dev, "ce: unable to allocate gpfifo"); goto end; -- cgit v1.2.2