Commit cae9ff03 authored by Lyude Paul's avatar Lyude Paul Committed by Dave Airlie

drm/nouveau: Don't enabling polling twice on runtime resume

As it turns out, on cards that actually have CRTCs on them we're already
calling drm_kms_helper_poll_enable(drm_dev) from
nouveau_display_resume() before we call it in
nouveau_pmops_runtime_resume(). This leads us to accidentally trying to
enable polling twice, which results in a potential deadlock between the
RPM locks and drm_dev->mode_config.mutex if we end up trying to enable
polling the second time while output_poll_execute is running and holding
the mode_config lock. As such, make sure we only enable polling in
nouveau_pmops_runtime_resume() if we need to.

This fixes hangs observed on the ThinkPad W541
Signed-off-by: default avatarLyude <lyude@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Kilian Singer <kilian.singer@quantumtechnology.info>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: David Airlie <airlied@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6c971c09
...@@ -411,6 +411,7 @@ nouveau_display_init(struct drm_device *dev) ...@@ -411,6 +411,7 @@ nouveau_display_init(struct drm_device *dev)
return ret; return ret;
/* enable polling for external displays */ /* enable polling for external displays */
if (!dev->mode_config.poll_enabled)
drm_kms_helper_poll_enable(dev); drm_kms_helper_poll_enable(dev);
/* enable hotplug interrupts */ /* enable hotplug interrupts */
......
...@@ -773,7 +773,10 @@ nouveau_pmops_runtime_resume(struct device *dev) ...@@ -773,7 +773,10 @@ nouveau_pmops_runtime_resume(struct device *dev)
pci_set_master(pdev); pci_set_master(pdev);
ret = nouveau_do_resume(drm_dev, true); ret = nouveau_do_resume(drm_dev, true);
if (!drm_dev->mode_config.poll_enabled)
drm_kms_helper_poll_enable(drm_dev); drm_kms_helper_poll_enable(drm_dev);
/* do magic */ /* do magic */
nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25)); nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25));
vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON); vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment