Commit 41e3b072 authored by Pieter Jansen van Vuuren's avatar Pieter Jansen van Vuuren Committed by Paolo Abeni

sfc: introduce shutdown entry point in efx pci driver

Make the device inactive when the system shutdown callback has been
invoked. This is achieved by freezing the driver and disabling the
PCI bus mastering.
Co-developed-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: default avatarPieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Acked-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
Link: https://lore.kernel.org/r/20220906105620.26179-1-pieter.jansen-van-vuuren@amd.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 169ccf0e
...@@ -1175,6 +1175,17 @@ static int efx_pm_freeze(struct device *dev) ...@@ -1175,6 +1175,17 @@ static int efx_pm_freeze(struct device *dev)
return 0; return 0;
} }
static void efx_pci_shutdown(struct pci_dev *pci_dev)
{
struct efx_nic *efx = pci_get_drvdata(pci_dev);
if (!efx)
return;
efx_pm_freeze(&pci_dev->dev);
pci_disable_device(pci_dev);
}
static int efx_pm_thaw(struct device *dev) static int efx_pm_thaw(struct device *dev)
{ {
int rc; int rc;
...@@ -1279,6 +1290,7 @@ static struct pci_driver efx_pci_driver = { ...@@ -1279,6 +1290,7 @@ static struct pci_driver efx_pci_driver = {
.probe = efx_pci_probe, .probe = efx_pci_probe,
.remove = efx_pci_remove, .remove = efx_pci_remove,
.driver.pm = &efx_pm_ops, .driver.pm = &efx_pm_ops,
.shutdown = efx_pci_shutdown,
.err_handler = &efx_err_handlers, .err_handler = &efx_err_handlers,
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SRIOV
.sriov_configure = efx_pci_sriov_configure, .sriov_configure = efx_pci_sriov_configure,
......
...@@ -1148,6 +1148,17 @@ static int efx_pm_freeze(struct device *dev) ...@@ -1148,6 +1148,17 @@ static int efx_pm_freeze(struct device *dev)
return 0; return 0;
} }
static void efx_pci_shutdown(struct pci_dev *pci_dev)
{
struct efx_nic *efx = pci_get_drvdata(pci_dev);
if (!efx)
return;
efx_pm_freeze(&pci_dev->dev);
pci_disable_device(pci_dev);
}
static int efx_pm_thaw(struct device *dev) static int efx_pm_thaw(struct device *dev)
{ {
int rc; int rc;
...@@ -1252,6 +1263,7 @@ static struct pci_driver efx_pci_driver = { ...@@ -1252,6 +1263,7 @@ static struct pci_driver efx_pci_driver = {
.probe = efx_pci_probe, .probe = efx_pci_probe,
.remove = efx_pci_remove, .remove = efx_pci_remove,
.driver.pm = &efx_pm_ops, .driver.pm = &efx_pm_ops,
.shutdown = efx_pci_shutdown,
.err_handler = &efx_siena_err_handlers, .err_handler = &efx_siena_err_handlers,
#ifdef CONFIG_SFC_SIENA_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
.sriov_configure = efx_pci_sriov_configure, .sriov_configure = efx_pci_sriov_configure,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment