Merge branch 'pds_core-error-handling-fixes'
Shannon Nelson says: ==================== pds_core: error handling fixes Some fixes for better handling of broken states. ==================== Link: https://lore.kernel.org/r/20230824161754.34264-1-shannon.nelson@amd.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
5c905279a1
@ -464,7 +464,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pdsc_devcmd_reset(pdsc);
|
if (!pdsc->pdev->is_virtfn)
|
||||||
|
pdsc_devcmd_reset(pdsc);
|
||||||
pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
|
pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
|
||||||
pdsc_qcq_free(pdsc, &pdsc->adminqcq);
|
pdsc_qcq_free(pdsc, &pdsc->adminqcq);
|
||||||
|
|
||||||
@ -524,7 +525,8 @@ static void pdsc_fw_down(struct pdsc *pdsc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Notify clients of fw_down */
|
/* Notify clients of fw_down */
|
||||||
devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc);
|
if (pdsc->fw_reporter)
|
||||||
|
devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc);
|
||||||
pdsc_notify(PDS_EVENT_RESET, &reset_event);
|
pdsc_notify(PDS_EVENT_RESET, &reset_event);
|
||||||
|
|
||||||
pdsc_stop(pdsc);
|
pdsc_stop(pdsc);
|
||||||
@ -554,8 +556,9 @@ static void pdsc_fw_up(struct pdsc *pdsc)
|
|||||||
|
|
||||||
/* Notify clients of fw_up */
|
/* Notify clients of fw_up */
|
||||||
pdsc->fw_recoveries++;
|
pdsc->fw_recoveries++;
|
||||||
devlink_health_reporter_state_update(pdsc->fw_reporter,
|
if (pdsc->fw_reporter)
|
||||||
DEVLINK_HEALTH_REPORTER_STATE_HEALTHY);
|
devlink_health_reporter_state_update(pdsc->fw_reporter,
|
||||||
|
DEVLINK_HEALTH_REPORTER_STATE_HEALTHY);
|
||||||
pdsc_notify(PDS_EVENT_RESET, &reset_event);
|
pdsc_notify(PDS_EVENT_RESET, &reset_event);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -121,7 +121,7 @@ static const char *pdsc_devcmd_str(int opcode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
|
static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds)
|
||||||
{
|
{
|
||||||
struct device *dev = pdsc->dev;
|
struct device *dev = pdsc->dev;
|
||||||
unsigned long start_time;
|
unsigned long start_time;
|
||||||
@ -131,9 +131,6 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
|
|||||||
int done = 0;
|
int done = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int status;
|
int status;
|
||||||
int opcode;
|
|
||||||
|
|
||||||
opcode = ioread8(&pdsc->cmd_regs->cmd.opcode);
|
|
||||||
|
|
||||||
start_time = jiffies;
|
start_time = jiffies;
|
||||||
max_wait = start_time + (max_seconds * HZ);
|
max_wait = start_time + (max_seconds * HZ);
|
||||||
@ -180,10 +177,10 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
|
|||||||
|
|
||||||
memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
|
memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
|
||||||
pdsc_devcmd_dbell(pdsc);
|
pdsc_devcmd_dbell(pdsc);
|
||||||
err = pdsc_devcmd_wait(pdsc, max_seconds);
|
err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
|
||||||
memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
|
memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
|
||||||
|
|
||||||
if (err == -ENXIO || err == -ETIMEDOUT)
|
if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
|
||||||
queue_work(pdsc->wq, &pdsc->health_work);
|
queue_work(pdsc->wq, &pdsc->health_work);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -10,6 +10,9 @@ pdsc_viftype *pdsc_dl_find_viftype_by_id(struct pdsc *pdsc,
|
|||||||
{
|
{
|
||||||
int vt;
|
int vt;
|
||||||
|
|
||||||
|
if (!pdsc->viftype_status)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for (vt = 0; vt < PDS_DEV_TYPE_MAX; vt++) {
|
for (vt = 0; vt < PDS_DEV_TYPE_MAX; vt++) {
|
||||||
if (pdsc->viftype_status[vt].dl_id == dl_id)
|
if (pdsc->viftype_status[vt].dl_id == dl_id)
|
||||||
return &pdsc->viftype_status[vt];
|
return &pdsc->viftype_status[vt];
|
||||||
|
Loading…
Reference in New Issue
Block a user