History

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley: - add support for new devices (ufs, mvsas) - a major set of fixes in lpfc - get rid of a driver specific ioctl in pcmraid - a major rework of aha152x to get rid of the scsi_pointer. - minor fixes and obvious changes including several spelling updates. * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (36 commits) scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan scsi: ufs: ufshpb: Fix a NULL check on list iterator scsi: sd: Clean up gendisk if device_add_disk() failed scsi: message: fusion: Remove redundant variable dmp scsi: mvsas: Add PCI ID of RocketRaid 2640 scsi: sd: sd_read_cpr() requires VPD pages scsi: mpt3sas: Fail reset operation if config request timed out scsi: sym53c500_cs: Stop using struct scsi_pointer scsi: ufs: ufs-pci: Add support for Intel MTL scsi: mpt3sas: Fix mpt3sas_check_same_4gb_region() kdoc comment scsi: scsi_debug: Fix sdebug_blk_mq_poll() in_use_bm bitmap use scsi: bnx2i: Fix spelling mistake "mis-match" -> "mismatch" scsi: bnx2fc: Fix spelling mistake "mis-match" -> "mismatch" scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one() scsi: aic7xxx: Use standard PCI subsystem, subdevice defines scsi: ufs: qcom: Drop custom Android boot parameters scsi: core: sysfs: Remove comments that conflict with the actual logic scsi: hisi_sas: Remove stray fallthrough annotation scsi: virtio-scsi: Eliminate anonymous module_init & module_exit scsi: isci: Fix spelling mistake "doesnt" -> "doesn't" ...

Linus Torvalds committed 4 years ago

Commit e1f700e2 parents f1b45d8 56495f242 files · +467 −826Browse files

Unified · Split

42 files
  1. drivers/message/fusion/mptbase.c +2 −2
  2. drivers/scsi/aha152x.c +113 −122
  3. drivers/scsi/aic7xxx/aic79xx_osm.h +0 −2
  4. drivers/scsi/aic7xxx/aic79xx_pci.c +3 −3
  5. drivers/scsi/aic7xxx/aic7xxx_osm.h +0 −2
  6. drivers/scsi/aic7xxx/aic7xxx_pci.c +2 −2
  7. drivers/scsi/bnx2fc/bnx2fc_hwi.c +3 −3
  8. drivers/scsi/bnx2i/bnx2i_hwi.c +2 −2
  9. drivers/scsi/hisi_sas/hisi_sas_main.c +0 −1
  10. drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 −1
  11. drivers/scsi/isci/host.c +3 −3
  12. drivers/scsi/libiscsi.c +0 −1
  13. drivers/scsi/lpfc/lpfc.h +5 −2
  14. drivers/scsi/lpfc/lpfc_crtn.h +3 −0
  15. drivers/scsi/lpfc/lpfc_hbadisc.c +97 −23
  16. drivers/scsi/lpfc/lpfc_init.c +63 −25
  17. drivers/scsi/lpfc/lpfc_nvme.c +18 −9
  18. drivers/scsi/lpfc/lpfc_scsi.c +7 −5
  19. drivers/scsi/lpfc/lpfc_sli.c +53 −22
  20. drivers/scsi/lpfc/lpfc_version.h +1 −1
  21. drivers/scsi/megaraid/megaraid_sas.h +3 −0
  22. drivers/scsi/megaraid/megaraid_sas_base.c +7 −0
  23. drivers/scsi/mpt3sas/mpt3sas_base.c +1 −2
  24. drivers/scsi/mpt3sas/mpt3sas_config.c +6 −3
  25. drivers/scsi/mpt3sas/mpt3sas_scsih.c +4 −1
  26. drivers/scsi/mvsas/mv_init.c +1 −0
  27. drivers/scsi/pcmcia/sym53c500_cs.c +25 −27
  28. drivers/scsi/pmcraid.c +0 −491
  29. drivers/scsi/pmcraid.h +0 −33
  30. drivers/scsi/scsi_debug.c +5 −3
  31. drivers/scsi/scsi_logging.c +1 −1
  32. drivers/scsi/scsi_scan.c +5 −0
  33. drivers/scsi/scsi_sysfs.c +0 −4
  34. drivers/scsi/sd.c +2 −1
  35. drivers/scsi/sr.c +1 −1
  36. drivers/scsi/ufs/ufs-qcom.c +0 −15
  37. drivers/scsi/ufs/ufshcd-pci.c +17 −0
  38. drivers/scsi/ufs/ufshcd.h +0 −2
  39. drivers/scsi/ufs/ufshpb.c +5 −6
  40. drivers/scsi/virtio_scsi.c +4 −4
  41. drivers/scsi/zorro7xx.c +2 −0
  42. drivers/target/target_core_user.c +2 −1
drivers/message/fusion/mptbase.c+2−2
@@ -6658,13 +6658,13 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v) · 6657 unmodified lines
66586658 static int mpt_version_proc_show(struct seq_file *m, void *v)
66596659 {
66606660 u8 cb_idx;
6661− int scsi, fc, sas, lan, ctl, targ, dmp;
6661+ int scsi, fc, sas, lan, ctl, targ;
66626662 char *drvname;
66636663
66646664 seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON);
66656665 seq_printf(m, " Fusion MPT base driver\n");
66666666
6667− scsi = fc = sas = lan = ctl = targ = dmp = 0;
6667+ scsi = fc = sas = lan = ctl = targ = 0;
66686668 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
66696669 drvname = NULL;
66706670 if (MptCallbacks[cb_idx]) {
drivers/scsi/aha152x.c+113−122
@@ -317,14 +317,18 @@ enum { · 316 unmodified lines
317317 };
318318
319319 struct aha152x_cmd_priv {
320− struct scsi_pointer scsi_pointer;
320+ char *ptr;
321+ int this_residual;
322+ struct scatterlist *buffer;
323+ int status;
324+ int message;
325+ int sent_command;
326+ int phase;
321327 };
322328
323−static struct scsi_pointer *aha152x_scsi_pointer(struct scsi_cmnd *cmd)
329+static struct aha152x_cmd_priv *aha152x_priv(struct scsi_cmnd *cmd)
324330 {
325− struct aha152x_cmd_priv *acmd = scsi_cmd_priv(cmd);
326−
327− return &acmd->scsi_pointer;
331+ return scsi_cmd_priv(cmd);
328332 }
329333
330334 MODULE_AUTHOR("Jürgen Fischer");
@@ -890,17 +894,16 @@ void aha152x_release(struct Scsi_Host *shpnt) · 559 unmodified lines
890894 static int setup_expected_interrupts(struct Scsi_Host *shpnt)
891895 {
892896 if(CURRENT_SC) {
893− struct scsi_pointer *scsi_pointer =
894− aha152x_scsi_pointer(CURRENT_SC);
897+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
895898
896− scsi_pointer->phase |= 1 << 16;
899+ acp->phase |= 1 << 16;
897900
898− if (scsi_pointer->phase & selecting) {
901+ if (acp->phase & selecting) {
899902 SETPORT(SSTAT1, SELTO);
900903 SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0));
901904 SETPORT(SIMODE1, ENSELTIMO);
902905 } else {
903− SETPORT(SIMODE0, (scsi_pointer->phase & spiordy) ? ENSPIORDY : 0);
906+ SETPORT(SIMODE0, (acp->phase & spiordy) ? ENSPIORDY : 0);
904907 SETPORT(SIMODE1, ENPHASEMIS | ENSCSIRST | ENSCSIPERR | ENBUSFREE);
905908 }
906909 } else if(STATE==seldi) {
@@ -924,17 +927,16 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt) · 17 unmodified lines
924927 static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,
925928 struct completion *complete, int phase)
926929 {
927− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(SCpnt);
930+ struct aha152x_cmd_priv *acp = aha152x_priv(SCpnt);
928931 struct Scsi_Host *shpnt = SCpnt->device->host;
929932 unsigned long flags;
930933
931− scsi_pointer->phase = not_issued | phase;
932− scsi_pointer->Status = 0x1; /* Ilegal status by SCSI standard */
933− scsi_pointer->Message = 0;
934− scsi_pointer->have_data_in = 0;
935− scsi_pointer->sent_command = 0;
934+ acp->phase = not_issued | phase;
935+ acp->status = 0x1; /* Illegal status by SCSI standard */
936+ acp->message = 0;
937+ acp->sent_command = 0;
936938
937− if (scsi_pointer->phase & (resetting | check_condition)) {
939+ if (acp->phase & (resetting | check_condition)) {
938940 if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
939941 scmd_printk(KERN_ERR, SCpnt, "cannot reuse command\n");
940942 return FAILED;
@@ -957,15 +959,15 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt, · 16 unmodified lines
957959 SCp.phase : current state of the command */
958960
959961 if ((phase & resetting) || !scsi_sglist(SCpnt)) {
960− scsi_pointer->ptr = NULL;
961− scsi_pointer->this_residual = 0;
962+ acp->ptr = NULL;
963+ acp->this_residual = 0;
962964 scsi_set_resid(SCpnt, 0);
963− scsi_pointer->buffer = NULL;
965+ acp->buffer = NULL;
964966 } else {
965967 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
966− scsi_pointer->buffer = scsi_sglist(SCpnt);
967− scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer);
968− scsi_pointer->this_residual = scsi_pointer->buffer->length;
968+ acp->buffer = scsi_sglist(SCpnt);
969+ acp->ptr = SG_ADDRESS(acp->buffer);
970+ acp->this_residual = acp->buffer->length;
969971 }
970972
971973 DO_LOCK(flags);
@@ -1015,7 +1017,7 @@ static void reset_done(struct scsi_cmnd *SCpnt) · 43 unmodified lines
10151017
10161018 static void aha152x_scsi_done(struct scsi_cmnd *SCpnt)
10171019 {
1018− if (aha152x_scsi_pointer(SCpnt)->phase & resetting)
1020+ if (aha152x_priv(SCpnt)->phase & resetting)
10191021 reset_done(SCpnt);
10201022 else
10211023 scsi_done(SCpnt);
@@ -1101,7 +1103,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt) · 79 unmodified lines
11011103
11021104 DO_LOCK(flags);
11031105
1104− if (aha152x_scsi_pointer(SCpnt)->phase & resetted) {
1106+ if (aha152x_priv(SCpnt)->phase & resetted) {
11051107 HOSTDATA(shpnt)->commands--;
11061108 if (!HOSTDATA(shpnt)->commands)
11071109 SETPORT(PORTA, 0);
@@ -1395,31 +1397,30 @@ static void busfree_run(struct Scsi_Host *shpnt) · 287 unmodified lines
13951397 SETPORT(SSTAT1, CLRBUSFREE);
13961398
13971399 if(CURRENT_SC) {
1398− struct scsi_pointer *scsi_pointer =
1399− aha152x_scsi_pointer(CURRENT_SC);
1400+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
14001401
14011402 #if defined(AHA152X_STAT)
14021403 action++;
14031404 #endif
1404− scsi_pointer->phase &= ~syncneg;
1405+ acp->phase &= ~syncneg;
14051406
1406− if (scsi_pointer->phase & completed) {
1407+ if (acp->phase & completed) {
14071408 /* target sent COMMAND COMPLETE */
1408− done(shpnt, scsi_pointer->Status, DID_OK);
1409+ done(shpnt, acp->status, DID_OK);
14091410
1410− } else if (scsi_pointer->phase & aborted) {
1411− done(shpnt, scsi_pointer->Status, DID_ABORT);
1411+ } else if (acp->phase & aborted) {
1412+ done(shpnt, acp->status, DID_ABORT);
14121413
1413− } else if (scsi_pointer->phase & resetted) {
1414− done(shpnt, scsi_pointer->Status, DID_RESET);
1414+ } else if (acp->phase & resetted) {
1415+ done(shpnt, acp->status, DID_RESET);
14151416
1416− } else if (scsi_pointer->phase & disconnected) {
1417+ } else if (acp->phase & disconnected) {
14171418 /* target sent DISCONNECT */
14181419 #if defined(AHA152X_STAT)
14191420 HOSTDATA(shpnt)->disconnections++;
14201421 #endif
14211422 append_SC(&DISCONNECTED_SC, CURRENT_SC);
1422− scsi_pointer->phase |= 1 << 16;
1423+ acp->phase |= 1 << 16;
14231424 CURRENT_SC = NULL;
14241425
14251426 } else {
@@ -1438,24 +1439,23 @@ static void busfree_run(struct Scsi_Host *shpnt) · 12 unmodified lines
14381439 action++;
14391440 #endif
14401441
1441− if (aha152x_scsi_pointer(DONE_SC)->phase & check_condition) {
1442+ if (aha152x_priv(DONE_SC)->phase & check_condition) {
14421443 struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC;
14431444 struct aha152x_scdata *sc = SCDATA(cmd);
14441445
14451446 scsi_eh_restore_cmnd(cmd, &sc->ses);
14461447
1447− aha152x_scsi_pointer(cmd)->Status = SAM_STAT_CHECK_CONDITION;
1448+ aha152x_priv(cmd)->status = SAM_STAT_CHECK_CONDITION;
14481449
14491450 HOSTDATA(shpnt)->commands--;
14501451 if (!HOSTDATA(shpnt)->commands)
14511452 SETPORT(PORTA, 0); /* turn led off */
1452− } else if (aha152x_scsi_pointer(DONE_SC)->Status ==
1453− SAM_STAT_CHECK_CONDITION) {
1453+ } else if (aha152x_priv(DONE_SC)->status == SAM_STAT_CHECK_CONDITION) {
14541454 #if defined(AHA152X_STAT)
14551455 HOSTDATA(shpnt)->busfree_with_check_condition++;
14561456 #endif
14571457
1458− if(!(aha152x_scsi_pointer(DONE_SC)->phase & not_issued)) {
1458+ if (!(aha152x_priv(DONE_SC)->phase & not_issued)) {
14591459 struct aha152x_scdata *sc;
14601460 struct scsi_cmnd *ptr = DONE_SC;
14611461 DONE_SC=NULL;
@@ -1480,7 +1480,7 @@ static void busfree_run(struct Scsi_Host *shpnt) · 18 unmodified lines
14801480 if (!HOSTDATA(shpnt)->commands)
14811481 SETPORT(PORTA, 0); /* turn led off */
14821482
1483− if (!(aha152x_scsi_pointer(ptr)->phase & resetting)) {
1483+ if (!(aha152x_priv(ptr)->phase & resetting)) {
14841484 kfree(ptr->host_scribble);
14851485 ptr->host_scribble=NULL;
14861486 }
@@ -1503,13 +1503,12 @@ static void busfree_run(struct Scsi_Host *shpnt) · 16 unmodified lines
15031503 DO_UNLOCK(flags);
15041504
15051505 if(CURRENT_SC) {
1506− struct scsi_pointer *scsi_pointer =
1507− aha152x_scsi_pointer(CURRENT_SC);
1506+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
15081507
15091508 #if defined(AHA152X_STAT)
15101509 action++;
15111510 #endif
1512− scsi_pointer->phase |= selecting;
1511+ acp->phase |= selecting;
15131512
15141513 /* clear selection timeout */
15151514 SETPORT(SSTAT1, SELTO);
@@ -1537,13 +1536,13 @@ static void busfree_run(struct Scsi_Host *shpnt) · 21 unmodified lines
15371536 */
15381537 static void seldo_run(struct Scsi_Host *shpnt)
15391538 {
1540− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
1539+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
15411540
15421541 SETPORT(SCSISIG, 0);
15431542 SETPORT(SSTAT1, CLRBUSFREE);
15441543 SETPORT(SSTAT1, CLRPHASECHG);
15451544
1546− scsi_pointer->phase &= ~(selecting | not_issued);
1545+ acp->phase &= ~(selecting | not_issued);
15471546
15481547 SETPORT(SCSISEQ, 0);
15491548
@@ -1558,12 +1557,12 @@ static void seldo_run(struct Scsi_Host *shpnt) · 8 unmodified lines
15581557
15591558 ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
15601559
1561− if (scsi_pointer->phase & aborting) {
1560+ if (acp->phase & aborting) {
15621561 ADDMSGO(ABORT);
1563− } else if (scsi_pointer->phase & resetting) {
1562+ } else if (acp->phase & resetting) {
15641563 ADDMSGO(BUS_DEVICE_RESET);
15651564 } else if (SYNCNEG==0 && SYNCHRONOUS) {
1566− scsi_pointer->phase |= syncneg;
1565+ acp->phase |= syncneg;
15671566 MSGOLEN += spi_populate_sync_msg(&MSGO(MSGOLEN), 50, 8);
15681567 SYNCNEG=1; /* negotiation in progress */
15691568 }
@@ -1578,7 +1577,7 @@ static void seldo_run(struct Scsi_Host *shpnt) · 8 unmodified lines
15781577 */
15791578 static void selto_run(struct Scsi_Host *shpnt)
15801579 {
1581− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
1580+ struct aha152x_cmd_priv *acp;
15821581
15831582 SETPORT(SCSISEQ, 0);
15841583 SETPORT(SSTAT1, CLRSELTIMO);
@@ -1586,9 +1585,10 @@ static void selto_run(struct Scsi_Host *shpnt) · 1 unmodified line
15861585 if (!CURRENT_SC)
15871586 return;
15881587
1589− scsi_pointer->phase &= ~selecting;
1588+ acp = aha152x_priv(CURRENT_SC);
1589+ acp->phase &= ~selecting;
15901590
1591− if (scsi_pointer->phase & aborted)
1591+ if (acp->phase & aborted)
15921592 done(shpnt, SAM_STAT_GOOD, DID_ABORT);
15931593 else if (TESTLO(SSTAT0, SELINGO))
15941594 done(shpnt, SAM_STAT_GOOD, DID_BUS_BUSY);
@@ -1616,10 +1616,9 @@ static void seldi_run(struct Scsi_Host *shpnt) · 21 unmodified lines
16161616 SETPORT(SSTAT1, CLRPHASECHG);
16171617
16181618 if(CURRENT_SC) {
1619− struct scsi_pointer *scsi_pointer =
1620− aha152x_scsi_pointer(CURRENT_SC);
1619+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
16211620
1622− if (!(scsi_pointer->phase & not_issued))
1621+ if (!(acp->phase & not_issued))
16231622 scmd_printk(KERN_ERR, CURRENT_SC,
16241623 "command should not have been issued yet\n");
16251624
@@ -1676,7 +1675,7 @@ static void seldi_run(struct Scsi_Host *shpnt) · 50 unmodified lines
16761675 static void msgi_run(struct Scsi_Host *shpnt)
16771676 {
16781677 for(;;) {
1679− struct scsi_pointer *scsi_pointer;
1678+ struct aha152x_cmd_priv *acp;
16801679 int sstat1 = GETPORT(SSTAT1);
16811680
16821681 if(sstat1 & (PHASECHG|PHASEMIS|BUSFREE) || !(sstat1 & REQINIT))
@@ -1714,9 +1713,9 @@ static void msgi_run(struct Scsi_Host *shpnt) · 31 unmodified lines
17141713 continue;
17151714 }
17161715
1717− scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
1718− scsi_pointer->Message = MSGI(0);
1719− scsi_pointer->phase &= ~disconnected;
1716+ acp = aha152x_priv(CURRENT_SC);
1717+ acp->message = MSGI(0);
1718+ acp->phase &= ~disconnected;
17201719
17211720 MSGILEN=0;
17221721
@@ -1724,8 +1723,8 @@ static void msgi_run(struct Scsi_Host *shpnt) · 1 unmodified line
17241723 continue;
17251724 }
17261725
1727− scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
1728− scsi_pointer->Message = MSGI(0);
1726+ acp = aha152x_priv(CURRENT_SC);
1727+ acp->message = MSGI(0);
17291728
17301729 switch (MSGI(0)) {
17311730 case DISCONNECT:
@@ -1733,11 +1732,11 @@ static void msgi_run(struct Scsi_Host *shpnt) · 1 unmodified line
17331732 scmd_printk(KERN_WARNING, CURRENT_SC,
17341733 "target was not allowed to disconnect\n");
17351734
1736− scsi_pointer->phase |= disconnected;
1735+ acp->phase |= disconnected;
17371736 break;
17381737
17391738 case COMMAND_COMPLETE:
1740− scsi_pointer->phase |= completed;
1739+ acp->phase |= completed;
17411740 break;
17421741
17431742 case MESSAGE_REJECT:
@@ -1867,11 +1866,9 @@ static void msgi_end(struct Scsi_Host *shpnt) · 123 unmodified lines
18671866 */
18681867 static void msgo_init(struct Scsi_Host *shpnt)
18691868 {
1870− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
1871−
18721869 if(MSGOLEN==0) {
1873− if ((scsi_pointer->phase & syncneg) && SYNCNEG==2 &&
1874− SYNCRATE==0) {
1870+ if ((aha152x_priv(CURRENT_SC)->phase & syncneg) &&
1871+ SYNCNEG == 2 && SYNCRATE == 0) {
18751872 ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
18761873 } else {
18771874 scmd_printk(KERN_INFO, CURRENT_SC,
@@ -1888,7 +1885,7 @@ static void msgo_init(struct Scsi_Host *shpnt) · 10 unmodified lines
18881885 */
18891886 static void msgo_run(struct Scsi_Host *shpnt)
18901887 {
1891− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
1888+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
18921889
18931890 while(MSGO_I<MSGOLEN) {
18941891 if (TESTLO(SSTAT0, SPIORDY))
@@ -1901,13 +1898,13 @@ static void msgo_run(struct Scsi_Host *shpnt) · 6 unmodified lines
19011898
19021899
19031900 if (MSGO(MSGO_I) & IDENTIFY_BASE)
1904− scsi_pointer->phase |= identified;
1901+ acp->phase |= identified;
19051902
19061903 if (MSGO(MSGO_I)==ABORT)
1907− scsi_pointer->phase |= aborted;
1904+ acp->phase |= aborted;
19081905
19091906 if (MSGO(MSGO_I)==BUS_DEVICE_RESET)
1910− scsi_pointer->phase |= resetted;
1907+ acp->phase |= resetted;
19111908
19121909 SETPORT(SCSIDAT, MSGO(MSGO_I++));
19131910 }
@@ -1936,7 +1933,7 @@ static void msgo_end(struct Scsi_Host *shpnt) · 22 unmodified lines
19361933 */
19371934 static void cmd_init(struct Scsi_Host *shpnt)
19381935 {
1939− if (aha152x_scsi_pointer(CURRENT_SC)->sent_command) {
1936+ if (aha152x_priv(CURRENT_SC)->sent_command) {
19401937 scmd_printk(KERN_ERR, CURRENT_SC,
19411938 "command already sent\n");
19421939 done(shpnt, SAM_STAT_GOOD, DID_ERROR);
@@ -1967,7 +1964,7 @@ static void cmd_end(struct Scsi_Host *shpnt) · 24 unmodified lines
19671964 "command sent incompletely (%d/%d)\n",
19681965 CMD_I, CURRENT_SC->cmd_len);
19691966 else
1970− aha152x_scsi_pointer(CURRENT_SC)->sent_command++;
1967+ aha152x_priv(CURRENT_SC)->sent_command++;
19711968 }
19721969
19731970 /*
@@ -1979,7 +1976,7 @@ static void status_run(struct Scsi_Host *shpnt) · 5 unmodified lines
19791976 if (TESTLO(SSTAT0, SPIORDY))
19801977 return;
19811978
1982− aha152x_scsi_pointer(CURRENT_SC)->Status = GETPORT(SCSIDAT);
1979+ aha152x_priv(CURRENT_SC)->status = GETPORT(SCSIDAT);
19831980
19841981 }
19851982
@@ -2003,7 +2000,7 @@ static void datai_init(struct Scsi_Host *shpnt) · 17 unmodified lines
20032000
20042001 static void datai_run(struct Scsi_Host *shpnt)
20052002 {
2006− struct scsi_pointer *scsi_pointer;
2003+ struct aha152x_cmd_priv *acp;
20072004 unsigned long the_time;
20082005 int fifodata, data_count;
20092006
@@ -2041,36 +2038,35 @@ static void datai_run(struct Scsi_Host *shpnt) · 31 unmodified lines
20412038 fifodata = GETPORT(FIFOSTAT);
20422039 }
20432040
2044− scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
2045− if (scsi_pointer->this_residual > 0) {
2046− while (fifodata > 0 && scsi_pointer->this_residual > 0) {
2047− data_count = fifodata > scsi_pointer->this_residual ?
2048− scsi_pointer->this_residual :
2049− fifodata;
2041+ acp = aha152x_priv(CURRENT_SC);
2042+ if (acp->this_residual > 0) {
2043+ while (fifodata > 0 && acp->this_residual > 0) {
2044+ data_count = fifodata > acp->this_residual ?
2045+ acp->this_residual : fifodata;
20502046 fifodata -= data_count;
20512047
20522048 if (data_count & 1) {
20532049 SETPORT(DMACNTRL0, ENDMA|_8BIT);
2054− *scsi_pointer->ptr++ = GETPORT(DATAPORT);
2055− scsi_pointer->this_residual--;
2050+ *acp->ptr++ = GETPORT(DATAPORT);
2051+ acp->this_residual--;
20562052 DATA_LEN++;
20572053 SETPORT(DMACNTRL0, ENDMA);
20582054 }
20592055
20602056 if (data_count > 1) {
20612057 data_count >>= 1;
2062− insw(DATAPORT, scsi_pointer->ptr, data_count);
2063− scsi_pointer->ptr += 2 * data_count;
2064− scsi_pointer->this_residual -= 2 * data_count;
2058+ insw(DATAPORT, acp->ptr, data_count);
2059+ acp->ptr += 2 * data_count;
2060+ acp->this_residual -= 2 * data_count;
20652061 DATA_LEN += 2 * data_count;
20662062 }
20672063
2068− if (scsi_pointer->this_residual == 0 &&
2069− !sg_is_last(scsi_pointer->buffer)) {
2064+ if (acp->this_residual == 0 &&
2065+ !sg_is_last(acp->buffer)) {
20702066 /* advance to next buffer */
2071− scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
2072− scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer);
2073− scsi_pointer->this_residual = scsi_pointer->buffer->length;
2067+ acp->buffer = sg_next(acp->buffer);
2068+ acp->ptr = SG_ADDRESS(acp->buffer);
2069+ acp->this_residual = acp->buffer->length;
20742070 }
20752071 }
20762072 } else if (fifodata > 0) {
@@ -2138,15 +2134,15 @@ static void datao_init(struct Scsi_Host *shpnt) · 61 unmodified lines
21382134
21392135 static void datao_run(struct Scsi_Host *shpnt)
21402136 {
2141− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
2137+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
21422138 unsigned long the_time;
21432139 int data_count;
21442140
21452141 /* until phase changes or all data sent */
2146− while (TESTLO(DMASTAT, INTSTAT) && scsi_pointer->this_residual > 0) {
2142+ while (TESTLO(DMASTAT, INTSTAT) && acp->this_residual > 0) {
21472143 data_count = 128;
2148− if (data_count > scsi_pointer->this_residual)
2149− data_count = scsi_pointer->this_residual;
2144+ if (data_count > acp->this_residual)
2145+ data_count = acp->this_residual;
21502146
21512147 if(TESTLO(DMASTAT, DFIFOEMP)) {
21522148 scmd_printk(KERN_ERR, CURRENT_SC,
@@ -2157,26 +2153,25 @@ static void datao_run(struct Scsi_Host *shpnt) · 4 unmodified lines
21572153
21582154 if(data_count & 1) {
21592155 SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT);
2160− SETPORT(DATAPORT, *scsi_pointer->ptr++);
2161− scsi_pointer->this_residual--;
2156+ SETPORT(DATAPORT, *acp->ptr++);
2157+ acp->this_residual--;
21622158 CMD_INC_RESID(CURRENT_SC, -1);
21632159 SETPORT(DMACNTRL0,WRITE_READ|ENDMA);
21642160 }
21652161
21662162 if(data_count > 1) {
21672163 data_count >>= 1;
2168− outsw(DATAPORT, scsi_pointer->ptr, data_count);
2169− scsi_pointer->ptr += 2 * data_count;
2170− scsi_pointer->this_residual -= 2 * data_count;
2164+ outsw(DATAPORT, acp->ptr, data_count);
2165+ acp->ptr += 2 * data_count;
2166+ acp->this_residual -= 2 * data_count;
21712167 CMD_INC_RESID(CURRENT_SC, -2 * data_count);
21722168 }
21732169
2174− if (scsi_pointer->this_residual == 0 &&
2175− !sg_is_last(scsi_pointer->buffer)) {
2170+ if (acp->this_residual == 0 && !sg_is_last(acp->buffer)) {
21762171 /* advance to next buffer */
2177− scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
2178− scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer);
2179− scsi_pointer->this_residual = scsi_pointer->buffer->length;
2172+ acp->buffer = sg_next(acp->buffer);
2173+ acp->ptr = SG_ADDRESS(acp->buffer);
2174+ acp->this_residual = acp->buffer->length;
21802175 }
21812176
21822177 the_time=jiffies + 100*HZ;
@@ -2192,7 +2187,7 @@ static void datao_run(struct Scsi_Host *shpnt) · 9 unmodified lines
21922187
21932188 static void datao_end(struct Scsi_Host *shpnt)
21942189 {
2195− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
2190+ struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC);
21962191
21972192 if(TESTLO(DMASTAT, DFIFOEMP)) {
21982193 u32 datao_cnt = GETSTCNT();
@@ -2211,10 +2206,9 @@ static void datao_end(struct Scsi_Host *shpnt) · 12 unmodified lines
22112206 sg = sg_next(sg);
22122207 }
22132208
2214− scsi_pointer->buffer = sg;
2215− scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer) + done;
2216− scsi_pointer->this_residual = scsi_pointer->buffer->length -
2217− done;
2209+ acp->buffer = sg;
2210+ acp->ptr = SG_ADDRESS(acp->buffer) + done;
2211+ acp->this_residual = acp->buffer->length - done;
22182212 }
22192213
22202214 SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT);
@@ -2229,7 +2223,6 @@ static void datao_end(struct Scsi_Host *shpnt) · 8 unmodified lines
22292223 */
22302224 static int update_state(struct Scsi_Host *shpnt)
22312225 {
2232− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
22332226 int dataphase=0;
22342227 unsigned int stat0 = GETPORT(SSTAT0);
22352228 unsigned int stat1 = GETPORT(SSTAT1);
@@ -2244,7 +2237,7 @@ static int update_state(struct Scsi_Host *shpnt) · 8 unmodified lines
22442237 } else if (stat0 & SELDI && PREVSTATE == busfree) {
22452238 STATE=seldi;
22462239 } else if (stat0 & SELDO && CURRENT_SC &&
2247− (scsi_pointer->phase & selecting)) {
2240+ (aha152x_priv(CURRENT_SC)->phase & selecting)) {
22482241 STATE=seldo;
22492242 } else if(stat1 & SELTO) {
22502243 STATE=selto;
@@ -2376,8 +2369,7 @@ static void is_complete(struct Scsi_Host *shpnt) · 125 unmodified lines
23762369 SETPORT(SXFRCTL0, CH1);
23772370 SETPORT(DMACNTRL0, 0);
23782371 if(CURRENT_SC)
2379− aha152x_scsi_pointer(CURRENT_SC)->phase &=
2380− ~spiordy;
2372+ aha152x_priv(CURRENT_SC)->phase &= ~spiordy;
23812373 }
23822374
23832375 /*
@@ -2399,8 +2391,7 @@ static void is_complete(struct Scsi_Host *shpnt) · 15 unmodified lines
23992391 SETPORT(DMACNTRL0, 0);
24002392 SETPORT(SXFRCTL0, CH1|SPIOEN);
24012393 if(CURRENT_SC)
2402− aha152x_scsi_pointer(CURRENT_SC)->phase |=
2403− spiordy;
2394+ aha152x_priv(CURRENT_SC)->phase |= spiordy;
24042395 }
24052396
24062397 /*
@@ -2490,7 +2481,7 @@ static void disp_enintr(struct Scsi_Host *shpnt) · 83 unmodified lines
24902481 */
24912482 static void show_command(struct scsi_cmnd *ptr)
24922483 {
2493− const int phase = aha152x_scsi_pointer(ptr)->phase;
2484+ const int phase = aha152x_priv(ptr)->phase;
24942485
24952486 scsi_print_command(ptr);
24962487 scmd_printk(KERN_DEBUG, ptr,
@@ -2538,8 +2529,8 @@ static void show_queues(struct Scsi_Host *shpnt) · 41 unmodified lines
25382529
25392530 static void get_command(struct seq_file *m, struct scsi_cmnd * ptr)
25402531 {
2541− struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(ptr);
2542− const int phase = scsi_pointer->phase;
2532+ struct aha152x_cmd_priv *acp = aha152x_priv(ptr);
2533+ const int phase = acp->phase;
25432534 int i;
25442535
25452536 seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",
@@ -2549,8 +2540,8 @@ static void get_command(struct seq_file *m, struct scsi_cmnd * ptr) · 3 unmodified lines
25492540 seq_printf(m, "0x%02x ", ptr->cmnd[i]);
25502541
25512542 seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |",
2552− scsi_get_resid(ptr), scsi_pointer->this_residual,
2553− sg_nents(scsi_pointer->buffer) - 1);
2543+ scsi_get_resid(ptr), acp->this_residual,
2544+ sg_nents(acp->buffer) - 1);
25542545
25552546 if (phase & not_issued)
25562547 seq_puts(m, "not issued|");
drivers/scsi/aic7xxx/aic79xx_osm.h+0−2
@@ -420,8 +420,6 @@ ahd_unlock(struct ahd_softc *ahd, unsigned long *flags) · 419 unmodified lines
420420
421421 /* config registers for header type 0 devices */
422422 #define PCIR_MAPS 0x10
423−#define PCIR_SUBVEND_0 0x2c
424−#define PCIR_SUBDEV_0 0x2e
425423
426424 /****************************** PCI-X definitions *****************************/
427425 #define PCIXR_COMMAND 0x96
drivers/scsi/aic7xxx/aic79xx_pci.c+3−3
@@ -260,8 +260,8 @@ ahd_find_pci_device(ahd_dev_softc_t pci) · 259 unmodified lines
260260
261261 vendor = ahd_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2);
262262 device = ahd_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2);
263− subvendor = ahd_pci_read_config(pci, PCIR_SUBVEND_0, /*bytes*/2);
264− subdevice = ahd_pci_read_config(pci, PCIR_SUBDEV_0, /*bytes*/2);
263+ subvendor = ahd_pci_read_config(pci, PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2);
264+ subdevice = ahd_pci_read_config(pci, PCI_SUBSYSTEM_ID, /*bytes*/2);
265265 full_id = ahd_compose_id(device,
266266 vendor,
267267 subdevice,
@@ -298,7 +298,7 @@ ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) · 30 unmodified lines
298298 * Record if this is an HP board.
299299 */
300300 subvendor = ahd_pci_read_config(ahd->dev_softc,
301− PCIR_SUBVEND_0, /*bytes*/2);
301+ PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2);
302302 if (subvendor == SUBID_HP)
303303 ahd->flags |= AHD_HP_BOARD;
304304
drivers/scsi/aic7xxx/aic7xxx_osm.h+0−2
@@ -433,8 +433,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags) · 432 unmodified lines
433433
434434 /* config registers for header type 0 devices */
435435 #define PCIR_MAPS 0x10
436−#define PCIR_SUBVEND_0 0x2c
437−#define PCIR_SUBDEV_0 0x2e
438436
439437 typedef enum
440438 {
drivers/scsi/aic7xxx/aic7xxx_pci.c+2−2
@@ -673,8 +673,8 @@ ahc_find_pci_device(ahc_dev_softc_t pci) · 672 unmodified lines
673673
674674 vendor = ahc_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2);
675675 device = ahc_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2);
676− subvendor = ahc_pci_read_config(pci, PCIR_SUBVEND_0, /*bytes*/2);
677− subdevice = ahc_pci_read_config(pci, PCIR_SUBDEV_0, /*bytes*/2);
676+ subvendor = ahc_pci_read_config(pci, PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2);
677+ subdevice = ahc_pci_read_config(pci, PCI_SUBSYSTEM_ID, /*bytes*/2);
678678 full_id = ahc_compose_id(device, vendor, subdevice, subvendor);
679679
680680 /*
drivers/scsi/bnx2fc/bnx2fc_hwi.c+3−3
@@ -1169,7 +1169,7 @@ static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba, · 1168 unmodified lines
11691169 ofld_kcqe->fcoe_conn_context_id);
11701170 interface = tgt->port->priv;
11711171 if (hba != interface->hba) {
1172− printk(KERN_ERR PFX "ERROR:ofld_cmpl: HBA mis-match\n");
1172+ printk(KERN_ERR PFX "ERROR:ofld_cmpl: HBA mismatch\n");
11731173 goto ofld_cmpl_err;
11741174 }
11751175 /*
@@ -1226,12 +1226,12 @@ static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba, · 50 unmodified lines
12261226 * and enable
12271227 */
12281228 if (tgt->context_id != context_id) {
1229− printk(KERN_ERR PFX "context id mis-match\n");
1229+ printk(KERN_ERR PFX "context id mismatch\n");
12301230 return;
12311231 }
12321232 interface = tgt->port->priv;
12331233 if (hba != interface->hba) {
1234− printk(KERN_ERR PFX "bnx2fc-enbl_cmpl: HBA mis-match\n");
1234+ printk(KERN_ERR PFX "bnx2fc-enbl_cmpl: HBA mismatch\n");
12351235 goto enbl_cmpl_err;
12361236 }
12371237 if (!ofld_kcqe->completion_status)
drivers/scsi/bnx2i/bnx2i_hwi.c+2−2
@@ -2398,7 +2398,7 @@ static void bnx2i_process_conn_destroy_cmpl(struct bnx2i_hba *hba, · 2397 unmodified lines
23982398 }
23992399
24002400 if (hba != ep->hba) {
2401− printk(KERN_ALERT "conn destroy- error hba mis-match\n");
2401+ printk(KERN_ALERT "conn destroy- error hba mismatch\n");
24022402 return;
24032403 }
24042404
@@ -2432,7 +2432,7 @@ static void bnx2i_process_ofld_cmpl(struct bnx2i_hba *hba, · 27 unmodified lines
24322432 }
24332433
24342434 if (hba != ep->hba) {
2435− printk(KERN_ALERT "ofld_cmpl: error hba mis-match\n");
2435+ printk(KERN_ALERT "ofld_cmpl: error hba mismatch\n");
24362436 return;
24372437 }
24382438
drivers/scsi/hisi_sas/hisi_sas_main.c+0−1
@@ -442,7 +442,6 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba, · 441 unmodified lines
442442 case SAS_PROTOCOL_INTERNAL_ABORT:
443443 hisi_sas_task_prep_abort(hisi_hba, slot);
444444 break;
445− fallthrough;
446445 default:
447446 return;
448447 }
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c+1−1
@@ -36,7 +36,7 @@ · 35 unmodified lines
3636
3737 #define IBMVSCSIS_VERSION "v0.2"
3838
39−#define INITIAL_SRP_LIMIT 800
39+#define INITIAL_SRP_LIMIT 1024
4040 #define DEFAULT_MAX_SECTORS 256
4141 #define MAX_TXU 1024 * 1024
4242
drivers/scsi/isci/host.c+3−3
@@ -413,7 +413,7 @@ static void sci_controller_event_completion(struct isci_host *ihost, u32 ent) · 412 unmodified lines
413413 dev_warn(&ihost->pdev->dev,
414414 "%s: SCIC Controller 0x%p received "
415415 "event 0x%x for io request object "
416− "that doesnt exist.\n",
416+ "that doesn't exist.\n",
417417 __func__,
418418 ihost,
419419 ent);
@@ -428,7 +428,7 @@ static void sci_controller_event_completion(struct isci_host *ihost, u32 ent) · 8 unmodified lines
428428 dev_warn(&ihost->pdev->dev,
429429 "%s: SCIC Controller 0x%p received "
430430 "event 0x%x for remote device object "
431− "that doesnt exist.\n",
431+ "that doesn't exist.\n",
432432 __func__,
433433 ihost,
434434 ent);
@@ -462,7 +462,7 @@ static void sci_controller_event_completion(struct isci_host *ihost, u32 ent) · 27 unmodified lines
462462 } else
463463 dev_err(&ihost->pdev->dev,
464464 "%s: SCIC Controller 0x%p received event 0x%x "
465− "for remote device object 0x%0x that doesnt "
465+ "for remote device object 0x%0x that doesn't "
466466 "exist.\n",
467467 __func__,
468468 ihost,
drivers/scsi/libiscsi.c+0−1
@@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, · 3044 unmodified lines
30453045 if (!cls_conn)
30463046 return NULL;
30473047 conn = cls_conn->dd_data;
3048− memset(conn, 0, sizeof(*conn) + dd_size);
30493048
30503049 conn->dd_data = cls_conn->dd_data + sizeof(*conn);
30513050 conn->session = session;
drivers/scsi/lpfc/lpfc.h+5−2
@@ -897,6 +897,11 @@ enum lpfc_irq_chann_mode { · 896 unmodified lines
897897 NHT_MODE,
898898 };
899899
900+enum lpfc_hba_bit_flags {
901+ FABRIC_COMANDS_BLOCKED,
902+ HBA_PCI_ERR,
903+};
904+
900905 struct lpfc_hba {
901906 /* SCSI interface function jump table entries */
902907 struct lpfc_io_buf * (*lpfc_get_scsi_buf)
@@ -1043,7 +1048,6 @@ struct lpfc_hba { · 140 unmodified lines
10431048 * Firmware supports Forced Link Speed
10441049 * capability
10451050 */
1046−#define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */
10471051 #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */
10481052 #define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */
10491053 #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */
@@ -1350,7 +1354,6 @@ struct lpfc_hba { · 300 unmodified lines
13501354 atomic_t fabric_iocb_count;
13511355 struct timer_list fabric_block_timer;
13521356 unsigned long bit_flags;
1353−#define FABRIC_COMANDS_BLOCKED 0
13541357 atomic_t num_rsrc_err;
13551358 atomic_t num_cmd_success;
13561359 unsigned long last_rsrc_error_time;
drivers/scsi/lpfc/lpfc_crtn.h+3−0
@@ -670,3 +670,6 @@ struct lpfc_vmid *lpfc_get_vmid_from_hashtable(struct lpfc_vport *vport, · 669 unmodified lines
670670 uint32_t hash, uint8_t *buf);
671671 void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport);
672672 int lpfc_issue_els_qfpa(struct lpfc_vport *vport);
673+
674+void lpfc_sli_rpi_release(struct lpfc_vport *vport,
675+ struct lpfc_nodelist *ndlp);
drivers/scsi/lpfc/lpfc_hbadisc.c+97−23
@@ -109,8 +109,8 @@ lpfc_rport_invalid(struct fc_rport *rport) · 108 unmodified lines
109109
110110 ndlp = rdata->pnode;
111111 if (!rdata->pnode) {
112− pr_err("**** %s: NULL ndlp on rport x%px SID x%x\n",
113− __func__, rport, rport->scsi_target_id);
112+ pr_info("**** %s: NULL ndlp on rport x%px SID x%x\n",
113+ __func__, rport, rport->scsi_target_id);
114114 return -EINVAL;
115115 }
116116
@@ -169,9 +169,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 52 unmodified lines
169169
170170 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
171171 "3181 dev_loss_callbk x%06x, rport x%px flg x%x "
172− "load_flag x%x refcnt %d\n",
172+ "load_flag x%x refcnt %d state %d xpt x%x\n",
173173 ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag,
174− vport->load_flag, kref_read(&ndlp->kref));
174+ vport->load_flag, kref_read(&ndlp->kref),
175+ ndlp->nlp_state, ndlp->fc4_xpt_flags);
175176
176177 /* Don't schedule a worker thread event if the vport is going down.
177178 * The teardown process cleans up the node via lpfc_drop_node.
@@ -181,6 +182,11 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 3 unmodified lines
181182 ndlp->rport = NULL;
182183
183184 ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD;
185+ /* clear the NLP_XPT_REGD if the node is not registered
186+ * with nvme-fc
187+ */
188+ if (ndlp->fc4_xpt_flags == NLP_XPT_REGD)
189+ ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD;
184190
185191 /* Remove the node reference from remote_port_add now.
186192 * The driver will not call remote_port_delete.
@@ -225,18 +231,36 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 38 unmodified lines
225231 ndlp->rport = NULL;
226232 spin_unlock_irqrestore(&ndlp->lock, iflags);
227233
228− /* We need to hold the node by incrementing the reference
229− * count until this queued work is done
230− */
231− evtp->evt_arg1 = lpfc_nlp_get(ndlp);
234+ if (phba->worker_thread) {
235+ /* We need to hold the node by incrementing the reference
236+ * count until this queued work is done
237+ */
238+ evtp->evt_arg1 = lpfc_nlp_get(ndlp);
239+
240+ spin_lock_irqsave(&phba->hbalock, iflags);
241+ if (evtp->evt_arg1) {
242+ evtp->evt = LPFC_EVT_DEV_LOSS;
243+ list_add_tail(&evtp->evt_listp, &phba->work_list);
244+ lpfc_worker_wake_up(phba);
245+ }
246+ spin_unlock_irqrestore(&phba->hbalock, iflags);
247+ } else {
248+ lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
249+ "3188 worker thread is stopped %s x%06x, "
250+ " rport x%px flg x%x load_flag x%x refcnt "
251+ "%d\n", __func__, ndlp->nlp_DID,
252+ ndlp->rport, ndlp->nlp_flag,
253+ vport->load_flag, kref_read(&ndlp->kref));
254+ if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) {
255+ spin_lock_irqsave(&ndlp->lock, iflags);
256+ /* Node is in dev loss. No further transaction. */
257+ ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
258+ spin_unlock_irqrestore(&ndlp->lock, iflags);
259+ lpfc_disc_state_machine(vport, ndlp, NULL,
260+ NLP_EVT_DEVICE_RM);
261+ }
232262
233− spin_lock_irqsave(&phba->hbalock, iflags);
234− if (evtp->evt_arg1) {
235− evtp->evt = LPFC_EVT_DEV_LOSS;
236− list_add_tail(&evtp->evt_listp, &phba->work_list);
237− lpfc_worker_wake_up(phba);
238263 }
239− spin_unlock_irqrestore(&phba->hbalock, iflags);
240264
241265 return;
242266 }
@@ -503,11 +527,12 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) · 260 unmodified lines
503527 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
504528 "0203 Devloss timeout on "
505529 "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
506− "NPort x%06x Data: x%x x%x x%x\n",
530+ "NPort x%06x Data: x%x x%x x%x refcnt %d\n",
507531 *name, *(name+1), *(name+2), *(name+3),
508532 *(name+4), *(name+5), *(name+6), *(name+7),
509533 ndlp->nlp_DID, ndlp->nlp_flag,
510− ndlp->nlp_state, ndlp->nlp_rpi);
534+ ndlp->nlp_state, ndlp->nlp_rpi,
535+ kref_read(&ndlp->kref));
511536 } else {
512537 lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT,
513538 "0204 Devloss timeout on "
@@ -755,18 +780,22 @@ lpfc_work_list_done(struct lpfc_hba *phba) · 241 unmodified lines
755780 int free_evt;
756781 int fcf_inuse;
757782 uint32_t nlp_did;
783+ bool hba_pci_err;
758784
759785 spin_lock_irq(&phba->hbalock);
760786 while (!list_empty(&phba->work_list)) {
761787 list_remove_head((&phba->work_list), evtp, typeof(*evtp),
762788 evt_listp);
763789 spin_unlock_irq(&phba->hbalock);
790+ hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags);
764791 free_evt = 1;
765792 switch (evtp->evt) {
766793 case LPFC_EVT_ELS_RETRY:
767794 ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1);
768− lpfc_els_retry_delay_handler(ndlp);
769− free_evt = 0; /* evt is part of ndlp */
795+ if (!hba_pci_err) {
796+ lpfc_els_retry_delay_handler(ndlp);
797+ free_evt = 0; /* evt is part of ndlp */
798+ }
770799 /* decrement the node reference count held
771800 * for this queued work
772801 */
@@ -788,8 +817,10 @@ lpfc_work_list_done(struct lpfc_hba *phba) · 15 unmodified lines
788817 break;
789818 case LPFC_EVT_RECOVER_PORT:
790819 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
791− lpfc_sli_abts_recover_port(ndlp->vport, ndlp);
792− free_evt = 0;
820+ if (!hba_pci_err) {
821+ lpfc_sli_abts_recover_port(ndlp->vport, ndlp);
822+ free_evt = 0;
823+ }
793824 /* decrement the node reference count held for
794825 * this queued work
795826 */
@@ -859,14 +890,18 @@ lpfc_work_done(struct lpfc_hba *phba) · 63 unmodified lines
859890 struct lpfc_vport **vports;
860891 struct lpfc_vport *vport;
861892 int i;
893+ bool hba_pci_err;
862894
895+ hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags);
863896 spin_lock_irq(&phba->hbalock);
864897 ha_copy = phba->work_ha;
865898 phba->work_ha = 0;
866899 spin_unlock_irq(&phba->hbalock);
900+ if (hba_pci_err)
901+ ha_copy = 0;
867902
868903 /* First, try to post the next mailbox command to SLI4 device */
869− if (phba->pci_dev_grp == LPFC_PCI_DEV_OC)
904+ if (phba->pci_dev_grp == LPFC_PCI_DEV_OC && !hba_pci_err)
870905 lpfc_sli4_post_async_mbox(phba);
871906
872907 if (ha_copy & HA_ERATT) {
@@ -886,7 +921,7 @@ lpfc_work_done(struct lpfc_hba *phba) · 13 unmodified lines
886921 lpfc_handle_latt(phba);
887922
888923 /* Handle VMID Events */
889− if (lpfc_is_vmid_enabled(phba)) {
924+ if (lpfc_is_vmid_enabled(phba) && !hba_pci_err) {
890925 if (phba->pport->work_port_events &
891926 WORKER_CHECK_VMID_ISSUE_QFPA) {
892927 lpfc_check_vmid_qfpa_issue(phba);
@@ -936,6 +971,8 @@ lpfc_work_done(struct lpfc_hba *phba) · 43 unmodified lines
936971 work_port_events = vport->work_port_events;
937972 vport->work_port_events &= ~work_port_events;
938973 spin_unlock_irq(&vport->work_port_lock);
974+ if (hba_pci_err)
975+ continue;
939976 if (work_port_events & WORKER_DISC_TMO)
940977 lpfc_disc_timeout_handler(vport);
941978 if (work_port_events & WORKER_ELS_TMO)
@@ -1173,12 +1210,14 @@ lpfc_linkdown(struct lpfc_hba *phba) · 231 unmodified lines
11731210 struct lpfc_vport **vports;
11741211 LPFC_MBOXQ_t *mb;
11751212 int i;
1213+ int offline;
11761214
11771215 if (phba->link_state == LPFC_LINK_DOWN)
11781216 return 0;
11791217
11801218 /* Block all SCSI stack I/Os */
11811219 lpfc_scsi_dev_block(phba);
1220+ offline = pci_channel_offline(phba->pcidev);
11821221
11831222 phba->defer_flogi_acc_flag = false;
11841223
@@ -1219,7 +1258,7 @@ lpfc_linkdown(struct lpfc_hba *phba) · 34 unmodified lines
12191258 lpfc_destroy_vport_work_array(phba, vports);
12201259
12211260 /* Clean up any SLI3 firmware default rpi's */
1222− if (phba->sli_rev > LPFC_SLI_REV3)
1261+ if (phba->sli_rev > LPFC_SLI_REV3 || offline)
12231262 goto skip_unreg_did;
12241263
12251264 mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
@@ -4712,6 +4751,11 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 3486 unmodified lines
47124751 spin_lock_irqsave(&ndlp->lock, iflags);
47134752 if (!(ndlp->fc4_xpt_flags & NLP_XPT_REGD)) {
47144753 spin_unlock_irqrestore(&ndlp->lock, iflags);
4754+ lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
4755+ "0999 %s Not regd: ndlp x%px rport x%px DID "
4756+ "x%x FLG x%x XPT x%x\n",
4757+ __func__, ndlp, ndlp->rport, ndlp->nlp_DID,
4758+ ndlp->nlp_flag, ndlp->fc4_xpt_flags);
47154759 return;
47164760 }
47174761
@@ -4722,6 +4766,13 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 4 unmodified lines
47224766 ndlp->fc4_xpt_flags & SCSI_XPT_REGD) {
47234767 vport->phba->nport_event_cnt++;
47244768 lpfc_unregister_remote_port(ndlp);
4769+ } else if (!ndlp->rport) {
4770+ lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
4771+ "1999 %s NDLP in devloss x%px DID x%x FLG x%x"
4772+ " XPT x%x refcnt %d\n",
4773+ __func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag,
4774+ ndlp->fc4_xpt_flags,
4775+ kref_read(&ndlp->kref));
47254776 }
47264777
47274778 if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) {
@@ -5371,6 +5422,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 643 unmodified lines
53715422 ndlp->nlp_flag &= ~NLP_UNREG_INP;
53725423 mempool_free(mbox, phba->mbox_mem_pool);
53735424 acc_plogi = 1;
5425+ lpfc_nlp_put(ndlp);
53745426 }
53755427 } else {
53765428 lpfc_printf_vlog(vport, KERN_INFO,
@@ -6097,12 +6149,34 @@ lpfc_disc_flush_list(struct lpfc_vport *vport) · 720 unmodified lines
60976149 }
60986150 }
60996151
6152+/*
6153+ * lpfc_notify_xport_npr - notifies xport of node disappearance
6154+ * @vport: Pointer to Virtual Port object.
6155+ *
6156+ * Transitions all ndlps to NPR state. When lpfc_nlp_set_state
6157+ * calls lpfc_nlp_state_cleanup, the ndlp->rport is unregistered
6158+ * and transport notified that the node is gone.
6159+ * Return Code:
6160+ * none
6161+ */
6162+static void
6163+lpfc_notify_xport_npr(struct lpfc_vport *vport)
6164+{
6165+ struct lpfc_nodelist *ndlp, *next_ndlp;
6166+
6167+ list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes,
6168+ nlp_listp) {
6169+ lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
6170+ }
6171+}
61006172 void
61016173 lpfc_cleanup_discovery_resources(struct lpfc_vport *vport)
61026174 {
61036175 lpfc_els_flush_rscn(vport);
61046176 lpfc_els_flush_cmd(vport);
61056177 lpfc_disc_flush_list(vport);
6178+ if (pci_channel_offline(vport->phba->pcidev))
6179+ lpfc_notify_xport_npr(vport);
61066180 }
61076181
61086182 /*****************************************************************************/
drivers/scsi/lpfc/lpfc_init.c+63−25
@@ -95,6 +95,7 @@ static void lpfc_sli4_oas_verify(struct lpfc_hba *phba); · 94 unmodified lines
9595 static uint16_t lpfc_find_cpu_handle(struct lpfc_hba *, uint16_t, int);
9696 static void lpfc_setup_bg(struct lpfc_hba *, struct Scsi_Host *);
9797 static int lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *);
98+static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba);
9899
99100 static struct scsi_transport_template *lpfc_transport_template = NULL;
100101 static struct scsi_transport_template *lpfc_vport_transport_template = NULL;
@@ -1642,7 +1643,7 @@ lpfc_sli4_offline_eratt(struct lpfc_hba *phba) · 1541 unmodified lines
16421643 {
16431644 spin_lock_irq(&phba->hbalock);
16441645 if (phba->link_state == LPFC_HBA_ERROR &&
1645− phba->hba_flag & HBA_PCI_ERR) {
1646+ test_bit(HBA_PCI_ERR, &phba->bit_flags)) {
16461647 spin_unlock_irq(&phba->hbalock);
16471648 return;
16481649 }
@@ -1985,6 +1986,7 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) · 336 unmodified lines
19851986 if (pci_channel_offline(phba->pcidev)) {
19861987 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
19871988 "3166 pci channel is offline\n");
1989+ lpfc_sli_flush_io_rings(phba);
19881990 return;
19891991 }
19901992
@@ -2973,6 +2975,22 @@ lpfc_cleanup(struct lpfc_vport *vport) · 982 unmodified lines
29732975 NLP_EVT_DEVICE_RM);
29742976 }
29752977
2978+ /* This is a special case flush to return all
2979+ * IOs before entering this loop. There are
2980+ * two points in the code where a flush is
2981+ * avoided if the FC_UNLOADING flag is set.
2982+ * one is in the multipool destroy,
2983+ * (this prevents a crash) and the other is
2984+ * in the nvme abort handler, ( also prevents
2985+ * a crash). Both of these exceptions are
2986+ * cases where the slot is still accessible.
2987+ * The flush here is only when the pci slot
2988+ * is offline.
2989+ */
2990+ if (vport->load_flag & FC_UNLOADING &&
2991+ pci_channel_offline(phba->pcidev))
2992+ lpfc_sli_flush_io_rings(vport->phba);
2993+
29762994 /* At this point, ALL ndlp's should be gone
29772995 * because of the previous NLP_EVT_DEVICE_RM.
29782996 * Lets wait for this to happen, if needed.
@@ -2985,7 +3003,7 @@ lpfc_cleanup(struct lpfc_vport *vport) · 6 unmodified lines
29853003 list_for_each_entry_safe(ndlp, next_ndlp,
29863004 &vport->fc_nodes, nlp_listp) {
29873005 lpfc_printf_vlog(ndlp->vport, KERN_ERR,
2988− LOG_TRACE_EVENT,
3006+ LOG_DISCOVERY,
29893007 "0282 did:x%x ndlp:x%px "
29903008 "refcnt:%d xflags x%x nflag x%x\n",
29913009 ndlp->nlp_DID, (void *)ndlp,
@@ -3682,7 +3700,8 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) · 690 unmodified lines
36823700 struct lpfc_vport **vports;
36833701 struct Scsi_Host *shost;
36843702 int i;
3685− int offline = 0;
3703+ int offline;
3704+ bool hba_pci_err;
36863705
36873706 if (vport->fc_flag & FC_OFFLINE_MODE)
36883707 return;
@@ -3692,6 +3711,7 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) · 3 unmodified lines
36923711 lpfc_linkdown(phba);
36933712
36943713 offline = pci_channel_offline(phba->pcidev);
3714+ hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags);
36953715
36963716 /* Issue an unreg_login to all nodes on all vports */
36973717 vports = lpfc_create_vport_work_array(phba);
@@ -3715,11 +3735,14 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) · 17 unmodified lines
37153735 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
37163736 spin_unlock_irq(&ndlp->lock);
37173737
3718− if (offline) {
3738+ if (offline || hba_pci_err) {
37193739 spin_lock_irq(&ndlp->lock);
37203740 ndlp->nlp_flag &= ~(NLP_UNREG_INP |
37213741 NLP_RPI_REGISTERED);
37223742 spin_unlock_irq(&ndlp->lock);
3743+ if (phba->sli_rev == LPFC_SLI_REV4)
3744+ lpfc_sli_rpi_release(vports[i],
3745+ ndlp);
37233746 } else {
37243747 lpfc_unreg_rpi(vports[i], ndlp);
37253748 }
@@ -13354,8 +13377,9 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 9628 unmodified lines
1335413377 /* Abort all iocbs associated with the hba */
1335513378 lpfc_sli_hba_iocb_abort(phba);
1335613379
13357− /* Wait for completion of device XRI exchange busy */
13358− lpfc_sli4_xri_exchange_busy_wait(phba);
13380+ if (!pci_channel_offline(phba->pcidev))
13381+ /* Wait for completion of device XRI exchange busy */
13382+ lpfc_sli4_xri_exchange_busy_wait(phba);
1335913383
1336013384 /* per-phba callback de-registration for hotplug event */
1336113385 if (phba->pport)
@@ -13374,15 +13398,12 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 12 unmodified lines
1337413398 /* Disable FW logging to host memory */
1337513399 lpfc_ras_stop_fwlog(phba);
1337613400
13377− /* Unset the queues shared with the hardware then release all
13378− * allocated resources.
13379− */
13380− lpfc_sli4_queue_unset(phba);
13381− lpfc_sli4_queue_destroy(phba);
13382−
1338313401 /* Reset SLI4 HBA FCoE function */
1338413402 lpfc_pci_function_reset(phba);
1338513403
13404+ /* release all queue allocated resources. */
13405+ lpfc_sli4_queue_destroy(phba);
13406+
1338613407 /* Free RAS DMA memory */
1338713408 if (phba->ras_fwlog.ras_enabled)
1338813409 lpfc_sli4_ras_dma_free(phba);
@@ -14262,6 +14283,7 @@ lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) · 873 unmodified lines
1426214283 "2711 PCI channel permanent disable for failure\n");
1426314284 /* Block all SCSI devices' I/Os on the host */
1426414285 lpfc_scsi_dev_block(phba);
14286+ lpfc_sli4_prep_dev_for_reset(phba);
1426514287
1426614288 /* stop all timers */
1426714289 lpfc_stop_hba_timers(phba);
@@ -15057,24 +15079,28 @@ lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) · 789 unmodified lines
1505715079 static void
1505815080 lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba)
1505915081 {
15060− lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
15061− "2826 PCI channel disable preparing for reset\n");
15082+ int offline = pci_channel_offline(phba->pcidev);
15083+
15084+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
15085+ "2826 PCI channel disable preparing for reset offline"
15086+ " %d\n", offline);
1506215087
1506315088 /* Block any management I/Os to the device */
1506415089 lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT);
1506515090
15066− /* Block all SCSI devices' I/Os on the host */
15067− lpfc_scsi_dev_block(phba);
1506815091
15092+ /* HBA_PCI_ERR was set in io_error_detect */
15093+ lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT);
1506915094 /* Flush all driver's outstanding I/Os as we are to reset */
1507015095 lpfc_sli_flush_io_rings(phba);
15096+ lpfc_offline(phba);
1507115097
1507215098 /* stop all timers */
1507315099 lpfc_stop_hba_timers(phba);
1507415100
15101+ lpfc_sli4_queue_destroy(phba);
1507515102 /* Disable interrupt and pci device */
1507615103 lpfc_sli4_disable_intr(phba);
15077− lpfc_sli4_queue_destroy(phba);
1507815104 pci_disable_device(phba->pcidev);
1507915105 }
1508015106
@@ -15123,6 +15149,7 @@ lpfc_io_error_detected_s4(struct pci_dev *pdev, pci_channel_state_t state) · 42 unmodified lines
1512315149 {
1512415150 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1512515151 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
15152+ bool hba_pci_err;
1512615153
1512715154 switch (state) {
1512815155 case pci_channel_io_normal:
@@ -15130,17 +15157,24 @@ lpfc_io_error_detected_s4(struct pci_dev *pdev, pci_channel_state_t state) · 1 unmodified line
1513015157 lpfc_sli4_prep_dev_for_recover(phba);
1513115158 return PCI_ERS_RESULT_CAN_RECOVER;
1513215159 case pci_channel_io_frozen:
15133− phba->hba_flag |= HBA_PCI_ERR;
15160+ hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags);
1513415161 /* Fatal error, prepare for slot reset */
15135− lpfc_sli4_prep_dev_for_reset(phba);
15162+ if (!hba_pci_err)
15163+ lpfc_sli4_prep_dev_for_reset(phba);
15164+ else
15165+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
15166+ "2832 Already handling PCI error "
15167+ "state: x%x\n", state);
1513615168 return PCI_ERS_RESULT_NEED_RESET;
1513715169 case pci_channel_io_perm_failure:
15138− phba->hba_flag |= HBA_PCI_ERR;
15170+ set_bit(HBA_PCI_ERR, &phba->bit_flags);
1513915171 /* Permanent failure, prepare for device down */
1514015172 lpfc_sli4_prep_dev_for_perm_failure(phba);
1514115173 return PCI_ERS_RESULT_DISCONNECT;
1514215174 default:
15143− phba->hba_flag |= HBA_PCI_ERR;
15175+ hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags);
15176+ if (!hba_pci_err)
15177+ lpfc_sli4_prep_dev_for_reset(phba);
1514415178 /* Unknown state, prepare and request slot reset */
1514515179 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
1514615180 "2825 Unknown PCI error state: x%x\n", state);
@@ -15174,17 +15208,21 @@ lpfc_io_slot_reset_s4(struct pci_dev *pdev) · 27 unmodified lines
1517415208 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
1517515209 struct lpfc_sli *psli = &phba->sli;
1517615210 uint32_t intr_mode;
15211+ bool hba_pci_err;
1517715212
1517815213 dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n");
1517915214 if (pci_enable_device_mem(pdev)) {
1518015215 printk(KERN_ERR "lpfc: Cannot re-enable "
15181− "PCI device after reset.\n");
15216+ "PCI device after reset.\n");
1518215217 return PCI_ERS_RESULT_DISCONNECT;
1518315218 }
1518415219
1518515220 pci_restore_state(pdev);
1518615221
15187− phba->hba_flag &= ~HBA_PCI_ERR;
15222+ hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags);
15223+ if (!hba_pci_err)
15224+ dev_info(&pdev->dev,
15225+ "hba_pci_err was not set, recovering slot reset.\n");
1518815226 /*
1518915227 * As the new kernel behavior of pci_restore_state() API call clears
1519015228 * device saved_state flag, need to save the restored state again.
@@ -15198,6 +15236,8 @@ lpfc_io_slot_reset_s4(struct pci_dev *pdev) · 7 unmodified lines
1519815236 psli->sli_flag &= ~LPFC_SLI_ACTIVE;
1519915237 spin_unlock_irq(&phba->hbalock);
1520015238
15239+ /* Init cpu_map array */
15240+ lpfc_cpu_map_array_init(phba);
1520115241 /* Configure and enable interrupt */
1520215242 intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode);
1520315243 if (intr_mode == LPFC_INTR_ERROR) {
@@ -15239,8 +15279,6 @@ lpfc_io_resume_s4(struct pci_dev *pdev) · 35 unmodified lines
1523915279 */
1524015280 if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) {
1524115281 /* Perform device reset */
15242− lpfc_offline_prep(phba, LPFC_MBX_WAIT);
15243− lpfc_offline(phba);
1524415282 lpfc_sli_brdrestart(phba);
1524515283 /* Bring the device back online */
1524615284 lpfc_online(phba);
drivers/scsi/lpfc/lpfc_nvme.c+18−9
@@ -93,6 +93,11 @@ lpfc_nvme_create_queue(struct nvme_fc_local_port *pnvme_lport, · 92 unmodified lines
9393
9494 lport = (struct lpfc_nvme_lport *)pnvme_lport->private;
9595 vport = lport->vport;
96+
97+ if (!vport || vport->load_flag & FC_UNLOADING ||
98+ vport->phba->hba_flag & HBA_IOQ_FLUSH)
99+ return -ENODEV;
100+
96101 qhandle = kzalloc(sizeof(struct lpfc_nvme_qhandle), GFP_KERNEL);
97102 if (qhandle == NULL)
98103 return -ENOMEM;
@@ -267,7 +272,8 @@ lpfc_nvme_handle_lsreq(struct lpfc_hba *phba, · 168 unmodified lines
267272 return -EINVAL;
268273
269274 remoteport = lpfc_rport->remoteport;
270− if (!vport->localport)
275+ if (!vport->localport ||
276+ vport->phba->hba_flag & HBA_IOQ_FLUSH)
271277 return -EINVAL;
272278
273279 lport = vport->localport->private;
@@ -559,6 +565,8 @@ __lpfc_nvme_ls_req(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 285 unmodified lines
559565 ndlp->nlp_DID, ntype, nstate);
560566 return -ENODEV;
561567 }
568+ if (vport->phba->hba_flag & HBA_IOQ_FLUSH)
569+ return -ENODEV;
562570
563571 if (!vport->phba->sli4_hba.nvmels_wq)
564572 return -ENOMEM;
@@ -662,7 +670,8 @@ lpfc_nvme_ls_req(struct nvme_fc_local_port *pnvme_lport, · 97 unmodified lines
662670 return -EINVAL;
663671
664672 vport = lport->vport;
665− if (vport->load_flag & FC_UNLOADING)
673+ if (vport->load_flag & FC_UNLOADING ||
674+ vport->phba->hba_flag & HBA_IOQ_FLUSH)
666675 return -ENODEV;
667676
668677 atomic_inc(&lport->fc4NvmeLsRequests);
@@ -1516,7 +1525,8 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, · 847 unmodified lines
15161525
15171526 phba = vport->phba;
15181527
1519− if (unlikely(vport->load_flag & FC_UNLOADING)) {
1528+ if ((unlikely(vport->load_flag & FC_UNLOADING)) ||
1529+ phba->hba_flag & HBA_IOQ_FLUSH) {
15201530 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR,
15211531 "6124 Fail IO, Driver unload\n");
15221532 atomic_inc(&lport->xmt_fcp_err);
@@ -2169,8 +2179,7 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, · 646 unmodified lines
21692179 abts_nvme = 0;
21702180 for (i = 0; i < phba->cfg_hdw_queue; i++) {
21712181 qp = &phba->sli4_hba.hdwq[i];
2172− if (!vport || !vport->localport ||
2173− !qp || !qp->io_wq)
2182+ if (!vport->localport || !qp || !qp->io_wq)
21742183 return;
21752184
21762185 pring = qp->io_wq->pring;
@@ -2180,8 +2189,9 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, · 3 unmodified lines
21802189 abts_scsi += qp->abts_scsi_io_bufs;
21812190 abts_nvme += qp->abts_nvme_io_bufs;
21822191 }
2183− if (!vport || !vport->localport ||
2184− vport->phba->hba_flag & HBA_PCI_ERR)
2192+ if (!vport->localport ||
2193+ test_bit(HBA_PCI_ERR, &vport->phba->bit_flags) ||
2194+ vport->load_flag & FC_UNLOADING)
21852195 return;
21862196
21872197 lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
@@ -2541,8 +2551,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 353 unmodified lines
25412551 * return values is ignored. The upcall is a courtesy to the
25422552 * transport.
25432553 */
2544− if (vport->load_flag & FC_UNLOADING ||
2545− unlikely(vport->phba->hba_flag & HBA_PCI_ERR))
2554+ if (vport->load_flag & FC_UNLOADING)
25462555 (void)nvme_fc_set_remoteport_devloss(remoteport, 0);
25472556
25482557 ret = nvme_fc_unregister_remoteport(remoteport);
drivers/scsi/lpfc/lpfc_scsi.c+7−5
@@ -5929,13 +5929,15 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) · 5928 unmodified lines
59295929 }
59305930
59315931 lpfc_cmd->waitq = &waitq;
5932− if (phba->sli_rev == LPFC_SLI_REV4)
5932+ if (phba->sli_rev == LPFC_SLI_REV4) {
59335933 spin_unlock(&pring_s4->ring_lock);
5934− else
5934+ ret_val = lpfc_sli4_issue_abort_iotag(phba, iocb,
5935+ lpfc_sli_abort_fcp_cmpl);
5936+ } else {
59355937 pring = &phba->sli.sli3_ring[LPFC_FCP_RING];
5936−
5937− ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb,
5938− lpfc_sli_abort_fcp_cmpl);
5938+ ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb,
5939+ lpfc_sli_abort_fcp_cmpl);
5940+ }
59395941
59405942 /* Make sure HBA is alive */
59415943 lpfc_issue_hb_tmo(phba);
drivers/scsi/lpfc/lpfc_sli.c+53−22
@@ -2828,6 +2828,12 @@ __lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 2827 unmodified lines
28282828 ndlp->nlp_flag &= ~NLP_UNREG_INP;
28292829 }
28302830
2831+void
2832+lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2833+{
2834+ __lpfc_sli_rpi_release(vport, ndlp);
2835+}
2836+
28312837 /**
28322838 * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler
28332839 * @phba: Pointer to HBA context object.
@@ -3715,7 +3721,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, · 881 unmodified lines
37153721 unsigned long iflag;
37163722 u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag;
37173723
3724+ if (phba->sli_rev == LPFC_SLI_REV4)
3725+ spin_lock_irqsave(&pring->ring_lock, iflag);
3726+ else
3727+ spin_lock_irqsave(&phba->hbalock, iflag);
37183728 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq);
3729+ if (phba->sli_rev == LPFC_SLI_REV4)
3730+ spin_unlock_irqrestore(&pring->ring_lock, iflag);
3731+ else
3732+ spin_unlock_irqrestore(&phba->hbalock, iflag);
37193733
37203734 ulp_command = get_job_cmnd(phba, saveq);
37213735 ulp_status = get_job_ulpstatus(phba, saveq);
@@ -4052,10 +4066,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, · 330 unmodified lines
40524066 break;
40534067 }
40544068
4055− spin_unlock_irqrestore(&phba->hbalock, iflag);
40564069 cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
40574070 &rspiocbq);
4058− spin_lock_irqsave(&phba->hbalock, iflag);
40594071 if (unlikely(!cmdiocbq))
40604072 break;
40614073 if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED)
@@ -4536,42 +4548,62 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 474 unmodified lines
45364548 void
45374549 lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
45384550 {
4539− LIST_HEAD(completions);
4551+ LIST_HEAD(tx_completions);
4552+ LIST_HEAD(txcmplq_completions);
45404553 struct lpfc_iocbq *iocb, *next_iocb;
4554+ int offline;
45414555
45424556 if (pring->ringno == LPFC_ELS_RING) {
45434557 lpfc_fabric_abort_hba(phba);
45444558 }
4559+ offline = pci_channel_offline(phba->pcidev);
45454560
45464561 /* Error everything on txq and txcmplq
45474562 * First do the txq.
45484563 */
45494564 if (phba->sli_rev >= LPFC_SLI_REV4) {
45504565 spin_lock_irq(&pring->ring_lock);
4551− list_splice_init(&pring->txq, &completions);
4566+ list_splice_init(&pring->txq, &tx_completions);
45524567 pring->txq_cnt = 0;
4553− spin_unlock_irq(&pring->ring_lock);
45544568
4555− spin_lock_irq(&phba->hbalock);
4556− /* Next issue ABTS for everything on the txcmplq */
4557− list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
4558− lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL);
4559− spin_unlock_irq(&phba->hbalock);
4569+ if (offline) {
4570+ list_splice_init(&pring->txcmplq,
4571+ &txcmplq_completions);
4572+ } else {
4573+ /* Next issue ABTS for everything on the txcmplq */
4574+ list_for_each_entry_safe(iocb, next_iocb,
4575+ &pring->txcmplq, list)
4576+ lpfc_sli_issue_abort_iotag(phba, pring,
4577+ iocb, NULL);
4578+ }
4579+ spin_unlock_irq(&pring->ring_lock);
45604580 } else {
45614581 spin_lock_irq(&phba->hbalock);
4562− list_splice_init(&pring->txq, &completions);
4582+ list_splice_init(&pring->txq, &tx_completions);
45634583 pring->txq_cnt = 0;
45644584
4565− /* Next issue ABTS for everything on the txcmplq */
4566− list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
4567− lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL);
4585+ if (offline) {
4586+ list_splice_init(&pring->txcmplq, &txcmplq_completions);
4587+ } else {
4588+ /* Next issue ABTS for everything on the txcmplq */
4589+ list_for_each_entry_safe(iocb, next_iocb,
4590+ &pring->txcmplq, list)
4591+ lpfc_sli_issue_abort_iotag(phba, pring,
4592+ iocb, NULL);
4593+ }
45684594 spin_unlock_irq(&phba->hbalock);
45694595 }
4570− /* Make sure HBA is alive */
4571− lpfc_issue_hb_tmo(phba);
45724596
4597+ if (offline) {
4598+ /* Cancel all the IOCBs from the completions list */
4599+ lpfc_sli_cancel_iocbs(phba, &txcmplq_completions,
4600+ IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED);
4601+ } else {
4602+ /* Make sure HBA is alive */
4603+ lpfc_issue_hb_tmo(phba);
4604+ }
45734605 /* Cancel all the IOCBs from the completions list */
4574− lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
4606+ lpfc_sli_cancel_iocbs(phba, &tx_completions, IOSTAT_LOCAL_REJECT,
45754607 IOERR_SLI_ABORTED);
45764608 }
45774609
@@ -4624,11 +4656,6 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) · 46 unmodified lines
46244656 struct lpfc_iocbq *piocb, *next_iocb;
46254657
46264658 spin_lock_irq(&phba->hbalock);
4627− if (phba->hba_flag & HBA_IOQ_FLUSH ||
4628− !phba->sli4_hba.hdwq) {
4629− spin_unlock_irq(&phba->hbalock);
4630− return;
4631− }
46324659 /* Indicate the I/O queues are flushed */
46334660 phba->hba_flag |= HBA_IOQ_FLUSH;
46344661 spin_unlock_irq(&phba->hbalock);
@@ -10997,6 +11024,10 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, · 6362 unmodified lines
1099711024 unsigned long iflags;
1099811025 int rc;
1099911026
11027+ /* If the PCI channel is in offline state, do not post iocbs. */
11028+ if (unlikely(pci_channel_offline(phba->pcidev)))
11029+ return IOCB_ERROR;
11030+
1100011031 if (phba->sli_rev == LPFC_SLI_REV4) {
1100111032 lpfc_sli_prep_wqe(phba, piocb);
1100211033
drivers/scsi/lpfc/lpfc_version.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 * included with this package. *
2121 *******************************************************************/
2222
23−#define LPFC_DRIVER_VERSION "14.2.0.0"
23+#define LPFC_DRIVER_VERSION "14.2.0.1"
2424 #define LPFC_DRIVER_NAME "lpfc"
2525
2626 /* Used for SLI 2/3 */
drivers/scsi/megaraid/megaraid_sas.h+3−0
@@ -2560,6 +2560,9 @@ struct megasas_instance_template { · 2559 unmodified lines
25602560 #define MEGASAS_IS_LOGICAL(sdev) \
25612561 ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1)
25622562
2563+#define MEGASAS_IS_LUN_VALID(sdev) \
2564+ (((sdev)->lun == 0) ? 1 : 0)
2565+
25632566 #define MEGASAS_DEV_INDEX(scp) \
25642567 (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
25652568 scp->device->id)
drivers/scsi/megaraid/megaraid_sas_base.c+7−0
@@ -2126,6 +2126,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev) · 2125 unmodified lines
21262126 goto scan_target;
21272127 }
21282128 return -ENXIO;
2129+ } else if (!MEGASAS_IS_LUN_VALID(sdev)) {
2130+ sdev_printk(KERN_INFO, sdev, "%s: invalid LUN\n", __func__);
2131+ return -ENXIO;
21292132 }
21302133
21312134 scan_target:
@@ -2156,6 +2159,10 @@ static void megasas_slave_destroy(struct scsi_device *sdev) · 24 unmodified lines
21562159 instance = megasas_lookup_instance(sdev->host->host_no);
21572160
21582161 if (MEGASAS_IS_LOGICAL(sdev)) {
2162+ if (!MEGASAS_IS_LUN_VALID(sdev)) {
2163+ sdev_printk(KERN_INFO, sdev, "%s: invalid LUN\n", __func__);
2164+ return;
2165+ }
21592166 ld_tgt_id = MEGASAS_TARGET_ID(sdev);
21602167 instance->ld_tgtid_status[ld_tgt_id] = LD_TARGET_ID_DELETED;
21612168 if (megasas_dbg_lvl & LD_PD_DEBUG)
drivers/scsi/mpt3sas/mpt3sas_base.c+1−2
@@ -5716,13 +5716,12 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5715 unmodified lines
57165716 /**
57175717 * mpt3sas_check_same_4gb_region - checks whether all reply queues in a set are
57185718 * having same upper 32bits in their base memory address.
5719− * @reply_pool_start_address: Base address of a reply queue set
5719+ * @start_address: Base address of a reply queue set
57205720 * @pool_sz: Size of single Reply Descriptor Post Queues pool size
57215721 *
57225722 * Return: 1 if reply queues in a set have a same upper 32bits in their base
57235723 * memory address, else 0.
57245724 */
5725−
57265725 static int
57275726 mpt3sas_check_same_4gb_region(dma_addr_t start_address, u32 pool_sz)
57285727 {
drivers/scsi/mpt3sas/mpt3sas_config.c+6−3
@@ -394,10 +394,13 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 393 unmodified lines
394394 retry_count++;
395395 if (ioc->config_cmds.smid == smid)
396396 mpt3sas_base_free_smid(ioc, smid);
397− if ((ioc->shost_recovery) || (ioc->config_cmds.status &
398− MPT3_CMD_RESET) || ioc->pci_error_recovery)
397+ if (ioc->config_cmds.status & MPT3_CMD_RESET)
399398 goto retry_config;
400− issue_host_reset = 1;
399+ if (ioc->shost_recovery || ioc->pci_error_recovery) {
400+ issue_host_reset = 0;
401+ r = -EFAULT;
402+ } else
403+ issue_host_reset = 1;
401404 goto free_mem;
402405 }
403406
drivers/scsi/mpt3sas/mpt3sas_scsih.c+4−1
@@ -11035,6 +11035,7 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 11034 unmodified lines
1103511035 {
1103611036 struct _sas_port *mpt3sas_port, *next;
1103711037 unsigned long flags;
11038+ int port_id;
1103811039
1103911040 /* remove sibling ports attached to this expander */
1104011041 list_for_each_entry_safe(mpt3sas_port, next,
@@ -11055,6 +11056,8 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines
1105511056 mpt3sas_port->hba_port);
1105611057 }
1105711058
11059+ port_id = sas_expander->port->port_id;
11060+
1105811061 mpt3sas_transport_port_remove(ioc, sas_expander->sas_address,
1105911062 sas_expander->sas_address_parent, sas_expander->port);
1106011063
@@ -11062,7 +11065,7 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
1106211065 "expander_remove: handle(0x%04x), sas_addr(0x%016llx), port:%d\n",
1106311066 sas_expander->handle, (unsigned long long)
1106411067 sas_expander->sas_address,
11065− sas_expander->port->port_id);
11068+ port_id);
1106611069
1106711070 spin_lock_irqsave(&ioc->sas_node_lock, flags);
1106811071 list_del(&sas_expander->list);
drivers/scsi/mvsas/mv_init.c+1−0
@@ -647,6 +647,7 @@ static struct pci_device_id mvs_pci_table[] = { · 646 unmodified lines
647647 { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 },
648648 { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 },
649649 { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 },
650+ { PCI_VDEVICE(TTI, 0x2640), chip_6440 },
650651 { PCI_VDEVICE(TTI, 0x2710), chip_9480 },
651652 { PCI_VDEVICE(TTI, 0x2720), chip_9480 },
652653 { PCI_VDEVICE(TTI, 0x2721), chip_9480 },
drivers/scsi/pcmcia/sym53c500_cs.c+25−27
@@ -192,10 +192,11 @@ struct sym53c500_data { · 191 unmodified lines
192192 int fast_pio;
193193 };
194194
195−static struct scsi_pointer *sym53c500_scsi_pointer(struct scsi_cmnd *cmd)
196−{
197− return scsi_cmd_priv(cmd);
198−}
195+struct sym53c500_cmd_priv {
196+ int status;
197+ int message;
198+ int phase;
199+};
199200
200201 enum Phase {
201202 idle,
@@ -356,7 +357,7 @@ SYM53C500_intr(int irq, void *dev_id) · 154 unmodified lines
356357 struct sym53c500_data *data =
357358 (struct sym53c500_data *)dev->hostdata;
358359 struct scsi_cmnd *curSC = data->current_SC;
359− struct scsi_pointer *scsi_pointer = sym53c500_scsi_pointer(curSC);
360+ struct sym53c500_cmd_priv *scp = scsi_cmd_priv(curSC);
360361 int fast_pio = data->fast_pio;
361362
362363 spin_lock_irqsave(dev->host_lock, flags);
@@ -403,12 +404,11 @@ SYM53C500_intr(int irq, void *dev_id) · 40 unmodified lines
403404
404405 if (int_reg & 0x20) { /* Disconnect */
405406 DEB(printk("SYM53C500: disconnect intr received\n"));
406− if (scsi_pointer->phase != message_in) { /* Unexpected disconnect */
407+ if (scp->phase != message_in) { /* Unexpected disconnect */
407408 curSC->result = DID_NO_CONNECT << 16;
408409 } else { /* Command complete, return status and message */
409− curSC->result = (scsi_pointer->Status & 0xff) |
410− ((scsi_pointer->Message & 0xff) << 8) |
411− (DID_OK << 16);
410+ curSC->result = (scp->status & 0xff) |
411+ ((scp->message & 0xff) << 8) | (DID_OK << 16);
412412 }
413413 goto idle_out;
414414 }
@@ -419,7 +419,7 @@ SYM53C500_intr(int irq, void *dev_id) · 4 unmodified lines
419419 struct scatterlist *sg;
420420 int i;
421421
422− scsi_pointer->phase = data_out;
422+ scp->phase = data_out;
423423 VDEB(printk("SYM53C500: Data-Out phase\n"));
424424 outb(FLUSH_FIFO, port_base + CMD_REG);
425425 LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */
@@ -438,7 +438,7 @@ SYM53C500_intr(int irq, void *dev_id) · 12 unmodified lines
438438 struct scatterlist *sg;
439439 int i;
440440
441− scsi_pointer->phase = data_in;
441+ scp->phase = data_in;
442442 VDEB(printk("SYM53C500: Data-In phase\n"));
443443 outb(FLUSH_FIFO, port_base + CMD_REG);
444444 LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */
@@ -453,12 +453,12 @@ SYM53C500_intr(int irq, void *dev_id) · 8 unmodified lines
453453 break;
454454
455455 case 0x02: /* COMMAND */
456− scsi_pointer->phase = command_ph;
456+ scp->phase = command_ph;
457457 printk("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n");
458458 break;
459459
460460 case 0x03: /* STATUS */
461− scsi_pointer->phase = status_ph;
461+ scp->phase = status_ph;
462462 VDEB(printk("SYM53C500: Status phase\n"));
463463 outb(FLUSH_FIFO, port_base + CMD_REG);
464464 outb(INIT_CMD_COMPLETE, port_base + CMD_REG);
@@ -471,24 +471,22 @@ SYM53C500_intr(int irq, void *dev_id) · 6 unmodified lines
471471
472472 case 0x06: /* MESSAGE-OUT */
473473 DEB(printk("SYM53C500: Message-Out phase\n"));
474− scsi_pointer->phase = message_out;
474+ scp->phase = message_out;
475475 outb(SET_ATN, port_base + CMD_REG); /* Reject the message */
476476 outb(MSG_ACCEPT, port_base + CMD_REG);
477477 break;
478478
479479 case 0x07: /* MESSAGE-IN */
480480 VDEB(printk("SYM53C500: Message-In phase\n"));
481− scsi_pointer->phase = message_in;
481+ scp->phase = message_in;
482482
483− scsi_pointer->Status = inb(port_base + SCSI_FIFO);
484− scsi_pointer->Message = inb(port_base + SCSI_FIFO);
483+ scp->status = inb(port_base + SCSI_FIFO);
484+ scp->message = inb(port_base + SCSI_FIFO);
485485
486486 VDEB(printk("SCSI FIFO size=%d\n", inb(port_base + FIFO_FLAGS) & 0x1f));
487− DEB(printk("Status = %02x Message = %02x\n",
488− scsi_pointer->Status, scsi_pointer->Message));
487+ DEB(printk("Status = %02x Message = %02x\n", scp->status, scp->message));
489488
490− if (scsi_pointer->Message == SAVE_POINTERS ||
491− scsi_pointer->Message == DISCONNECT) {
489+ if (scp->message == SAVE_POINTERS || scp->message == DISCONNECT) {
492490 outb(SET_ATN, port_base + CMD_REG); /* Reject message */
493491 DEB(printk("Discarding SAVE_POINTERS message\n"));
494492 }
@@ -500,7 +498,7 @@ out: · 5 unmodified lines
500498 return IRQ_HANDLED;
501499
502500 idle_out:
503− scsi_pointer->phase = idle;
501+ scp->phase = idle;
504502 scsi_done(curSC);
505503 goto out;
506504 }
@@ -548,7 +546,7 @@ SYM53C500_info(struct Scsi_Host *SChost) · 41 unmodified lines
548546
549547 static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt)
550548 {
551− struct scsi_pointer *scsi_pointer = sym53c500_scsi_pointer(SCpnt);
549+ struct sym53c500_cmd_priv *scp = scsi_cmd_priv(SCpnt);
552550 int i;
553551 int port_base = SCpnt->device->host->io_port;
554552 struct sym53c500_data *data =
@@ -565,9 +563,9 @@ static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt) · 10 unmodified lines
565563 VDEB(printk("\n"));
566564
567565 data->current_SC = SCpnt;
568− scsi_pointer->phase = command_ph;
569− scsi_pointer->Status = 0;
570− scsi_pointer->Message = 0;
566+ scp->phase = command_ph;
567+ scp->status = 0;
568+ scp->message = 0;
571569
572570 /* We are locked here already by the mid layer */
573571 REG0(port_base);
@@ -682,7 +680,7 @@ static struct scsi_host_template sym53c500_driver_template = { · 108 unmodified lines
682680 .this_id = 7,
683681 .sg_tablesize = 32,
684682 .shost_groups = SYM53C500_shost_groups,
685− .cmd_size = sizeof(struct scsi_pointer),
683+ .cmd_size = sizeof(struct sym53c500_cmd_priv),
686684 };
687685
688686 static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data)
drivers/scsi/pmcraid.c+0−491
@@ -3181,124 +3181,6 @@ static int pmcraid_build_ioadl( · 3180 unmodified lines
31813181 return 0;
31823182 }
31833183
3184−/**
3185− * pmcraid_free_sglist - Frees an allocated SG buffer list
3186− * @sglist: scatter/gather list pointer
3187− *
3188− * Free a DMA'able memory previously allocated with pmcraid_alloc_sglist
3189− *
3190− * Return value:
3191− * none
3192− */
3193−static void pmcraid_free_sglist(struct pmcraid_sglist *sglist)
3194−{
3195− sgl_free_order(sglist->scatterlist, sglist->order);
3196− kfree(sglist);
3197−}
3198−
3199−/**
3200− * pmcraid_alloc_sglist - Allocates memory for a SG list
3201− * @buflen: buffer length
3202− *
3203− * Allocates a DMA'able buffer in chunks and assembles a scatter/gather
3204− * list.
3205− *
3206− * Return value
3207− * pointer to sglist / NULL on failure
3208− */
3209−static struct pmcraid_sglist *pmcraid_alloc_sglist(int buflen)
3210−{
3211− struct pmcraid_sglist *sglist;
3212− int sg_size;
3213− int order;
3214−
3215− sg_size = buflen / (PMCRAID_MAX_IOADLS - 1);
3216− order = (sg_size > 0) ? get_order(sg_size) : 0;
3217−
3218− /* Allocate a scatter/gather list for the DMA */
3219− sglist = kzalloc(sizeof(struct pmcraid_sglist), GFP_KERNEL);
3220− if (sglist == NULL)
3221− return NULL;
3222−
3223− sglist->order = order;
3224− sgl_alloc_order(buflen, order, false, GFP_KERNEL | __GFP_ZERO,
3225− &sglist->num_sg);
3226−
3227− return sglist;
3228−}
3229−
3230−/**
3231− * pmcraid_copy_sglist - Copy user buffer to kernel buffer's SG list
3232− * @sglist: scatter/gather list pointer
3233− * @buffer: buffer pointer
3234− * @len: buffer length
3235− * @direction: data transfer direction
3236− *
3237− * Copy a user buffer into a buffer allocated by pmcraid_alloc_sglist
3238− *
3239− * Return value:
3240− * 0 on success / other on failure
3241− */
3242−static int pmcraid_copy_sglist(
3243− struct pmcraid_sglist *sglist,
3244− void __user *buffer,
3245− u32 len,
3246− int direction
3247−)
3248−{
3249− struct scatterlist *sg;
3250− void *kaddr;
3251− int bsize_elem;
3252− int i;
3253− int rc = 0;
3254−
3255− /* Determine the actual number of bytes per element */
3256− bsize_elem = PAGE_SIZE * (1 << sglist->order);
3257−
3258− sg = sglist->scatterlist;
3259−
3260− for (i = 0; i < (len / bsize_elem); i++, sg = sg_next(sg), buffer += bsize_elem) {
3261− struct page *page = sg_page(sg);
3262−
3263− kaddr = kmap(page);
3264− if (direction == DMA_TO_DEVICE)
3265− rc = copy_from_user(kaddr, buffer, bsize_elem);
3266− else
3267− rc = copy_to_user(buffer, kaddr, bsize_elem);
3268−
3269− kunmap(page);
3270−
3271− if (rc) {
3272− pmcraid_err("failed to copy user data into sg list\n");
3273− return -EFAULT;
3274− }
3275−
3276− sg->length = bsize_elem;
3277− }
3278−
3279− if (len % bsize_elem) {
3280− struct page *page = sg_page(sg);
3281−
3282− kaddr = kmap(page);
3283−
3284− if (direction == DMA_TO_DEVICE)
3285− rc = copy_from_user(kaddr, buffer, len % bsize_elem);
3286− else
3287− rc = copy_to_user(buffer, kaddr, len % bsize_elem);
3288−
3289− kunmap(page);
3290−
3291− sg->length = len % bsize_elem;
3292− }
3293−
3294− if (rc) {
3295− pmcraid_err("failed to copy user data into sg list\n");
3296− rc = -EFAULT;
3297− }
3298−
3299− return rc;
3300−}
3301−
33023184 /**
33033185 * pmcraid_queuecommand_lck - Queue a mid-layer request
33043186 * @scsi_cmd: scsi command struct
@@ -3454,365 +3336,6 @@ static int pmcraid_chr_fasync(int fd, struct file *filep, int mode) · 149 unmodified lines
34543336 return rc;
34553337 }
34563338
3457−
3458−/**
3459− * pmcraid_build_passthrough_ioadls - builds SG elements for passthrough
3460− * commands sent over IOCTL interface
3461− *
3462− * @cmd : pointer to struct pmcraid_cmd
3463− * @buflen : length of the request buffer
3464− * @direction : data transfer direction
3465− *
3466− * Return value
3467− * 0 on success, non-zero error code on failure
3468− */
3469−static int pmcraid_build_passthrough_ioadls(
3470− struct pmcraid_cmd *cmd,
3471− int buflen,
3472− int direction
3473−)
3474−{
3475− struct pmcraid_sglist *sglist = NULL;
3476− struct scatterlist *sg = NULL;
3477− struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb;
3478− struct pmcraid_ioadl_desc *ioadl;
3479− int i;
3480−
3481− sglist = pmcraid_alloc_sglist(buflen);
3482−
3483− if (!sglist) {
3484− pmcraid_err("can't allocate memory for passthrough SGls\n");
3485− return -ENOMEM;
3486− }
3487−
3488− sglist->num_dma_sg = dma_map_sg(&cmd->drv_inst->pdev->dev,
3489− sglist->scatterlist,
3490− sglist->num_sg, direction);
3491−
3492− if (!sglist->num_dma_sg || sglist->num_dma_sg > PMCRAID_MAX_IOADLS) {
3493− dev_err(&cmd->drv_inst->pdev->dev,
3494− "Failed to map passthrough buffer!\n");
3495− pmcraid_free_sglist(sglist);
3496− return -EIO;
3497− }
3498−
3499− cmd->sglist = sglist;
3500− ioarcb->request_flags0 |= NO_LINK_DESCS;
3501−
3502− ioadl = pmcraid_init_ioadls(cmd, sglist->num_dma_sg);
3503−
3504− /* Initialize IOADL descriptor addresses */
3505− for_each_sg(sglist->scatterlist, sg, sglist->num_dma_sg, i) {
3506− ioadl[i].data_len = cpu_to_le32(sg_dma_len(sg));
3507− ioadl[i].address = cpu_to_le64(sg_dma_address(sg));
3508− ioadl[i].flags = 0;
3509− }
3510−
3511− /* setup the last descriptor */
3512− ioadl[i - 1].flags = IOADL_FLAGS_LAST_DESC;
3513−
3514− return 0;
3515−}
3516−
3517−
3518−/**
3519− * pmcraid_release_passthrough_ioadls - release passthrough ioadls
3520− *
3521− * @cmd: pointer to struct pmcraid_cmd for which ioadls were allocated
3522− * @buflen: size of the request buffer
3523− * @direction: data transfer direction
3524− *
3525− * Return value
3526− * 0 on success, non-zero error code on failure
3527− */
3528−static void pmcraid_release_passthrough_ioadls(
3529− struct pmcraid_cmd *cmd,
3530− int buflen,
3531− int direction
3532−)
3533−{
3534− struct pmcraid_sglist *sglist = cmd->sglist;
3535−
3536− if (buflen > 0) {
3537− dma_unmap_sg(&cmd->drv_inst->pdev->dev,
3538− sglist->scatterlist,
3539− sglist->num_sg,
3540− direction);
3541− pmcraid_free_sglist(sglist);
3542− cmd->sglist = NULL;
3543− }
3544−}
3545−
3546−/**
3547− * pmcraid_ioctl_passthrough - handling passthrough IOCTL commands
3548− *
3549− * @pinstance: pointer to adapter instance structure
3550− * @ioctl_cmd: ioctl code
3551− * @buflen: unused
3552− * @arg: pointer to pmcraid_passthrough_buffer user buffer
3553− *
3554− * Return value
3555− * 0 on success, non-zero error code on failure
3556− */
3557−static long pmcraid_ioctl_passthrough(
3558− struct pmcraid_instance *pinstance,
3559− unsigned int ioctl_cmd,
3560− unsigned int buflen,
3561− void __user *arg
3562−)
3563−{
3564− struct pmcraid_passthrough_ioctl_buffer *buffer;
3565− struct pmcraid_ioarcb *ioarcb;
3566− struct pmcraid_cmd *cmd;
3567− struct pmcraid_cmd *cancel_cmd;
3568− void __user *request_buffer;
3569− unsigned long request_offset;
3570− unsigned long lock_flags;
3571− void __user *ioasa;
3572− u32 ioasc;
3573− int request_size;
3574− int buffer_size;
3575− u8 direction;
3576− int rc = 0;
3577−
3578− /* If IOA reset is in progress, wait 10 secs for reset to complete */
3579− if (pinstance->ioa_reset_in_progress) {
3580− rc = wait_event_interruptible_timeout(
3581− pinstance->reset_wait_q,
3582− !pinstance->ioa_reset_in_progress,
3583− msecs_to_jiffies(10000));
3584−
3585− if (!rc)
3586− return -ETIMEDOUT;
3587− else if (rc < 0)
3588− return -ERESTARTSYS;
3589− }
3590−
3591− /* If adapter is not in operational state, return error */
3592− if (pinstance->ioa_state != IOA_STATE_OPERATIONAL) {
3593− pmcraid_err("IOA is not operational\n");
3594− return -ENOTTY;
3595− }
3596−
3597− buffer_size = sizeof(struct pmcraid_passthrough_ioctl_buffer);
3598− buffer = kmalloc(buffer_size, GFP_KERNEL);
3599−
3600− if (!buffer) {
3601− pmcraid_err("no memory for passthrough buffer\n");
3602− return -ENOMEM;
3603− }
3604−
3605− request_offset =
3606− offsetof(struct pmcraid_passthrough_ioctl_buffer, request_buffer);
3607−
3608− request_buffer = arg + request_offset;
3609−
3610− rc = copy_from_user(buffer, arg,
3611− sizeof(struct pmcraid_passthrough_ioctl_buffer));
3612−
3613− ioasa = arg + offsetof(struct pmcraid_passthrough_ioctl_buffer, ioasa);
3614−
3615− if (rc) {
3616− pmcraid_err("ioctl: can't copy passthrough buffer\n");
3617− rc = -EFAULT;
3618− goto out_free_buffer;
3619− }
3620−
3621− request_size = le32_to_cpu(buffer->ioarcb.data_transfer_length);
3622−
3623− if (buffer->ioarcb.request_flags0 & TRANSFER_DIR_WRITE) {
3624− direction = DMA_TO_DEVICE;
3625− } else {
3626− direction = DMA_FROM_DEVICE;
3627− }
3628−
3629− if (request_size < 0) {
3630− rc = -EINVAL;
3631− goto out_free_buffer;
3632− }
3633−
3634− /* check if we have any additional command parameters */
3635− if (le16_to_cpu(buffer->ioarcb.add_cmd_param_length)
3636− > PMCRAID_ADD_CMD_PARAM_LEN) {
3637− rc = -EINVAL;
3638− goto out_free_buffer;
3639− }
3640−
3641− cmd = pmcraid_get_free_cmd(pinstance);
3642−
3643− if (!cmd) {
3644− pmcraid_err("free command block is not available\n");
3645− rc = -ENOMEM;
3646− goto out_free_buffer;
3647− }
3648−
3649− cmd->scsi_cmd = NULL;
3650− ioarcb = &(cmd->ioa_cb->ioarcb);
3651−
3652− /* Copy the user-provided IOARCB stuff field by field */
3653− ioarcb->resource_handle = buffer->ioarcb.resource_handle;
3654− ioarcb->data_transfer_length = buffer->ioarcb.data_transfer_length;
3655− ioarcb->cmd_timeout = buffer->ioarcb.cmd_timeout;
3656− ioarcb->request_type = buffer->ioarcb.request_type;
3657− ioarcb->request_flags0 = buffer->ioarcb.request_flags0;
3658− ioarcb->request_flags1 = buffer->ioarcb.request_flags1;
3659− memcpy(ioarcb->cdb, buffer->ioarcb.cdb, PMCRAID_MAX_CDB_LEN);
3660−
3661− if (buffer->ioarcb.add_cmd_param_length) {
3662− ioarcb->add_cmd_param_length =
3663− buffer->ioarcb.add_cmd_param_length;
3664− ioarcb->add_cmd_param_offset =
3665− buffer->ioarcb.add_cmd_param_offset;
3666− memcpy(ioarcb->add_data.u.add_cmd_params,
3667− buffer->ioarcb.add_data.u.add_cmd_params,
3668− le16_to_cpu(buffer->ioarcb.add_cmd_param_length));
3669− }
3670−
3671− /* set hrrq number where the IOA should respond to. Note that all cmds
3672− * generated internally uses hrrq_id 0, exception to this is the cmd
3673− * block of scsi_cmd which is re-used (e.g. cancel/abort), which uses
3674− * hrrq_id assigned here in queuecommand
3675− */
3676− ioarcb->hrrq_id = atomic_add_return(1, &(pinstance->last_message_id)) %
3677− pinstance->num_hrrq;
3678−
3679− if (request_size) {
3680− rc = pmcraid_build_passthrough_ioadls(cmd,
3681− request_size,
3682− direction);
3683− if (rc) {
3684− pmcraid_err("couldn't build passthrough ioadls\n");
3685− goto out_free_cmd;
3686− }
3687− }
3688−
3689− /* If data is being written into the device, copy the data from user
3690− * buffers
3691− */
3692− if (direction == DMA_TO_DEVICE && request_size > 0) {
3693− rc = pmcraid_copy_sglist(cmd->sglist,
3694− request_buffer,
3695− request_size,
3696− direction);
3697− if (rc) {
3698− pmcraid_err("failed to copy user buffer\n");
3699− goto out_free_sglist;
3700− }
3701− }
3702−
3703− /* passthrough ioctl is a blocking command so, put the user to sleep
3704− * until timeout. Note that a timeout value of 0 means, do timeout.
3705− */
3706− cmd->cmd_done = pmcraid_internal_done;
3707− init_completion(&cmd->wait_for_completion);
3708− cmd->completion_req = 1;
3709−
3710− pmcraid_info("command(%d) (CDB[0] = %x) for %x\n",
3711− le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2,
3712− cmd->ioa_cb->ioarcb.cdb[0],
3713− le32_to_cpu(cmd->ioa_cb->ioarcb.resource_handle));
3714−
3715− spin_lock_irqsave(pinstance->host->host_lock, lock_flags);
3716− _pmcraid_fire_command(cmd);
3717− spin_unlock_irqrestore(pinstance->host->host_lock, lock_flags);
3718−
3719− /* NOTE ! Remove the below line once abort_task is implemented
3720− * in firmware. This line disables ioctl command timeout handling logic
3721− * similar to IO command timeout handling, making ioctl commands to wait
3722− * until the command completion regardless of timeout value specified in
3723− * ioarcb
3724− */
3725− buffer->ioarcb.cmd_timeout = 0;
3726−
3727− /* If command timeout is specified put caller to wait till that time,
3728− * otherwise it would be blocking wait. If command gets timed out, it
3729− * will be aborted.
3730− */
3731− if (buffer->ioarcb.cmd_timeout == 0) {
3732− wait_for_completion(&cmd->wait_for_completion);
3733− } else if (!wait_for_completion_timeout(
3734− &cmd->wait_for_completion,
3735− msecs_to_jiffies(le16_to_cpu(buffer->ioarcb.cmd_timeout) * 1000))) {
3736−
3737− pmcraid_info("aborting cmd %d (CDB[0] = %x) due to timeout\n",
3738− le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2,
3739− cmd->ioa_cb->ioarcb.cdb[0]);
3740−
3741− spin_lock_irqsave(pinstance->host->host_lock, lock_flags);
3742− cancel_cmd = pmcraid_abort_cmd(cmd);
3743− spin_unlock_irqrestore(pinstance->host->host_lock, lock_flags);
3744−
3745− if (cancel_cmd) {
3746− wait_for_completion(&cancel_cmd->wait_for_completion);
3747− ioasc = le32_to_cpu(cancel_cmd->ioa_cb->ioasa.ioasc);
3748− pmcraid_return_cmd(cancel_cmd);
3749−
3750− /* if abort task couldn't find the command i.e it got
3751− * completed prior to aborting, return good completion.
3752− * if command got aborted successfully or there was IOA
3753− * reset due to abort task itself getting timedout then
3754− * return -ETIMEDOUT
3755− */
3756− if (ioasc == PMCRAID_IOASC_IOA_WAS_RESET ||
3757− PMCRAID_IOASC_SENSE_KEY(ioasc) == 0x00) {
3758− if (ioasc != PMCRAID_IOASC_GC_IOARCB_NOTFOUND)
3759− rc = -ETIMEDOUT;
3760− goto out_handle_response;
3761− }
3762− }
3763−
3764− /* no command block for abort task or abort task failed to abort
3765− * the IOARCB, then wait for 150 more seconds and initiate reset
3766− * sequence after timeout
3767− */
3768− if (!wait_for_completion_timeout(
3769− &cmd->wait_for_completion,
3770− msecs_to_jiffies(150 * 1000))) {
3771− pmcraid_reset_bringup(cmd->drv_inst);
3772− rc = -ETIMEDOUT;
3773− }
3774− }
3775−
3776−out_handle_response:
3777− /* copy entire IOASA buffer and return IOCTL success.
3778− * If copying IOASA to user-buffer fails, return
3779− * EFAULT
3780− */
3781− if (copy_to_user(ioasa, &cmd->ioa_cb->ioasa,
3782− sizeof(struct pmcraid_ioasa))) {
3783− pmcraid_err("failed to copy ioasa buffer to user\n");
3784− rc = -EFAULT;
3785− }
3786−
3787− /* If the data transfer was from device, copy the data onto user
3788− * buffers
3789− */
3790− else if (direction == DMA_FROM_DEVICE && request_size > 0) {
3791− rc = pmcraid_copy_sglist(cmd->sglist,
3792− request_buffer,
3793− request_size,
3794− direction);
3795− if (rc) {
3796− pmcraid_err("failed to copy user buffer\n");
3797− rc = -EFAULT;
3798− }
3799− }
3800−
3801−out_free_sglist:
3802− pmcraid_release_passthrough_ioadls(cmd, request_size, direction);
3803−
3804−out_free_cmd:
3805− pmcraid_return_cmd(cmd);
3806−
3807−out_free_buffer:
3808− kfree(buffer);
3809−
3810− return rc;
3811−}
3812−
3813−
3814−
3815−
38163339 /**
38173340 * pmcraid_ioctl_driver - ioctl handler for commands handled by driver itself
38183341 *
@@ -3922,20 +3445,6 @@ static long pmcraid_chr_ioctl( · 103 unmodified lines
39223445
39233446 switch (_IOC_TYPE(cmd)) {
39243447
3925− case PMCRAID_PASSTHROUGH_IOCTL:
3926− /* If ioctl code is to download microcode, we need to block
3927− * mid-layer requests.
3928− */
3929− if (cmd == PMCRAID_IOCTL_DOWNLOAD_MICROCODE)
3930− scsi_block_requests(pinstance->host);
3931−
3932− retval = pmcraid_ioctl_passthrough(pinstance, cmd,
3933− hdr->buffer_length, argp);
3934−
3935− if (cmd == PMCRAID_IOCTL_DOWNLOAD_MICROCODE)
3936− scsi_unblock_requests(pinstance->host);
3937− break;
3938−
39393448 case PMCRAID_DRIVER_IOCTL:
39403449 arg += sizeof(struct pmcraid_ioctl_header);
39413450 retval = pmcraid_ioctl_driver(pinstance, cmd,
drivers/scsi/pmcraid.h+0−33
@@ -1022,41 +1022,16 @@ struct pmcraid_ioctl_header { · 1021 unmodified lines
10221022
10231023 #define PMCRAID_IOCTL_SIGNATURE "PMCRAID"
10241024
1025−/*
1026− * pmcraid_passthrough_ioctl_buffer - structure given as argument to
1027− * passthrough(or firmware handled) IOCTL commands. Note that ioarcb requires
1028− * 32-byte alignment so, it is necessary to pack this structure to avoid any
1029− * holes between ioctl_header and passthrough buffer
1030− *
1031− * .ioactl_header : ioctl header
1032− * .ioarcb : filled-up ioarcb buffer, driver always reads this buffer
1033− * .ioasa : buffer for ioasa, driver fills this with IOASA from firmware
1034− * .request_buffer: The I/O buffer (flat), driver reads/writes to this based on
1035− * the transfer directions passed in ioarcb.flags0. Contents
1036− * of this buffer are valid only when ioarcb.data_transfer_len
1037− * is not zero.
1038− */
1039−struct pmcraid_passthrough_ioctl_buffer {
1040− struct pmcraid_ioctl_header ioctl_header;
1041− struct pmcraid_ioarcb ioarcb;
1042− struct pmcraid_ioasa ioasa;
1043− u8 request_buffer[];
1044−} __attribute__ ((packed, aligned(PMCRAID_IOARCB_ALIGNMENT)));
1045−
10461025 /*
10471026 * keys to differentiate between driver handled IOCTLs and passthrough
10481027 * IOCTLs passed to IOA. driver determines the ioctl type using macro
10491028 * _IOC_TYPE
10501029 */
10511030 #define PMCRAID_DRIVER_IOCTL 'D'
1052−#define PMCRAID_PASSTHROUGH_IOCTL 'F'
10531031
10541032 #define DRV_IOCTL(n, size) \
10551033 _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_DRIVER_IOCTL, (n), (size))
10561034
1057−#define FMW_IOCTL(n, size) \
1058− _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_PASSTHROUGH_IOCTL, (n), (size))
1059−
10601035 /*
10611036 * _ARGSIZE: macro that gives size of the argument type passed to an IOCTL cmd.
10621037 * This is to facilitate applications avoiding un-necessary memory allocations.
@@ -1069,12 +1044,4 @@ struct pmcraid_passthrough_ioctl_buffer { · 6 unmodified lines
10691044 #define PMCRAID_IOCTL_RESET_ADAPTER \
10701045 DRV_IOCTL(5, sizeof(struct pmcraid_ioctl_header))
10711046
1072−/* passthrough/firmware handled commands */
1073−#define PMCRAID_IOCTL_PASSTHROUGH_COMMAND \
1074− FMW_IOCTL(1, sizeof(struct pmcraid_passthrough_ioctl_buffer))
1075−
1076−#define PMCRAID_IOCTL_DOWNLOAD_MICROCODE \
1077− FMW_IOCTL(2, sizeof(struct pmcraid_passthrough_ioctl_buffer))
1078−
1079−
10801047 #endif /* _PMCRAID_H */
drivers/scsi/scsi_debug.c+5−3
@@ -7519,12 +7519,13 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) · 7518 unmodified lines
75197519 struct sdebug_defer *sd_dp;
75207520
75217521 sqp = sdebug_q_arr + queue_num;
7522− qc_idx = find_first_bit(sqp->in_use_bm, sdebug_max_queue);
7523− if (qc_idx >= sdebug_max_queue)
7524− return 0;
75257522
75267523 spin_lock_irqsave(&sqp->qc_lock, iflags);
75277524
7525+ qc_idx = find_first_bit(sqp->in_use_bm, sdebug_max_queue);
7526+ if (qc_idx >= sdebug_max_queue)
7527+ goto unlock;
7528+
75287529 for (first = true; first || qc_idx + 1 < sdebug_max_queue; ) {
75297530 if (first) {
75307531 first = false;
@@ -7589,6 +7590,7 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) · 58 unmodified lines
75897590 break;
75907591 }
75917592
7593+unlock:
75927594 spin_unlock_irqrestore(&sqp->qc_lock, iflags);
75937595
75947596 if (num_entries > 0)
drivers/scsi/scsi_logging.c+1−1
@@ -30,7 +30,7 @@ static inline const char *scmd_name(const struct scsi_cmnd *scmd) · 29 unmodified lines
3030 {
3131 struct request *rq = scsi_cmd_to_rq((struct scsi_cmnd *)scmd);
3232
33− if (!rq->q->disk)
33+ if (!rq->q || !rq->q->disk)
3434 return NULL;
3535 return rq->q->disk->disk_name;
3636 }
drivers/scsi/scsi_scan.c+5−0
@@ -223,6 +223,8 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, · 222 unmodified lines
223223 int ret;
224224 struct sbitmap sb_backup;
225225
226+ depth = min_t(unsigned int, depth, scsi_device_max_queue_depth(sdev));
227+
226228 /*
227229 * realloc if new shift is calculated, which is caused by setting
228230 * up one new default queue depth after calling ->slave_configure
@@ -245,6 +247,9 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, · 16 unmodified lines
245247 scsi_device_max_queue_depth(sdev),
246248 new_shift, GFP_KERNEL,
247249 sdev->request_queue->node, false, true);
250+ if (!ret)
251+ sbitmap_resize(&sdev->budget_map, depth);
252+
248253 if (need_free) {
249254 if (ret)
250255 sdev->budget_map = sb_backup;
drivers/scsi/scsi_sysfs.c+0−4
@@ -1384,10 +1384,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) · 1383 unmodified lines
13841384 if (IS_ENABLED(CONFIG_BLK_DEV_BSG)) {
13851385 sdev->bsg_dev = scsi_bsg_register_queue(sdev);
13861386 if (IS_ERR(sdev->bsg_dev)) {
1387− /*
1388− * We're treating error on bsg register as non-fatal, so
1389− * pretend nothing went wrong.
1390− */
13911387 error = PTR_ERR(sdev->bsg_dev);
13921388 sdev_printk(KERN_INFO, sdev,
13931389 "Failed to register bsg queue, errno=%d\n",
drivers/scsi/sd.c+2−1
@@ -3216,6 +3216,7 @@ static int sd_revalidate_disk(struct gendisk *disk) · 3215 unmodified lines
32163216 sd_read_block_limits(sdkp);
32173217 sd_read_block_characteristics(sdkp);
32183218 sd_zbc_read_zones(sdkp, buffer);
3219+ sd_read_cpr(sdkp);
32193220 }
32203221
32213222 sd_print_capacity(sdkp, old_capacity);
@@ -3225,7 +3226,6 @@ static int sd_revalidate_disk(struct gendisk *disk) · 3 unmodified lines
32253226 sd_read_app_tag_own(sdkp, buffer);
32263227 sd_read_write_same(sdkp, buffer);
32273228 sd_read_security(sdkp, buffer);
3228− sd_read_cpr(sdkp);
32293229 }
32303230
32313231 /*
@@ -3475,6 +3475,7 @@ static int sd_probe(struct device *dev) · 243 unmodified lines
34753475 error = device_add_disk(dev, gd, NULL);
34763476 if (error) {
34773477 put_device(&sdkp->disk_dev);
3478+ blk_cleanup_disk(gd);
34783479 goto out;
34793480 }
34803481
drivers/scsi/sr.c+1−1
@@ -535,7 +535,7 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, · 534 unmodified lines
535535
536536 scsi_autopm_get_device(sdev);
537537
538− if (ret != CDROMCLOSETRAY && ret != CDROMEJECT) {
538+ if (cmd != CDROMCLOSETRAY && cmd != CDROMEJECT) {
539539 ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg);
540540 if (ret != -ENOSYS)
541541 goto put;
drivers/scsi/ufs/ufs-qcom.c+0−15
@@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = { · 956 unmodified lines
957957 .deassert = ufs_qcom_reset_deassert,
958958 };
959959
960−#define ANDROID_BOOT_DEV_MAX 30
961−static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
962−
963−#ifndef MODULE
964−static int __init get_android_boot_dev(char *str)
965−{
966− strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
967− return 1;
968−}
969−__setup("androidboot.bootdevice=", get_android_boot_dev);
970−#endif
971−
972960 /**
973961 * ufs_qcom_init - bind phy with controller
974962 * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) · 13 unmodified lines
988976 struct resource *res;
989977 struct ufs_clk_info *clki;
990978
991− if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
992− return -ENODEV;
993−
994979 host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
995980 if (!host) {
996981 err = -ENOMEM;
drivers/scsi/ufs/ufshcd-pci.c+17−0
@@ -428,6 +428,12 @@ static int ufs_intel_adl_init(struct ufs_hba *hba) · 427 unmodified lines
428428 return ufs_intel_common_init(hba);
429429 }
430430
431+static int ufs_intel_mtl_init(struct ufs_hba *hba)
432+{
433+ hba->caps |= UFSHCD_CAP_CRYPTO | UFSHCD_CAP_WB_EN;
434+ return ufs_intel_common_init(hba);
435+}
436+
431437 static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = {
432438 .name = "intel-pci",
433439 .init = ufs_intel_common_init,
@@ -465,6 +471,16 @@ static struct ufs_hba_variant_ops ufs_intel_adl_hba_vops = { · 31 unmodified lines
465471 .device_reset = ufs_intel_device_reset,
466472 };
467473
474+static struct ufs_hba_variant_ops ufs_intel_mtl_hba_vops = {
475+ .name = "intel-pci",
476+ .init = ufs_intel_mtl_init,
477+ .exit = ufs_intel_common_exit,
478+ .hce_enable_notify = ufs_intel_hce_enable_notify,
479+ .link_startup_notify = ufs_intel_link_startup_notify,
480+ .resume = ufs_intel_resume,
481+ .device_reset = ufs_intel_device_reset,
482+};
483+
468484 #ifdef CONFIG_PM_SLEEP
469485 static int ufshcd_pci_restore(struct device *dev)
470486 {
@@ -579,6 +595,7 @@ static const struct pci_device_id ufshcd_pci_tbl[] = { · 108 unmodified lines
579595 { PCI_VDEVICE(INTEL, 0x98FA), (kernel_ulong_t)&ufs_intel_lkf_hba_vops },
580596 { PCI_VDEVICE(INTEL, 0x51FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops },
581597 { PCI_VDEVICE(INTEL, 0x54FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops },
598+ { PCI_VDEVICE(INTEL, 0x7E47), (kernel_ulong_t)&ufs_intel_mtl_hba_vops },
582599 { } /* terminate list */
583600 };
584601
drivers/scsi/ufs/ufshcd.h+0−2
@@ -820,8 +820,6 @@ struct ufs_hba { · 819 unmodified lines
820820 enum ufs_pm_level rpm_lvl;
821821 /* Desired UFS power management level during system PM */
822822 enum ufs_pm_level spm_lvl;
823− struct device_attribute rpm_lvl_attr;
824− struct device_attribute spm_lvl_attr;
825823 int pm_op_in_progress;
826824
827825 /* Auto-Hibernate Idle Timer register value */
drivers/scsi/ufs/ufshpb.c+5−6
@@ -867,12 +867,6 @@ static struct ufshpb_region *ufshpb_victim_lru_info(struct ufshpb_lu *hpb) · 866 unmodified lines
867867 struct ufshpb_region *rgn, *victim_rgn = NULL;
868868
869869 list_for_each_entry(rgn, &lru_info->lh_lru_rgn, list_lru_rgn) {
870− if (!rgn) {
871− dev_err(&hpb->sdev_ufs_lu->sdev_dev,
872− "%s: no region allocated\n",
873− __func__);
874− return NULL;
875− }
876870 if (ufshpb_check_srgns_issue_state(hpb, rgn))
877871 continue;
878872
@@ -888,6 +882,11 @@ static struct ufshpb_region *ufshpb_victim_lru_info(struct ufshpb_lu *hpb) · 9 unmodified lines
888882 break;
889883 }
890884
885+ if (!victim_rgn)
886+ dev_err(&hpb->sdev_ufs_lu->sdev_dev,
887+ "%s: no region allocated\n",
888+ __func__);
889+
891890 return victim_rgn;
892891 }
893892
drivers/scsi/virtio_scsi.c+4−4
@@ -988,7 +988,7 @@ static struct virtio_driver virtio_scsi_driver = { · 987 unmodified lines
988988 .remove = virtscsi_remove,
989989 };
990990
991−static int __init init(void)
991+static int __init virtio_scsi_init(void)
992992 {
993993 int ret = -ENOMEM;
994994
@@ -1020,14 +1020,14 @@ error: · 25 unmodified lines
10201020 return ret;
10211021 }
10221022
1023−static void __exit fini(void)
1023+static void __exit virtio_scsi_fini(void)
10241024 {
10251025 unregister_virtio_driver(&virtio_scsi_driver);
10261026 mempool_destroy(virtscsi_cmd_pool);
10271027 kmem_cache_destroy(virtscsi_cmd_cache);
10281028 }
1029−module_init(init);
1030−module_exit(fini);
1029+module_init(virtio_scsi_init);
1030+module_exit(virtio_scsi_fini);
10311031
10321032 MODULE_DEVICE_TABLE(virtio, id_table);
10331033 MODULE_DESCRIPTION("Virtio SCSI HBA driver");
drivers/scsi/zorro7xx.c+2−0
@@ -159,6 +159,8 @@ static void zorro7xx_remove_one(struct zorro_dev *z) · 158 unmodified lines
159159 scsi_remove_host(host);
160160
161161 NCR_700_release(host);
162+ if (host->base > 0x01000000)
163+ iounmap(hostdata->base);
162164 kfree(hostdata);
163165 free_irq(host->irq, host);
164166 zorro_release_device(z);
drivers/target/target_core_user.c+2−1
@@ -1821,6 +1821,7 @@ static struct page *tcmu_try_get_data_page(struct tcmu_dev *udev, uint32_t dpi) · 1820 unmodified lines
18211821 mutex_lock(&udev->cmdr_lock);
18221822 page = xa_load(&udev->data_pages, dpi);
18231823 if (likely(page)) {
1824+ get_page(page);
18241825 mutex_unlock(&udev->cmdr_lock);
18251826 return page;
18261827 }
@@ -1877,6 +1878,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) · 50 unmodified lines
18771878 /* For the vmalloc()ed cmd area pages */
18781879 addr = (void *)(unsigned long)info->mem[mi].addr + offset;
18791880 page = vmalloc_to_page(addr);
1881+ get_page(page);
18801882 } else {
18811883 uint32_t dpi;
18821884
@@ -1887,7 +1889,6 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) · 4 unmodified lines
18871889 return VM_FAULT_SIGBUS;
18881890 }
18891891
1890− get_page(page);
18911892 vmf->page = page;
18921893 return 0;
18931894 }