linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/AER: Enable SERR# forwarding in non ACPI flow
@ 2018-07-12 14:45 Bharat Kumar Gogada
  2018-07-13  5:14 ` poza
  2018-07-31 22:47 ` Bjorn Helgaas
  0 siblings, 2 replies; 12+ messages in thread
From: Bharat Kumar Gogada @ 2018-07-12 14:45 UTC (permalink / raw)
  To: linux-pci, linux-kernel; +Cc: bhelgaas, Bharat Kumar Gogada

Currently PCI_BRIDGE_CTL_SERR is being enabled only in
ACPI flow.
This bit is required for forwarding errors reported
by EP devices to upstream device.
This patch enables SERR# for Type-1 PCI device.

Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
---
 drivers/pci/pcie/aer.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index a2e8838..943e084 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -343,6 +343,19 @@ int pci_enable_pcie_error_reporting(struct pci_dev *dev)
 	if (!dev->aer_cap)
 		return -EIO;
 
+	if (!IS_ENABLED(CONFIG_ACPI) &&
+	    dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+		u16 control;
+
+		/*
+		 * A Type-1 PCI bridge will not forward ERR_ messages coming
+		 * from an endpoint if SERR# forwarding is not enabled.
+		 */
+		pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &control);
+		control |= PCI_BRIDGE_CTL_SERR;
+		pci_write_config_word(dev, PCI_BRIDGE_CONTROL, control);
+	}
+
 	return pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_AER_FLAGS);
 }
 EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
@@ -352,6 +365,16 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev)
 	if (pcie_aer_get_firmware_first(dev))
 		return -EIO;
 
+	if (!IS_ENABLED(CONFIG_ACPI) &&
+	    dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+		u16 control;
+
+		/* Clear SERR Forwarding */
+		pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &control);
+		control &= ~PCI_BRIDGE_CTL_SERR;
+		pci_write_config_word(dev, PCI_BRIDGE_CONTROL, control);
+	}
+
 	return pcie_capability_clear_word(dev, PCI_EXP_DEVCTL,
 					  PCI_EXP_AER_FLAGS);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-08-02  6:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 14:45 [PATCH] PCI/AER: Enable SERR# forwarding in non ACPI flow Bharat Kumar Gogada
2018-07-13  5:14 ` poza
2018-07-13 13:55   ` Bharat Kumar Gogada
2018-07-14  7:15     ` poza
2018-07-18 13:34       ` Bharat Kumar Gogada
2018-07-23  8:11         ` poza
2018-07-23  8:49           ` [RFC] SERR# handling by Linux poza
2018-07-26 13:18           ` [PATCH] PCI/AER: Enable SERR# forwarding in non ACPI flow Bharat Kumar Gogada
2018-07-31 22:47 ` Bjorn Helgaas
2018-08-01 16:07   ` Bharat Kumar Gogada
2018-08-02  6:23   ` poza
2018-08-02  6:26     ` poza

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).