From 91515d1b47baf3eaeabef3641bb29e1bf39b4501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Tue, 11 Aug 2020 12:54:17 +0300 Subject: [PATCH] gpu: nvgpu: unify joblist api names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the nvgpu_ prefix to the peek, add and delete functions to make them consistent with the rest of the joblist functions. Rename the "prealloc resources" alloc and free functions to joblist init and deinit; there are many other resources that are also preallocated, and these handle just the job tracking list. NVGPU-5772 Change-Id: Ie5e6ba4f4b17465d626f36a0239bddb03a0a2fcb Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2397395 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 16 ++++++++-------- drivers/gpu/nvgpu/common/fifo/job.c | 10 +++++----- drivers/gpu/nvgpu/include/nvgpu/job.h | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 11958ca97..35f9bcac0 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -234,7 +234,7 @@ static void channel_kernelmode_deinit(struct nvgpu_channel *ch) ch->priv_cmd_q = NULL; } - channel_free_prealloc_resources(ch); + nvgpu_channel_joblist_deinit(ch); /* sync must be destroyed before releasing channel vm */ nvgpu_mutex_acquire(&ch->sync_lock); @@ -390,7 +390,7 @@ static int channel_setup_kernelmode(struct nvgpu_channel *c, job_count = nvgpu_safe_add_u32(gpfifo_size, 2U) / 3U; } - err = channel_prealloc_resources(c, job_count); + err = nvgpu_channel_joblist_init(c, job_count); if (err != 0) { goto clean_up_sync; } @@ -411,7 +411,7 @@ clean_up_priv_cmd: nvgpu_priv_cmdbuf_queue_free(c->priv_cmd_q); c->priv_cmd_q = NULL; clean_up_prealloc: - channel_free_prealloc_resources(c); + nvgpu_channel_joblist_deinit(c); clean_up_sync: if (c->sync != NULL) { nvgpu_channel_sync_destroy(c->sync); @@ -638,7 +638,7 @@ int nvgpu_channel_add_job(struct nvgpu_channel *c, nvgpu_channel_wdt_start(c->wdt, c); nvgpu_channel_joblist_lock(c); - channel_joblist_add(c, job); + nvgpu_channel_joblist_add(c, job); nvgpu_channel_joblist_unlock(c); } else { err = -ETIMEDOUT; @@ -688,7 +688,7 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c) bool completed; nvgpu_channel_joblist_lock(c); - job = channel_joblist_peek(c); + job = nvgpu_channel_joblist_peek(c); nvgpu_channel_joblist_unlock(c); if (job == NULL) { @@ -752,7 +752,7 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c) nvgpu_channel_free_job(c, job); nvgpu_channel_joblist_lock(c); - channel_joblist_delete(c, job); + nvgpu_channel_joblist_delete(c, job); nvgpu_channel_joblist_unlock(c); job_finished = true; @@ -787,7 +787,7 @@ void nvgpu_channel_clean_up_deterministic_job(struct nvgpu_channel *c) nvgpu_mutex_acquire(&c->joblist.cleanup_lock); nvgpu_channel_joblist_lock(c); - job = channel_joblist_peek(c); + job = nvgpu_channel_joblist_peek(c); nvgpu_channel_joblist_unlock(c); if (job == NULL) { @@ -817,7 +817,7 @@ void nvgpu_channel_clean_up_deterministic_job(struct nvgpu_channel *c) nvgpu_channel_free_job(c, job); nvgpu_channel_joblist_lock(c); - channel_joblist_delete(c, job); + nvgpu_channel_joblist_delete(c, job); nvgpu_channel_joblist_unlock(c); out_unlock: diff --git a/drivers/gpu/nvgpu/common/fifo/job.c b/drivers/gpu/nvgpu/common/fifo/job.c index c4cca88c2..635957acb 100644 --- a/drivers/gpu/nvgpu/common/fifo/job.c +++ b/drivers/gpu/nvgpu/common/fifo/job.c @@ -76,7 +76,7 @@ void nvgpu_channel_joblist_unlock(struct nvgpu_channel *c) nvgpu_mutex_release(&c->joblist.pre_alloc.read_lock); } -struct nvgpu_channel_job *channel_joblist_peek(struct nvgpu_channel *c) +struct nvgpu_channel_job *nvgpu_channel_joblist_peek(struct nvgpu_channel *c) { unsigned int get = c->joblist.pre_alloc.get; unsigned int put = c->joblist.pre_alloc.put; @@ -85,21 +85,21 @@ struct nvgpu_channel_job *channel_joblist_peek(struct nvgpu_channel *c) return empty ? NULL : &c->joblist.pre_alloc.jobs[get]; } -void channel_joblist_add(struct nvgpu_channel *c, +void nvgpu_channel_joblist_add(struct nvgpu_channel *c, struct nvgpu_channel_job *job) { c->joblist.pre_alloc.put = (c->joblist.pre_alloc.put + 1U) % (c->joblist.pre_alloc.length); } -void channel_joblist_delete(struct nvgpu_channel *c, +void nvgpu_channel_joblist_delete(struct nvgpu_channel *c, struct nvgpu_channel_job *job) { c->joblist.pre_alloc.get = (c->joblist.pre_alloc.get + 1U) % (c->joblist.pre_alloc.length); } -int channel_prealloc_resources(struct nvgpu_channel *c, u32 num_jobs) +int nvgpu_channel_joblist_init(struct nvgpu_channel *c, u32 num_jobs) { int err; u32 size; @@ -140,7 +140,7 @@ clean_up: return err; } -void channel_free_prealloc_resources(struct nvgpu_channel *c) +void nvgpu_channel_joblist_deinit(struct nvgpu_channel *c) { if (c->joblist.pre_alloc.jobs != NULL) { nvgpu_vfree(c->g, c->joblist.pre_alloc.jobs); diff --git a/drivers/gpu/nvgpu/include/nvgpu/job.h b/drivers/gpu/nvgpu/include/nvgpu/job.h index 5d2664459..154bfb504 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/job.h +++ b/drivers/gpu/nvgpu/include/nvgpu/job.h @@ -47,13 +47,13 @@ void nvgpu_channel_free_job(struct nvgpu_channel *c, void nvgpu_channel_joblist_lock(struct nvgpu_channel *c); void nvgpu_channel_joblist_unlock(struct nvgpu_channel *c); -struct nvgpu_channel_job *channel_joblist_peek(struct nvgpu_channel *c); -void channel_joblist_add(struct nvgpu_channel *c, +struct nvgpu_channel_job *nvgpu_channel_joblist_peek(struct nvgpu_channel *c); +void nvgpu_channel_joblist_add(struct nvgpu_channel *c, struct nvgpu_channel_job *job); -void channel_joblist_delete(struct nvgpu_channel *c, +void nvgpu_channel_joblist_delete(struct nvgpu_channel *c, struct nvgpu_channel_job *job); -int channel_prealloc_resources(struct nvgpu_channel *c, u32 num_jobs); -void channel_free_prealloc_resources(struct nvgpu_channel *c); +int nvgpu_channel_joblist_init(struct nvgpu_channel *c, u32 num_jobs); +void nvgpu_channel_joblist_deinit(struct nvgpu_channel *c); #endif