summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_arb.c
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2017-10-10 01:15:54 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-16 16:35:04 -0400
commit61b263d83222cd5d2ff3d2d5d699b07ebdf44288 (patch)
tree07ef35fb427dc2f93741ed9193673b6da2872bb7 /drivers/gpu/nvgpu/clk/clk_arb.c
parent30b9cbe35a2a0adc4e3a65b033dc0f61046783ea (diff)
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 <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1575778 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_arb.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_arb.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c
index a914b4a2..937d47db 100644
--- a/drivers/gpu/nvgpu/clk/clk_arb.c
+++ b/drivers/gpu/nvgpu/clk/clk_arb.c
@@ -40,6 +40,7 @@
40#include <nvgpu/kref.h> 40#include <nvgpu/kref.h>
41#include <nvgpu/log.h> 41#include <nvgpu/log.h>
42#include <nvgpu/barrier.h> 42#include <nvgpu/barrier.h>
43#include <nvgpu/cond.h>
43 44
44#include "gk20a/gk20a.h" 45#include "gk20a/gk20a.h"
45#include "clk/clk_arb.h" 46#include "clk/clk_arb.h"
@@ -189,7 +190,7 @@ struct nvgpu_clk_arb {
189 struct work_struct vf_table_fn_work; 190 struct work_struct vf_table_fn_work;
190 struct workqueue_struct *vf_table_work_queue; 191 struct workqueue_struct *vf_table_work_queue;
191 192
192 wait_queue_head_t request_wq; 193 struct nvgpu_cond request_wq;
193 194
194 struct nvgpu_clk_vf_table *current_vf_table; 195 struct nvgpu_clk_vf_table *current_vf_table;
195 struct nvgpu_clk_vf_table vf_table_pool[2]; 196 struct nvgpu_clk_vf_table vf_table_pool[2];
@@ -218,7 +219,7 @@ struct nvgpu_clk_dev {
218 struct list_head link; 219 struct list_head link;
219 struct llist_node node; 220 struct llist_node node;
220 }; 221 };
221 wait_queue_head_t readout_wq; 222 struct nvgpu_cond readout_wq;
222 nvgpu_atomic_t poll_mask; 223 nvgpu_atomic_t poll_mask;
223 u16 gpc2clk_target_mhz; 224 u16 gpc2clk_target_mhz;
224 u16 mclk_target_mhz; 225 u16 mclk_target_mhz;
@@ -371,7 +372,7 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g)
371 INIT_LIST_HEAD_RCU(&arb->sessions); 372 INIT_LIST_HEAD_RCU(&arb->sessions);
372 init_llist_head(&arb->requests); 373 init_llist_head(&arb->requests);
373 374
374 init_waitqueue_head(&arb->request_wq); 375 nvgpu_cond_init(&arb->request_wq);
375 arb->vf_table_work_queue = alloc_workqueue("%s", WQ_HIGHPRI, 1, 376 arb->vf_table_work_queue = alloc_workqueue("%s", WQ_HIGHPRI, 1,
376 "vf_table_update"); 377 "vf_table_update");
377 arb->update_work_queue = alloc_workqueue("%s", WQ_HIGHPRI, 1, 378 arb->update_work_queue = alloc_workqueue("%s", WQ_HIGHPRI, 1,
@@ -400,8 +401,8 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g)
400 do { 401 do {
401 /* Check that first run is completed */ 402 /* Check that first run is completed */
402 nvgpu_smp_mb(); 403 nvgpu_smp_mb();
403 wait_event_interruptible(arb->request_wq, 404 NVGPU_COND_WAIT_INTERRUPTIBLE(&arb->request_wq,
404 nvgpu_atomic_read(&arb->req_nr)); 405 nvgpu_atomic_read(&arb->req_nr), 0);
405 } while (!nvgpu_atomic_read(&arb->req_nr)); 406 } while (!nvgpu_atomic_read(&arb->req_nr));
406 407
407 408
@@ -547,7 +548,7 @@ static int nvgpu_clk_arb_install_fd(struct gk20a *g,
547 548
548 fd_install(fd, file); 549 fd_install(fd, file);
549 550
550 init_waitqueue_head(&dev->readout_wq); 551 nvgpu_cond_init(&dev->readout_wq);
551 552
552 nvgpu_atomic_set(&dev->poll_mask, 0); 553 nvgpu_atomic_set(&dev->poll_mask, 0);
553 554
@@ -1269,7 +1270,7 @@ static void nvgpu_clk_arb_run_arbiter_cb(struct work_struct *work)
1269 /* VF Update complete */ 1270 /* VF Update complete */
1270 nvgpu_clk_arb_set_global_alarm(g, EVENT(VF_UPDATE)); 1271 nvgpu_clk_arb_set_global_alarm(g, EVENT(VF_UPDATE));
1271 1272
1272 wake_up_interruptible(&arb->request_wq); 1273 nvgpu_cond_signal_interruptible(&arb->request_wq);
1273 1274
1274#ifdef CONFIG_DEBUG_FS 1275#ifdef CONFIG_DEBUG_FS
1275 g->ops.bus.read_ptimer(g, &t1); 1276 g->ops.bus.read_ptimer(g, &t1);
@@ -1317,7 +1318,7 @@ exit_arb:
1317 head = llist_del_all(&arb->requests); 1318 head = llist_del_all(&arb->requests);
1318 llist_for_each_entry_safe(dev, tmp, head, node) { 1319 llist_for_each_entry_safe(dev, tmp, head, node) {
1319 nvgpu_atomic_set(&dev->poll_mask, POLLIN | POLLRDNORM); 1320 nvgpu_atomic_set(&dev->poll_mask, POLLIN | POLLRDNORM);
1320 wake_up_interruptible(&dev->readout_wq); 1321 nvgpu_cond_signal_interruptible(&dev->readout_wq);
1321 nvgpu_ref_put(&dev->refcount, nvgpu_clk_arb_free_fd); 1322 nvgpu_ref_put(&dev->refcount, nvgpu_clk_arb_free_fd);
1322 } 1323 }
1323 1324
@@ -1444,7 +1445,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev,
1444 1445
1445 if (poll_mask) { 1446 if (poll_mask) {
1446 nvgpu_atomic_set(&dev->poll_mask, poll_mask); 1447 nvgpu_atomic_set(&dev->poll_mask, poll_mask);
1447 wake_up_interruptible_all(&dev->readout_wq); 1448 nvgpu_cond_broadcast_interruptible(&dev->readout_wq);
1448 } 1449 }
1449 1450
1450 return new_alarms_reported; 1451 return new_alarms_reported;
@@ -1587,8 +1588,8 @@ static ssize_t nvgpu_clk_arb_read_event_dev(struct file *filp, char __user *buf,
1587 while (!__pending_event(dev, &info)) { 1588 while (!__pending_event(dev, &info)) {
1588 if (filp->f_flags & O_NONBLOCK) 1589 if (filp->f_flags & O_NONBLOCK)
1589 return -EAGAIN; 1590 return -EAGAIN;
1590 err = wait_event_interruptible(dev->readout_wq, 1591 err = NVGPU_COND_WAIT_INTERRUPTIBLE(&dev->readout_wq,
1591 __pending_event(dev, &info)); 1592 __pending_event(dev, &info), 0);
1592 if (err) 1593 if (err)
1593 return err; 1594 return err;
1594 if (info.timestamp) 1595 if (info.timestamp)
@@ -1607,7 +1608,7 @@ static unsigned int nvgpu_clk_arb_poll_dev(struct file *filp, poll_table *wait)
1607 1608
1608 gk20a_dbg_fn(""); 1609 gk20a_dbg_fn("");
1609 1610
1610 poll_wait(filp, &dev->readout_wq, wait); 1611 poll_wait(filp, &dev->readout_wq.wq, wait);
1611 return nvgpu_atomic_xchg(&dev->poll_mask, 0); 1612 return nvgpu_atomic_xchg(&dev->poll_mask, 0);
1612} 1613}
1613 1614