diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/clk_arb.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | 10 |
3 files changed, 34 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/clk_arb.c b/drivers/gpu/nvgpu/common/linux/clk_arb.c index 3ec7fd54..39763f14 100644 --- a/drivers/gpu/nvgpu/common/linux/clk_arb.c +++ b/drivers/gpu/nvgpu/common/linux/clk_arb.c | |||
@@ -20,10 +20,6 @@ | |||
20 | #include <linux/rculist.h> | 20 | #include <linux/rculist.h> |
21 | #include <linux/llist.h> | 21 | #include <linux/llist.h> |
22 | #include <linux/uaccess.h> | 22 | #include <linux/uaccess.h> |
23 | #include <linux/poll.h> | ||
24 | #ifdef CONFIG_DEBUG_FS | ||
25 | #include <linux/debugfs.h> | ||
26 | #endif | ||
27 | 23 | ||
28 | #include <nvgpu/bitops.h> | 24 | #include <nvgpu/bitops.h> |
29 | #include <nvgpu/lock.h> | 25 | #include <nvgpu/lock.h> |
@@ -678,7 +674,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev, | |||
678 | if ((target->gpc2clk < session->target->gpc2clk) | 674 | if ((target->gpc2clk < session->target->gpc2clk) |
679 | || (target->mclk < session->target->mclk)) { | 675 | || (target->mclk < session->target->mclk)) { |
680 | 676 | ||
681 | poll_mask |= (POLLIN | POLLPRI); | 677 | poll_mask |= (NVGPU_POLLIN | NVGPU_POLLPRI); |
682 | nvgpu_clk_arb_queue_notification(arb->g, &dev->queue, | 678 | nvgpu_clk_arb_queue_notification(arb->g, &dev->queue, |
683 | EVENT(ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE)); | 679 | EVENT(ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE)); |
684 | } | 680 | } |
@@ -686,7 +682,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev, | |||
686 | 682 | ||
687 | /* Check if there is a new VF update */ | 683 | /* Check if there is a new VF update */ |
688 | if (queue_alarm_mask & EVENT(VF_UPDATE)) | 684 | if (queue_alarm_mask & EVENT(VF_UPDATE)) |
689 | poll_mask |= (POLLIN | POLLRDNORM); | 685 | poll_mask |= (NVGPU_POLLIN | NVGPU_POLLRDNORM); |
690 | 686 | ||
691 | /* Notify sticky alarms that were not reported on previous run*/ | 687 | /* Notify sticky alarms that were not reported on previous run*/ |
692 | new_alarms_reported = (queue_alarm_mask | | 688 | new_alarms_reported = (queue_alarm_mask | |
@@ -695,9 +691,9 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev, | |||
695 | if (new_alarms_reported & ~LOCAL_ALARM_MASK) { | 691 | if (new_alarms_reported & ~LOCAL_ALARM_MASK) { |
696 | /* check that we are not re-reporting */ | 692 | /* check that we are not re-reporting */ |
697 | if (new_alarms_reported & EVENT(ALARM_GPU_LOST)) | 693 | if (new_alarms_reported & EVENT(ALARM_GPU_LOST)) |
698 | poll_mask |= POLLHUP; | 694 | poll_mask |= NVGPU_POLLHUP; |
699 | 695 | ||
700 | poll_mask |= (POLLIN | POLLPRI); | 696 | poll_mask |= (NVGPU_POLLIN | NVGPU_POLLPRI); |
701 | /* On next run do not report global alarms that were already | 697 | /* On next run do not report global alarms that were already |
702 | * reported, but report SHUTDOWN always | 698 | * reported, but report SHUTDOWN always |
703 | */ | 699 | */ |
@@ -1016,7 +1012,7 @@ exit_arb: | |||
1016 | /* notify completion for all requests */ | 1012 | /* notify completion for all requests */ |
1017 | head = llist_del_all(&arb->requests); | 1013 | head = llist_del_all(&arb->requests); |
1018 | llist_for_each_entry_safe(dev, tmp, head, node) { | 1014 | llist_for_each_entry_safe(dev, tmp, head, node) { |
1019 | nvgpu_atomic_set(&dev->poll_mask, POLLIN | POLLRDNORM); | 1015 | nvgpu_atomic_set(&dev->poll_mask, NVGPU_POLLIN | NVGPU_POLLRDNORM); |
1020 | nvgpu_cond_signal_interruptible(&dev->readout_wq); | 1016 | nvgpu_cond_signal_interruptible(&dev->readout_wq); |
1021 | nvgpu_ref_put(&dev->refcount, nvgpu_clk_arb_free_fd); | 1017 | nvgpu_ref_put(&dev->refcount, nvgpu_clk_arb_free_fd); |
1022 | } | 1018 | } |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c b/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c index 40a5b11c..2bf2e653 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_clk_arb.c | |||
@@ -62,6 +62,24 @@ static int nvgpu_clk_arb_release_completion_dev(struct inode *inode, | |||
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | static inline unsigned int nvgpu_convert_poll_mask(unsigned int nvgpu_poll_mask) | ||
66 | { | ||
67 | unsigned int poll_mask = 0; | ||
68 | |||
69 | if (nvgpu_poll_mask & NVGPU_POLLIN) | ||
70 | poll_mask |= POLLIN; | ||
71 | if (nvgpu_poll_mask & NVGPU_POLLPRI) | ||
72 | poll_mask |= POLLPRI; | ||
73 | if (nvgpu_poll_mask & NVGPU_POLLOUT) | ||
74 | poll_mask |= POLLOUT; | ||
75 | if (nvgpu_poll_mask & NVGPU_POLLRDNORM) | ||
76 | poll_mask |= POLLRDNORM; | ||
77 | if (nvgpu_poll_mask & NVGPU_POLLHUP) | ||
78 | poll_mask |= POLLHUP; | ||
79 | |||
80 | return poll_mask; | ||
81 | } | ||
82 | |||
65 | static unsigned int nvgpu_clk_arb_poll_dev(struct file *filp, poll_table *wait) | 83 | static unsigned int nvgpu_clk_arb_poll_dev(struct file *filp, poll_table *wait) |
66 | { | 84 | { |
67 | struct nvgpu_clk_dev *dev = filp->private_data; | 85 | struct nvgpu_clk_dev *dev = filp->private_data; |
@@ -69,7 +87,7 @@ static unsigned int nvgpu_clk_arb_poll_dev(struct file *filp, poll_table *wait) | |||
69 | nvgpu_log(dev->session->g, gpu_dbg_fn | gpu_dbg_clk_arb, " "); | 87 | nvgpu_log(dev->session->g, gpu_dbg_fn | gpu_dbg_clk_arb, " "); |
70 | 88 | ||
71 | poll_wait(filp, &dev->readout_wq.wq, wait); | 89 | poll_wait(filp, &dev->readout_wq.wq, wait); |
72 | return nvgpu_atomic_xchg(&dev->poll_mask, 0); | 90 | return nvgpu_convert_poll_mask(nvgpu_atomic_xchg(&dev->poll_mask, 0)); |
73 | } | 91 | } |
74 | 92 | ||
75 | static int nvgpu_clk_arb_release_event_dev(struct inode *inode, | 93 | static int nvgpu_clk_arb_release_event_dev(struct inode *inode, |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h index 45561e31..a5f8a7d5 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h +++ b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | |||
@@ -93,6 +93,16 @@ struct nvgpu_clk_session; | |||
93 | 93 | ||
94 | #define _WRAPGTEQ(a, b) ((a-b) > 0) | 94 | #define _WRAPGTEQ(a, b) ((a-b) > 0) |
95 | 95 | ||
96 | /* | ||
97 | * NVGPU_POLL* defines equivalent to the POLL* linux defines | ||
98 | */ | ||
99 | #define NVGPU_POLLIN (1 << 0) | ||
100 | #define NVGPU_POLLPRI (1 << 1) | ||
101 | #define NVGPU_POLLOUT (1 << 2) | ||
102 | #define NVGPU_POLLRDNORM (1 << 3) | ||
103 | #define NVGPU_POLLHUP (1 << 4) | ||
104 | |||
105 | |||
96 | struct nvgpu_clk_notification { | 106 | struct nvgpu_clk_notification { |
97 | u32 notification; | 107 | u32 notification; |
98 | u64 timestamp; | 108 | u64 timestamp; |