From fff31d310c03a6e34234a133df694d4e4d777754 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 31 Jul 2014 14:40:36 +0530 Subject: gpu: nvgpu: add channel enable/disable ioctls Add below ioctls for channels 1. NVHOST_IOCTL_CHANNEL_ENABLE To enable the channel 2. NVHOST_IOCTL_CHANNEL_DISABLE To disable the channel 3. NVHOST_IOCTL_CHANNEL_PREEMPT To preempt the channel (Not supported for a channel in TSG) Bug 1514064 Change-Id: Ie9315f9742bb27efb22f993799c51a1ecda91756 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/449229 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 5bb62dd3..f7cafc52 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -2264,6 +2264,48 @@ long gk20a_channel_ioctl(struct file *filp, ((struct nvhost_set_priority_args *)buf)->priority); gk20a_idle(dev); break; + case NVHOST_IOCTL_CHANNEL_ENABLE: + err = gk20a_busy(dev); + if (err) { + dev_err(&dev->dev, + "%s: failed to host gk20a for ioctl cmd: 0x%x", + __func__, cmd); + return err; + } + /* enable channel */ + gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid), + gk20a_readl(ch->g, ccsr_channel_r(ch->hw_chid)) | + ccsr_channel_enable_set_true_f()); + gk20a_idle(dev); + break; + case NVHOST_IOCTL_CHANNEL_DISABLE: + err = gk20a_busy(dev); + if (err) { + dev_err(&dev->dev, + "%s: failed to host gk20a for ioctl cmd: 0x%x", + __func__, cmd); + return err; + } + /* disable channel */ + gk20a_writel(ch->g, ccsr_channel_r(ch->hw_chid), + gk20a_readl(ch->g, ccsr_channel_r(ch->hw_chid)) | + ccsr_channel_enable_clr_true_f()); + gk20a_idle(dev); + break; + case NVHOST_IOCTL_CHANNEL_PREEMPT: + if (gk20a_is_channel_marked_as_tsg(ch)) + return -EINVAL; + err = gk20a_busy(dev); + if (err) { + dev_err(&dev->dev, + "%s: failed to host gk20a for ioctl cmd: 0x%x", + __func__, cmd); + return err; + } + /* preempt channel */ + err = gk20a_fifo_preempt_channel(ch->g, ch->hw_chid); + gk20a_idle(dev); + break; default: dev_err(&dev->dev, "unrecognized ioctl cmd: 0x%x", cmd); err = -ENOTTY; -- cgit v1.2.2