* [PATCH] PCI: do not perform FLR for 82579 devices
@ 2017-03-19 8:15 Sasha Neftin
2017-04-03 21:03 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Neftin @ 2017-03-19 8:15 UTC (permalink / raw)
To: linux-pci, bhelgaas, alex.williamson, dima.ruinskiy,
alexander.h.duyck, sasha.neftin
This patch come to solve problem of 82579 network adapters hang.
Link on Datasheets and Specification Updates:
http://www.intel.com/content/www/us/en/embedded/products
/networking/82579-gigabit-ethernet-connection-family-documentation.html
Please, refer to Specification Update:
http://www.intel.com/content/dam/www/public/us/en/documents/
specification-updates/
82579lm-82579v-gigabit-network-connection-spec-update.pdf
Reproduction:
Attach the device to a VM, then detach and try to attach again.
Fix:
Operating system won't support FLR for 82579 devices.
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
---
drivers/pci/pci.c | 6 ++++++
drivers/pci/quirks.c | 13 +++++++++++++
include/linux/pci.h | 2 ++
3 files changed, 21 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7904d02ffdb9..bef14777bb30 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3781,6 +3781,9 @@ static int pcie_flr(struct pci_dev *dev, int probe)
if (!(cap & PCI_EXP_DEVCAP_FLR))
return -ENOTTY;
+ if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
+ return -ENOTTY;
+
if (probe)
return 0;
@@ -3801,6 +3804,9 @@ static int pci_af_flr(struct pci_dev *dev, int probe)
if (!pos)
return -ENOTTY;
+ if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
+ return -ENOTTY;
+
pci_read_config_byte(dev, pos + PCI_AF_CAP, &cap);
if (!(cap & PCI_AF_CAP_TP) || !(cap & PCI_AF_CAP_FLR))
return -ENOTTY;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1800befa8b8b..eb333a61637e 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4566,3 +4566,16 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2030, quirk_no_aersid);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
+
+/*
+ * Workaround FLR issues for 82579 devices
+ * This code make sure not perform 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.
+ */
+static void quirk_intel_no_flr(struct pci_dev *dev)
+{
+ dev->dev_flags |= PCI_DEV_FLAGS_NO_FLR_RESET;
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_intel_no_flr);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_intel_no_flr);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e2d1a124216a..f4fea5ad2d12 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -178,6 +178,8 @@ enum pci_dev_flags {
PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
/* Get VPD from function 0 VPD */
PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
+ /* Do not use FLR even if device advertises PCI_AF_CAP */
+ PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 9),
};
enum pci_irq_reroute_variant {
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: do not perform FLR for 82579 devices
2017-03-19 8:15 [PATCH] PCI: do not perform FLR for 82579 devices Sasha Neftin
@ 2017-04-03 21:03 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2017-04-03 21:03 UTC (permalink / raw)
To: Sasha Neftin
Cc: linux-pci, bhelgaas, alex.williamson, dima.ruinskiy, alexander.h.duyck
On Sun, Mar 19, 2017 at 10:15:42AM +0200, Sasha Neftin wrote:
> This patch come to solve problem of 82579 network adapters hang.
> Link on Datasheets and Specification Updates:
> http://www.intel.com/content/www/us/en/embedded/products
> /networking/82579-gigabit-ethernet-connection-family-documentation.html
> Please, refer to Specification Update:
> http://www.intel.com/content/dam/www/public/us/en/documents/
> specification-updates/
> 82579lm-82579v-gigabit-network-connection-spec-update.pdf
>
> Reproduction:
> Attach the device to a VM, then detach and try to attach again.
>
> Fix:
> Operating system won't support FLR for 82579 devices.
>
> Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Applied to pci/virtualization for v4.12, thanks!
> ---
> drivers/pci/pci.c | 6 ++++++
> drivers/pci/quirks.c | 13 +++++++++++++
> include/linux/pci.h | 2 ++
> 3 files changed, 21 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7904d02ffdb9..bef14777bb30 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -3781,6 +3781,9 @@ static int pcie_flr(struct pci_dev *dev, int probe)
> if (!(cap & PCI_EXP_DEVCAP_FLR))
> return -ENOTTY;
>
> + if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
> + return -ENOTTY;
> +
> if (probe)
> return 0;
>
> @@ -3801,6 +3804,9 @@ static int pci_af_flr(struct pci_dev *dev, int probe)
> if (!pos)
> return -ENOTTY;
>
> + if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
> + return -ENOTTY;
> +
> pci_read_config_byte(dev, pos + PCI_AF_CAP, &cap);
> if (!(cap & PCI_AF_CAP_TP) || !(cap & PCI_AF_CAP_FLR))
> return -ENOTTY;
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 1800befa8b8b..eb333a61637e 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -4566,3 +4566,16 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2030, quirk_no_aersid);
> DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid);
> DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid);
> DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
> +
> +/*
> + * Workaround FLR issues for 82579 devices
> + * This code make sure not perform 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.
> + */
> +static void quirk_intel_no_flr(struct pci_dev *dev)
> +{
> + dev->dev_flags |= PCI_DEV_FLAGS_NO_FLR_RESET;
> +}
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_intel_no_flr);
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_intel_no_flr);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index e2d1a124216a..f4fea5ad2d12 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -178,6 +178,8 @@ enum pci_dev_flags {
> PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
> /* Get VPD from function 0 VPD */
> PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
> + /* Do not use FLR even if device advertises PCI_AF_CAP */
> + PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 9),
> };
>
> enum pci_irq_reroute_variant {
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-03 21:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-19 8:15 [PATCH] PCI: do not perform FLR for 82579 devices Sasha Neftin
2017-04-03 21:03 ` Bjorn Helgaas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.