From patchwork Mon May 18 20:51:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 24628 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4IKrX6e020513 for ; Mon, 18 May 2009 20:53:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753735AbZERUx3 (ORCPT ); Mon, 18 May 2009 16:53:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753483AbZERUx3 (ORCPT ); Mon, 18 May 2009 16:53:29 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:57354 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbZERUx1 (ORCPT ); Mon, 18 May 2009 16:53:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id F0495133D04; Mon, 18 May 2009 19:59:22 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03267-05; Mon, 18 May 2009 19:59:12 +0200 (CEST) Received: from tosh.localnet (unknown [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id C474C133F4A; Mon, 18 May 2009 19:59:12 +0200 (CEST) From: "Rafael J. Wysocki" To: Jesse Barnes Subject: [PATCH 1/2] PCI PM: Follow PCI_PM_CTRL_NO_SOFT_RESET during transitions from D3 Date: Mon, 18 May 2009 22:51:12 +0200 User-Agent: KMail/1.11.2 (Linux/2.6.30-rc6-rjw; KDE/4.2.3; x86_64; ; ) Cc: pm list , Linux PCI , LKML References: <200905182246.41129.rjw@sisk.pl> In-Reply-To: <200905182246.41129.rjw@sisk.pl> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200905182251.13197.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Rafael J. Wysocki According to the PCI PM specification (PCI Bus Power Management Interface Specification, Rev. 1.2, Section 5.4.1) we are supposed to reinitialize devices that have PCI_PM_CTRL_NO_SOFT_RESET clear during all transitions from PCI_D3hot to PCI_D0, but we only do it if the device's current_state field is equal to PCI_UNKNOWN. This may lead to problems if a device with PCI_PM_CTRL_NO_SOFT_RESET unset is put into PCI_D3hot at run time by its driver and pci_set_power_state() is used to put it back into PCI_D0, because in that case the device will remain uninitialized after pci_set_power_state() has returned. Prevent that from happening by modifying pci_raw_set_power_state() to reinitialize devices with PCI_PM_CTRL_NO_SOFT_RESET unset during all transitions from D3 to D0. Signed-off-by: Rafael J. Wysocki --- drivers/pci/pci.c | 2 ++ 1 file changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/pci/pci.c =================================================================== --- linux-2.6.orig/drivers/pci/pci.c +++ linux-2.6/drivers/pci/pci.c @@ -480,6 +480,8 @@ static int pci_raw_set_power_state(struc pmcsr &= ~PCI_PM_CTRL_STATE_MASK; pmcsr |= state; break; + case PCI_D3hot: + case PCI_D3cold: case PCI_UNKNOWN: /* Boot-up */ if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))