From patchwork Thu Apr 28 05:20:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 738461 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3S5KiaQ022672 for ; Thu, 28 Apr 2011 05:21:06 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 001F29E91D for ; Wed, 27 Apr 2011 22:20:43 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 8445F9E7A8 for ; Wed, 27 Apr 2011 22:20:34 -0700 (PDT) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3S5KIxE004526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Apr 2011 01:20:18 -0400 Received: from localhost6.localdomain6 (ovpn-113-32.phx2.redhat.com [10.3.113.32]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3S5KH5k000556; Thu, 28 Apr 2011 01:20:17 -0400 From: Alex Williamson Subject: [PATCH] drm/nouveau: Remove interrupt handler around suspend/resume To: airlied@linux.ie, dri-devel@lists.freedesktop.org Date: Wed, 27 Apr 2011 23:20:17 -0600 Message-ID: <20110428051926.10111.28554.stgit@localhost6.localdomain6> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Cc: linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 28 Apr 2011 05:21:16 +0000 (UTC) We're often using a shared interrupt line for nouveau, so we have to be prepared that it could be called at any point in time. If we've suspended the device via vga switcheroo and get a stray interrupt on the line from another device, we'll read back -1 from the device and head down all sorts of strange paths, most of which eventually lock the system. On my system (Asus UL30VT) the interrupt line is shared with USB. Attempting to disable the USB bluetooth device seems to trigger a stray interrupt that ends up in nv04_fifo_isr() where we eventually hit the "PFIFO still angry after 100 spins, halt", which kills the system. Using free_irq/request_irq around the suspend seems to be a reliable fix. Attempting to flag the device state in nouvea_irq_handler(), similar to the intel_lid_notify() fix is too racy since we can power off the device as an interrupt is being processed. Signed-off-by: Alex Williamson --- drivers/gpu/drm/nouveau/nouveau_drv.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 155ebdc..91f2aca 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c @@ -229,6 +229,10 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) NV_INFO(dev, "And we're gone!\n"); pci_save_state(pdev); + + pci_intx(pdev, 0); + free_irq(drm_dev_to_irq(dev), dev); + if (pm_state.event == PM_EVENT_SUSPEND) { pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); @@ -255,6 +259,8 @@ nouveau_pci_resume(struct pci_dev *pdev) struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_engine *engine = &dev_priv->engine; struct drm_crtc *crtc; + char *irqname; + unsigned long sh_flags = 0; int ret, i; if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) @@ -265,6 +271,22 @@ nouveau_pci_resume(struct pci_dev *pdev) NV_INFO(dev, "We're back, enabling device...\n"); pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); + + if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) + sh_flags = IRQF_SHARED; + + if (dev->devname) + irqname = dev->devname; + else + irqname = dev->driver->name; + + ret = request_irq(drm_dev_to_irq(dev), dev->driver->irq_handler, + sh_flags, irqname, dev); + if (ret < 0) { + NV_ERROR(dev, "error re-requesting irq: %d\n", ret); + return ret; + } + if (pci_enable_device(pdev)) return -1; pci_set_master(dev->pdev);