From b92a6bdbf51da0d071fc11146258ca6a80e2b9d7 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 12 Dec 2017 15:35:52 -0800 Subject: gpu: nvgpu: Use TSG for CDE channels All channels should be wrapped in TSGs so that bare channel support can be dropped. Bind all CDE channels to TSGs. Bug 1842197 Change-Id: I20b68c81b47e0d742e5922e7b85ac5cba75984b0 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1616698 Reviewed-by: Seshendra Gadagottu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/cde.c | 18 ++++++++++++++++++ drivers/gpu/nvgpu/common/linux/cde.h | 1 + 2 files changed, 19 insertions(+) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c index f6b43113..1cb531fb 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.c +++ b/drivers/gpu/nvgpu/common/linux/cde.c @@ -107,6 +107,10 @@ __must_hold(&cde_app->mutex) cde_ctx->backing_store_vaddr); /* free the channel */ + if (cde_ctx->tsg && ch) { + gk20a_tsg_unbind_channel(cde_ctx->ch); + } + gk20a_channel_close(ch); /* housekeeping on app */ @@ -1266,6 +1270,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) struct gk20a *g = &l->g; struct nvgpu_firmware *img; struct channel_gk20a *ch; + struct tsg_gk20a *tsg; struct gr_gk20a *gr = &g->gr; int err = 0; u64 vaddr; @@ -1276,6 +1281,12 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) return -ENOSYS; } + tsg = gk20a_tsg_open(g); + if (!tsg) { + nvgpu_err(g, "cde: could not create TSG"); + goto err_get_gk20a_channel; + } + ch = gk20a_open_new_channel_with_cb(g, gk20a_cde_finished_ctx_cb, cde_ctx, -1, @@ -1293,6 +1304,12 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) goto err_commit_va; } + err = gk20a_tsg_bind_channel(tsg, ch); + if (err) { + nvgpu_err(g, "cde: unable to bind to tsg"); + goto err_alloc_gpfifo; + } + /* allocate gpfifo (1024 should be more than enough) */ err = gk20a_channel_alloc_gpfifo(ch, 1024, 0, NVGPU_GPFIFO_FLAGS_ALLOW_BARE_CHANNEL); @@ -1317,6 +1334,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) /* store initialisation data */ cde_ctx->ch = ch; + cde_ctx->tsg = tsg; cde_ctx->vm = ch->vm; cde_ctx->backing_store_vaddr = vaddr; diff --git a/drivers/gpu/nvgpu/common/linux/cde.h b/drivers/gpu/nvgpu/common/linux/cde.h index fe206401..91ea9b88 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.h +++ b/drivers/gpu/nvgpu/common/linux/cde.h @@ -232,6 +232,7 @@ struct gk20a_cde_ctx { /* channel related data */ struct channel_gk20a *ch; + struct tsg_gk20a *tsg; struct vm_gk20a *vm; /* buf converter configuration */ -- cgit v1.2.2