From: Sinan Kaya <okaya@kernel.org>
To: linux-pci@vger.kernel.org
Cc: Sinan Kaya <okaya@kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Frank Haverkamp <haver@linux.vnet.ibm.com>,
"Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Harish Patil <harish.patil@cavium.com>,
Manish Chopra <manish.chopra@cavium.com>,
Dept-GELinuxNICDev@cavium.com,
"David S. Miller" <davem@davemloft.net>,
Solarflare linux maintainers <linux-net-drivers@solarflare.com>,
Edward Cree <ecree@solarflare.com>,
Bert Kenward <bkenward@solarflare.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Anton Vasilyev <vasilyev@ispras.ru>
Subject: [PATCH v6 2/7] PCI: Expose reset_type to users of pci_reset_function()
Date: Fri, 19 Oct 2018 02:11:22 +0000 [thread overview]
Message-ID: <20181019021132.14743-2-okaya@kernel.org> (raw)
In-Reply-To: <20181019021132.14743-1-okaya@kernel.org>
Looking to have more control between the users of the API vs. what the API
can do internally. The new reset_type tells the PCI core about the bounds
of the request.
PCI_RESET_ANY was chosen to match the existing behavior in the code.
Current pci_reset_function() tries all reset types one by one until
it returns 0. By specifying PCI_RESET_ANY, we get the same behavior like
before.
Signed-off-by: Sinan Kaya <okaya@kernel.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> (drivers/hid/intel-ish-hid/ipc/ipc.c)
---
drivers/hid/intel-ish-hid/ipc/ipc.c | 2 +-
drivers/misc/genwqe/card_base.c | 2 +-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 2 +-
drivers/net/ethernet/sfc/mcdi.c | 2 +-
drivers/pci/pci-sysfs.c | 2 +-
drivers/pci/pci.c | 5 +++--
include/linux/pci.h | 2 +-
7 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index bfbca7ec54ce..18312969f1b3 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -754,7 +754,7 @@ static int _ish_hw_reset(struct ishtp_device *dev)
if (!pdev)
return -ENODEV;
- rv = pci_reset_function(pdev);
+ rv = pci_reset_function(pdev, PCI_RESET_ANY);
if (!rv)
dev->dev_state = ISHTP_DEV_RESETTING;
diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index c7cd3675bcd1..cc78ef28ee38 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -201,7 +201,7 @@ static int genwqe_bus_reset(struct genwqe_dev *cd)
* restored by the pci_reset_function().
*/
dev_dbg(&pci_dev->dev, "[%s] pci_reset function ...\n", __func__);
- rc = pci_reset_function(pci_dev);
+ rc = pci_reset_function(pci_dev, PCI_RESET_ANY);
if (rc) {
dev_err(&pci_dev->dev,
"[%s] err: failed reset func (rc %d)\n", __func__, rc);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index d344e9d43832..bb737725f175 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -629,7 +629,7 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev)
int i, err, ring;
if (dev->flags & QLCNIC_NEED_FLR) {
- pci_reset_function(dev->pdev);
+ pci_reset_function(dev->pdev, PCI_RESET_ANY);
dev->flags &= ~QLCNIC_NEED_FLR;
}
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index dfad93fca0a6..7f95e17b8a48 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -1862,7 +1862,7 @@ int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method)
/* If MCDI is down, we can't handle_assertion */
if (method == RESET_TYPE_MCDI_TIMEOUT) {
- rc = pci_reset_function(efx->pci_dev);
+ rc = pci_reset_function(efx->pci_dev, PCI_RESET_ANY);
if (rc)
return rc;
/* Re-enable polled MCDI completion */
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 9ecfe13157c0..9569664ec4b2 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1449,7 +1449,7 @@ static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;
pm_runtime_get_sync(dev);
- result = pci_reset_function(pdev);
+ result = pci_reset_function(pdev, PCI_RESET_ANY);
pm_runtime_put(dev);
if (result < 0)
return result;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e292ea589d3e..66f102b7ed4e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4780,6 +4780,7 @@ int pci_probe_reset_function(struct pci_dev *dev)
/**
* pci_reset_function - quiesce and reset a PCI device function
* @dev: PCI device to reset
+ * @reset_type: reset type to apply
*
* Some devices allow an individual function to be reset without affecting
* other functions in the same device. The PCI device must be responsive
@@ -4793,7 +4794,7 @@ int pci_probe_reset_function(struct pci_dev *dev)
* Returns 0 if the device function was successfully reset or negative if the
* device doesn't support resetting a single function.
*/
-int pci_reset_function(struct pci_dev *dev)
+int pci_reset_function(struct pci_dev *dev, u32 reset_type)
{
int rc;
@@ -4803,7 +4804,7 @@ int pci_reset_function(struct pci_dev *dev)
pci_dev_lock(dev);
pci_dev_save_and_disable(dev);
- rc = __pci_reset_function_locked(dev, PCI_RESET_ANY);
+ rc = __pci_reset_function_locked(dev, reset_type);
pci_dev_restore(dev);
pci_dev_unlock(dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7ace46b3e479..927e60660b96 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1168,7 +1168,7 @@ 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_locked(struct pci_dev *dev, u32 reset_type);
-int pci_reset_function(struct pci_dev *dev);
+int pci_reset_function(struct pci_dev *dev, u32 reset_type);
int pci_reset_function_locked(struct pci_dev *dev);
int pci_try_reset_function(struct pci_dev *dev);
int pci_probe_reset_slot(struct pci_slot *slot);
--
2.19.0
next prev parent reply other threads:[~2018-10-19 2:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 2:11 [PATCH v6 1/7] PCI: Expose reset_type to users of __pci_reset_function_locked() Sinan Kaya
2018-10-19 2:11 ` Sinan Kaya [this message]
2018-10-19 2:11 ` [PATCH v6 3/7] PCI: Expose reset_type to users of pci_reset_function_locked() Sinan Kaya
2018-10-19 20:20 ` Bjorn Helgaas
2018-10-19 22:18 ` Sinan Kaya
2018-10-19 2:11 ` [PATCH v6 4/7] PCI: Expose reset type to users of pci_try_reset_function() Sinan Kaya
2018-10-19 20:14 ` Bjorn Helgaas
2018-10-19 20:21 ` Brian Norris
2018-10-19 2:11 ` [PATCH v6 5/7] PCI: Expose reset type to users of pci_probe_reset_function() Sinan Kaya
2018-10-19 2:11 ` [PATCH v6 6/7] PCI: Expose reset type to users of pci_reset_bus() Sinan Kaya
2018-10-19 2:11 ` [PATCH v6 7/7] IB/hfi1,PCI: switch to __pci_function_locked() for reset request Sinan Kaya
2018-10-19 13:10 ` Doug Ledford
2018-10-20 2:09 ` [PATCH v6 1/7] PCI: Expose reset_type to users of __pci_reset_function_locked() Bjorn Helgaas
2018-10-20 2:58 ` Sinan Kaya
2018-10-20 15:03 ` Bjorn Helgaas
2018-10-20 16:21 ` Sinan Kaya
2018-11-08 20:31 ` Alex Williamson
2018-11-08 21:13 ` Bjorn Helgaas
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=20181019021132.14743-2-okaya@kernel.org \
--to=okaya@kernel.org \
--cc=Dept-GELinuxNICDev@cavium.com \
--cc=arnd@arndb.de \
--cc=benjamin.tissoires@redhat.com \
--cc=bhelgaas@google.com \
--cc=bkenward@solarflare.com \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=gpiccoli@linux.vnet.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=harish.patil@cavium.com \
--cc=haver@linux.vnet.ibm.com \
--cc=jikos@kernel.org \
--cc=linux-net-drivers@solarflare.com \
--cc=linux-pci@vger.kernel.org \
--cc=manish.chopra@cavium.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=vasilyev@ispras.ru \
/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 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.