Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: Avoid FLR for Intel 82579 NICs

Per Intel Specification Update 335553-002 (see link below), some 82579
network adapters advertise a Function Level Reset (FLR) capability, but
they can hang when an FLR is triggered.

To reproduce the problem, attach the device to a VM, then detach and try to
attach again.

Add a quirk to prevent the use of FLR on these devices.

[bhelgaas: changelog, comments]
Link: http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/82579lm-82579v-gigabit-network-connection-spec-update.pdf
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Sasha Neftin and committed by
Bjorn Helgaas
f65fd1aa c1ae3cfa

+16
+6
drivers/pci/pci.c
··· 3781 3781 if (!(cap & PCI_EXP_DEVCAP_FLR)) 3782 3782 return -ENOTTY; 3783 3783 3784 + if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET) 3785 + return -ENOTTY; 3786 + 3784 3787 if (probe) 3785 3788 return 0; 3786 3789 ··· 3802 3799 3803 3800 pos = pci_find_capability(dev, PCI_CAP_ID_AF); 3804 3801 if (!pos) 3802 + return -ENOTTY; 3803 + 3804 + if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET) 3805 3805 return -ENOTTY; 3806 3806 3807 3807 pci_read_config_byte(dev, pos + PCI_AF_CAP, &cap);
+8
drivers/pci/quirks.c
··· 4633 4633 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid); 4634 4634 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid); 4635 4635 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid); 4636 + 4637 + /* FLR may cause some 82579 devices to hang. */ 4638 + static void quirk_intel_no_flr(struct pci_dev *dev) 4639 + { 4640 + dev->dev_flags |= PCI_DEV_FLAGS_NO_FLR_RESET; 4641 + } 4642 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_intel_no_flr); 4643 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_intel_no_flr);
+2
include/linux/pci.h
··· 178 178 PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), 179 179 /* Get VPD from function 0 VPD */ 180 180 PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), 181 + /* Do not use FLR even if device advertises PCI_AF_CAP */ 182 + PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), 181 183 }; 182 184 183 185 enum pci_irq_reroute_variant {