Skip to content

Commit 6cd48c8

Browse files
Merge patch series "mpi3mr: Support PCI Error Recovery"
Sumit Saxena <sumit.saxena@broadcom.com> says: This patch series contains the changes done in the driver to support PCI error recovery. It is rework of older patch series from Ranjan Kumar, see [1]. [1] https://lore.kernel.org/all/20231214205900.270488-1-ranjan.kumar@broadcom.com/ Link: https://lore.kernel.org/r/20240627101735.18286-1-sumit.saxena@broadcom.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 3443855 + cf82b9e commit 6cd48c8

File tree

5 files changed

+311
-19
lines changed

5 files changed

+311
-19
lines changed

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/miscdevice.h>
2424
#include <linux/module.h>
2525
#include <linux/pci.h>
26+
#include <linux/aer.h>
2627
#include <linux/poll.h>
2728
#include <linux/sched.h>
2829
#include <linux/slab.h>
@@ -56,8 +57,8 @@ extern struct list_head mrioc_list;
5657
extern int prot_mask;
5758
extern atomic64_t event_counter;
5859

59-
#define MPI3MR_DRIVER_VERSION "8.9.1.0.50"
60-
#define MPI3MR_DRIVER_RELDATE "14-May-2024"
60+
#define MPI3MR_DRIVER_VERSION "8.9.1.0.51"
61+
#define MPI3MR_DRIVER_RELDATE "29-May-2024"
6162

6263
#define MPI3MR_DRIVER_NAME "mpi3mr"
6364
#define MPI3MR_DRIVER_LICENSE "GPL"
@@ -129,6 +130,7 @@ extern atomic64_t event_counter;
129130
#define MPI3MR_PREPARE_FOR_RESET_TIMEOUT 180
130131
#define MPI3MR_RESET_ACK_TIMEOUT 30
131132
#define MPI3MR_MUR_TIMEOUT 120
133+
#define MPI3MR_RESET_TIMEOUT 510
132134

133135
#define MPI3MR_WATCHDOG_INTERVAL 1000 /* in milli seconds */
134136

@@ -517,6 +519,7 @@ struct mpi3mr_throttle_group_info {
517519

518520
/* HBA port flags */
519521
#define MPI3MR_HBA_PORT_FLAG_DIRTY 0x01
522+
#define MPI3MR_HBA_PORT_FLAG_NEW 0x02
520523

521524
/* IOCTL data transfer sge*/
522525
#define MPI3MR_NUM_IOCTL_SGE 256
@@ -1153,6 +1156,8 @@ struct scmd_priv {
11531156
* @trace_release_trigger_active: Trace trigger active flag
11541157
* @fw_release_trigger_active: Fw release trigger active flag
11551158
* @snapdump_trigger_active: Snapdump trigger active flag
1159+
* @pci_err_recovery: PCI error recovery in progress
1160+
* @block_on_pci_err: Block IO during PCI error recovery
11561161
*/
11571162
struct mpi3mr_ioc {
11581163
struct list_head list;
@@ -1353,6 +1358,8 @@ struct mpi3mr_ioc {
13531358
bool snapdump_trigger_active;
13541359
bool trace_release_trigger_active;
13551360
bool fw_release_trigger_active;
1361+
bool pci_err_recovery;
1362+
bool block_on_pci_err;
13561363
};
13571364

13581365
/**

drivers/scsi/mpi3mr/mpi3mr_app.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ static int mpi3mr_bsg_pel_abort(struct mpi3mr_ioc *mrioc)
846846
dprint_bsg_err(mrioc, "%s: reset in progress\n", __func__);
847847
return -1;
848848
}
849-
if (mrioc->stop_bsgs) {
849+
if (mrioc->stop_bsgs || mrioc->block_on_pci_err) {
850850
dprint_bsg_err(mrioc, "%s: bsgs are blocked\n", __func__);
851851
return -1;
852852
}
@@ -1492,6 +1492,9 @@ static long mpi3mr_bsg_adp_reset(struct mpi3mr_ioc *mrioc,
14921492
goto out;
14931493
}
14941494

1495+
if (mrioc->unrecoverable || mrioc->block_on_pci_err)
1496+
return -EINVAL;
1497+
14951498
sg_copy_to_buffer(job->request_payload.sg_list,
14961499
job->request_payload.sg_cnt,
14971500
&adpreset, sizeof(adpreset));
@@ -2575,7 +2578,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
25752578
mutex_unlock(&mrioc->bsg_cmds.mutex);
25762579
goto out;
25772580
}
2578-
if (mrioc->stop_bsgs) {
2581+
if (mrioc->stop_bsgs || mrioc->block_on_pci_err) {
25792582
dprint_bsg_err(mrioc, "%s: bsgs are blocked\n", __func__);
25802583
rval = -EAGAIN;
25812584
mutex_unlock(&mrioc->bsg_cmds.mutex);
@@ -3108,7 +3111,8 @@ adp_state_show(struct device *dev, struct device_attribute *attr,
31083111
ioc_state = mpi3mr_get_iocstate(mrioc);
31093112
if (ioc_state == MRIOC_STATE_UNRECOVERABLE)
31103113
adp_state = MPI3MR_BSG_ADPSTATE_UNRECOVERABLE;
3111-
else if ((mrioc->reset_in_progress) || (mrioc->stop_bsgs))
3114+
else if (mrioc->reset_in_progress || mrioc->stop_bsgs ||
3115+
mrioc->block_on_pci_err)
31123116
adp_state = MPI3MR_BSG_ADPSTATE_IN_RESET;
31133117
else if (ioc_state == MRIOC_STATE_FAULT)
31143118
adp_state = MPI3MR_BSG_ADPSTATE_FAULT;

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ int mpi3mr_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num)
608608
mrioc = (struct mpi3mr_ioc *)shost->hostdata;
609609

610610
if ((mrioc->reset_in_progress || mrioc->prepare_for_reset ||
611-
mrioc->unrecoverable))
611+
mrioc->unrecoverable || mrioc->pci_err_recovery))
612612
return 0;
613613

614614
num_entries = mpi3mr_process_op_reply_q(mrioc,
@@ -1693,6 +1693,12 @@ int mpi3mr_admin_request_post(struct mpi3mr_ioc *mrioc, void *admin_req,
16931693
retval = -EAGAIN;
16941694
goto out;
16951695
}
1696+
if (mrioc->pci_err_recovery) {
1697+
ioc_err(mrioc, "admin request queue submission failed due to pci error recovery in progress\n");
1698+
retval = -EAGAIN;
1699+
goto out;
1700+
}
1701+
16961702
areq_entry = (u8 *)mrioc->admin_req_base +
16971703
(areq_pi * MPI3MR_ADMIN_REQ_FRAME_SZ);
16981704
memset(areq_entry, 0, MPI3MR_ADMIN_REQ_FRAME_SZ);
@@ -2363,6 +2369,11 @@ int mpi3mr_op_request_post(struct mpi3mr_ioc *mrioc,
23632369
retval = -EAGAIN;
23642370
goto out;
23652371
}
2372+
if (mrioc->pci_err_recovery) {
2373+
ioc_err(mrioc, "operational request queue submission failed due to pci error recovery in progress\n");
2374+
retval = -EAGAIN;
2375+
goto out;
2376+
}
23662377

23672378
segment_base_addr = segments[pi / op_req_q->segment_qd].segment;
23682379
req_entry = (u8 *)segment_base_addr +
@@ -2627,7 +2638,7 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
26272638
union mpi3mr_trigger_data trigger_data;
26282639
u16 reset_reason = MPI3MR_RESET_FROM_FAULT_WATCH;
26292640

2630-
if (mrioc->reset_in_progress)
2641+
if (mrioc->reset_in_progress || mrioc->pci_err_recovery)
26312642
return;
26322643

26332644
if (!mrioc->unrecoverable && !pci_device_is_present(mrioc->pdev)) {
@@ -4268,7 +4279,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
42684279
goto out_failed_noretry;
42694280
}
42704281

4271-
if (is_resume) {
4282+
if (is_resume || mrioc->block_on_pci_err) {
42724283
dprint_reset(mrioc, "setting up single ISR\n");
42734284
retval = mpi3mr_setup_isr(mrioc, 1);
42744285
if (retval) {
@@ -4319,7 +4330,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
43194330
goto out_failed;
43204331
}
43214332

4322-
if (is_resume) {
4333+
if (is_resume || mrioc->block_on_pci_err) {
43234334
dprint_reset(mrioc, "setting up multiple ISR\n");
43244335
retval = mpi3mr_setup_isr(mrioc, 0);
43254336
if (retval) {
@@ -4807,7 +4818,8 @@ void mpi3mr_cleanup_ioc(struct mpi3mr_ioc *mrioc)
48074818

48084819
ioc_state = mpi3mr_get_iocstate(mrioc);
48094820

4810-
if ((!mrioc->unrecoverable) && (!mrioc->reset_in_progress) &&
4821+
if (!mrioc->unrecoverable && !mrioc->reset_in_progress &&
4822+
!mrioc->pci_err_recovery &&
48114823
(ioc_state == MRIOC_STATE_READY)) {
48124824
if (mpi3mr_issue_and_process_mur(mrioc,
48134825
MPI3MR_RESET_FROM_CTLR_CLEANUP))

0 commit comments

Comments
 (0)