linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Len Brown <lenb@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	linux-pm@lists.linux-foundation.org, linux-pci@vger.kernel.org,
	Matthew Garrett <mjg59@srcf.ucam.org>
Subject: [PATCH] portdrv: Don't take control of AER if not required
Date: Fri, 30 Jul 2010 17:47:20 +0900	[thread overview]
Message-ID: <4C529198.1050904@jp.fujitsu.com> (raw)
In-Reply-To: <4C529086.9090600@jp.fujitsu.com>

OS cannot handle AER when:
 - !CONFIG_PCIEAER
 - option pci=noaer is specified
 - MSIs are globally disabled (by quirk for the chipset etc.)

In such cases don't request AER control via _OSC.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 drivers/pci/pci.h               |    2 ++
 drivers/pci/pcie/aer/aerdrv.c   |    9 ++++++---
 drivers/pci/pcie/portdrv_acpi.c |    5 ++++-
 drivers/pci/pcie/portdrv_core.c |    2 ++
 4 files changed, 14 insertions(+), 4 deletions(-)

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 <linux/pcieport_if.h>
 
 #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);
-- 
1.7.2

  reply	other threads:[~2010-07-30  8:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28 21:23 [PATCH] PCI / PCIe: Ask BIOS for control of all native services at once (v4) Rafael J. Wysocki
2010-07-28 21:43 ` Jesse Barnes
2010-07-29  5:03   ` Kenji Kaneshige
2010-07-29 15:45     ` Rafael J. Wysocki
2010-07-30  6:00       ` Kenji Kaneshige
2010-07-30  6:16         ` Kenji Kaneshige
2010-07-30  6:20           ` [PATCH 1/6] ACPI/PCI: cleanup acpi_pci_run_osc Kenji Kaneshige
2010-07-30 12:15             ` Rafael J. Wysocki
2010-07-30  6:21           ` [PATCH 2/6] ACPI/PCI: do not preserve query result Kenji Kaneshige
2010-07-30 12:42             ` Rafael J. Wysocki
2010-07-30  6:22           ` [PATCH 3/6] ACPI/PCI: optimize checks in acpi_pci_osc_control_set() Kenji Kaneshige
2010-07-30 12:42             ` Rafael J. Wysocki
2010-07-30  6:23           ` [PATCH 4/6] ACPI/PCI: ask bios for control of all native services at once Kenji Kaneshige
2010-07-30  8:42             ` Hidetoshi Seto
2010-07-30  8:47               ` Hidetoshi Seto [this message]
2010-07-30 12:46             ` Rafael J. Wysocki
2010-07-30  6:24           ` [PATCH 5/6] PCI: portdrv: disable native hot-plug interrupt Kenji Kaneshige
2010-07-30  6:25           ` [PATCH 6/6] PCI: portdrv: remove module_exit Kenji Kaneshige
2010-07-30 11:50         ` [PATCH] PCI / PCIe: Ask BIOS for control of all native services at once (v4) Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C529198.1050904@jp.fujitsu.com \
    --to=seto.hidetoshi@jp.fujitsu.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).