PCI: Work around Huawei Intelligent NIC VF FLR erratum
authorChiqijun <chiqijun@huawei.com>
Mon, 24 May 2021 22:44:07 +0000 (17:44 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 18 Jun 2021 15:32:35 +0000 (10:32 -0500)
commitce00322c2365e1f7b0312f2f493539c833465d97
tree27a2cb67ac0277f5e80cfab6b1f79acb29972ee0
parent4c207e7121fa92b66bf1896bf8ccb9edfb0f9731
PCI: Work around Huawei Intelligent NIC VF FLR erratum

pcie_flr() starts a Function Level Reset (FLR), waits 100ms (the maximum
time allowed for FLR completion by PCIe r5.0, sec 6.6.2), and waits for the
FLR to complete.  It assumes the FLR is complete when a config read returns
valid data.

When we do an FLR on several Huawei Intelligent NIC VFs at the same time,
firmware on the NIC processes them serially.  The VF may respond to config
reads before the firmware has completed its reset processing.  If we bind a
driver to the VF (e.g., by assigning the VF to a virtual machine) in the
interval between the successful config read and completion of the firmware
reset processing, the NIC VF driver may fail to load.

Prevent this driver failure by waiting for the NIC firmware to complete its
reset processing.  Not all NIC firmware supports this feature.

[bhelgaas: commit log]
Link: https://support.huawei.com/enterprise/en/doc/EDOC1100063073/87950645/vm-oss-occasionally-fail-to-load-the-in200-driver-when-the-vf-performs-flr
Link: https://lore.kernel.org/r/20210414132301.1793-1-chiqijun@huawei.com
Signed-off-by: Chiqijun <chiqijun@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Cc: stable@vger.kernel.org
drivers/pci/quirks.c