Skip to content

Commit 0a319f1

Browse files
Ranjan Kumarmartinkpetersen
authored andcommitted
scsi: mpi3mr: Wait for diagnostic save during controller init
If a controller reset operation is triggered to recover the controller from a fault state, then wait for the snapdump to be saved in the firmware region before proceeding to reset the controller. Signed-off-by: Ranjan Kumar <[email protected]> Signed-off-by: Sreekanth Reddy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 5b06a71 commit 0a319f1

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc)
11981198
*/
11991199
static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
12001200
{
1201-
u32 ioc_config, ioc_status, timeout;
1201+
u32 ioc_config, ioc_status, timeout, host_diagnostic;
12021202
int retval = 0;
12031203
enum mpi3mr_iocstate ioc_state;
12041204
u64 base_info;
@@ -1252,6 +1252,23 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
12521252
retval, mpi3mr_iocstate_name(ioc_state));
12531253
}
12541254
if (ioc_state != MRIOC_STATE_RESET) {
1255+
if (ioc_state == MRIOC_STATE_FAULT) {
1256+
timeout = MPI3_SYSIF_DIAG_SAVE_TIMEOUT * 10;
1257+
mpi3mr_print_fault_info(mrioc);
1258+
do {
1259+
host_diagnostic =
1260+
readl(&mrioc->sysif_regs->host_diagnostic);
1261+
if (!(host_diagnostic &
1262+
MPI3_SYSIF_HOST_DIAG_SAVE_IN_PROGRESS))
1263+
break;
1264+
if (!pci_device_is_present(mrioc->pdev)) {
1265+
mrioc->unrecoverable = 1;
1266+
ioc_err(mrioc, "controller is not present at the bringup\n");
1267+
goto out_device_not_present;
1268+
}
1269+
msleep(100);
1270+
} while (--timeout);
1271+
}
12551272
mpi3mr_print_fault_info(mrioc);
12561273
ioc_info(mrioc, "issuing soft reset to bring to reset state\n");
12571274
retval = mpi3mr_issue_reset(mrioc,

0 commit comments

Comments
 (0)