aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-08-24 02:06:27 -0400
committerSinclair Yeh <syeh@vmware.com>2017-08-28 11:40:40 -0400
commite300173f06160d65d383d54fdd48027ecd052af3 (patch)
tree0859b97da1dd00e43da3e9b4b13a0875acca92ea /drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
parent7c0059dd832cc686bf0febefdcf8295cdd93007f (diff)
drm/vmwgfx: Don't use drm_irq_[un]install
We're not allowed to change the upstream version of the drm_irq_install function to be able to incorporate threaded irqs. So roll our own irq install- and uninstall functions instead of relying on the drm core ones. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_irq.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_irq.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
index 0c7e1723292c..9b519c4b4ec2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
@@ -30,7 +30,7 @@
30 30
31#define VMW_FENCE_WRAP (1 << 24) 31#define VMW_FENCE_WRAP (1 << 24)
32 32
33irqreturn_t vmw_irq_handler(int irq, void *arg) 33static irqreturn_t vmw_irq_handler(int irq, void *arg)
34{ 34{
35 struct drm_device *dev = (struct drm_device *)arg; 35 struct drm_device *dev = (struct drm_device *)arg;
36 struct vmw_private *dev_priv = vmw_priv(dev); 36 struct vmw_private *dev_priv = vmw_priv(dev);
@@ -281,23 +281,15 @@ int vmw_wait_seqno(struct vmw_private *dev_priv,
281 return ret; 281 return ret;
282} 282}
283 283
284void vmw_irq_preinstall(struct drm_device *dev) 284static void vmw_irq_preinstall(struct drm_device *dev)
285{ 285{
286 struct vmw_private *dev_priv = vmw_priv(dev); 286 struct vmw_private *dev_priv = vmw_priv(dev);
287 uint32_t status; 287 uint32_t status;
288 288
289 if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK))
290 return;
291
292 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); 289 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
293 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); 290 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
294} 291}
295 292
296int vmw_irq_postinstall(struct drm_device *dev)
297{
298 return 0;
299}
300
301void vmw_irq_uninstall(struct drm_device *dev) 293void vmw_irq_uninstall(struct drm_device *dev)
302{ 294{
303 struct vmw_private *dev_priv = vmw_priv(dev); 295 struct vmw_private *dev_priv = vmw_priv(dev);
@@ -306,8 +298,41 @@ void vmw_irq_uninstall(struct drm_device *dev)
306 if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK)) 298 if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK))
307 return; 299 return;
308 300
301 if (!dev->irq_enabled)
302 return;
303
309 vmw_write(dev_priv, SVGA_REG_IRQMASK, 0); 304 vmw_write(dev_priv, SVGA_REG_IRQMASK, 0);
310 305
311 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); 306 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
312 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); 307 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
308
309 dev->irq_enabled = false;
310 free_irq(dev->irq, dev);
311}
312
313/**
314 * vmw_irq_install - Install the irq handlers
315 *
316 * @dev: Pointer to the drm device.
317 * @irq: The irq number.
318 * Return: Zero if successful. Negative number otherwise.
319 */
320int vmw_irq_install(struct drm_device *dev, int irq)
321{
322 int ret;
323
324 if (dev->irq_enabled)
325 return -EBUSY;
326
327 vmw_irq_preinstall(dev);
328
329 ret = request_threaded_irq(irq, vmw_irq_handler, NULL,
330 IRQF_SHARED, VMWGFX_DRIVER_NAME, dev);
331 if (ret < 0)
332 return ret;
333
334 dev->irq_enabled = true;
335 dev->irq = irq;
336
337 return ret;
313} 338}