]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
PCI/PCIe/AER: Disable native AER service if BIOS has precedence
authorRafael J. Wysocki <rjw@sisk.pl>
Mon, 20 Sep 2010 16:50:00 +0000 (18:50 +0200)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 15 Oct 2010 20:09:50 +0000 (13:09 -0700)
There is a design issue related to PCIe AER and _OSC that the BIOS
may be asked to grant control of the AER service even if some
Hardware Error Source Table (HEST) entries contain information
meaning that the BIOS really should control it.  Namely,
pcie_port_acpi_setup() calls pcie_aer_get_firmware_first() that
determines whether or not the AER service should be controlled by
the BIOS on the basis of the HEST information for the given PCIe
port.  The BIOS is asked to grant control of the AER service for
a PCIe Root Complex if pcie_aer_get_firmware_first() returns 'false'
for at least one root port in that complex, even if all of the other
root ports' HEST entries have the FIRMWARE_FIRST flag set (and none
of them has the GLOBAL flag set).  However, if the AER service is
controlled by the kernel, that may interfere with the BIOS' handling
of the error sources having the FIRMWARE_FIRST flag.  Moreover,
there may be PCIe endpoints that have the FIRMWARE_FIRST flag set in
HEST and are attached to the root ports in question, in which case it
also may be unsafe to ask the BIOS for control of the AER service.

For this reason, introduce a function checking if there's at least
one PCIe-related HEST entry with the FIRMWARE_FIRST flag set and
disable the native AER service altogether if this function returns
'true'.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pcie/aer/aerdrv.c
drivers/pci/pcie/aer/aerdrv.h
drivers/pci/pcie/aer/aerdrv_acpi.c
drivers/pci/pcie/portdrv_acpi.c

index f409948e1a9bb614cfe5fedc1dc652285f8e0307..2b2b6508efde1c951afe0e913394a1babeab1d1e 100644 (file)
@@ -416,7 +416,7 @@ static void aer_error_resume(struct pci_dev *dev)
  */
 static int __init aer_service_init(void)
 {
-       if (!pci_aer_available())
+       if (!pci_aer_available() || aer_acpi_firmware_first())
                return -ENXIO;
        return pcie_port_service_register(&aerdriver);
 }
index 80c11d1314999c77f9666dd6f892610b90e07bd0..9656e3060412d137109b9978ed0b5a9a4fa2b15c 100644 (file)
@@ -132,6 +132,7 @@ static inline int aer_osc_setup(struct pcie_device *pciedev)
 
 #ifdef CONFIG_ACPI_APEI
 extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev);
+extern bool aer_acpi_firmware_first(void);
 #else
 static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev)
 {
@@ -139,6 +140,8 @@ static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev)
                return pci_dev->__aer_firmware_first;
        return 0;
 }
+
+static inline bool aer_acpi_firmware_first(void) { return false; }
 #endif
 
 static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev,
index 2bb9b8972211073564b9d99b3cc85a148d79e583..275bf158ffa7184978e33fb23124888e25570cc2 100644 (file)
@@ -93,4 +93,38 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev)
                aer_set_firmware_first(dev);
        return dev->__aer_firmware_first;
 }
+
+static bool aer_firmware_first;
+
+static int aer_hest_parse_aff(struct acpi_hest_header *hest_hdr, void *data)
+{
+       struct acpi_hest_aer_common *p;
+
+       if (aer_firmware_first)
+               return 0;
+
+       switch (hest_hdr->type) {
+       case ACPI_HEST_TYPE_AER_ROOT_PORT:
+       case ACPI_HEST_TYPE_AER_ENDPOINT:
+       case ACPI_HEST_TYPE_AER_BRIDGE:
+               p = (struct acpi_hest_aer_common *)(hest_hdr + 1);
+               aer_firmware_first = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST);
+       default:
+               return 0;
+       }
+}
+
+/**
+ * aer_acpi_firmware_first - Check if APEI should control AER.
+ */
+bool aer_acpi_firmware_first(void)
+{
+       static bool parsed = false;
+
+       if (!parsed) {
+               apei_hest_parse(aer_hest_parse_aff, NULL);
+               parsed = true;
+       }
+       return aer_firmware_first;
+}
 #endif
index b7c4cb1ccb23732c22d4e3ecc455b4692e98dade..5982b6a63b895a989b2c2888847795bffda6f316 100644 (file)
@@ -49,7 +49,7 @@ int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask)
                | OSC_PCI_EXPRESS_PME_CONTROL;
 
        if (pci_aer_available()) {
-               if (pcie_aer_get_firmware_first(port))
+               if (aer_acpi_firmware_first())
                        dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n");
                else
                        flags |= OSC_PCI_EXPRESS_AER_CONTROL;