From c0473460ea0c4a1807f1e599299d2351b4fedadb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Mon, 1 Nov 2021 17:38:34 +0200 Subject: [PATCH] gpu: nvgpu: don't check ch activity on bind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete an unnecessary check of the active_channels bitmap when attempting to bind a channel to a TSG. There is already a verification that the channel must not be a part of a TSG; if it's not, it cannot be set in the bitmap. All channels become active via a parent TSG, but the activity check predates this design. A channel is bound to a TSG early before setting up its gpfifo etc. and mandatory membership of a TSG is one of the setup_bind prechecks. Jira NVGPU-6425 Change-Id: Id34686f198db0a0265ffd6a49a0b2e47c37fd5f7 Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2621211 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: svcacv Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/fifo/tsg.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index 46c0a4df8..fb51e2097 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -70,24 +70,6 @@ struct nvgpu_tsg *nvgpu_tsg_get_from_id(struct gk20a *g, u32 tsgid) return &f->tsg[tsgid]; } - -static bool nvgpu_tsg_is_channel_active(struct gk20a *g, - struct nvgpu_channel *ch) -{ - struct nvgpu_fifo *f = &g->fifo; - struct nvgpu_runlist *runlist; - unsigned int i; - - for (i = 0; i < f->num_runlists; ++i) { - runlist = &f->active_runlists[i]; - if (nvgpu_test_bit(ch->chid, runlist->domain->active_channels)) { - return true; - } - } - - return false; -} - /* * API to mark channel as part of TSG * @@ -106,11 +88,6 @@ int nvgpu_tsg_bind_channel(struct nvgpu_tsg *tsg, struct nvgpu_channel *ch) return -EINVAL; } - /* channel cannot be bound to TSG if it is already active */ - if (nvgpu_tsg_is_channel_active(tsg->g, ch)) { - return -EINVAL; - } - /* cannot bind more channels than MAX channels supported per TSG */ nvgpu_rwsem_down_read(&tsg->ch_list_lock); max_ch_per_tsg = g->ops.runlist.get_max_channels_per_tsg();