Skip to contentSkip to conversation

export pcie_flr and remove copies of it in drivers V2

PATCH Applied Christoph Hellwig 8 participants 20 messages Apr 14, 2017 – Apr 27, 2017

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Hi all,

this exports the PCI layer pcie_flr helper, and removes various opencoded copies of it.

Changes since V1:
- rebase on top of the pci/virtualization branch
- fixed the probe case in __pci_dev_reset
- added ACKs from Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

PATCH 1/7 PCI: export pcie_flr

Currently we opencode the FLR sequence in lots of place, export a core helper instead. We split out the probing for FLR support as all the non-core callers already know their hardware.

Note that in the new pci_has_flr function the quirk check has been moved before the capability check as there is no point in reading the capability in this case.

---
 drivers/pci/pci.c   | 39 ++++++++++++++++++++++++++++-----------
 include/linux/pci.h |  1 +
 2 files changed, 29 insertions(+), 11 deletions(-)
drivers/pci/pci.c +28 -11
index bef14777bb30..957a11a6a840 100644
@@ -3773,27 +3773,41 @@ static void pci_flr_wait(struct pci_dev *dev)
 			 (i - 1) * 100);
 }
 
-static int pcie_flr(struct pci_dev *dev, int probe)
+/**
+ * pcie_has_flr - check if a device supports function level resets
+ * @dev:	device to check
+ *
+ * Returns true if the device advertises support for PCIe function level
+ * resets.
+ */
+static bool pcie_has_flr(struct pci_dev *dev)
 {
 	u32 cap;
 
-	pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
-	if (!(cap & PCI_EXP_DEVCAP_FLR))
-		return -ENOTTY;
-
 	if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
-		return -ENOTTY;
+		return false;
 
-	if (probe)
-		return 0;
+	pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
+	return cap & PCI_EXP_DEVCAP_FLR;
+}
 
+/**
+ * pcie_flr - initiate a PCIe function level reset
+ * @dev:	device to reset
+ *
+ * Initiate a function level reset on @dev.  The caller should ensure the
+ * device supports FLR before calling this function, e.g. by using the
+ * pcie_has_flr() helper.
+ */
+void pcie_flr(struct pci_dev *dev)
+{
 	if (!pci_wait_for_pending_transaction(dev))
 		dev_err(&dev->dev, "timed out waiting for pending transaction; performing function level reset anyway\n");
 
 	pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
 	pci_flr_wait(dev);
-	return 0;
 }
+EXPORT_SYMBOL_GPL(pcie_flr);
 
 static int pci_af_flr(struct pci_dev *dev, int probe)
 {
@@ -3977,9 +3991,12 @@ static int __pci_dev_reset(struct pci_dev *dev, int probe)
 	if (rc != -ENOTTY)
 		goto done;
 
-	rc = pcie_flr(dev, probe);
-	if (rc != -ENOTTY)
+	if (pcie_has_flr(dev)) {
+		if (!probe)
+			pcie_flr(dev);
+		rc = 0;
 		goto done;
+	}
 
 	rc = pci_af_flr(dev, probe);
 	if (rc != -ENOTTY)
include/linux/pci.h +1 -0
index 20e1865233a4..60162f51227a 100644
@@ -1054,6 +1054,7 @@ int pcie_get_mps(struct pci_dev *dev);
 int pcie_set_mps(struct pci_dev *dev, int mps);
 int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
 			  enum pcie_link_width *width);
+void pcie_flr(struct pci_dev *dev);
 int __pci_reset_function(struct pci_dev *dev);
 int __pci_reset_function_locked(struct pci_dev *dev);
 int pci_reset_function(struct pci_dev *dev);
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/7 PCI: call pcie_flr from reset_intel_82599_sfp_virtfn

In reply to Christoph Hellwig

The 82599 quirk contained an outdated copy of the FLR code.

---
 drivers/pci/quirks.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/pci/quirks.c +4 -12
index 823271b13d12..8195ca294ee5 100644
@@ -3641,19 +3641,11 @@ static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
 	 *
 	 * The 82599 supports FLR on VFs, but FLR support is reported only
 	 * in the PF DEVCAP (sec 9.3.10.4), not in the VF DEVCAP (sec 9.5).
-	 * Therefore, we can't use pcie_flr(), which checks the VF DEVCAP.
+	 * Thus we must call pcie_flr directly without first checking if it is
+	 * supported.
 	 */
-
-	if (probe)
-		return 0;
-
-	if (!pci_wait_for_pending_transaction(dev))
-		dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
-
-	pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
-
-	msleep(100);
-
+	if (!probe)
+		pcie_flr(dev);
 	return 0;
 }
 
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/7 PCI: call pcie_flr from reset_chelsio_generic_dev

In reply to Christoph Hellwig

Instead of copy & pasting and old version of the code.

---
 drivers/pci/quirks.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/pci/quirks.c +1 -14
index 8195ca294ee5..715ed8c08fa3 100644
@@ -3750,20 +3750,7 @@ static int reset_chelsio_generic_dev(struct pci_dev *dev, int probe)
 				      PCI_MSIX_FLAGS_ENABLE |
 				      PCI_MSIX_FLAGS_MASKALL);
 
-	/*
-	 * Start of pcie_flr() code sequence.  This reset code is a copy of
-	 * the guts of pcie_flr() because that's not an exported function.
-	 */
-
-	if (!pci_wait_for_pending_transaction(dev))
-		dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
-
-	pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
-	msleep(100);
-
-	/*
-	 * End of pcie_flr() code sequence.
-	 */
+	pcie_flr(dev);
 
 	/*
 	 * Restore the configuration information (BAR values, etc.) including
Signature · 1 line
2.11.0
#4 lore raw

PATCH 4/7 ixgbe: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -14
index a7a430a7be2c..543ddde5f8e2 100644
@@ -7112,18 +7112,6 @@ static void ixgbe_watchdog_flush_tx(struct ixgbe_adapter *adapter)
 }
 
 #ifdef CONFIG_PCI_IOV
-static inline void ixgbe_issue_vf_flr(struct ixgbe_adapter *adapter,
-				      struct pci_dev *vfdev)
-{
-	if (!pci_wait_for_pending_transaction(vfdev))
-		e_dev_warn("Issuing VFLR with pending transactions\n");
-
-	e_dev_err("Issuing VFLR for VF %s\n", pci_name(vfdev));
-	pcie_capability_set_word(vfdev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
-
-	msleep(100);
-}
-
 static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
@@ -7156,7 +7144,7 @@ static void ixgbe_check_for_bad_vf(struct ixgbe_adapter *adapter)
 		pci_read_config_word(vfdev, PCI_STATUS, &status_reg);
 		if (status_reg != IXGBE_FAILED_READ_CFG_WORD &&
 		    status_reg & PCI_STATUS_REC_MASTER_ABORT)
-			ixgbe_issue_vf_flr(adapter, vfdev);
+			pcie_flr(vfdev);
 	}
 }
 
@@ -10244,7 +10232,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
 		 * VFLR.  Just clean up the AER in that case.
 		 */
 		if (vfdev) {
-			ixgbe_issue_vf_flr(adapter, vfdev);
+			pcie_flr(vfdev);
 			/* Free device reference count */
 			pci_dev_put(vfdev);
 		}
Signature · 1 line
2.11.0
#5 lore raw

PATCH 5/7 IB/hfi1: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig
---
 drivers/infiniband/hw/hfi1/chip.c |  4 ++--
 drivers/infiniband/hw/hfi1/hfi.h  |  1 -
 drivers/infiniband/hw/hfi1/pcie.c | 30 ------------------------------
 3 files changed, 2 insertions(+), 33 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +2 -2
index 121a4c920f1b..d037f72e4d96 100644
@@ -13610,14 +13610,14 @@ static void init_chip(struct hfi1_devdata *dd)
 		dd_dev_info(dd, "Resetting CSRs with FLR\n");
 
 		/* do the FLR, the DC reset will remain */
-		hfi1_pcie_flr(dd);
+		pcie_flr(dd->pcidev);
 
 		/* restore command and BARs */
 		restore_pci_variables(dd);
 
 		if (is_ax(dd)) {
 			dd_dev_info(dd, "Resetting CSRs with FLR\n");
-			hfi1_pcie_flr(dd);
+			pcie_flr(dd->pcidev);
 			restore_pci_variables(dd);
 		}
 	} else {
drivers/infiniband/hw/hfi1/hfi.h +0 -1
index 0808e3c3ba39..40d7559fa723 100644
@@ -1764,7 +1764,6 @@ int hfi1_pcie_init(struct pci_dev *, const struct pci_device_id *);
 void hfi1_pcie_cleanup(struct pci_dev *);
 int hfi1_pcie_ddinit(struct hfi1_devdata *, struct pci_dev *);
 void hfi1_pcie_ddcleanup(struct hfi1_devdata *);
-void hfi1_pcie_flr(struct hfi1_devdata *);
 int pcie_speeds(struct hfi1_devdata *);
 void request_msix(struct hfi1_devdata *, u32 *, struct hfi1_msix_entry *);
 void hfi1_enable_intx(struct pci_dev *);
drivers/infiniband/hw/hfi1/pcie.c +0 -30
index 0829fce06172..c81556e84831 100644
@@ -240,36 +240,6 @@ void hfi1_pcie_ddcleanup(struct hfi1_devdata *dd)
 		iounmap(dd->piobase);
 }
 
-/*
- * Do a Function Level Reset (FLR) on the device.
- * Based on static function drivers/pci/pci.c:pcie_flr().
- */
-void hfi1_pcie_flr(struct hfi1_devdata *dd)
-{
-	int i;
-	u16 status;
-
-	/* no need to check for the capability - we know the device has it */
-
-	/* wait for Transaction Pending bit to clear, at most a few ms */
-	for (i = 0; i < 4; i++) {
-		if (i)
-			msleep((1 << (i - 1)) * 100);
-
-		pcie_capability_read_word(dd->pcidev, PCI_EXP_DEVSTA, &status);
-		if (!(status & PCI_EXP_DEVSTA_TRPND))
-			goto clear;
-	}
-
-	dd_dev_err(dd, "Transaction Pending bit is not clearing, proceeding with reset anyway\n");
-
-clear:
-	pcie_capability_set_word(dd->pcidev, PCI_EXP_DEVCTL,
-				 PCI_EXP_DEVCTL_BCR_FLR);
-	/* PCIe spec requires the function to be back within 100ms */
-	msleep(100);
-}
-
 static void msix_setup(struct hfi1_devdata *dd, int pos, u32 *msixcnt,
 		       struct hfi1_msix_entry *hfi1_msix_entry)
 {
Signature · 1 line
2.11.0
#14 lore raw

PATCH 6/7 crypto: qat: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig
---
 drivers/crypto/qat/qat_common/adf_aer.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/crypto/qat/qat_common/adf_aer.c +1 -14
index 2839fccdd84b..d3e25c37dc33 100644
@@ -109,20 +109,7 @@ EXPORT_SYMBOL_GPL(adf_reset_sbr);
 
 void adf_reset_flr(struct adf_accel_dev *accel_dev)
 {
-	struct pci_dev *pdev = accel_to_pci_dev(accel_dev);
-	u16 control = 0;
-	int pos = 0;
-
-	dev_info(&GET_DEV(accel_dev), "Function level reset\n");
-	pos = pci_pcie_cap(pdev);
-	if (!pos) {
-		dev_err(&GET_DEV(accel_dev), "Restart device failed\n");
-		return;
-	}
-	pci_read_config_word(pdev, pos + PCI_EXP_DEVCTL, &control);
-	control |= PCI_EXP_DEVCTL_BCR_FLR;
-	pci_write_config_word(pdev, pos + PCI_EXP_DEVCTL, control);
-	msleep(100);
+	pcie_flr(accel_to_pci_dev(accel_dev));
 }
 EXPORT_SYMBOL_GPL(adf_reset_flr);
 
Signature · 1 line
2.11.0
#15 lore raw

PATCH 7/7 liquidio: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig
---
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +1 -14
index 9d5e03502c76..afdbf7fa016e 100644
@@ -869,20 +869,7 @@ static void octeon_pci_flr(struct octeon_device *oct)
 	pci_write_config_word(oct->pci_dev, PCI_COMMAND,
 			      PCI_COMMAND_INTX_DISABLE);
 
-	/* Wait for Transaction Pending bit clean */
-	msleep(100);
-	pcie_capability_read_word(oct->pci_dev, PCI_EXP_DEVSTA, &status);
-	if (status & PCI_EXP_DEVSTA_TRPND) {
-		dev_info(&oct->pci_dev->dev, "Function reset incomplete after 100ms, sleeping for 5 seconds\n");
-		ssleep(5);
-		pcie_capability_read_word(oct->pci_dev, PCI_EXP_DEVSTA,
-					  &status);
-		if (status & PCI_EXP_DEVSTA_TRPND)
-			dev_info(&oct->pci_dev->dev, "Function reset still incomplete after 5s, reset anyway\n");
-	}
-	pcie_capability_set_word(oct->pci_dev, PCI_EXP_DEVCTL,
-				 PCI_EXP_DEVCTL_BCR_FLR);
-	mdelay(100);
+	pcie_flr(oct->pci_dev);
 
 	pci_cfg_access_unlock(oct->pci_dev);
 
Signature · 1 line
2.11.0
#17 lore raw
In reply to Christoph Hellwig
Quoted 9 lines · Christoph Hellwig

Hi all,

this exports the PCI layer pcie_flr helper, and removes various opencoded copies of it.

Changes since V1:
- rebase on top of the pci/virtualization branch
- fixed the probe case in __pci_dev_reset
- added ACKs from Bjorn

Applied the first three patches:

bc13871ef35a PCI: Export pcie_flr()
e641c375d414 PCI: Call pcie_flr() from reset_intel_82599_sfp_virtfn() 40e0901ea4bf PCI: Call pcie_flr() from reset_chelsio_generic_dev()

to pci/virtualization for v4.12, thanks!

#18 lore raw
Quoted 11 lines · Bjorn Helgaas
Quoted 9 lines · Christoph Hellwig

Hi all,

this exports the PCI layer pcie_flr helper, and removes various opencoded copies of it.

Changes since V1:
- rebase on top of the pci/virtualization branch
- fixed the probe case in __pci_dev_reset
- added ACKs from Bjorn

Quoted 6 lines

Applied the first three patches:

bc13871ef35a PCI: Export pcie_flr()
e641c375d414 PCI: Call pcie_flr() from reset_intel_82599_sfp_virtfn() 40e0901ea4bf PCI: Call pcie_flr() from reset_chelsio_generic_dev()

Bjorn,

How do you suggest to proceed with other patches? They should be applied to your tree either, because they depend on "bc13871ef35a PCI: Export pcie_flr()".

Thanks

Quoted 1 line

to pci/virtualization for v4.12, thanks!

#19 lore raw
Quoted 19 lines · Leon Romanovsky
Quoted 11 lines · Bjorn Helgaas
Quoted 9 lines · Christoph Hellwig

Hi all,

this exports the PCI layer pcie_flr helper, and removes various opencoded copies of it.

Changes since V1:
- rebase on top of the pci/virtualization branch
- fixed the probe case in __pci_dev_reset
- added ACKs from Bjorn

Quoted 6 lines

Applied the first three patches:

bc13871ef35a PCI: Export pcie_flr()
e641c375d414 PCI: Call pcie_flr() from reset_intel_82599_sfp_virtfn() 40e0901ea4bf PCI: Call pcie_flr() from reset_chelsio_generic_dev()

Quoted 5 lines

Bjorn,

How do you suggest to proceed with other patches? They should be applied to your tree either, because they depend on "bc13871ef35a PCI: Export pcie_flr()".

I finally caught the old emails and found the answer by myself.
http://marc.info/?l=linux-rdma&m=149218545228343&w=2

Thanks

Quoted 5 lines

Thanks

Quoted 1 line

to pci/virtualization for v4.12, thanks!

Tested-by on v1 5/7
#6 lore raw

RE: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Christoph Hellwig
Sent: Friday, April 14, 2017 9:11 PM
To: Bjorn Helgaas <[email protected]>; Cabiddu, Giovanni <[email protected]>; Benedetto, Salvatore <[email protected]>; Marciniszyn, Mike <[email protected]>; Dalessandro, Dennis <[email protected]>; Derek Chickles <[email protected]>; Satanand Burla <[email protected]>; Felix Manlunas <[email protected]>; Raghu Vatsavayi <[email protected]>; Kirsher, Jeffrey T <[email protected]>
Cc: [email protected]; qat-linux <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

---
 drivers/infiniband/hw/hfi1/chip.c |  4 ++--  drivers/infiniband/hw/hfi1/hfi.h  |  1 -  drivers/infiniband/hw/hfi1/pcie.c | 30 ------------------------------
 3 files changed, 2 insertions(+), 33 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +2 -2
index 121a4c920f1b..d037f72e4d96 100644
@@ -13610,14 +13610,14 @@ static void init_chip(struct hfi1_devdata *dd)
 		dd_dev_info(dd, "Resetting CSRs with FLR\n");
 
 		/* do the FLR, the DC reset will remain */
-		hfi1_pcie_flr(dd);
+		pcie_flr(dd->pcidev);
 
 		/* restore command and BARs */
 		restore_pci_variables(dd);
 
 		if (is_ax(dd)) {
 			dd_dev_info(dd, "Resetting CSRs with FLR\n");
-			hfi1_pcie_flr(dd);
+			pcie_flr(dd->pcidev);
 			restore_pci_variables(dd);
 		}
 	} else {
drivers/infiniband/hw/hfi1/hfi.h +0 -0
index 0808e3c3ba39..40d7559fa723 100644
@@ -1764,7 +1764,6 @@ int hfi1_pcie_init(struct pci_dev *, const struct pci_device_id *);  void hfi1_pcie_cleanup(struct pci_dev *);  int hfi1_pcie_ddinit(struct hfi1_devdata *, struct pci_dev *);  void hfi1_pcie_ddcleanup(struct hfi1_devdata *); -void hfi1_pcie_flr(struct hfi1_devdata *);  int pcie_speeds(struct hfi1_devdata *);  void request_msix(struct hfi1_devdata *, u32 *, struct hfi1_msix_entry *);  void hfi1_enable_intx(struct pci_dev *); diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c

index 0829fce06172..c81556e84831 100644

drivers/infiniband/hw/hfi1/pcie.c +0 -30
@@ -240,36 +240,6 @@ void hfi1_pcie_ddcleanup(struct hfi1_devdata *dd)
 		iounmap(dd->piobase);
 }
 
-/*
- * Do a Function Level Reset (FLR) on the device.
- * Based on static function drivers/pci/pci.c:pcie_flr().
- */
-void hfi1_pcie_flr(struct hfi1_devdata *dd) -{
-	int i;
-	u16 status;
-
-	/* no need to check for the capability - we know the device has it */
-
-	/* wait for Transaction Pending bit to clear, at most a few ms */
-	for (i = 0; i < 4; i++) {
-		if (i)
-			msleep((1 << (i - 1)) * 100);
-
-		pcie_capability_read_word(dd->pcidev, PCI_EXP_DEVSTA, &status);
-		if (!(status & PCI_EXP_DEVSTA_TRPND))
-			goto clear;
-	}
-
-	dd_dev_err(dd, "Transaction Pending bit is not clearing, proceeding with reset anyway\n");
-
-clear:
-	pcie_capability_set_word(dd->pcidev, PCI_EXP_DEVCTL,
-				 PCI_EXP_DEVCTL_BCR_FLR);
-	/* PCIe spec requires the function to be back within 100ms */
-	msleep(100);
-}
-
 static void msix_setup(struct hfi1_devdata *dd, int pos, u32 *msixcnt,
 		       struct hfi1_msix_entry *hfi1_msix_entry)  {
--

2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

#8 lore raw

Re: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Jakub

Are you (and Doug) ok with queueing this up in the PCI tree?

We are fine however Doug wants to handle it.

-Denny

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH 7/7] liquidio: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig

From: Christoph Hellwig <[email protected]>
Date: Fri, 14 Apr 2017 21:11:31 +0200

Quoted 34 lines
---
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +1 -14
index 9d5e03502c76..afdbf7fa016e 100644
@@ -869,20 +869,7 @@ static void octeon_pci_flr(struct octeon_device *oct)
 	pci_write_config_word(oct->pci_dev, PCI_COMMAND,
 			      PCI_COMMAND_INTX_DISABLE);
 
-	/* Wait for Transaction Pending bit clean */
-	msleep(100);
-	pcie_capability_read_word(oct->pci_dev, PCI_EXP_DEVSTA, &status);
-	if (status & PCI_EXP_DEVSTA_TRPND) {
-		dev_info(&oct->pci_dev->dev, "Function reset incomplete after 100ms, sleeping for 5 seconds\n");
-		ssleep(5);
-		pcie_capability_read_word(oct->pci_dev, PCI_EXP_DEVSTA,
-					  &status);
-		if (status & PCI_EXP_DEVSTA_TRPND)
-			dev_info(&oct->pci_dev->dev, "Function reset still incomplete after 5s, reset anyway\n");
-	}
-	pcie_capability_set_word(oct->pci_dev, PCI_EXP_DEVCTL,
-				 PCI_EXP_DEVCTL_BCR_FLR);
-	mdelay(100);
+	pcie_flr(oct->pci_dev);
 
 	pci_cfg_access_unlock(oct->pci_dev);
 
Signature · 1 line
2.11.0

This patch works. I tested it on a LiquidIO NIC and the "next" branch of the PCI git tree.

But the patch causes a gcc warning:

    .../lio_vf_main.c: In function 'octeon_pci_flr':
    .../lio_vf_main.c:862:6: warning: unused variable 'status' [-Wunused-variable]

Can you rework the patch to get rid of the warning? Thanks.

#9 lore raw

Re: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Jakub

Are you (and Doug) ok with queueing this up in the PCI tree?

I'm fine with that.  Feel free to add my Acked-by to the hfi1 patch.

Signature · 9 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Re: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Jakub

Are you (and Doug) ok with queueing this up in the PCI tree?

Applied this with Jakub's tested-by and Doug's ack to pci/virtualization for v4.12.

This still leaves these:

[PATCH 4/7] ixgbe: use pcie_flr instead of duplicating it [PATCH 6/7] crypto: qat: use pcie_flr instead of duplicating it [PATCH 7/7] liquidio: use pcie_flr instead of duplicating it

I haven't seen any response to 4 and 6. Felix reported an unused variable in 7. Let me know if you'd like me to do anything with these.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

Quoted 11 lines · Bjorn Helgaas
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Jakub

Are you (and Doug) ok with queueing this up in the PCI tree?

Applied this with Jakub's tested-by and Doug's ack to pci/virtualization for v4.12.

This still leaves these:

Quoted 7 lines

  [PATCH 4/7] ixgbe: use pcie_flr instead of duplicating it [PATCH 6/7] crypto: qat: use pcie_flr instead of duplicating it [PATCH 7/7] liquidio: use pcie_flr instead of duplicating it

I haven't seen any response to 4 and 6.  Felix reported an unused variable in 7.  Let me know if you'd like me to do anything with these.

Just provided my ACK for ixgbe patch.

#12 lore raw

Re: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

In reply to Bjorn Helgaas
Quoted 9 lines · Bjorn Helgaas

This still leaves these:

[PATCH 4/7] ixgbe: use pcie_flr instead of duplicating it [PATCH 6/7] crypto: qat: use pcie_flr instead of duplicating it [PATCH 7/7] liquidio: use pcie_flr instead of duplicating it

I haven't seen any response to 4 and 6. Felix reported an unused variable in 7. Let me know if you'd like me to do anything with these.

Now that Jeff ACKed 4 it might be worth to add it to the pci tree last minute. I'll resend liquidio and qat to the respective maintainers for the next merge window.

#13 lore raw

Re: [PATCH 5/7] IB/hfi1: use pcie_flr instead of duplicating it

Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Bjorn Helgaas

This still leaves these:

[PATCH 4/7] ixgbe: use pcie_flr instead of duplicating it [PATCH 6/7] crypto: qat: use pcie_flr instead of duplicating it [PATCH 7/7] liquidio: use pcie_flr instead of duplicating it

Quoted 7 lines
Quoted 3 lines

I haven't seen any response to 4 and 6. Felix reported an unused variable in 7. Let me know if you'd like me to do anything with these.

Now that Jeff ACKed 4 it might be worth to add it to the pci tree last minute. I'll resend liquidio and qat to the respective maintainers for the next merge window.

I applied 4 with Jeff's ack to pci/virtualization for v4.12, thanks!