From 61b263d83222cd5d2ff3d2d5d699b07ebdf44288 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Tue, 10 Oct 2017 10:45:54 +0530 Subject: gpu: nvgpu: replace wait_queue_head_t with nvgpu_cond Replace existing usages of wait_queue_head_t with struct nvgpu_cond and using the corresponding APIs in order to reduce Linux dependencies in NVGPU. JIRA NVGPU-205 Change-Id: I85850369c3c47d3e1704e4171b1d172361842423 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1575778 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/driver_common.c | 12 ++++++------ drivers/gpu/nvgpu/common/linux/intr.c | 4 ++-- drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 6 +++--- drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 4 ++-- drivers/gpu/nvgpu/common/linux/os_linux.h | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index 295297b6..e4a65692 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -39,8 +39,8 @@ static void nvgpu_init_vars(struct gk20a *g) struct device *dev = dev_from_gk20a(g); struct gk20a_platform *platform = dev_get_drvdata(dev); - init_waitqueue_head(&l->sw_irq_stall_last_handled_wq); - init_waitqueue_head(&l->sw_irq_nonstall_last_handled_wq); + nvgpu_cond_init(&l->sw_irq_stall_last_handled_wq); + nvgpu_cond_init(&l->sw_irq_nonstall_last_handled_wq); gk20a_init_gr(g); init_rwsem(&l->busy_lock); @@ -261,14 +261,14 @@ void nvgpu_wait_for_deferred_interrupts(struct gk20a *g) int nonstall_irq_threshold = atomic_read(&l->hw_irq_nonstall_count); /* wait until all stalling irqs are handled */ - wait_event(l->sw_irq_stall_last_handled_wq, + NVGPU_COND_WAIT(&l->sw_irq_stall_last_handled_wq, cyclic_delta(stall_irq_threshold, atomic_read(&l->sw_irq_stall_last_handled)) - <= 0); + <= 0, 0); /* wait until all non-stalling irqs are handled */ - wait_event(l->sw_irq_nonstall_last_handled_wq, + NVGPU_COND_WAIT(&l->sw_irq_nonstall_last_handled_wq, cyclic_delta(nonstall_irq_threshold, atomic_read(&l->sw_irq_nonstall_last_handled)) - <= 0); + <= 0, 0); } diff --git a/drivers/gpu/nvgpu/common/linux/intr.c b/drivers/gpu/nvgpu/common/linux/intr.c index da177b55..d1b6ef36 100644 --- a/drivers/gpu/nvgpu/common/linux/intr.c +++ b/drivers/gpu/nvgpu/common/linux/intr.c @@ -59,7 +59,7 @@ irqreturn_t nvgpu_intr_thread_stall(struct gk20a *g) /* sync handled irq counter before re-enabling interrupts */ atomic_set(&l->sw_irq_stall_last_handled, hw_irq_count); - wake_up_all(&l->sw_irq_stall_last_handled_wq); + nvgpu_cond_broadcast(&l->sw_irq_stall_last_handled_wq); trace_mc_gk20a_intr_thread_stall_done(g->name); @@ -128,7 +128,7 @@ irqreturn_t nvgpu_intr_nonstall(struct gk20a *g) g->ops.mc.intr_nonstall_resume(g); - wake_up_all(&l->sw_irq_nonstall_last_handled_wq); + nvgpu_cond_broadcast(&l->sw_irq_nonstall_last_handled_wq); return IRQ_HANDLED; } diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 6c66eca0..3ea07eed 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -575,7 +575,7 @@ static unsigned int gk20a_event_id_poll(struct file *filep, poll_table *wait) gk20a_dbg(gpu_dbg_fn | gpu_dbg_info, ""); - poll_wait(filep, &event_id_data->event_id_wq, wait); + poll_wait(filep, &event_id_data->event_id_wq.wq, wait); nvgpu_mutex_acquire(&event_id_data->lock); @@ -683,7 +683,7 @@ void gk20a_channel_event_id_post_event(struct channel_gk20a *ch, event_id, ch->chid); event_id_data->event_posted = true; - wake_up_interruptible_all(&event_id_data->event_id_wq); + nvgpu_cond_broadcast_interruptible(&event_id_data->event_id_wq); nvgpu_mutex_release(&event_id_data->lock); } @@ -735,7 +735,7 @@ static int gk20a_channel_event_id_enable(struct channel_gk20a *ch, event_id_data->is_tsg = false; event_id_data->event_id = event_id; - init_waitqueue_head(&event_id_data->event_id_wq); + nvgpu_cond_init(&event_id_data->event_id_wq); err = nvgpu_mutex_init(&event_id_data->lock); if (err) goto clean_up_free; diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index 10379633..6d0439f3 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c @@ -97,7 +97,7 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, event_id, tsg->tsgid); event_id_data->event_posted = true; - wake_up_interruptible_all(&event_id_data->event_id_wq); + nvgpu_cond_broadcast_interruptible(&event_id_data->event_id_wq); nvgpu_mutex_release(&event_id_data->lock); } @@ -150,7 +150,7 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, event_id_data->is_tsg = true; event_id_data->event_id = event_id; - init_waitqueue_head(&event_id_data->event_id_wq); + nvgpu_cond_init(&event_id_data->event_id_wq); err = nvgpu_mutex_init(&event_id_data->lock); if (err) goto clean_up_free; diff --git a/drivers/gpu/nvgpu/common/linux/os_linux.h b/drivers/gpu/nvgpu/common/linux/os_linux.h index 4a3128c3..c67cbbcc 100644 --- a/drivers/gpu/nvgpu/common/linux/os_linux.h +++ b/drivers/gpu/nvgpu/common/linux/os_linux.h @@ -77,12 +77,12 @@ struct nvgpu_os_linux { atomic_t hw_irq_stall_count; atomic_t hw_irq_nonstall_count; - wait_queue_head_t sw_irq_stall_last_handled_wq; + struct nvgpu_cond sw_irq_stall_last_handled_wq; atomic_t sw_irq_stall_last_handled; atomic_t nonstall_ops; - wait_queue_head_t sw_irq_nonstall_last_handled_wq; + struct nvgpu_cond sw_irq_nonstall_last_handled_wq; atomic_t sw_irq_nonstall_last_handled; struct work_struct nonstall_fn_work; -- cgit v1.2.2