pds_core: delete VF dev on reset
When the VF is hit with a reset, remove the aux device in the prepare for reset and try to restore it after the reset. The userland mechanics will need to recover and rebuild whatever uses the device afterwards. Reviewed-by: Brett Creeley <brett.creeley@amd.com> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d740f4be7c
commit
2dac60e062
@ -184,6 +184,9 @@ int pdsc_auxbus_dev_del(struct pdsc *cf, struct pdsc *pf)
|
||||
struct pds_auxiliary_dev *padev;
|
||||
int err = 0;
|
||||
|
||||
if (!cf)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&pf->config_lock);
|
||||
|
||||
padev = pf->vfs[cf->vf_id].padev;
|
||||
@ -202,14 +205,27 @@ int pdsc_auxbus_dev_del(struct pdsc *cf, struct pdsc *pf)
|
||||
int pdsc_auxbus_dev_add(struct pdsc *cf, struct pdsc *pf)
|
||||
{
|
||||
struct pds_auxiliary_dev *padev;
|
||||
enum pds_core_vif_types vt;
|
||||
char devname[PDS_DEVNAME_LEN];
|
||||
enum pds_core_vif_types vt;
|
||||
unsigned long mask;
|
||||
u16 vt_support;
|
||||
int client_id;
|
||||
int err = 0;
|
||||
|
||||
if (!cf)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&pf->config_lock);
|
||||
|
||||
mask = BIT_ULL(PDSC_S_FW_DEAD) |
|
||||
BIT_ULL(PDSC_S_STOPPING_DRIVER);
|
||||
if (cf->state & mask) {
|
||||
dev_err(pf->dev, "%s: can't add dev, VF client in bad state %#lx\n",
|
||||
__func__, cf->state);
|
||||
err = -ENXIO;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* We only support vDPA so far, so it is the only one to
|
||||
* be verified that it is available in the Core device and
|
||||
* enabled in the devlink param. In the future this might
|
||||
|
@ -476,6 +476,14 @@ void pdsc_reset_prepare(struct pci_dev *pdev)
|
||||
pdsc_stop_health_thread(pdsc);
|
||||
pdsc_fw_down(pdsc);
|
||||
|
||||
if (pdev->is_virtfn) {
|
||||
struct pdsc *pf;
|
||||
|
||||
pf = pdsc_get_pf_struct(pdsc->pdev);
|
||||
if (!IS_ERR(pf))
|
||||
pdsc_auxbus_dev_del(pdsc, pf);
|
||||
}
|
||||
|
||||
pdsc_unmap_bars(pdsc);
|
||||
pci_release_regions(pdev);
|
||||
pci_disable_device(pdev);
|
||||
@ -511,6 +519,14 @@ void pdsc_reset_done(struct pci_dev *pdev)
|
||||
|
||||
pdsc_fw_up(pdsc);
|
||||
pdsc_restart_health_thread(pdsc);
|
||||
|
||||
if (pdev->is_virtfn) {
|
||||
struct pdsc *pf;
|
||||
|
||||
pf = pdsc_get_pf_struct(pdsc->pdev);
|
||||
if (!IS_ERR(pf))
|
||||
pdsc_auxbus_dev_add(pdsc, pf);
|
||||
}
|
||||
}
|
||||
|
||||
static pci_ers_result_t pdsc_pci_error_detected(struct pci_dev *pdev,
|
||||
|
Loading…
x
Reference in New Issue
Block a user