From patchwork Fri Jul 30 08:47:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hidetoshi Seto X-Patchwork-Id: 115430 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6U8lmb2001314 for ; Fri, 30 Jul 2010 08:47:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755858Ab0G3Irr (ORCPT ); Fri, 30 Jul 2010 04:47:47 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:33998 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755791Ab0G3Irq (ORCPT ); Fri, 30 Jul 2010 04:47:46 -0400 Received: from m3.gw.fujitsu.co.jp ([10.0.50.73]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o6U8li7V031230 (envelope-from seto.hidetoshi@jp.fujitsu.com); Fri, 30 Jul 2010 17:47:45 +0900 Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id D04D345DE50; Fri, 30 Jul 2010 17:47:44 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id A40D445DE4E; Fri, 30 Jul 2010 17:47:44 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 90EFE1DB8038; Fri, 30 Jul 2010 17:47:44 +0900 (JST) Received: from m107.s.css.fujitsu.com (m107.s.css.fujitsu.com [10.249.87.107]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 336BE1DB8037; Fri, 30 Jul 2010 17:47:44 +0900 (JST) Received: from m107.css.fujitsu.com (m107 [127.0.0.1]) by m107.s.css.fujitsu.com (Postfix) with ESMTP id 09F49670004; Fri, 30 Jul 2010 17:47:44 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.102.27]) by m107.s.css.fujitsu.com (Postfix) with ESMTP id 7AF1B670003; Fri, 30 Jul 2010 17:47:43 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from FMVDA2A041[10.124.102.27] by FMVDA2A041 (FujitsuOutboundMailChecker v1.3.1/9992[10.124.102.27]); Fri, 30 Jul 2010 17:47:30 +0900 (JST) Message-ID: <4C529198.1050904@jp.fujitsu.com> Date: Fri, 30 Jul 2010 17:47:20 +0900 From: Hidetoshi Seto User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: Kenji Kaneshige CC: "Rafael J. Wysocki" , Jesse Barnes , Len Brown , ACPI Devel Maling List , linux-pm@lists.linux-foundation.org, linux-pci@vger.kernel.org, Matthew Garrett Subject: [PATCH] portdrv: Don't take control of AER if not required References: <201007282323.56351.rjw@sisk.pl> <20100728144358.5e2c12ce@virtuousgeek.org> <4C510B90.9070302@jp.fujitsu.com> <201007291745.39285.rjw@sisk.pl> <4C526A85.3070902@jp.fujitsu.com> <4C526E3E.3000600@jp.fujitsu.com> <4C526FDC.6050800@jp.fujitsu.com> <4C529086.9090600@jp.fujitsu.com> In-Reply-To: <4C529086.9090600@jp.fujitsu.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 30 Jul 2010 08:47:48 +0000 (UTC) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index f8077b3..d09d4f3 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -130,8 +130,10 @@ static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } #ifdef CONFIG_PCIEAER void pci_no_aer(void); +bool pci_aer_available(void); #else static inline void pci_no_aer(void) { } +static inline bool pci_aer_available(void) { return false; } #endif static inline int pci_no_d1d2(struct pci_dev *dev) diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 484cc55..4fbec91 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c @@ -67,6 +67,11 @@ static struct pcie_port_service_driver aerdriver = { static int pcie_aer_disable; +bool pci_aer_available(void) +{ + return !pcie_aer_disable && pci_msi_enabled(); +} + void pci_no_aer(void) { pcie_aer_disable = 1; /* has priority over 'forceload' */ @@ -411,9 +416,7 @@ static void aer_error_resume(struct pci_dev *dev) */ static int __init aer_service_init(void) { - if (pcie_aer_disable) - return -ENXIO; - if (!pci_msi_enabled()) + if (!pci_aer_available()) return -ENXIO; return pcie_port_service_register(&aerdriver); } diff --git a/drivers/pci/pcie/portdrv_acpi.c b/drivers/pci/pcie/portdrv_acpi.c index a957de2..c8814b9 100644 --- a/drivers/pci/pcie/portdrv_acpi.c +++ b/drivers/pci/pcie/portdrv_acpi.c @@ -16,6 +16,7 @@ #include #include "aer/aerdrv.h" +#include "../pci.h" /** * pcie_port_acpi_setup - Request the BIOS to release control of PCIe services. @@ -48,7 +49,9 @@ int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) OSC_PCI_EXPRESS_PME_CONTROL | OSC_PCI_EXPRESS_AER_CONTROL); - if (pcie_aer_get_firmware_first(port)) { + if (!pci_aer_available()) { + request &= ~OSC_PCI_EXPRESS_AER_CONTROL; + } else if (pcie_aer_get_firmware_first(port)) { dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n"); request &= ~OSC_PCI_EXPRESS_AER_CONTROL; } diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 8e96bd4..8e26025 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -246,6 +246,8 @@ static int get_port_device_capability(struct pci_dev *dev) return 0; } else { cap_mask = PCIE_PORT_SERVICE_MASK; + if (!pci_aer_available()) + cap_mask &= ~PCIE_PORT_SERVICE_AER; } pos = pci_pcie_cap(dev);