gpu: nvgpu: add conversion function for poll masks

In order to enable the movement of clk arbitrator to common
code, we need to remove the linux specific POLL* defines
and instead use NVGPU defines. Add a conversion function
for the same.
Also remove debugfs include, while at it.

Jira VQRM-3741

Change-Id: I3c367625f9fa5fb8480d01bdaf6233df8cc2c722
Signed-off-by: Sourab Gupta <sourabg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1704885
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sourab Gupta
2018-04-29 14:37:32 +05:30
committed by mobile promotions
parent 0ad40e83db
commit 3dabdf3e6d
3 changed files with 34 additions and 10 deletions

View File

@@ -20,10 +20,6 @@
#include <linux/rculist.h>
#include <linux/llist.h>
#include <linux/uaccess.h>
#include <linux/poll.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <nvgpu/bitops.h>
#include <nvgpu/lock.h>
@@ -678,7 +674,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev,
if ((target->gpc2clk < session->target->gpc2clk)
|| (target->mclk < session->target->mclk)) {
poll_mask |= (POLLIN | POLLPRI);
poll_mask |= (NVGPU_POLLIN | NVGPU_POLLPRI);
nvgpu_clk_arb_queue_notification(arb->g, &dev->queue,
EVENT(ALARM_LOCAL_TARGET_VF_NOT_POSSIBLE));
}
@@ -686,7 +682,7 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev,
/* Check if there is a new VF update */
if (queue_alarm_mask & EVENT(VF_UPDATE))
poll_mask |= (POLLIN | POLLRDNORM);
poll_mask |= (NVGPU_POLLIN | NVGPU_POLLRDNORM);
/* Notify sticky alarms that were not reported on previous run*/
new_alarms_reported = (queue_alarm_mask |
@@ -695,9 +691,9 @@ static u32 nvgpu_clk_arb_notify(struct nvgpu_clk_dev *dev,
if (new_alarms_reported & ~LOCAL_ALARM_MASK) {
/* check that we are not re-reporting */
if (new_alarms_reported & EVENT(ALARM_GPU_LOST))
poll_mask |= POLLHUP;
poll_mask |= NVGPU_POLLHUP;
poll_mask |= (POLLIN | POLLPRI);
poll_mask |= (NVGPU_POLLIN | NVGPU_POLLPRI);
/* On next run do not report global alarms that were already
* reported, but report SHUTDOWN always
*/
@@ -1016,7 +1012,7 @@ exit_arb:
/* notify completion for all requests */
head = llist_del_all(&arb->requests);
llist_for_each_entry_safe(dev, tmp, head, node) {
nvgpu_atomic_set(&dev->poll_mask, POLLIN | POLLRDNORM);
nvgpu_atomic_set(&dev->poll_mask, NVGPU_POLLIN | NVGPU_POLLRDNORM);
nvgpu_cond_signal_interruptible(&dev->readout_wq);
nvgpu_ref_put(&dev->refcount, nvgpu_clk_arb_free_fd);
}

View File

@@ -62,6 +62,24 @@ static int nvgpu_clk_arb_release_completion_dev(struct inode *inode,
return 0;
}
static inline unsigned int nvgpu_convert_poll_mask(unsigned int nvgpu_poll_mask)
{
unsigned int poll_mask = 0;
if (nvgpu_poll_mask & NVGPU_POLLIN)
poll_mask |= POLLIN;
if (nvgpu_poll_mask & NVGPU_POLLPRI)
poll_mask |= POLLPRI;
if (nvgpu_poll_mask & NVGPU_POLLOUT)
poll_mask |= POLLOUT;
if (nvgpu_poll_mask & NVGPU_POLLRDNORM)
poll_mask |= POLLRDNORM;
if (nvgpu_poll_mask & NVGPU_POLLHUP)
poll_mask |= POLLHUP;
return poll_mask;
}
static unsigned int nvgpu_clk_arb_poll_dev(struct file *filp, poll_table *wait)
{
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)
nvgpu_log(dev->session->g, gpu_dbg_fn | gpu_dbg_clk_arb, " ");
poll_wait(filp, &dev->readout_wq.wq, wait);
return nvgpu_atomic_xchg(&dev->poll_mask, 0);
return nvgpu_convert_poll_mask(nvgpu_atomic_xchg(&dev->poll_mask, 0));
}
static int nvgpu_clk_arb_release_event_dev(struct inode *inode,

View File

@@ -93,6 +93,16 @@ struct nvgpu_clk_session;
#define _WRAPGTEQ(a, b) ((a-b) > 0)
/*
* NVGPU_POLL* defines equivalent to the POLL* linux defines
*/
#define NVGPU_POLLIN (1 << 0)
#define NVGPU_POLLPRI (1 << 1)
#define NVGPU_POLLOUT (1 << 2)
#define NVGPU_POLLRDNORM (1 << 3)
#define NVGPU_POLLHUP (1 << 4)
struct nvgpu_clk_notification {
u32 notification;
u64 timestamp;