linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sinan Kaya <okaya@kernel.org>
To: linux-pci@vger.kernel.org
Cc: Sinan Kaya <okaya@kernel.org>,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Dennis Dalessandro <dennis.dalessandro@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Derek Chickles <derek.chickles@caviumnetworks.com>,
	Satanand Burla <satananda.burla@caviumnetworks.com>,
	Felix Manlunas <felix.manlunas@caviumnetworks.com>,
	Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: [PATCH v5 11/11] PCI: Hide pcie_flr() in favor of pci_reset_function()
Date: Thu, 11 Oct 2018 04:50:03 +0000	[thread overview]
Message-ID: <20181011045008.32212-11-okaya@kernel.org> (raw)
In-Reply-To: <20181011045008.32212-1-okaya@kernel.org>

Now that we have a unified API for device reset, let's eliminate
one duplication by hiding pcie_flr().

Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
 drivers/crypto/qat/qat_common/adf_aer.c            | 3 ++-
 drivers/infiniband/hw/hfi1/chip.c                  | 5 +++--
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 3 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c      | 6 ++++--
 drivers/pci/pci.h                                  | 1 +
 include/linux/pci.h                                | 1 -
 6 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/adf_aer.c b/drivers/crypto/qat/qat_common/adf_aer.c
index 9225d060e18f..9326685dd89f 100644
--- a/drivers/crypto/qat/qat_common/adf_aer.c
+++ b/drivers/crypto/qat/qat_common/adf_aer.c
@@ -109,7 +109,8 @@ EXPORT_SYMBOL_GPL(adf_reset_sbr);
 
 void adf_reset_flr(struct adf_accel_dev *accel_dev)
 {
-	pcie_flr(accel_to_pci_dev(accel_dev));
+	pci_reset_function(accel_to_pci_dev(accel_dev), PCI_RESET_FLR,
+			   false, true);
 }
 EXPORT_SYMBOL_GPL(adf_reset_flr);
 
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index e1668bcc2d13..12bc5ef81e12 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -14077,7 +14077,7 @@ static int init_chip(struct hfi1_devdata *dd)
 		dd_dev_info(dd, "Resetting CSRs with FLR\n");
 
 		/* do the FLR, the DC reset will remain */
-		pcie_flr(dd->pcidev);
+		pci_reset_function(dd->pcidev, PCI_RESET_FLR, false, true);
 
 		/* restore command and BARs */
 		ret = restore_pci_variables(dd);
@@ -14089,7 +14089,8 @@ static int init_chip(struct hfi1_devdata *dd)
 
 		if (is_ax(dd)) {
 			dd_dev_info(dd, "Resetting CSRs with FLR\n");
-			pcie_flr(dd->pcidev);
+			pci_reset_function(dd->pcidev, PCI_RESET_FLR, false,
+					   true);
 			ret = restore_pci_variables(dd);
 			if (ret) {
 				dd_dev_err(dd, "%s: Could not restore PCI variables\n",
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index b77835724dc8..6af086337359 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -438,7 +438,8 @@ static void octeon_pci_flr(struct octeon_device *oct)
 	pci_write_config_word(oct->pci_dev, PCI_COMMAND,
 			      PCI_COMMAND_INTX_DISABLE);
 
-	pcie_flr(oct->pci_dev);
+	pci_reset_function(oct->pci_dev, PCI_RESET_FUNCTION,
+			   false, true);
 
 	pci_cfg_access_unlock(oct->pci_dev);
 
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index f27d73a7bf16..6345c2c11c62 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7539,7 +7539,8 @@ 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)
-			pcie_flr(vfdev);
+			pci_reset_function(vfdev, PCI_RESET_FLR, false
+					   true);
 	}
 }
 
@@ -11046,7 +11047,8 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
 		 * VFLR.  Just clean up the AER in that case.
 		 */
 		if (vfdev) {
-			pcie_flr(vfdev);
+			pci_reset_function(vfdev, PCI_RESET_FUNCTION, false,
+					   true);
 			/* Free device reference count */
 			pci_dev_put(vfdev);
 		}
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 737fdc36fe36..c1dc92b1cc1e 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -38,6 +38,7 @@ int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
 int __pci_reset_function_locked(struct pci_dev *dev, u32 reset_type);
 int pci_reset_function_locked(struct pci_dev *dev, u32 reset_type,
 			      bool saverestore);
+int pcie_flr(struct pci_dev *dev);
 
 /**
  * struct pci_platform_pm_ops - Firmware PM callbacks
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 95efffd09690..acaf115841cc 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1164,7 +1164,6 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
 			     enum pcie_link_width *width);
 void pcie_print_link_status(struct pci_dev *dev);
 bool pcie_has_flr(struct pci_dev *dev);
-int pcie_flr(struct pci_dev *dev);
 int pci_reset_function(struct pci_dev *dev, u32 reset_type, bool saverestore,
 		       bool locked);
 int pci_try_reset_function(struct pci_dev *dev, u32 reset_type);
-- 
2.19.0


  parent reply	other threads:[~2018-10-11  4:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  4:49 [PATCH v5 01/11] PCI: Expose reset_type to users of __pci_reset_function_locked() Sinan Kaya
2018-10-11  4:49 ` [PATCH v5 02/11] PCI: Expose reset_type to users of pci_reset_function() Sinan Kaya
2018-10-11  4:49 ` [PATCH v5 03/11] PCI: Expose reset_type to users of pci_reset_function_locked() Sinan Kaya
2018-10-11  4:49 ` [PATCH v5 04/11] PCI: Expose reset type to users of pci_try_reset_function() Sinan Kaya
2018-10-11  4:49 ` [PATCH v5 05/11] PCI: Expose reset type to users of pci_probe_reset_function() Sinan Kaya
2018-10-11  4:49 ` [PATCH v5 06/11] PCI: Expose reset type to users of pci_reset_bus() Sinan Kaya
2018-10-11 15:33   ` Alex Williamson
2018-10-11 15:36     ` Sinan Kaya
2018-10-11  4:49 ` [PATCH v5 07/11] IB/hfi1,PCI: switch to __pci_function_locked() for reset request Sinan Kaya
2018-10-11  4:50 ` [PATCH v5 08/11] PCI: Unify pci_reset_function_locked() and __pci_reset_function_locked() Sinan Kaya
2018-10-11 16:02   ` Alex Williamson
2018-10-11 16:11     ` Sinan Kaya
2018-10-12  9:18   ` Christoph Hellwig
2018-10-12 14:46     ` Sinan Kaya
2018-10-11  4:50 ` [PATCH v5 09/11] PCI: Add options to pci_reset_function Sinan Kaya
2018-10-12  9:18   ` Christoph Hellwig
2018-10-11  4:50 ` [PATCH v5 10/11] PCI: Hide pci_reset_function_locked() Sinan Kaya
2018-10-11  4:50 ` Sinan Kaya [this message]
2018-10-11 15:41   ` [PATCH v5 11/11] PCI: Hide pcie_flr() in favor of pci_reset_function() Sinan Kaya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181011045008.32212-11-okaya@kernel.org \
    --to=okaya@kernel.org \
    --cc=baijiaju1990@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=dennis.dalessandro@intel.com \
    --cc=derek.chickles@caviumnetworks.com \
    --cc=dledford@redhat.com \
    --cc=felix.manlunas@caviumnetworks.com \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-pci@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    --cc=raghu.vatsavayi@caviumnetworks.com \
    --cc=satananda.burla@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).