Skip to contentSkip to conversation

PCI: disable FLR for 82579 device

PATCH New Sasha Neftin 2 participants 2 messages Sep 8, 2016 – Sep 16, 2016 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: disable FLR for 82579 device

82579 has a problem reattaching itself after the device is detached. The bug was reported by Redhat. The suggested fix is to disable FLR capability in PCIe configuration space.

Reproduction:
Attach the device to a VM, then detach and try to attach again.

Fix:
Disable FLR capability to prevent the 82579 from hanging.

---
 drivers/pci/quirks.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/pci/quirks.c +21 -0
index 37ff015..729ca69 100644
@@ -4428,3 +4428,24 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 	}
 }
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap);
+/*
+ * Workaround FLR issues for 82579
+ * This code disables the FLR (Function Level Reset) via PCIe, in order
+ * to workaround a bug found while using device passthrough, where the
+ * interface would become non-responsive.
+ * NOTE: the FLR bit is Read/Write Once (RWO) in config space, so if
+ * the BIOS or kernel writes this register * then this workaround will
+ * not work.
+ */
+static void quirk_intel_flr_cap_dis(struct pci_dev *dev)
+{
+	int pos = pci_find_capability(dev, PCI_CAP_ID_AF);
+	if (pos) {
+		u8 cap;
+		pci_read_config_byte(dev, pos + PCI_AF_CAP, &cap);
+		cap = cap & (~PCI_AF_CAP_FLR);
+		pci_write_config_byte(dev, pos + PCI_AF_CAP, cap);
+	}
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_intel_flr_cap_dis);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_intel_flr_cap_dis);
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 PCI: disable FLR for 82579 device

Quoted 13 lines

From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Sasha Neftin
Sent: Wednesday, September 7, 2016 11:27 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] PCI: disable FLR for 82579 device

82579 has a problem reattaching itself after the device is detached. The bug was reported by Redhat. The suggested fix is to disable FLR capability in PCIe configuration space.

Reproduction:
Attach the device to a VM, then detach and try to attach again.

Quoted 7 lines

Fix:
Disable FLR capability to prevent the 82579 from hanging.

---
 drivers/pci/quirks.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)