mirror of https://github.com/torvalds/linux.git
scsi: mpi3mr: Handling of fault code for insufficient power
Before retrying initialization, check and abort if the fault code indicates insufficient power. Also mark the controller as unrecoverable instead of issuing reset in the watch dog timer if the fault code indicates insufficient power. Signed-off-by: Prayas Patel <prayas.patel@broadcom.com> Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com> Link: https://lore.kernel.org/r/20241110194405.10108-5-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
0d32014f1e
commit
fb6eb98f39
|
|
@ -1035,6 +1035,36 @@ static const char *mpi3mr_reset_type_name(u16 reset_type)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mpi3mr_is_fault_recoverable - Read fault code and decide
|
||||||
|
* whether the controller can be recoverable
|
||||||
|
* @mrioc: Adapter instance reference
|
||||||
|
* Return: true if fault is recoverable, false otherwise.
|
||||||
|
*/
|
||||||
|
static inline bool mpi3mr_is_fault_recoverable(struct mpi3mr_ioc *mrioc)
|
||||||
|
{
|
||||||
|
u32 fault;
|
||||||
|
|
||||||
|
fault = (readl(&mrioc->sysif_regs->fault) &
|
||||||
|
MPI3_SYSIF_FAULT_CODE_MASK);
|
||||||
|
|
||||||
|
switch (fault) {
|
||||||
|
case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED:
|
||||||
|
case MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED:
|
||||||
|
ioc_warn(mrioc,
|
||||||
|
"controller requires system power cycle, marking controller as unrecoverable\n");
|
||||||
|
return false;
|
||||||
|
case MPI3_SYSIF_FAULT_CODE_INSUFFICIENT_PCI_SLOT_POWER:
|
||||||
|
ioc_warn(mrioc,
|
||||||
|
"controller faulted due to insufficient power,\n"
|
||||||
|
" try by connecting it to a different slot\n");
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mpi3mr_print_fault_info - Display fault information
|
* mpi3mr_print_fault_info - Display fault information
|
||||||
* @mrioc: Adapter instance reference
|
* @mrioc: Adapter instance reference
|
||||||
|
|
@ -1373,6 +1403,11 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
|
||||||
ioc_info(mrioc, "ioc_status(0x%08x), ioc_config(0x%08x), ioc_info(0x%016llx) at the bringup\n",
|
ioc_info(mrioc, "ioc_status(0x%08x), ioc_config(0x%08x), ioc_info(0x%016llx) at the bringup\n",
|
||||||
ioc_status, ioc_config, base_info);
|
ioc_status, ioc_config, base_info);
|
||||||
|
|
||||||
|
if (!mpi3mr_is_fault_recoverable(mrioc)) {
|
||||||
|
mrioc->unrecoverable = 1;
|
||||||
|
goto out_device_not_present;
|
||||||
|
}
|
||||||
|
|
||||||
/*The timeout value is in 2sec unit, changing it to seconds*/
|
/*The timeout value is in 2sec unit, changing it to seconds*/
|
||||||
mrioc->ready_timeout =
|
mrioc->ready_timeout =
|
||||||
((base_info & MPI3_SYSIF_IOC_INFO_LOW_TIMEOUT_MASK) >>
|
((base_info & MPI3_SYSIF_IOC_INFO_LOW_TIMEOUT_MASK) >>
|
||||||
|
|
@ -2734,6 +2769,11 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
|
||||||
mpi3mr_print_fault_info(mrioc);
|
mpi3mr_print_fault_info(mrioc);
|
||||||
mrioc->diagsave_timeout = 0;
|
mrioc->diagsave_timeout = 0;
|
||||||
|
|
||||||
|
if (!mpi3mr_is_fault_recoverable(mrioc)) {
|
||||||
|
mrioc->unrecoverable = 1;
|
||||||
|
goto schedule_work;
|
||||||
|
}
|
||||||
|
|
||||||
switch (trigger_data.fault) {
|
switch (trigger_data.fault) {
|
||||||
case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED:
|
case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED:
|
||||||
case MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED:
|
case MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue