Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull SCSI updates from James Bottomley:
"Updates to the usual drivers (ufs, smartpqi, NCR5380, mac_scsi, lpfc,
mpi3mr).

There are no user visible core changes and a whole series of minor
updates and fixes. The largest core change is probably the
simplification of the workqueue allocation path"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (86 commits)
scsi: smartpqi: update driver version to 2.1.30-031
scsi: smartpqi: fix volume size updates
scsi: smartpqi: fix rare system hang during LUN reset
scsi: smartpqi: add new controller PCI IDs
scsi: smartpqi: add counter for parity write stream requests
scsi: smartpqi: correct stream detection
scsi: smartpqi: Add fw log to kdump
scsi: bnx2fc: Remove some unused fields in struct bnx2fc_rport
scsi: qla2xxx: Remove the unused 'del_list_entry' field in struct fc_port
scsi: ufs: core: Remove ufshcd_urgent_bkops()
scsi: core: Remove obsoleted declaration for scsi_driverbyte_string()
scsi: bnx2i: Remove unused declarations
scsi: core: Simplify an alloc_workqueue() invocation
scsi: ufs: Simplify alloc*_workqueue() invocation
scsi: stex: Simplify an alloc_ordered_workqueue() invocation
scsi: scsi_transport_fc: Simplify alloc_workqueue() invocations
scsi: snic: Simplify alloc_workqueue() invocations
scsi: qedi: Simplify an alloc_workqueue() invocation
scsi: qedf: Simplify alloc_workqueue() invocations
scsi: myrs: Simplify an alloc_ordered_workqueue() invocation
...

+1185 -849
+27
Documentation/ABI/testing/sysfs-driver-ufs
··· 1532 1532 Description: 1533 1533 rtc_update_ms indicates how often the host should synchronize or update the 1534 1534 UFS RTC. If set to 0, this will disable UFS RTC periodic update. 1535 + 1536 + What: /sys/devices/platform/.../ufshci_capabilities/version 1537 + Date: August 2024 1538 + Contact: Avri Altman <avri.altman@wdc.com> 1539 + Description: 1540 + Host Capabilities register group: UFS version register. 1541 + Symbol - VER. This file shows the UFSHCD version. 1542 + Example: Version 3.12 would be represented as 0000_0312h. 1543 + The file is read only. 1544 + 1545 + What: /sys/devices/platform/.../ufshci_capabilities/product_id 1546 + Date: August 2024 1547 + Contact: Avri Altman <avri.altman@wdc.com> 1548 + Description: 1549 + Host Capabilities register group: product ID register. 1550 + Symbol - HCPID. This file shows the UFSHCD product id. 1551 + The content of this register is vendor specific. 1552 + The file is read only. 1553 + 1554 + What: /sys/devices/platform/.../ufshci_capabilities/man_id 1555 + Date: August 2024 1556 + Contact: Avri Altman <avri.altman@wdc.com> 1557 + Description: 1558 + Host Capabilities register group: manufacturer ID register. 1559 + Symbol - HCMID. This file shows the UFSHCD manufacturer id. 1560 + The Manufacturer ID is defined by JEDEC in JEDEC-JEP106. 1561 + The file is read only.
+1
block/blk-core.c
··· 799 799 800 800 switch (bio_op(bio)) { 801 801 case REQ_OP_READ: 802 + break; 802 803 case REQ_OP_WRITE: 803 804 if (bio->bi_opf & REQ_ATOMIC) { 804 805 status = blk_validate_atomic_write_op_size(q, bio);
+6 -54
drivers/message/fusion/lsi/mpi_cnfg.h
··· 1018 1018 1019 1019 #define MPI_IOCPAGE2_FLAG_VOLUME_INACTIVE (0x08) 1020 1020 1021 - /* 1022 - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 1023 - * one and check Header.PageLength at runtime. 1024 - */ 1025 - #ifndef MPI_IOC_PAGE_2_RAID_VOLUME_MAX 1026 - #define MPI_IOC_PAGE_2_RAID_VOLUME_MAX (1) 1027 - #endif 1028 - 1029 1021 typedef struct _CONFIG_PAGE_IOC_2 1030 1022 { 1031 1023 CONFIG_PAGE_HEADER Header; /* 00h */ ··· 1026 1034 U8 MaxVolumes; /* 09h */ 1027 1035 U8 NumActivePhysDisks; /* 0Ah */ 1028 1036 U8 MaxPhysDisks; /* 0Bh */ 1029 - CONFIG_PAGE_IOC_2_RAID_VOL RaidVolume[MPI_IOC_PAGE_2_RAID_VOLUME_MAX];/* 0Ch */ 1037 + CONFIG_PAGE_IOC_2_RAID_VOL RaidVolume[] __counted_by(NumActiveVolumes); /* 0Ch */ 1030 1038 } CONFIG_PAGE_IOC_2, MPI_POINTER PTR_CONFIG_PAGE_IOC_2, 1031 1039 IOCPage2_t, MPI_POINTER pIOCPage2_t; 1032 1040 ··· 1056 1064 } IOC_3_PHYS_DISK, MPI_POINTER PTR_IOC_3_PHYS_DISK, 1057 1065 Ioc3PhysDisk_t, MPI_POINTER pIoc3PhysDisk_t; 1058 1066 1059 - /* 1060 - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 1061 - * one and check Header.PageLength at runtime. 1062 - */ 1063 - #ifndef MPI_IOC_PAGE_3_PHYSDISK_MAX 1064 - #define MPI_IOC_PAGE_3_PHYSDISK_MAX (1) 1065 - #endif 1066 - 1067 1067 typedef struct _CONFIG_PAGE_IOC_3 1068 1068 { 1069 1069 CONFIG_PAGE_HEADER Header; /* 00h */ 1070 1070 U8 NumPhysDisks; /* 04h */ 1071 1071 U8 Reserved1; /* 05h */ 1072 1072 U16 Reserved2; /* 06h */ 1073 - IOC_3_PHYS_DISK PhysDisk[MPI_IOC_PAGE_3_PHYSDISK_MAX]; /* 08h */ 1073 + IOC_3_PHYS_DISK PhysDisk[] __counted_by(NumPhysDisks); /* 08h */ 1074 1074 } CONFIG_PAGE_IOC_3, MPI_POINTER PTR_CONFIG_PAGE_IOC_3, 1075 1075 IOCPage3_t, MPI_POINTER pIOCPage3_t; 1076 1076 ··· 1077 1093 } IOC_4_SEP, MPI_POINTER PTR_IOC_4_SEP, 1078 1094 Ioc4Sep_t, MPI_POINTER pIoc4Sep_t; 1079 1095 1080 - /* 1081 - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 1082 - * one and check Header.PageLength at runtime. 1083 - */ 1084 - #ifndef MPI_IOC_PAGE_4_SEP_MAX 1085 - #define MPI_IOC_PAGE_4_SEP_MAX (1) 1086 - #endif 1087 - 1088 1096 typedef struct _CONFIG_PAGE_IOC_4 1089 1097 { 1090 1098 CONFIG_PAGE_HEADER Header; /* 00h */ 1091 1099 U8 ActiveSEP; /* 04h */ 1092 1100 U8 MaxSEP; /* 05h */ 1093 1101 U16 Reserved1; /* 06h */ 1094 - IOC_4_SEP SEP[MPI_IOC_PAGE_4_SEP_MAX]; /* 08h */ 1102 + IOC_4_SEP SEP[] __counted_by(ActiveSEP); /* 08h */ 1095 1103 } CONFIG_PAGE_IOC_4, MPI_POINTER PTR_CONFIG_PAGE_IOC_4, 1096 1104 IOCPage4_t, MPI_POINTER pIOCPage4_t; 1097 1105 ··· 2271 2295 #define MPI_RAID_HOT_SPARE_POOL_6 (0x40) 2272 2296 #define MPI_RAID_HOT_SPARE_POOL_7 (0x80) 2273 2297 2274 - /* 2275 - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 2276 - * one and check Header.PageLength at runtime. 2277 - */ 2278 - #ifndef MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX 2279 - #define MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX (1) 2280 - #endif 2281 - 2282 2298 typedef struct _CONFIG_PAGE_RAID_VOL_0 2283 2299 { 2284 2300 CONFIG_PAGE_HEADER Header; /* 00h */ ··· 2289 2321 U8 DataScrubRate; /* 25h */ 2290 2322 U8 ResyncRate; /* 26h */ 2291 2323 U8 InactiveStatus; /* 27h */ 2292 - RAID_VOL0_PHYS_DISK PhysDisk[MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX];/* 28h */ 2324 + RAID_VOL0_PHYS_DISK PhysDisk[] __counted_by(NumPhysDisks); /* 28h */ 2293 2325 } CONFIG_PAGE_RAID_VOL_0, MPI_POINTER PTR_CONFIG_PAGE_RAID_VOL_0, 2294 2326 RaidVolumePage0_t, MPI_POINTER pRaidVolumePage0_t; 2295 2327 ··· 2423 2455 #define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001) 2424 2456 2425 2457 2426 - /* 2427 - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 2428 - * one and check Header.PageLength or NumPhysDiskPaths at runtime. 2429 - */ 2430 - #ifndef MPI_RAID_PHYS_DISK1_PATH_MAX 2431 - #define MPI_RAID_PHYS_DISK1_PATH_MAX (1) 2432 - #endif 2433 - 2434 2458 typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 2435 2459 { 2436 2460 CONFIG_PAGE_HEADER Header; /* 00h */ ··· 2430 2470 U8 PhysDiskNum; /* 05h */ 2431 2471 U16 Reserved2; /* 06h */ 2432 2472 U32 Reserved1; /* 08h */ 2433 - RAID_PHYS_DISK1_PATH Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */ 2473 + RAID_PHYS_DISK1_PATH Path[] __counted_by(NumPhysDiskPaths);/* 0Ch */ 2434 2474 } CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1, 2435 2475 RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t; 2436 2476 ··· 2515 2555 } MPI_SAS_IO_UNIT0_PHY_DATA, MPI_POINTER PTR_MPI_SAS_IO_UNIT0_PHY_DATA, 2516 2556 SasIOUnit0PhyData, MPI_POINTER pSasIOUnit0PhyData; 2517 2557 2518 - /* 2519 - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to 2520 - * one and check Header.PageLength at runtime. 2521 - */ 2522 - #ifndef MPI_SAS_IOUNIT0_PHY_MAX 2523 - #define MPI_SAS_IOUNIT0_PHY_MAX (1) 2524 - #endif 2525 - 2526 2558 typedef struct _CONFIG_PAGE_SAS_IO_UNIT_0 2527 2559 { 2528 2560 CONFIG_EXTENDED_PAGE_HEADER Header; /* 00h */ ··· 2523 2571 U8 NumPhys; /* 0Ch */ 2524 2572 U8 Reserved2; /* 0Dh */ 2525 2573 U16 Reserved3; /* 0Eh */ 2526 - MPI_SAS_IO_UNIT0_PHY_DATA PhyData[MPI_SAS_IOUNIT0_PHY_MAX]; /* 10h */ 2574 + MPI_SAS_IO_UNIT0_PHY_DATA PhyData[] __counted_by(NumPhys); /* 10h */ 2527 2575 } CONFIG_PAGE_SAS_IO_UNIT_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_0, 2528 2576 SasIOUnitPage0_t, MPI_POINTER pSasIOUnitPage0_t; 2529 2577
+3 -7
drivers/message/fusion/mptbase.c
··· 1856 1856 /* Initialize workqueue */ 1857 1857 INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work); 1858 1858 1859 - snprintf(ioc->reset_work_q_name, MPT_KOBJ_NAME_LEN, 1860 - "mpt_poll_%d", ioc->id); 1861 - ioc->reset_work_q = alloc_workqueue(ioc->reset_work_q_name, 1862 - WQ_MEM_RECLAIM, 0); 1859 + ioc->reset_work_q = 1860 + alloc_workqueue("mpt_poll_%d", WQ_MEM_RECLAIM, 0, ioc->id); 1863 1861 if (!ioc->reset_work_q) { 1864 1862 printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n", 1865 1863 ioc->name); ··· 1984 1986 1985 1987 INIT_LIST_HEAD(&ioc->fw_event_list); 1986 1988 spin_lock_init(&ioc->fw_event_lock); 1987 - snprintf(ioc->fw_event_q_name, MPT_KOBJ_NAME_LEN, "mpt/%d", ioc->id); 1988 - ioc->fw_event_q = alloc_workqueue(ioc->fw_event_q_name, 1989 - WQ_MEM_RECLAIM, 0); 1989 + ioc->fw_event_q = alloc_workqueue("mpt/%d", WQ_MEM_RECLAIM, 0, ioc->id); 1990 1990 if (!ioc->fw_event_q) { 1991 1991 printk(MYIOC_s_ERR_FMT "Insufficient memory to add adapter!\n", 1992 1992 ioc->name);
-3
drivers/message/fusion/mptbase.h
··· 729 729 struct list_head fw_event_list; 730 730 spinlock_t fw_event_lock; 731 731 u8 fw_events_off; /* if '1', then ignore events */ 732 - char fw_event_q_name[MPT_KOBJ_NAME_LEN]; 733 732 734 733 struct mutex sas_discovery_mutex; 735 734 u8 sas_discovery_runtime; ··· 763 764 u8 fc_link_speed[2]; 764 765 spinlock_t fc_rescan_work_lock; 765 766 struct work_struct fc_rescan_work; 766 - char fc_rescan_work_q_name[MPT_KOBJ_NAME_LEN]; 767 767 struct workqueue_struct *fc_rescan_work_q; 768 768 769 769 /* driver forced bus resets count */ ··· 776 778 spinlock_t scsi_lookup_lock; 777 779 u64 dma_mask; 778 780 u32 broadcast_aen_busy; 779 - char reset_work_q_name[MPT_KOBJ_NAME_LEN]; 780 781 struct workqueue_struct *reset_work_q; 781 782 struct delayed_work fault_reset_work; 782 783
+2 -5
drivers/message/fusion/mptfc.c
··· 1349 1349 1350 1350 /* initialize workqueue */ 1351 1351 1352 - snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name), 1353 - "mptfc_wq_%d", sh->host_no); 1354 - ioc->fc_rescan_work_q = 1355 - alloc_ordered_workqueue(ioc->fc_rescan_work_q_name, 1356 - WQ_MEM_RECLAIM); 1352 + ioc->fc_rescan_work_q = alloc_ordered_workqueue( 1353 + "mptfc_wq_%d", WQ_MEM_RECLAIM, sh->host_no); 1357 1354 if (!ioc->fc_rescan_work_q) { 1358 1355 error = -ENOMEM; 1359 1356 goto out_mptfc_host;
+116 -117
drivers/scsi/NCR5380.c
··· 157 157 } 158 158 159 159 ncmd->status = 0; 160 - ncmd->message = 0; 161 160 } 162 161 163 162 static inline void advance_sg_buffer(struct NCR5380_cmd *ncmd) ··· 198 199 * Polls the chip in a reasonably efficient manner waiting for an 199 200 * event to occur. After a short quick poll we begin to yield the CPU 200 201 * (if possible). In irq contexts the time-out is arbitrarily limited. 201 - * Callers may hold locks as long as they are held in irq mode. 202 202 * 203 203 * Returns 0 if either or both event(s) occurred otherwise -ETIMEDOUT. 204 204 */ ··· 1226 1228 return ret; 1227 1229 } 1228 1230 1229 - /* 1230 - * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance, 1231 - * unsigned char *phase, int *count, unsigned char **data) 1231 + /** 1232 + * NCR5380_transfer_pio() - transfers data in given phase using polled I/O 1233 + * @instance: instance of driver 1234 + * @phase: pointer to what phase is expected 1235 + * @count: pointer to number of bytes to transfer 1236 + * @data: pointer to data pointer 1237 + * @can_sleep: 1 or 0 when sleeping is permitted or not, respectively 1232 1238 * 1233 - * Purpose : transfers data in given phase using polled I/O 1234 - * 1235 - * Inputs : instance - instance of driver, *phase - pointer to 1236 - * what phase is expected, *count - pointer to number of 1237 - * bytes to transfer, **data - pointer to data pointer, 1238 - * can_sleep - 1 or 0 when sleeping is permitted or not, respectively. 1239 - * 1240 - * Returns : -1 when different phase is entered without transferring 1241 - * maximum number of bytes, 0 if all bytes are transferred or exit 1242 - * is in same phase. 1243 - * 1244 - * Also, *phase, *count, *data are modified in place. 1245 - * 1246 - * XXX Note : handling for bus free may be useful. 1239 + * Returns: void. *phase, *count, *data are modified in place. 1247 1240 */ 1248 1241 1249 1242 /* ··· 1243 1254 * counts, we will always do a pseudo DMA or DMA transfer. 1244 1255 */ 1245 1256 1246 - static int NCR5380_transfer_pio(struct Scsi_Host *instance, 1247 - unsigned char *phase, int *count, 1248 - unsigned char **data, unsigned int can_sleep) 1257 + static void NCR5380_transfer_pio(struct Scsi_Host *instance, 1258 + unsigned char *phase, int *count, 1259 + unsigned char **data, unsigned int can_sleep) 1249 1260 { 1250 1261 struct NCR5380_hostdata *hostdata = shost_priv(instance); 1251 1262 unsigned char p = *phase, tmp; ··· 1266 1277 * valid 1267 1278 */ 1268 1279 1269 - if (NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, 1270 - HZ * can_sleep) < 0) 1280 + if (NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ | SR_BSY, 1281 + SR_REQ | SR_BSY, HZ * can_sleep) < 0) 1271 1282 break; 1272 1283 1273 1284 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ asserted\n"); ··· 1318 1329 1319 1330 dsprintk(NDEBUG_HANDSHAKE, instance, "REQ negated, handshake complete\n"); 1320 1331 1321 - /* 1322 - * We have several special cases to consider during REQ/ACK handshaking : 1323 - * 1. We were in MSGOUT phase, and we are on the last byte of the 1324 - * message. ATN must be dropped as ACK is dropped. 1325 - * 1326 - * 2. We are in a MSGIN phase, and we are on the last byte of the 1327 - * message. We must exit with ACK asserted, so that the calling 1328 - * code may raise ATN before dropping ACK to reject the message. 1329 - * 1330 - * 3. ACK and ATN are clear and the target may proceed as normal. 1331 - */ 1332 + /* 1333 + * We have several special cases to consider during REQ/ACK 1334 + * handshaking: 1335 + * 1336 + * 1. We were in MSGOUT phase, and we are on the last byte of 1337 + * the message. ATN must be dropped as ACK is dropped. 1338 + * 1339 + * 2. We are in MSGIN phase, and we are on the last byte of the 1340 + * message. We must exit with ACK asserted, so that the calling 1341 + * code may raise ATN before dropping ACK to reject the message. 1342 + * 1343 + * 3. ACK and ATN are clear & the target may proceed as normal. 1344 + */ 1332 1345 if (!(p == PHASE_MSGIN && c == 1)) { 1333 1346 if (p == PHASE_MSGOUT && c > 1) 1334 1347 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); ··· 1352 1361 *phase = tmp & PHASE_MASK; 1353 1362 else 1354 1363 *phase = PHASE_UNKNOWN; 1355 - 1356 - if (!c || (*phase == p)) 1357 - return 0; 1358 - else 1359 - return -1; 1360 1364 } 1361 1365 1362 1366 /** ··· 1471 1485 unsigned char **data) 1472 1486 { 1473 1487 struct NCR5380_hostdata *hostdata = shost_priv(instance); 1488 + struct NCR5380_cmd *ncmd = NCR5380_to_ncmd(hostdata->connected); 1474 1489 int c = *count; 1475 1490 unsigned char p = *phase; 1476 1491 unsigned char *d = *data; ··· 1483 1496 return -1; 1484 1497 } 1485 1498 1486 - NCR5380_to_ncmd(hostdata->connected)->phase = p; 1499 + ncmd->phase = p; 1487 1500 1488 1501 if (p & SR_IO) { 1489 1502 if (hostdata->read_overruns) ··· 1561 1574 /* The result is zero iff pseudo DMA send/receive was completed. */ 1562 1575 hostdata->dma_len = c; 1563 1576 1564 - /* 1565 - * A note regarding the DMA errata workarounds for early NMOS silicon. 1566 - * 1567 - * For DMA sends, we want to wait until the last byte has been 1568 - * transferred out over the bus before we turn off DMA mode. Alas, there 1569 - * seems to be no terribly good way of doing this on a 5380 under all 1570 - * conditions. For non-scatter-gather operations, we can wait until REQ 1571 - * and ACK both go false, or until a phase mismatch occurs. Gather-sends 1572 - * are nastier, since the device will be expecting more data than we 1573 - * are prepared to send it, and REQ will remain asserted. On a 53C8[01] we 1574 - * could test Last Byte Sent to assure transfer (I imagine this is precisely 1575 - * why this signal was added to the newer chips) but on the older 538[01] 1576 - * this signal does not exist. The workaround for this lack is a watchdog; 1577 - * we bail out of the wait-loop after a modest amount of wait-time if 1578 - * the usual exit conditions are not met. Not a terribly clean or 1579 - * correct solution :-% 1580 - * 1581 - * DMA receive is equally tricky due to a nasty characteristic of the NCR5380. 1582 - * If the chip is in DMA receive mode, it will respond to a target's 1583 - * REQ by latching the SCSI data into the INPUT DATA register and asserting 1584 - * ACK, even if it has _already_ been notified by the DMA controller that 1585 - * the current DMA transfer has completed! If the NCR5380 is then taken 1586 - * out of DMA mode, this already-acknowledged byte is lost. This is 1587 - * not a problem for "one DMA transfer per READ command", because 1588 - * the situation will never arise... either all of the data is DMA'ed 1589 - * properly, or the target switches to MESSAGE IN phase to signal a 1590 - * disconnection (either operation bringing the DMA to a clean halt). 1591 - * However, in order to handle scatter-receive, we must work around the 1592 - * problem. The chosen fix is to DMA fewer bytes, then check for the 1593 - * condition before taking the NCR5380 out of DMA mode. One or two extra 1594 - * bytes are transferred via PIO as necessary to fill out the original 1595 - * request. 1596 - */ 1577 + /* 1578 + * A note regarding the DMA errata workarounds for early NMOS silicon. 1579 + * 1580 + * For DMA sends, we want to wait until the last byte has been 1581 + * transferred out over the bus before we turn off DMA mode. Alas, there 1582 + * seems to be no terribly good way of doing this on a 5380 under all 1583 + * conditions. For non-scatter-gather operations, we can wait until REQ 1584 + * and ACK both go false, or until a phase mismatch occurs. Gather-sends 1585 + * are nastier, since the device will be expecting more data than we 1586 + * are prepared to send it, and REQ will remain asserted. On a 53C8[01] 1587 + * we could test Last Byte Sent to assure transfer (I imagine this is 1588 + * precisely why this signal was added to the newer chips) but on the 1589 + * older 538[01] this signal does not exist. The workaround for this 1590 + * lack is a watchdog; we bail out of the wait-loop after a modest 1591 + * amount of wait-time if the usual exit conditions are not met. 1592 + * Not a terribly clean or correct solution :-% 1593 + * 1594 + * DMA receive is equally tricky due to a nasty characteristic of the 1595 + * NCR5380. If the chip is in DMA receive mode, it will respond to a 1596 + * target's REQ by latching the SCSI data into the INPUT DATA register 1597 + * and asserting ACK, even if it has _already_ been notified by the 1598 + * DMA controller that the current DMA transfer has completed! If the 1599 + * NCR5380 is then taken out of DMA mode, this already-acknowledged 1600 + * byte is lost. 1601 + * 1602 + * This is not a problem for "one DMA transfer per READ 1603 + * command", because the situation will never arise... either all of 1604 + * the data is DMA'ed properly, or the target switches to MESSAGE IN 1605 + * phase to signal a disconnection (either operation bringing the DMA 1606 + * to a clean halt). However, in order to handle scatter-receive, we 1607 + * must work around the problem. The chosen fix is to DMA fewer bytes, 1608 + * then check for the condition before taking the NCR5380 out of DMA 1609 + * mode. One or two extra bytes are transferred via PIO as necessary 1610 + * to fill out the original request. 1611 + */ 1597 1612 1598 - if (hostdata->flags & FLAG_DMA_FIXUP) { 1599 - if (p & SR_IO) { 1600 - /* 1601 - * The workaround was to transfer fewer bytes than we 1602 - * intended to with the pseudo-DMA read function, wait for 1603 - * the chip to latch the last byte, read it, and then disable 1604 - * pseudo-DMA mode. 1605 - * 1606 - * After REQ is asserted, the NCR5380 asserts DRQ and ACK. 1607 - * REQ is deasserted when ACK is asserted, and not reasserted 1608 - * until ACK goes false. Since the NCR5380 won't lower ACK 1609 - * until DACK is asserted, which won't happen unless we twiddle 1610 - * the DMA port or we take the NCR5380 out of DMA mode, we 1611 - * can guarantee that we won't handshake another extra 1612 - * byte. 1613 - */ 1614 - 1615 - if (NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, 1616 - BASR_DRQ, BASR_DRQ, 0) < 0) { 1617 - result = -1; 1618 - shost_printk(KERN_ERR, instance, "PDMA read: DRQ timeout\n"); 1613 + if ((hostdata->flags & FLAG_DMA_FIXUP) && 1614 + (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) { 1615 + /* 1616 + * The workaround was to transfer fewer bytes than we 1617 + * intended to with the pseudo-DMA receive function, wait for 1618 + * the chip to latch the last byte, read it, and then disable 1619 + * DMA mode. 1620 + * 1621 + * After REQ is asserted, the NCR5380 asserts DRQ and ACK. 1622 + * REQ is deasserted when ACK is asserted, and not reasserted 1623 + * until ACK goes false. Since the NCR5380 won't lower ACK 1624 + * until DACK is asserted, which won't happen unless we twiddle 1625 + * the DMA port or we take the NCR5380 out of DMA mode, we 1626 + * can guarantee that we won't handshake another extra 1627 + * byte. 1628 + * 1629 + * If sending, wait for the last byte to be sent. If REQ is 1630 + * being asserted for the byte we're interested, we'll ACK it 1631 + * and it will go false. 1632 + */ 1633 + if (!NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, 1634 + BASR_DRQ, BASR_DRQ, 0)) { 1635 + if ((p & SR_IO) && 1636 + (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) { 1637 + if (!NCR5380_poll_politely(hostdata, STATUS_REG, 1638 + SR_REQ, 0, 0)) { 1639 + d[c] = NCR5380_read(INPUT_DATA_REG); 1640 + --ncmd->this_residual; 1641 + } else { 1642 + result = -1; 1643 + scmd_printk(KERN_ERR, hostdata->connected, 1644 + "PDMA fixup: !REQ timeout\n"); 1645 + } 1619 1646 } 1620 - if (NCR5380_poll_politely(hostdata, STATUS_REG, 1621 - SR_REQ, 0, 0) < 0) { 1622 - result = -1; 1623 - shost_printk(KERN_ERR, instance, "PDMA read: !REQ timeout\n"); 1624 - } 1625 - d[*count - 1] = NCR5380_read(INPUT_DATA_REG); 1626 - } else { 1627 - /* 1628 - * Wait for the last byte to be sent. If REQ is being asserted for 1629 - * the byte we're interested, we'll ACK it and it will go false. 1630 - */ 1631 - if (NCR5380_poll_politely2(hostdata, 1632 - BUS_AND_STATUS_REG, BASR_DRQ, BASR_DRQ, 1633 - BUS_AND_STATUS_REG, BASR_PHASE_MATCH, 0, 0) < 0) { 1634 - result = -1; 1635 - shost_printk(KERN_ERR, instance, "PDMA write: DRQ and phase timeout\n"); 1636 - } 1647 + } else if (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH) { 1648 + result = -1; 1649 + scmd_printk(KERN_ERR, hostdata->connected, 1650 + "PDMA fixup: DRQ timeout\n"); 1637 1651 } 1638 1652 } 1639 1653 ··· 1654 1666 * Side effects : SCSI things happen, the disconnected queue will be 1655 1667 * modified if a command disconnects, *instance->connected will 1656 1668 * change. 1657 - * 1658 - * XXX Note : we need to watch for bus free or a reset condition here 1659 - * to recover from an unexpected bus free condition. 1660 1669 */ 1661 1670 1662 1671 static void NCR5380_information_transfer(struct Scsi_Host *instance) ··· 1792 1807 return; 1793 1808 case PHASE_MSGIN: 1794 1809 len = 1; 1810 + tmp = 0xff; 1795 1811 data = &tmp; 1796 1812 NCR5380_transfer_pio(instance, &phase, &len, &data, 0); 1797 - ncmd->message = tmp; 1813 + if (tmp == 0xff) 1814 + break; 1798 1815 1799 1816 switch (tmp) { 1800 1817 case ABORT: ··· 1983 1996 break; 1984 1997 case PHASE_STATIN: 1985 1998 len = 1; 1999 + tmp = ncmd->status; 1986 2000 data = &tmp; 1987 2001 NCR5380_transfer_pio(instance, &phase, &len, &data, 0); 1988 2002 ncmd->status = tmp; ··· 1993 2005 NCR5380_dprint(NDEBUG_ANY, instance); 1994 2006 } /* switch(phase) */ 1995 2007 } else { 2008 + int err; 2009 + 1996 2010 spin_unlock_irq(&hostdata->lock); 1997 - NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, HZ); 2011 + err = NCR5380_poll_politely(hostdata, STATUS_REG, 2012 + SR_REQ, SR_REQ, HZ); 1998 2013 spin_lock_irq(&hostdata->lock); 2014 + 2015 + if (err < 0 && hostdata->connected && 2016 + !(NCR5380_read(STATUS_REG) & SR_BSY)) { 2017 + scmd_printk(KERN_ERR, hostdata->connected, 2018 + "BSY signal lost\n"); 2019 + do_reset(instance); 2020 + bus_reset_cleanup(instance); 2021 + } 1999 2022 } 2000 2023 } 2001 2024 }
+10 -10
drivers/scsi/NCR5380.h
··· 3 3 * NCR 5380 defines 4 4 * 5 5 * Copyright 1993, Drew Eckhardt 6 - * Visionary Computing 7 - * (Unix consulting and custom programming) 8 - * drew@colorado.edu 9 - * +1 (303) 666-5836 6 + * Visionary Computing 7 + * (Unix consulting and custom programming) 8 + * drew@colorado.edu 9 + * +1 (303) 666-5836 10 10 * 11 11 * For more information, please consult 12 12 * ··· 78 78 #define ICR_DIFF_ENABLE 0x20 /* wo Set to enable diff. drivers */ 79 79 #define ICR_ASSERT_ACK 0x10 /* rw ini Set to assert ACK */ 80 80 #define ICR_ASSERT_BSY 0x08 /* rw Set to assert BSY */ 81 - #define ICR_ASSERT_SEL 0x04 /* rw Set to assert SEL */ 81 + #define ICR_ASSERT_SEL 0x04 /* rw Set to assert SEL */ 82 82 #define ICR_ASSERT_ATN 0x02 /* rw Set to assert ATN */ 83 83 #define ICR_ASSERT_DATA 0x01 /* rw SCSI_DATA_REG is asserted */ 84 84 ··· 135 135 #define BASR_IRQ 0x10 /* ro mirror of IRQ pin */ 136 136 #define BASR_PHASE_MATCH 0x08 /* ro Set when MSG CD IO match TCR */ 137 137 #define BASR_BUSY_ERROR 0x04 /* ro Unexpected change to inactive state */ 138 - #define BASR_ATN 0x02 /* ro BUS status */ 138 + #define BASR_ATN 0x02 /* ro BUS status */ 139 139 #define BASR_ACK 0x01 /* ro BUS status */ 140 140 141 141 /* Write any value to this register to start a DMA send */ ··· 170 170 #define CSR_BASE CSR_53C80_INTR 171 171 172 172 /* Note : PHASE_* macros are based on the values of the STATUS register */ 173 - #define PHASE_MASK (SR_MSG | SR_CD | SR_IO) 173 + #define PHASE_MASK (SR_MSG | SR_CD | SR_IO) 174 174 175 175 #define PHASE_DATAOUT 0 176 176 #define PHASE_DATAIN SR_IO ··· 231 231 int this_residual; 232 232 struct scatterlist *buffer; 233 233 int status; 234 - int message; 235 234 int phase; 236 235 struct list_head list; 237 236 }; ··· 285 286 static void NCR5380_reselect(struct Scsi_Host *instance); 286 287 static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *); 287 288 static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); 288 - static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data, 289 - unsigned int can_sleep); 289 + static void NCR5380_transfer_pio(struct Scsi_Host *instance, 290 + unsigned char *phase, int *count, 291 + unsigned char **data, unsigned int can_sleep); 290 292 static int NCR5380_poll_politely2(struct NCR5380_hostdata *, 291 293 unsigned int, u8, u8, 292 294 unsigned int, u8, u8, unsigned long);
+13 -15
drivers/scsi/aacraid/aachba.c
··· 1267 1267 return ret; 1268 1268 command = ContainerRawIo; 1269 1269 fibsize = sizeof(struct aac_raw_io) + 1270 - ((le32_to_cpu(readcmd->sg.count)-1) * sizeof(struct sgentryraw)); 1270 + (le32_to_cpu(readcmd->sg.count) * sizeof(struct sgentryraw)); 1271 1271 } 1272 1272 1273 1273 BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); ··· 1302 1302 if (ret < 0) 1303 1303 return ret; 1304 1304 fibsize = sizeof(struct aac_read64) + 1305 - ((le32_to_cpu(readcmd->sg.count) - 1) * 1305 + (le32_to_cpu(readcmd->sg.count) * 1306 1306 sizeof (struct sgentry64)); 1307 1307 BUG_ON (fibsize > (fib->dev->max_fib_size - 1308 1308 sizeof(struct aac_fibhdr))); ··· 1337 1337 if (ret < 0) 1338 1338 return ret; 1339 1339 fibsize = sizeof(struct aac_read) + 1340 - ((le32_to_cpu(readcmd->sg.count) - 1) * 1340 + (le32_to_cpu(readcmd->sg.count) * 1341 1341 sizeof (struct sgentry)); 1342 1342 BUG_ON (fibsize > (fib->dev->max_fib_size - 1343 1343 sizeof(struct aac_fibhdr))); ··· 1401 1401 return ret; 1402 1402 command = ContainerRawIo; 1403 1403 fibsize = sizeof(struct aac_raw_io) + 1404 - ((le32_to_cpu(writecmd->sg.count)-1) * sizeof (struct sgentryraw)); 1404 + (le32_to_cpu(writecmd->sg.count) * sizeof(struct sgentryraw)); 1405 1405 } 1406 1406 1407 1407 BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); ··· 1436 1436 if (ret < 0) 1437 1437 return ret; 1438 1438 fibsize = sizeof(struct aac_write64) + 1439 - ((le32_to_cpu(writecmd->sg.count) - 1) * 1439 + (le32_to_cpu(writecmd->sg.count) * 1440 1440 sizeof (struct sgentry64)); 1441 1441 BUG_ON (fibsize > (fib->dev->max_fib_size - 1442 1442 sizeof(struct aac_fibhdr))); ··· 1473 1473 if (ret < 0) 1474 1474 return ret; 1475 1475 fibsize = sizeof(struct aac_write) + 1476 - ((le32_to_cpu(writecmd->sg.count) - 1) * 1476 + (le32_to_cpu(writecmd->sg.count) * 1477 1477 sizeof (struct sgentry)); 1478 1478 BUG_ON (fibsize > (fib->dev->max_fib_size - 1479 1479 sizeof(struct aac_fibhdr))); ··· 1592 1592 /* 1593 1593 * Build Scatter/Gather list 1594 1594 */ 1595 - fibsize = sizeof (struct aac_srb) - sizeof (struct sgentry) + 1595 + fibsize = sizeof(struct aac_srb) + 1596 1596 ((le32_to_cpu(srbcmd->sg.count) & 0xff) * 1597 - sizeof (struct sgentry64)); 1597 + sizeof(struct sgentry64)); 1598 1598 BUG_ON (fibsize > (fib->dev->max_fib_size - 1599 1599 sizeof(struct aac_fibhdr))); 1600 1600 ··· 1624 1624 * Build Scatter/Gather list 1625 1625 */ 1626 1626 fibsize = sizeof (struct aac_srb) + 1627 - (((le32_to_cpu(srbcmd->sg.count) & 0xff) - 1) * 1627 + ((le32_to_cpu(srbcmd->sg.count) & 0xff) * 1628 1628 sizeof (struct sgentry)); 1629 1629 BUG_ON (fibsize > (fib->dev->max_fib_size - 1630 1630 sizeof(struct aac_fibhdr))); ··· 1693 1693 fibptr->hw_fib_va->header.XferState &= 1694 1694 ~cpu_to_le32(FastResponseCapable); 1695 1695 1696 - fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry) + 1697 - sizeof(struct sgentry64); 1696 + fibsize = sizeof(struct aac_srb) + sizeof(struct sgentry64); 1698 1697 1699 1698 /* allocate DMA buffer for response */ 1700 1699 addr = dma_map_single(&dev->pdev->dev, xfer_buf, xfer_len, ··· 1832 1833 struct aac_ciss_phys_luns_resp *phys_luns; 1833 1834 1834 1835 datasize = sizeof(struct aac_ciss_phys_luns_resp) + 1835 - (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun); 1836 + AAC_MAX_TARGETS * sizeof(struct _ciss_lun); 1836 1837 phys_luns = kmalloc(datasize, GFP_KERNEL); 1837 1838 if (phys_luns == NULL) 1838 1839 goto out; ··· 2266 2267 dev->a_ops.adapter_bounds = aac_bounds_32; 2267 2268 dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - 2268 2269 sizeof(struct aac_fibhdr) - 2269 - sizeof(struct aac_write) + sizeof(struct sgentry)) / 2270 + sizeof(struct aac_write)) / 2270 2271 sizeof(struct sgentry); 2271 2272 if (dev->dac_support) { 2272 2273 dev->a_ops.adapter_read = aac_read_block64; ··· 2277 2278 dev->scsi_host_ptr->sg_tablesize = 2278 2279 (dev->max_fib_size - 2279 2280 sizeof(struct aac_fibhdr) - 2280 - sizeof(struct aac_write64) + 2281 - sizeof(struct sgentry64)) / 2281 + sizeof(struct aac_write64)) / 2282 2282 sizeof(struct sgentry64); 2283 2283 } else { 2284 2284 dev->a_ops.adapter_read = aac_read_block;
+8 -13
drivers/scsi/aacraid/aacraid.h
··· 322 322 u8 level3[2]; 323 323 u8 level2[2]; 324 324 u8 node_ident[16]; /* phys. node identifier */ 325 - } lun[1]; /* List of phys. devices */ 325 + } lun[]; /* List of phys. devices */ 326 326 }; 327 327 328 328 /* ··· 507 507 508 508 struct sgmap { 509 509 __le32 count; 510 - struct sgentry sg[1]; 510 + struct sgentry sg[]; 511 511 }; 512 512 513 513 struct user_sgmap { 514 514 u32 count; 515 - struct user_sgentry sg[1]; 515 + struct user_sgentry sg[]; 516 516 }; 517 517 518 518 struct sgmap64 { 519 519 __le32 count; 520 - struct sgentry64 sg[1]; 520 + struct sgentry64 sg[]; 521 521 }; 522 522 523 523 struct user_sgmap64 { 524 524 u32 count; 525 - struct user_sgentry64 sg[1]; 525 + struct user_sgentry64 sg[]; 526 526 }; 527 527 528 528 struct sgmapraw { 529 529 __le32 count; 530 - struct sgentryraw sg[1]; 531 - }; 532 - 533 - struct user_sgmapraw { 534 - u32 count; 535 - struct user_sgentryraw sg[1]; 530 + struct sgentryraw sg[]; 536 531 }; 537 532 538 533 struct creation_info ··· 868 873 __le16 element_count; 869 874 __le16 comp_thresh; 870 875 __le16 unused; 871 - } rrq[1]; /* up to 64 RRQ addresses */ 876 + } rrq[] __counted_by_le(rr_queue_count); /* up to 64 RRQ addresses */ 872 877 } r8; 873 878 }; 874 879 ··· 2024 2029 }; 2025 2030 2026 2031 struct aac_srb_unit { 2027 - struct aac_srb srb; 2028 2032 struct aac_srb_reply srb_reply; 2033 + struct aac_srb srb; 2029 2034 }; 2030 2035 2031 2036 /*
+2 -2
drivers/scsi/aacraid/commctrl.c
··· 523 523 goto cleanup; 524 524 } 525 525 526 - if ((fibsize < (sizeof(struct user_aac_srb) - sizeof(struct user_sgentry))) || 526 + if ((fibsize < sizeof(struct user_aac_srb)) || 527 527 (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))) { 528 528 rcode = -EINVAL; 529 529 goto cleanup; ··· 561 561 rcode = -EINVAL; 562 562 goto cleanup; 563 563 } 564 - actual_fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry) + 564 + actual_fibsize = sizeof(struct aac_srb) + 565 565 ((user_srbcmd->sg.count & 0xff) * sizeof(struct sgentry)); 566 566 actual_fibsize64 = actual_fibsize + (user_srbcmd->sg.count & 0xff) * 567 567 (sizeof(struct sgentry64) - sizeof(struct sgentry));
+1 -2
drivers/scsi/aacraid/comminit.c
··· 522 522 spin_lock_init(&dev->iq_lock); 523 523 dev->max_fib_size = sizeof(struct hw_fib); 524 524 dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size 525 - - sizeof(struct aac_fibhdr) 526 - - sizeof(struct aac_write) + sizeof(struct sgentry)) 525 + - sizeof(struct aac_fibhdr) - sizeof(struct aac_write)) 527 526 / sizeof(struct sgentry); 528 527 dev->comm_interface = AAC_COMM_PRODUCER; 529 528 dev->raw_io_interface = dev->raw_io_64 = 0;
+3 -2
drivers/scsi/aacraid/commsup.c
··· 2327 2327 sg64->sg[0].addr[0] = cpu_to_le32((u32)(addr & 0xffffffff)); 2328 2328 sg64->sg[0].count = cpu_to_le32(datasize); 2329 2329 2330 - ret = aac_fib_send(ScsiPortCommand64, fibptr, sizeof(struct aac_srb), 2331 - FsaNormal, 1, 1, NULL, NULL); 2330 + ret = aac_fib_send(ScsiPortCommand64, fibptr, 2331 + sizeof(struct aac_srb) + sizeof(struct sgentry), 2332 + FsaNormal, 1, 1, NULL, NULL); 2332 2333 2333 2334 dma_free_coherent(&dev->pdev->dev, datasize, dma_buf, addr); 2334 2335
+1 -1
drivers/scsi/aacraid/src.c
··· 410 410 lower_32_bits(dev->init_pa), 411 411 upper_32_bits(dev->init_pa), 412 412 sizeof(struct _r8) + 413 - (AAC_MAX_HRRQ - 1) * sizeof(struct _rrq), 413 + AAC_MAX_HRRQ * sizeof(struct _rrq), 414 414 0, 0, 0, NULL, NULL, NULL, NULL, NULL); 415 415 } else { 416 416 init->r7.host_elapsed_seconds =
+2 -4
drivers/scsi/be2iscsi/be_main.c
··· 5528 5528 struct beiscsi_hba *phba = NULL; 5529 5529 struct be_eq_obj *pbe_eq; 5530 5530 unsigned int s_handle; 5531 - char wq_name[20]; 5532 5531 int ret, i; 5533 5532 5534 5533 ret = beiscsi_enable_pci(pcidev); ··· 5633 5634 5634 5635 phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0; 5635 5636 5636 - snprintf(wq_name, sizeof(wq_name), "beiscsi_%02x_wq", 5637 - phba->shost->host_no); 5638 - phba->wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, wq_name); 5637 + phba->wq = alloc_workqueue("beiscsi_%02x_wq", WQ_MEM_RECLAIM, 1, 5638 + phba->shost->host_no); 5639 5639 if (!phba->wq) { 5640 5640 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5641 5641 "BM_%d : beiscsi_dev_probe-"
+2 -3
drivers/scsi/bfa/bfad_im.c
··· 766 766 struct bfad_im_s *im = bfad->im; 767 767 768 768 bfa_trc(bfad, 0); 769 - snprintf(im->drv_workq_name, KOBJ_NAME_LEN, "bfad_wq_%d", 770 - bfad->inst_no); 771 - im->drv_workq = create_singlethread_workqueue(im->drv_workq_name); 769 + im->drv_workq = alloc_ordered_workqueue("bfad_wq_%d", WQ_MEM_RECLAIM, 770 + bfad->inst_no); 772 771 if (!im->drv_workq) 773 772 return BFA_STATUS_FAILED; 774 773
-1
drivers/scsi/bfa/bfad_im.h
··· 134 134 struct bfad_im_s { 135 135 struct bfad_s *bfad; 136 136 struct workqueue_struct *drv_workq; 137 - char drv_workq_name[KOBJ_NAME_LEN]; 138 137 struct work_struct aen_im_notify_work; 139 138 }; 140 139
-6
drivers/scsi/bnx2fc/bnx2fc.h
··· 358 358 dma_addr_t lcq_dma; 359 359 u32 lcq_mem_size; 360 360 361 - void *ofld_req[4]; 362 - dma_addr_t ofld_req_dma[4]; 363 - void *enbl_req; 364 - dma_addr_t enbl_req_dma; 365 - 366 361 spinlock_t tgt_lock; 367 362 spinlock_t cq_lock; 368 363 atomic_t num_active_ios; 369 364 u32 flush_in_prog; 370 365 unsigned long timestamp; 371 366 unsigned long retry_delay_timestamp; 372 - struct list_head free_task_list; 373 367 struct bnx2fc_cmd *pending_queue[BNX2FC_SQ_WQES_MAX+1]; 374 368 struct list_head active_cmd_queue; 375 369 struct list_head els_queue;
+2 -2
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
··· 2363 2363 interface->vlan_id = vlan_id; 2364 2364 interface->tm_timeout = BNX2FC_TM_TIMEOUT; 2365 2365 2366 - interface->timer_work_queue = 2367 - create_singlethread_workqueue("bnx2fc_timer_wq"); 2366 + interface->timer_work_queue = alloc_ordered_workqueue( 2367 + "%s", WQ_MEM_RECLAIM, "bnx2fc_timer_wq"); 2368 2368 if (!interface->timer_work_queue) { 2369 2369 printk(KERN_ERR PFX "ulp_init could not create timer_wq\n"); 2370 2370 rc = -EINVAL;
-11
drivers/scsi/bnx2i/bnx2i.h
··· 815 815 struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba, 816 816 u16 iscsi_cid); 817 817 818 - int bnx2i_alloc_ep_pool(void); 819 - void bnx2i_release_ep_pool(void); 820 - struct bnx2i_endpoint *bnx2i_ep_ofld_list_next(struct bnx2i_hba *hba); 821 - struct bnx2i_endpoint *bnx2i_ep_destroy_list_next(struct bnx2i_hba *hba); 822 - 823 818 struct bnx2i_hba *bnx2i_find_hba_for_cnic(struct cnic_dev *cnic); 824 819 825 820 struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic); ··· 863 868 extern int bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action); 864 869 865 870 extern int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep); 866 - 867 - /* Debug related function prototypes */ 868 - extern void bnx2i_print_pend_cmd_queue(struct bnx2i_conn *conn); 869 - extern void bnx2i_print_active_cmd_queue(struct bnx2i_conn *conn); 870 - extern void bnx2i_print_xmit_pdu_queue(struct bnx2i_conn *conn); 871 - extern void bnx2i_print_recv_state(struct bnx2i_conn *conn); 872 871 873 872 extern int bnx2i_percpu_io_thread(void *arg); 874 873 extern int bnx2i_process_scsi_cmd_resp(struct iscsi_session *session,
+2 -1
drivers/scsi/device_handler/scsi_dh_rdac.c
··· 822 822 /* 823 823 * Create workqueue to handle mode selects for rdac 824 824 */ 825 - kmpath_rdacd = create_singlethread_workqueue("kmpath_rdacd"); 825 + kmpath_rdacd = 826 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "kmpath_rdacd"); 826 827 if (!kmpath_rdacd) { 827 828 scsi_unregister_device_handler(&rdac_dh); 828 829 printk(KERN_ERR "kmpath_rdacd creation failed.\n");
+2 -1
drivers/scsi/elx/efct/efct_lio.c
··· 1114 1114 atomic_set(&efct->tgt_efct.watermark_hit, 0); 1115 1115 atomic_set(&efct->tgt_efct.initiator_count, 0); 1116 1116 1117 - lio_wq = create_singlethread_workqueue("efct_lio_worker"); 1117 + lio_wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, 1118 + "efct_lio_worker"); 1118 1119 if (!lio_wq) { 1119 1120 efc_log_err(efct, "workqueue create failed\n"); 1120 1121 return -EIO;
+1 -1
drivers/scsi/elx/libefc/efc_nport.c
··· 705 705 spin_lock_irqsave(&efc->lock, flags); 706 706 list_for_each_entry(nport, &domain->nport_list, list_entry) { 707 707 if (nport->wwpn == wwpn && nport->wwnn == wwnn) { 708 - kref_put(&nport->ref, nport->release); 709 708 /* Shutdown this NPORT */ 710 709 efc_sm_post_event(&nport->sm, EFC_EVT_SHUTDOWN, NULL); 710 + kref_put(&nport->ref, nport->release); 711 711 break; 712 712 } 713 713 }
-1
drivers/scsi/esas2r/esas2r.h
··· 929 929 struct list_head fw_event_list; 930 930 spinlock_t fw_event_lock; 931 931 u8 fw_events_off; /* if '1', then ignore events */ 932 - char fw_event_q_name[ESAS2R_KOBJ_NAME_LEN]; 933 932 /* 934 933 * intr_mode stores the interrupt mode currently being used by this 935 934 * adapter. it is based on the interrupt_mode module parameter, but
+2 -3
drivers/scsi/esas2r/esas2r_init.c
··· 311 311 sema_init(&a->nvram_semaphore, 1); 312 312 313 313 esas2r_fw_event_off(a); 314 - snprintf(a->fw_event_q_name, ESAS2R_KOBJ_NAME_LEN, "esas2r/%d", 315 - a->index); 316 - a->fw_event_q = create_singlethread_workqueue(a->fw_event_q_name); 314 + a->fw_event_q = 315 + alloc_ordered_workqueue("esas2r/%d", WQ_MEM_RECLAIM, a->index); 317 316 318 317 init_waitqueue_head(&a->buffered_ioctl_waiter); 319 318 init_waitqueue_head(&a->nvram_waiter);
+5 -13
drivers/scsi/fcoe/fcoe_sysfs.c
··· 45 45 */ 46 46 #define fcoe_ctlr_id(x) \ 47 47 ((x)->id) 48 - #define fcoe_ctlr_work_q_name(x) \ 49 - ((x)->work_q_name) 50 48 #define fcoe_ctlr_work_q(x) \ 51 49 ((x)->work_q) 52 - #define fcoe_ctlr_devloss_work_q_name(x) \ 53 - ((x)->devloss_work_q_name) 54 50 #define fcoe_ctlr_devloss_work_q(x) \ 55 51 ((x)->devloss_work_q) 56 52 #define fcoe_ctlr_mode(x) \ ··· 793 797 794 798 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; 795 799 796 - snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name), 797 - "ctlr_wq_%d", ctlr->id); 798 - ctlr->work_q = create_singlethread_workqueue( 799 - ctlr->work_q_name); 800 + ctlr->work_q = alloc_ordered_workqueue("ctlr_wq_%d", WQ_MEM_RECLAIM, 801 + ctlr->id); 800 802 if (!ctlr->work_q) 801 803 goto out_del; 802 804 803 - snprintf(ctlr->devloss_work_q_name, 804 - sizeof(ctlr->devloss_work_q_name), 805 - "ctlr_dl_wq_%d", ctlr->id); 806 - ctlr->devloss_work_q = create_singlethread_workqueue( 807 - ctlr->devloss_work_q_name); 805 + ctlr->devloss_work_q = alloc_ordered_workqueue("ctlr_dl_wq_%d", 806 + WQ_MEM_RECLAIM, 807 + ctlr->id); 808 808 if (!ctlr->devloss_work_q) 809 809 goto out_del_q; 810 810
+4 -2
drivers/scsi/fnic/fnic_main.c
··· 1161 1161 goto err_create_fnic_ioreq_slab; 1162 1162 } 1163 1163 1164 - fnic_event_queue = create_singlethread_workqueue("fnic_event_wq"); 1164 + fnic_event_queue = 1165 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fnic_event_wq"); 1165 1166 if (!fnic_event_queue) { 1166 1167 printk(KERN_ERR PFX "fnic work queue create failed\n"); 1167 1168 err = -ENOMEM; 1168 1169 goto err_create_fnic_workq; 1169 1170 } 1170 1171 1171 - fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); 1172 + fnic_fip_queue = 1173 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fnic_fip_q"); 1172 1174 if (!fnic_fip_queue) { 1173 1175 printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); 1174 1176 err = -ENOMEM;
+2 -1
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 2302 2302 2303 2303 hisi_hba->last_slot_index = 0; 2304 2304 2305 - hisi_hba->wq = create_singlethread_workqueue(dev_name(dev)); 2305 + hisi_hba->wq = 2306 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, dev_name(dev)); 2306 2307 if (!hisi_hba->wq) { 2307 2308 dev_err(dev, "sas_alloc: failed to create workqueue\n"); 2308 2309 goto err_out;
+4 -5
drivers/scsi/hosts.c
··· 292 292 } 293 293 294 294 if (shost->transportt->create_work_queue) { 295 - snprintf(shost->work_q_name, sizeof(shost->work_q_name), 296 - "scsi_wq_%d", shost->host_no); 297 - shost->work_q = alloc_workqueue("%s", 298 - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 299 - 1, shost->work_q_name); 295 + shost->work_q = alloc_workqueue( 296 + "scsi_wq_%d", 297 + WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 1, 298 + shost->host_no); 300 299 301 300 if (!shost->work_q) { 302 301 error = -EINVAL;
+2 -3
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
··· 3425 3425 struct scsi_info *vscsi; 3426 3426 int rc = 0; 3427 3427 long hrc = 0; 3428 - char wq_name[24]; 3429 3428 3430 3429 vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL); 3431 3430 if (!vscsi) { ··· 3535 3536 init_completion(&vscsi->wait_idle); 3536 3537 init_completion(&vscsi->unconfig); 3537 3538 3538 - snprintf(wq_name, 24, "ibmvscsis%s", dev_name(&vdev->dev)); 3539 - vscsi->work_q = create_workqueue(wq_name); 3539 + vscsi->work_q = alloc_workqueue("ibmvscsis%s", WQ_MEM_RECLAIM, 1, 3540 + dev_name(&vdev->dev)); 3540 3541 if (!vscsi->work_q) { 3541 3542 rc = -ENOMEM; 3542 3543 dev_err(&vscsi->dev, "create_workqueue failed\n");
+2 -2
drivers/scsi/ipr.h
··· 1030 1030 #define IPR_PATH_FAILED 0x03 1031 1031 1032 1032 __be16 num_entries; 1033 - struct ipr_hostrcb_config_element elem[1]; 1033 + struct ipr_hostrcb_config_element elem[]; 1034 1034 }__attribute__((packed, aligned (4))); 1035 1035 1036 1036 struct ipr_hostrcb64_fabric_desc { ··· 1044 1044 u8 res_path[8]; 1045 1045 u8 reserved3[6]; 1046 1046 __be16 num_entries; 1047 - struct ipr_hostrcb64_config_element elem[1]; 1047 + struct ipr_hostrcb64_config_element elem[]; 1048 1048 }__attribute__((packed, aligned (8))); 1049 1049 1050 1050 #define for_each_hrrq(hrrq, ioa_cfg) \
+2 -1
drivers/scsi/libfc/fc_exch.c
··· 2693 2693 fc_cpu_order = ilog2(roundup_pow_of_two(nr_cpu_ids)); 2694 2694 fc_cpu_mask = (1 << fc_cpu_order) - 1; 2695 2695 2696 - fc_exch_workqueue = create_singlethread_workqueue("fc_exch_workqueue"); 2696 + fc_exch_workqueue = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, 2697 + "fc_exch_workqueue"); 2697 2698 if (!fc_exch_workqueue) 2698 2699 goto err; 2699 2700 return 0;
+2 -1
drivers/scsi/libfc/fc_rport.c
··· 2263 2263 */ 2264 2264 int fc_setup_rport(void) 2265 2265 { 2266 - rport_event_queue = create_singlethread_workqueue("fc_rport_eq"); 2266 + rport_event_queue = 2267 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "fc_rport_eq"); 2267 2268 if (!rport_event_queue) 2268 2269 return -ENOMEM; 2269 2270 return 0;
+2 -2
drivers/scsi/libsas/sas_init.c
··· 122 122 123 123 error = -ENOMEM; 124 124 snprintf(name, sizeof(name), "%s_event_q", dev_name(sas_ha->dev)); 125 - sas_ha->event_q = create_singlethread_workqueue(name); 125 + sas_ha->event_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); 126 126 if (!sas_ha->event_q) 127 127 goto Undo_ports; 128 128 129 129 snprintf(name, sizeof(name), "%s_disco_q", dev_name(sas_ha->dev)); 130 - sas_ha->disco_q = create_singlethread_workqueue(name); 130 + sas_ha->disco_q = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); 131 131 if (!sas_ha->disco_q) 132 132 goto Undo_event_q; 133 133
+9 -3
drivers/scsi/lpfc/lpfc.h
··· 306 306 307 307 struct lpfc_hba; 308 308 309 + /* Data structure to keep withheld FLOGI_ACC information */ 310 + struct lpfc_defer_flogi_acc { 311 + bool flag; 312 + u16 rx_id; 313 + u16 ox_id; 314 + struct lpfc_nodelist *ndlp; 315 + 316 + }; 309 317 310 318 #define LPFC_VMID_TIMER 300 /* timer interval in seconds */ 311 319 ··· 1438 1430 uint16_t vlan_id; 1439 1431 struct list_head fcf_conn_rec_list; 1440 1432 1441 - bool defer_flogi_acc_flag; 1442 - uint16_t defer_flogi_acc_rx_id; 1443 - uint16_t defer_flogi_acc_ox_id; 1433 + struct lpfc_defer_flogi_acc defer_flogi_acc; 1444 1434 1445 1435 spinlock_t ct_ev_lock; /* synchronize access to ct_ev_waiters */ 1446 1436 struct list_head ct_ev_waiters;
+48 -31
drivers/scsi/lpfc/lpfc_els.c
··· 1099 1099 sp->cmn.priority_tagging, kref_read(&ndlp->kref)); 1100 1100 1101 1101 /* reinitialize the VMID datastructure before returning */ 1102 - if (lpfc_is_vmid_enabled(phba)) 1102 + if (lpfc_is_vmid_enabled(phba)) { 1103 1103 lpfc_reinit_vmid(vport); 1104 + vport->vmid_flag = 0; 1105 + } 1104 1106 if (sp->cmn.priority_tagging) 1105 1107 vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA | 1106 1108 LPFC_VMID_TYPE_PRIO); ··· 1392 1390 phba->link_flag &= ~LS_EXTERNAL_LOOPBACK; 1393 1391 1394 1392 /* Check for a deferred FLOGI ACC condition */ 1395 - if (phba->defer_flogi_acc_flag) { 1393 + if (phba->defer_flogi_acc.flag) { 1396 1394 /* lookup ndlp for received FLOGI */ 1397 1395 ndlp = lpfc_findnode_did(vport, 0); 1398 1396 if (!ndlp) ··· 1406 1404 if (phba->sli_rev == LPFC_SLI_REV4) { 1407 1405 bf_set(wqe_ctxt_tag, 1408 1406 &defer_flogi_acc.wqe.xmit_els_rsp.wqe_com, 1409 - phba->defer_flogi_acc_rx_id); 1407 + phba->defer_flogi_acc.rx_id); 1410 1408 bf_set(wqe_rcvoxid, 1411 1409 &defer_flogi_acc.wqe.xmit_els_rsp.wqe_com, 1412 - phba->defer_flogi_acc_ox_id); 1410 + phba->defer_flogi_acc.ox_id); 1413 1411 } else { 1414 1412 icmd = &defer_flogi_acc.iocb; 1415 - icmd->ulpContext = phba->defer_flogi_acc_rx_id; 1413 + icmd->ulpContext = phba->defer_flogi_acc.rx_id; 1416 1414 icmd->unsli3.rcvsli3.ox_id = 1417 - phba->defer_flogi_acc_ox_id; 1415 + phba->defer_flogi_acc.ox_id; 1418 1416 } 1419 1417 1420 1418 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 1421 1419 "3354 Xmit deferred FLOGI ACC: rx_id: x%x," 1422 1420 " ox_id: x%x, hba_flag x%lx\n", 1423 - phba->defer_flogi_acc_rx_id, 1424 - phba->defer_flogi_acc_ox_id, phba->hba_flag); 1421 + phba->defer_flogi_acc.rx_id, 1422 + phba->defer_flogi_acc.ox_id, phba->hba_flag); 1425 1423 1426 1424 /* Send deferred FLOGI ACC */ 1427 1425 lpfc_els_rsp_acc(vport, ELS_CMD_FLOGI, &defer_flogi_acc, 1428 1426 ndlp, NULL); 1429 1427 1430 - phba->defer_flogi_acc_flag = false; 1431 - vport->fc_myDID = did; 1428 + phba->defer_flogi_acc.flag = false; 1432 1429 1433 - /* Decrement ndlp reference count to indicate the node can be 1434 - * released when other references are removed. 1430 + /* Decrement the held ndlp that was incremented when the 1431 + * deferred flogi acc flag was set. 1435 1432 */ 1436 - lpfc_nlp_put(ndlp); 1433 + if (phba->defer_flogi_acc.ndlp) { 1434 + lpfc_nlp_put(phba->defer_flogi_acc.ndlp); 1435 + phba->defer_flogi_acc.ndlp = NULL; 1436 + } 1437 + 1438 + vport->fc_myDID = did; 1437 1439 } 1438 1440 1439 1441 return 0; ··· 5246 5240 /* ACC to LOGO completes to NPort <nlp_DID> */ 5247 5241 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 5248 5242 "0109 ACC to LOGO completes to NPort x%x refcnt %d " 5249 - "Data: x%x x%x x%x\n", 5250 - ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_flag, 5251 - ndlp->nlp_state, ndlp->nlp_rpi); 5243 + "last els x%x Data: x%x x%x x%x\n", 5244 + ndlp->nlp_DID, kref_read(&ndlp->kref), 5245 + ndlp->nlp_last_elscmd, ndlp->nlp_flag, ndlp->nlp_state, 5246 + ndlp->nlp_rpi); 5252 5247 5253 5248 /* This clause allows the LOGO ACC to complete and free resources 5254 5249 * for the Fabric Domain Controller. It does deliberately skip ··· 5261 5254 goto out; 5262 5255 5263 5256 if (ndlp->nlp_state == NLP_STE_NPR_NODE) { 5264 - /* If PLOGI is being retried, PLOGI completion will cleanup the 5265 - * node. The NLP_NPR_2B_DISC flag needs to be retained to make 5266 - * progress on nodes discovered from last RSCN. 5267 - */ 5268 - if ((ndlp->nlp_flag & NLP_DELAY_TMO) && 5269 - (ndlp->nlp_last_elscmd == ELS_CMD_PLOGI)) 5270 - goto out; 5271 - 5272 5257 if (ndlp->nlp_flag & NLP_RPI_REGISTERED) 5273 5258 lpfc_unreg_rpi(vport, ndlp); 5274 5259 5260 + /* If came from PRLO, then PRLO_ACC is done. 5261 + * Start rediscovery now. 5262 + */ 5263 + if (ndlp->nlp_last_elscmd == ELS_CMD_PRLO) { 5264 + spin_lock_irq(&ndlp->lock); 5265 + ndlp->nlp_flag |= NLP_NPR_2B_DISC; 5266 + spin_unlock_irq(&ndlp->lock); 5267 + ndlp->nlp_prev_state = ndlp->nlp_state; 5268 + lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 5269 + lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); 5270 + } 5275 5271 } 5272 + 5276 5273 out: 5277 5274 /* 5278 5275 * The driver received a LOGO from the rport and has ACK'd it. ··· 8465 8454 8466 8455 /* Defer ACC response until AFTER we issue a FLOGI */ 8467 8456 if (!test_bit(HBA_FLOGI_ISSUED, &phba->hba_flag)) { 8468 - phba->defer_flogi_acc_rx_id = bf_get(wqe_ctxt_tag, 8457 + phba->defer_flogi_acc.rx_id = bf_get(wqe_ctxt_tag, 8469 8458 &wqe->xmit_els_rsp.wqe_com); 8470 - phba->defer_flogi_acc_ox_id = bf_get(wqe_rcvoxid, 8459 + phba->defer_flogi_acc.ox_id = bf_get(wqe_rcvoxid, 8471 8460 &wqe->xmit_els_rsp.wqe_com); 8472 8461 8473 8462 vport->fc_myDID = did; ··· 8475 8464 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 8476 8465 "3344 Deferring FLOGI ACC: rx_id: x%x," 8477 8466 " ox_id: x%x, hba_flag x%lx\n", 8478 - phba->defer_flogi_acc_rx_id, 8479 - phba->defer_flogi_acc_ox_id, phba->hba_flag); 8467 + phba->defer_flogi_acc.rx_id, 8468 + phba->defer_flogi_acc.ox_id, phba->hba_flag); 8480 8469 8481 - phba->defer_flogi_acc_flag = true; 8470 + phba->defer_flogi_acc.flag = true; 8482 8471 8472 + /* This nlp_get is paired with nlp_puts that reset the 8473 + * defer_flogi_acc.flag back to false. We need to retain 8474 + * a kref on the ndlp until the deferred FLOGI ACC is 8475 + * processed or cancelled. 8476 + */ 8477 + phba->defer_flogi_acc.ndlp = lpfc_nlp_get(ndlp); 8483 8478 return 0; 8484 8479 } 8485 8480 ··· 10521 10504 10522 10505 lpfc_els_rcv_flogi(vport, elsiocb, ndlp); 10523 10506 /* retain node if our response is deferred */ 10524 - if (phba->defer_flogi_acc_flag) 10507 + if (phba->defer_flogi_acc.flag) 10525 10508 break; 10526 10509 if (newnode) 10527 10510 lpfc_disc_state_machine(vport, ndlp, NULL, ··· 10759 10742 rjt_exp = LSEXP_NOTHING_MORE; 10760 10743 10761 10744 /* Unknown ELS command <elsCmd> received from NPORT <did> */ 10762 - lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, 10745 + lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 10763 10746 "0115 Unknown ELS command x%x " 10764 10747 "received from NPORT x%x\n", cmd, did); 10765 10748 if (newnode)
+11 -3
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 175 175 ndlp->nlp_state, ndlp->fc4_xpt_flags); 176 176 177 177 /* Don't schedule a worker thread event if the vport is going down. */ 178 - if (test_bit(FC_UNLOADING, &vport->load_flag)) { 178 + if (test_bit(FC_UNLOADING, &vport->load_flag) || 179 + !test_bit(HBA_SETUP, &phba->hba_flag)) { 179 180 spin_lock_irqsave(&ndlp->lock, iflags); 180 181 ndlp->rport = NULL; 181 182 ··· 1255 1254 lpfc_scsi_dev_block(phba); 1256 1255 offline = pci_channel_offline(phba->pcidev); 1257 1256 1258 - phba->defer_flogi_acc_flag = false; 1257 + /* Decrement the held ndlp if there is a deferred flogi acc */ 1258 + if (phba->defer_flogi_acc.flag) { 1259 + if (phba->defer_flogi_acc.ndlp) { 1260 + lpfc_nlp_put(phba->defer_flogi_acc.ndlp); 1261 + phba->defer_flogi_acc.ndlp = NULL; 1262 + } 1263 + } 1264 + phba->defer_flogi_acc.flag = false; 1259 1265 1260 1266 /* Clear external loopback plug detected flag */ 1261 1267 phba->link_flag &= ~LS_EXTERNAL_LOOPBACK; ··· 1384 1376 (vport != phba->pport)) 1385 1377 return; 1386 1378 1387 - if (phba->defer_flogi_acc_flag) { 1379 + if (phba->defer_flogi_acc.flag) { 1388 1380 clear_bit(FC_ABORT_DISCOVERY, &vport->fc_flag); 1389 1381 clear_bit(FC_RSCN_MODE, &vport->fc_flag); 1390 1382 clear_bit(FC_NLP_MORE, &vport->fc_flag);
+20 -2
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 2652 2652 /* flush the target */ 2653 2653 lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); 2654 2654 2655 - /* Treat like rcv logo */ 2656 - lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); 2655 + /* Send PRLO_ACC */ 2656 + spin_lock_irq(&ndlp->lock); 2657 + ndlp->nlp_flag |= NLP_LOGO_ACC; 2658 + spin_unlock_irq(&ndlp->lock); 2659 + lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); 2660 + 2661 + /* Save ELS_CMD_PRLO as the last elscmd and then set to NPR. 2662 + * lpfc_cmpl_els_logo_acc is expected to restart discovery. 2663 + */ 2664 + ndlp->nlp_last_elscmd = ELS_CMD_PRLO; 2665 + ndlp->nlp_prev_state = ndlp->nlp_state; 2666 + 2667 + lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_ELS | LOG_DISCOVERY, 2668 + "3422 DID x%06x nflag x%x lastels x%x ref cnt %u\n", 2669 + ndlp->nlp_DID, ndlp->nlp_flag, 2670 + ndlp->nlp_last_elscmd, 2671 + kref_read(&ndlp->kref)); 2672 + 2673 + lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 2674 + 2657 2675 return ndlp->nlp_state; 2658 2676 } 2659 2677
+11 -2
drivers/scsi/lpfc/lpfc_scsi.c
··· 5555 5555 5556 5556 iocb = &lpfc_cmd->cur_iocbq; 5557 5557 if (phba->sli_rev == LPFC_SLI_REV4) { 5558 - pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring; 5559 - if (!pring_s4) { 5558 + /* if the io_wq & pring are gone, the port was reset. */ 5559 + if (!phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq || 5560 + !phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring) { 5561 + lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, 5562 + "2877 SCSI Layer I/O Abort Request " 5563 + "IO CMPL Status x%x ID %d LUN %llu " 5564 + "HBA_SETUP %d\n", FAILED, 5565 + cmnd->device->id, 5566 + (u64)cmnd->device->lun, 5567 + test_bit(HBA_SETUP, &phba->hba_flag)); 5560 5568 ret = FAILED; 5561 5569 goto out_unlock_hba; 5562 5570 } 5571 + pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring; 5563 5572 spin_lock(&pring_s4->ring_lock); 5564 5573 } 5565 5574 /* the command is in process of being cancelled */
+11 -2
drivers/scsi/lpfc/lpfc_sli.c
··· 4687 4687 /* Look on all the FCP Rings for the iotag */ 4688 4688 if (phba->sli_rev >= LPFC_SLI_REV4) { 4689 4689 for (i = 0; i < phba->cfg_hdw_queue; i++) { 4690 + if (!phba->sli4_hba.hdwq || 4691 + !phba->sli4_hba.hdwq[i].io_wq) { 4692 + lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 4693 + "7777 hdwq's deleted %lx " 4694 + "%lx %x %x\n", 4695 + phba->pport->load_flag, 4696 + phba->hba_flag, 4697 + phba->link_state, 4698 + phba->sli.sli_flag); 4699 + return; 4700 + } 4690 4701 pring = phba->sli4_hba.hdwq[i].io_wq->pring; 4691 4702 4692 4703 spin_lock_irq(&pring->ring_lock); ··· 12483 12472 lpfc_sli_prep_abort_xri(phba, abtsiocbp, ulp_context, iotag, 12484 12473 cmdiocb->iocb.ulpClass, 12485 12474 LPFC_WQE_CQ_ID_DEFAULT, ia, false); 12486 - 12487 - abtsiocbp->vport = vport; 12488 12475 12489 12476 /* ABTS WQE must go to the same WQ as the WQE to be aborted */ 12490 12477 abtsiocbp->hba_wqidx = cmdiocb->hba_wqidx;
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "14.4.0.3" 23 + #define LPFC_DRIVER_VERSION "14.4.0.4" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+1 -2
drivers/scsi/lpfc/lpfc_vmid.c
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 321 321 if (!hash_empty(vport->hash_table)) 322 322 hash_for_each_safe(vport->hash_table, bucket, tmp, cur, hnode) 323 323 hash_del(&cur->hnode); 324 - vport->vmid_flag = 0; 325 324 write_unlock(&vport->vmid_lock); 326 325 }
+90 -84
drivers/scsi/mac_scsi.c
··· 102 102 * Linux SCSI drivers lack knowledge of the timing behaviour of SCSI targets 103 103 * so bus errors are unavoidable. 104 104 * 105 - * If a MOVE.B instruction faults, we assume that zero bytes were transferred 106 - * and simply retry. That assumption probably depends on target behaviour but 107 - * seems to hold up okay. The NOP provides synchronization: without it the 108 - * fault can sometimes occur after the program counter has moved past the 109 - * offending instruction. Post-increment addressing can't be used. 105 + * If a MOVE.B instruction faults during a receive operation, we assume the 106 + * target sent nothing and try again. That assumption probably depends on 107 + * target firmware but it seems to hold up okay. If a fault happens during a 108 + * send operation, the target may or may not have seen /ACK and got the byte. 109 + * It's uncertain so the whole SCSI command gets retried. 110 + * 111 + * The NOP is needed for synchronization because the fault address in the 112 + * exception stack frame may or may not be the instruction that actually 113 + * caused the bus error. Post-increment addressing can't be used. 110 114 */ 111 115 112 116 #define MOVE_BYTE(operands) \ ··· 212 208 ".previous \n" \ 213 209 : "+a" (addr), "+r" (n), "+r" (result) : "a" (io)) 214 210 215 - #define MAC_PDMA_DELAY 32 216 - 217 211 static inline int mac_pdma_recv(void __iomem *io, unsigned char *start, int n) 218 212 { 219 213 unsigned char *addr = start; ··· 247 245 if (n >= 1) { 248 246 MOVE_BYTE("%0@,%3@"); 249 247 if (result) 250 - goto out; 248 + return -1; 251 249 } 252 250 if (n >= 1 && ((unsigned long)addr & 1)) { 253 251 MOVE_BYTE("%0@,%3@"); 254 252 if (result) 255 - goto out; 253 + return -2; 256 254 } 257 255 while (n >= 32) 258 256 MOVE_16_WORDS("%0@+,%3@"); 259 257 while (n >= 2) 260 258 MOVE_WORD("%0@+,%3@"); 261 259 if (result) 262 - return start - addr; /* Negated to indicate uncertain length */ 260 + return start - addr - 1; /* Negated to indicate uncertain length */ 263 261 if (n == 1) 264 262 MOVE_BYTE("%0@,%3@"); 265 - out: 266 263 return addr - start; 267 264 } 268 265 ··· 275 274 out_be32(hostdata->io + (CTRL_REG << 4), value); 276 275 } 277 276 277 + static inline int macscsi_wait_for_drq(struct NCR5380_hostdata *hostdata) 278 + { 279 + unsigned int n = 1; /* effectively multiplies NCR5380_REG_POLL_TIME */ 280 + unsigned char basr; 281 + 282 + again: 283 + basr = NCR5380_read(BUS_AND_STATUS_REG); 284 + 285 + if (!(basr & BASR_PHASE_MATCH)) 286 + return 1; 287 + 288 + if (basr & BASR_IRQ) 289 + return -1; 290 + 291 + if (basr & BASR_DRQ) 292 + return 0; 293 + 294 + if (n-- == 0) { 295 + NCR5380_dprint(NDEBUG_PSEUDO_DMA, hostdata->host); 296 + dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host, 297 + "%s: DRQ timeout\n", __func__); 298 + return -1; 299 + } 300 + 301 + NCR5380_poll_politely2(hostdata, 302 + BUS_AND_STATUS_REG, BASR_DRQ, BASR_DRQ, 303 + BUS_AND_STATUS_REG, BASR_PHASE_MATCH, 0, 0); 304 + goto again; 305 + } 306 + 278 307 static inline int macscsi_pread(struct NCR5380_hostdata *hostdata, 279 308 unsigned char *dst, int len) 280 309 { 281 310 u8 __iomem *s = hostdata->pdma_io + (INPUT_DATA_REG << 4); 282 311 unsigned char *d = dst; 283 - int result = 0; 284 312 285 313 hostdata->pdma_residual = len; 286 314 287 - while (!NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, 288 - BASR_DRQ | BASR_PHASE_MATCH, 289 - BASR_DRQ | BASR_PHASE_MATCH, 0)) { 290 - int bytes; 315 + while (macscsi_wait_for_drq(hostdata) == 0) { 316 + int bytes, chunk_bytes; 291 317 292 318 if (macintosh_config->ident == MAC_MODEL_IIFX) 293 319 write_ctrl_reg(hostdata, CTRL_HANDSHAKE_MODE | 294 320 CTRL_INTERRUPTS_ENABLE); 295 321 296 - bytes = mac_pdma_recv(s, d, min(hostdata->pdma_residual, 512)); 322 + chunk_bytes = min(hostdata->pdma_residual, 512); 323 + bytes = mac_pdma_recv(s, d, chunk_bytes); 324 + 325 + if (macintosh_config->ident == MAC_MODEL_IIFX) 326 + write_ctrl_reg(hostdata, CTRL_INTERRUPTS_ENABLE); 297 327 298 328 if (bytes > 0) { 299 329 d += bytes; ··· 332 300 } 333 301 334 302 if (hostdata->pdma_residual == 0) 335 - goto out; 303 + break; 336 304 337 - if (NCR5380_poll_politely2(hostdata, STATUS_REG, SR_REQ, SR_REQ, 338 - BUS_AND_STATUS_REG, BASR_ACK, 339 - BASR_ACK, 0) < 0) 340 - scmd_printk(KERN_DEBUG, hostdata->connected, 341 - "%s: !REQ and !ACK\n", __func__); 342 - if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) 343 - goto out; 344 - 345 - if (bytes == 0) 346 - udelay(MAC_PDMA_DELAY); 347 - 348 - if (bytes >= 0) 305 + if (bytes > 0) 349 306 continue; 350 307 351 - dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host, 352 - "%s: bus error (%d/%d)\n", __func__, d - dst, len); 353 308 NCR5380_dprint(NDEBUG_PSEUDO_DMA, hostdata->host); 354 - result = -1; 355 - goto out; 309 + dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host, 310 + "%s: bus error [%d/%d] (%d/%d)\n", 311 + __func__, d - dst, len, bytes, chunk_bytes); 312 + 313 + if (bytes == 0) 314 + continue; 315 + 316 + if (macscsi_wait_for_drq(hostdata) <= 0) 317 + set_host_byte(hostdata->connected, DID_ERROR); 318 + break; 356 319 } 357 320 358 - scmd_printk(KERN_ERR, hostdata->connected, 359 - "%s: phase mismatch or !DRQ\n", __func__); 360 - NCR5380_dprint(NDEBUG_PSEUDO_DMA, hostdata->host); 361 - result = -1; 362 - out: 363 - if (macintosh_config->ident == MAC_MODEL_IIFX) 364 - write_ctrl_reg(hostdata, CTRL_INTERRUPTS_ENABLE); 365 - return result; 321 + return 0; 366 322 } 367 323 368 324 static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata, ··· 358 338 { 359 339 unsigned char *s = src; 360 340 u8 __iomem *d = hostdata->pdma_io + (OUTPUT_DATA_REG << 4); 361 - int result = 0; 362 341 363 342 hostdata->pdma_residual = len; 364 343 365 - while (!NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, 366 - BASR_DRQ | BASR_PHASE_MATCH, 367 - BASR_DRQ | BASR_PHASE_MATCH, 0)) { 368 - int bytes; 344 + while (macscsi_wait_for_drq(hostdata) == 0) { 345 + int bytes, chunk_bytes; 369 346 370 347 if (macintosh_config->ident == MAC_MODEL_IIFX) 371 348 write_ctrl_reg(hostdata, CTRL_HANDSHAKE_MODE | 372 349 CTRL_INTERRUPTS_ENABLE); 373 350 374 - bytes = mac_pdma_send(s, d, min(hostdata->pdma_residual, 512)); 351 + chunk_bytes = min(hostdata->pdma_residual, 512); 352 + bytes = mac_pdma_send(s, d, chunk_bytes); 353 + 354 + if (macintosh_config->ident == MAC_MODEL_IIFX) 355 + write_ctrl_reg(hostdata, CTRL_INTERRUPTS_ENABLE); 375 356 376 357 if (bytes > 0) { 377 358 s += bytes; 378 359 hostdata->pdma_residual -= bytes; 379 360 } 380 361 381 - if (hostdata->pdma_residual == 0) { 382 - if (NCR5380_poll_politely(hostdata, TARGET_COMMAND_REG, 383 - TCR_LAST_BYTE_SENT, 384 - TCR_LAST_BYTE_SENT, 385 - 0) < 0) { 386 - scmd_printk(KERN_ERR, hostdata->connected, 387 - "%s: Last Byte Sent timeout\n", __func__); 388 - result = -1; 389 - } 390 - goto out; 391 - } 362 + if (hostdata->pdma_residual == 0) 363 + break; 392 364 393 - if (NCR5380_poll_politely2(hostdata, STATUS_REG, SR_REQ, SR_REQ, 394 - BUS_AND_STATUS_REG, BASR_ACK, 395 - BASR_ACK, 0) < 0) 396 - scmd_printk(KERN_DEBUG, hostdata->connected, 397 - "%s: !REQ and !ACK\n", __func__); 398 - if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) 399 - goto out; 400 - 401 - if (bytes == 0) 402 - udelay(MAC_PDMA_DELAY); 403 - 404 - if (bytes >= 0) 365 + if (bytes > 0) 405 366 continue; 406 367 407 - dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host, 408 - "%s: bus error (%d/%d)\n", __func__, s - src, len); 409 368 NCR5380_dprint(NDEBUG_PSEUDO_DMA, hostdata->host); 410 - result = -1; 411 - goto out; 369 + dsprintk(NDEBUG_PSEUDO_DMA, hostdata->host, 370 + "%s: bus error [%d/%d] (%d/%d)\n", 371 + __func__, s - src, len, bytes, chunk_bytes); 372 + 373 + if (bytes == 0) 374 + continue; 375 + 376 + if (macscsi_wait_for_drq(hostdata) <= 0) 377 + set_host_byte(hostdata->connected, DID_ERROR); 378 + break; 412 379 } 413 380 414 - scmd_printk(KERN_ERR, hostdata->connected, 415 - "%s: phase mismatch or !DRQ\n", __func__); 416 - NCR5380_dprint(NDEBUG_PSEUDO_DMA, hostdata->host); 417 - result = -1; 418 - out: 419 - if (macintosh_config->ident == MAC_MODEL_IIFX) 420 - write_ctrl_reg(hostdata, CTRL_INTERRUPTS_ENABLE); 421 - return result; 381 + return 0; 422 382 } 423 383 424 384 static int macscsi_dma_xfer_len(struct NCR5380_hostdata *hostdata, ··· 432 432 .eh_host_reset_handler = macscsi_host_reset, 433 433 .can_queue = 16, 434 434 .this_id = 7, 435 - .sg_tablesize = 1, 435 + .sg_tablesize = SG_ALL, 436 436 .cmd_per_lun = 2, 437 437 .dma_boundary = PAGE_SIZE - 1, 438 438 .cmd_size = sizeof(struct NCR5380_cmd), ··· 470 470 if (setup_hostid >= 0) 471 471 mac_scsi_template.this_id = setup_hostid & 7; 472 472 473 + if (macintosh_config->ident == MAC_MODEL_IIFX) 474 + mac_scsi_template.sg_tablesize = 1; 475 + 473 476 instance = scsi_host_alloc(&mac_scsi_template, 474 477 sizeof(struct NCR5380_hostdata)); 475 478 if (!instance) ··· 493 490 host_flags |= FLAG_NO_PSEUDO_DMA; 494 491 495 492 host_flags |= setup_toshiba_delay > 0 ? FLAG_TOSHIBA_DELAY : 0; 493 + 494 + if (instance->sg_tablesize > 1) 495 + host_flags |= FLAG_DMA_FIXUP; 496 496 497 497 error = NCR5380_init(instance, host_flags | FLAG_LATE_DMA_SETUP); 498 498 if (error)
+3 -3
drivers/scsi/megaraid/megaraid_sas.h
··· 814 814 __le32 size; 815 815 __le32 count; 816 816 __le32 reserved[2]; 817 - struct MR_HOST_DEVICE_LIST_ENTRY host_device_list[1]; 817 + struct MR_HOST_DEVICE_LIST_ENTRY host_device_list[] __counted_by_le(count); 818 818 } __packed; 819 819 820 820 #define HOST_DEVICE_LIST_SZ (sizeof(struct MR_HOST_DEVICE_LIST) + \ 821 821 (sizeof(struct MR_HOST_DEVICE_LIST_ENTRY) * \ 822 - (MEGASAS_MAX_PD + MAX_LOGICAL_DRIVES_EXT - 1))) 822 + (MEGASAS_MAX_PD + MAX_LOGICAL_DRIVES_EXT))) 823 823 824 824 825 825 /* ··· 2473 2473 union MR_LD_REF ref; 2474 2474 u8 ldVfCount; 2475 2475 u8 reserved[6]; 2476 - u8 policy[1]; 2476 + u8 policy[]; 2477 2477 }; 2478 2478 2479 2479 struct MR_LD_VF_AFFILIATION {
+2 -2
drivers/scsi/megaraid/megaraid_sas_fusion.c
··· 1988 1988 sizeof(instance->fault_handler_work_q_name), 1989 1989 "poll_megasas%d_status", instance->host->host_no); 1990 1990 1991 - instance->fw_fault_work_q = 1992 - create_singlethread_workqueue(instance->fault_handler_work_q_name); 1991 + instance->fw_fault_work_q = alloc_ordered_workqueue( 1992 + "%s", WQ_MEM_RECLAIM, instance->fault_handler_work_q_name); 1993 1993 if (!instance->fw_fault_work_q) { 1994 1994 dev_err(&instance->pdev->dev, "Failed from %s %d\n", 1995 1995 __func__, __LINE__);
+2 -8
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h
··· 1565 1565 __le32 reserved10; 1566 1566 }; 1567 1567 1568 - #ifndef MPI3_SAS_IO_UNIT0_PHY_MAX 1569 - #define MPI3_SAS_IO_UNIT0_PHY_MAX (1) 1570 - #endif 1571 1568 struct mpi3_sas_io_unit_page0 { 1572 1569 struct mpi3_config_page_header header; 1573 1570 __le32 reserved08; 1574 1571 u8 num_phys; 1575 1572 u8 init_status; 1576 1573 __le16 reserved0e; 1577 - struct mpi3_sas_io_unit0_phy_data phy_data[MPI3_SAS_IO_UNIT0_PHY_MAX]; 1574 + struct mpi3_sas_io_unit0_phy_data phy_data[]; 1578 1575 }; 1579 1576 1580 1577 #define MPI3_SASIOUNIT0_PAGEVERSION (0x00) ··· 1603 1606 __le32 reserved08; 1604 1607 }; 1605 1608 1606 - #ifndef MPI3_SAS_IO_UNIT1_PHY_MAX 1607 - #define MPI3_SAS_IO_UNIT1_PHY_MAX (1) 1608 - #endif 1609 1609 struct mpi3_sas_io_unit_page1 { 1610 1610 struct mpi3_config_page_header header; 1611 1611 __le16 control_flags; ··· 1612 1618 u8 num_phys; 1613 1619 u8 sata_max_q_depth; 1614 1620 __le16 reserved12; 1615 - struct mpi3_sas_io_unit1_phy_data phy_data[MPI3_SAS_IO_UNIT1_PHY_MAX]; 1621 + struct mpi3_sas_io_unit1_phy_data phy_data[]; 1616 1622 }; 1617 1623 1618 1624 #define MPI3_SASIOUNIT1_PAGEVERSION (0x00)
+2 -8
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h
··· 453 453 #define MPI3_EVENT_NOTIFY_PRIMITIVE_POWER_LOSS_EXPECTED (0x02) 454 454 #define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED1 (0x03) 455 455 #define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED2 (0x04) 456 - #ifndef MPI3_EVENT_SAS_TOPO_PHY_COUNT 457 - #define MPI3_EVENT_SAS_TOPO_PHY_COUNT (1) 458 - #endif 459 456 struct mpi3_event_sas_topo_phy_entry { 460 457 __le16 attached_dev_handle; 461 458 u8 link_rate; ··· 493 496 u8 start_phy_num; 494 497 u8 exp_status; 495 498 u8 io_unit_port; 496 - struct mpi3_event_sas_topo_phy_entry phy_entry[MPI3_EVENT_SAS_TOPO_PHY_COUNT]; 499 + struct mpi3_event_sas_topo_phy_entry phy_entry[] __counted_by(num_entries); 497 500 }; 498 501 499 502 #define MPI3_EVENT_SAS_TOPO_ES_NO_EXPANDER (0x00) ··· 542 545 #define MPI3_EVENT_PCIE_ENUM_ES_MAX_SWITCHES_EXCEED (0x40000000) 543 546 #define MPI3_EVENT_PCIE_ENUM_ES_MAX_DEVICES_EXCEED (0x20000000) 544 547 #define MPI3_EVENT_PCIE_ENUM_ES_RESOURCES_EXHAUSTED (0x10000000) 545 - #ifndef MPI3_EVENT_PCIE_TOPO_PORT_COUNT 546 - #define MPI3_EVENT_PCIE_TOPO_PORT_COUNT (1) 547 - #endif 548 548 struct mpi3_event_pcie_topo_port_entry { 549 549 __le16 attached_dev_handle; 550 550 u8 port_status; ··· 582 588 u8 switch_status; 583 589 u8 io_unit_port; 584 590 __le32 reserved0c; 585 - struct mpi3_event_pcie_topo_port_entry port_entry[MPI3_EVENT_PCIE_TOPO_PORT_COUNT]; 591 + struct mpi3_event_pcie_topo_port_entry port_entry[] __counted_by(num_entries); 586 592 }; 587 593 588 594 #define MPI3_EVENT_PCIE_TOPO_SS_NO_PCIE_SWITCH (0x00)
+3 -4
drivers/scsi/mpi3mr/mpi3mr.h
··· 57 57 extern int prot_mask; 58 58 extern atomic64_t event_counter; 59 59 60 - #define MPI3MR_DRIVER_VERSION "8.9.1.0.51" 61 - #define MPI3MR_DRIVER_RELDATE "29-May-2024" 60 + #define MPI3MR_DRIVER_VERSION "8.10.0.5.50" 61 + #define MPI3MR_DRIVER_RELDATE "08-Aug-2024" 62 62 63 63 #define MPI3MR_DRIVER_NAME "mpi3mr" 64 64 #define MPI3MR_DRIVER_LICENSE "GPL" ··· 213 213 #define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_INDEX 0 214 214 #define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_DATA 1 215 215 216 + #define MPI3MR_THRESHOLD_REPLY_COUNT 100 216 217 217 218 /* SGE Flag definition */ 218 219 #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \ ··· 1060 1059 * @sbq_lock: Sense buffer queue lock 1061 1060 * @sbq_host_index: Sense buffer queuehost index 1062 1061 * @event_masks: Event mask bitmap 1063 - * @fwevt_worker_name: Firmware event worker thread name 1064 1062 * @fwevt_worker_thread: Firmware event worker thread 1065 1063 * @fwevt_lock: Firmware event lock 1066 1064 * @fwevt_list: Firmware event list ··· 1240 1240 u32 sbq_host_index; 1241 1241 u32 event_masks[MPI3_EVENT_NOTIFY_EVENTMASK_WORDS]; 1242 1242 1243 - char fwevt_worker_name[MPI3MR_NAME_LENGTH]; 1244 1243 struct workqueue_struct *fwevt_worker_thread; 1245 1244 spinlock_t fwevt_lock; 1246 1245 struct list_head fwevt_list;
+27 -9
drivers/scsi/mpi3mr/mpi3mr_fw.c
··· 345 345 { 346 346 u16 reply_desc_type, host_tag = 0; 347 347 u16 ioc_status = MPI3_IOCSTATUS_SUCCESS; 348 + u16 masked_ioc_status = MPI3_IOCSTATUS_SUCCESS; 348 349 u32 ioc_loginfo = 0, sense_count = 0; 349 350 struct mpi3_status_reply_descriptor *status_desc; 350 351 struct mpi3_address_reply_descriptor *addr_desc; ··· 367 366 if (ioc_status & 368 367 MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL) 369 368 ioc_loginfo = le32_to_cpu(status_desc->ioc_log_info); 370 - ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK; 371 - mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo); 369 + masked_ioc_status = ioc_status & MPI3_IOCSTATUS_STATUS_MASK; 370 + mpi3mr_reply_trigger(mrioc, masked_ioc_status, ioc_loginfo); 372 371 break; 373 372 case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY: 374 373 addr_desc = (struct mpi3_address_reply_descriptor *)reply_desc; ··· 381 380 if (ioc_status & 382 381 MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL) 383 382 ioc_loginfo = le32_to_cpu(def_reply->ioc_log_info); 384 - ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK; 383 + masked_ioc_status = ioc_status & MPI3_IOCSTATUS_STATUS_MASK; 385 384 if (def_reply->function == MPI3_FUNCTION_SCSI_IO) { 386 385 scsi_reply = (struct mpi3_scsi_io_reply *)def_reply; 387 386 sense_buf = mpi3mr_get_sensebuf_virt_addr(mrioc, ··· 394 393 sshdr.asc, sshdr.ascq); 395 394 } 396 395 } 397 - mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo); 396 + mpi3mr_reply_trigger(mrioc, masked_ioc_status, ioc_loginfo); 398 397 break; 399 398 case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS: 400 399 success_desc = (struct mpi3_success_reply_descriptor *)reply_desc; ··· 409 408 if (cmdptr->state & MPI3MR_CMD_PENDING) { 410 409 cmdptr->state |= MPI3MR_CMD_COMPLETE; 411 410 cmdptr->ioc_loginfo = ioc_loginfo; 412 - cmdptr->ioc_status = ioc_status; 411 + if (host_tag == MPI3MR_HOSTTAG_BSG_CMDS) 412 + cmdptr->ioc_status = ioc_status; 413 + else 414 + cmdptr->ioc_status = masked_ioc_status; 413 415 cmdptr->state &= ~MPI3MR_CMD_PENDING; 414 416 if (def_reply) { 415 417 cmdptr->state |= MPI3MR_CMD_REPLY_VALID; ··· 443 439 u32 admin_reply_ci = mrioc->admin_reply_ci; 444 440 u32 num_admin_replies = 0; 445 441 u64 reply_dma = 0; 442 + u16 threshold_comps = 0; 446 443 struct mpi3_default_reply_descriptor *reply_desc; 447 444 448 445 if (!atomic_add_unless(&mrioc->admin_reply_q_in_use, 1, 1)) ··· 467 462 if (reply_dma) 468 463 mpi3mr_repost_reply_buf(mrioc, reply_dma); 469 464 num_admin_replies++; 465 + threshold_comps++; 470 466 if (++admin_reply_ci == mrioc->num_admin_replies) { 471 467 admin_reply_ci = 0; 472 468 exp_phase ^= 1; ··· 478 472 if ((le16_to_cpu(reply_desc->reply_flags) & 479 473 MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase) 480 474 break; 475 + if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) { 476 + writel(admin_reply_ci, 477 + &mrioc->sysif_regs->admin_reply_queue_ci); 478 + threshold_comps = 0; 479 + } 481 480 } while (1); 482 481 483 482 writel(admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci); ··· 536 525 u32 num_op_reply = 0; 537 526 u64 reply_dma = 0; 538 527 struct mpi3_default_reply_descriptor *reply_desc; 539 - u16 req_q_idx = 0, reply_qidx; 528 + u16 req_q_idx = 0, reply_qidx, threshold_comps = 0; 540 529 541 530 reply_qidx = op_reply_q->qid - 1; 542 531 ··· 567 556 if (reply_dma) 568 557 mpi3mr_repost_reply_buf(mrioc, reply_dma); 569 558 num_op_reply++; 559 + threshold_comps++; 570 560 571 561 if (++reply_ci == op_reply_q->num_replies) { 572 562 reply_ci = 0; ··· 589 577 break; 590 578 } 591 579 #endif 580 + if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) { 581 + writel(reply_ci, 582 + &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index); 583 + atomic_sub(threshold_comps, &op_reply_q->pend_ios); 584 + threshold_comps = 0; 585 + } 592 586 } while (1); 593 587 594 588 writel(reply_ci, 595 589 &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index); 596 590 op_reply_q->ci = reply_ci; 597 591 op_reply_q->ephase = exp_phase; 598 - 592 + atomic_sub(threshold_comps, &op_reply_q->pend_ios); 599 593 atomic_dec(&op_reply_q->in_use); 600 594 return num_op_reply; 601 595 } ··· 2760 2742 snprintf(mrioc->watchdog_work_q_name, 2761 2743 sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name, 2762 2744 mrioc->id); 2763 - mrioc->watchdog_work_q = 2764 - create_singlethread_workqueue(mrioc->watchdog_work_q_name); 2745 + mrioc->watchdog_work_q = alloc_ordered_workqueue( 2746 + "%s", WQ_MEM_RECLAIM, mrioc->watchdog_work_q_name); 2765 2747 if (!mrioc->watchdog_work_q) { 2766 2748 ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__); 2767 2749 return;
+1 -3
drivers/scsi/mpi3mr/mpi3mr_os.c
··· 5317 5317 else 5318 5318 scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); 5319 5319 5320 - snprintf(mrioc->fwevt_worker_name, sizeof(mrioc->fwevt_worker_name), 5321 - "%s%d_fwevt_wrkr", mrioc->driver_name, mrioc->id); 5322 5320 mrioc->fwevt_worker_thread = alloc_ordered_workqueue( 5323 - mrioc->fwevt_worker_name, 0); 5321 + "%s%d_fwevt_wrkr", 0, mrioc->driver_name, mrioc->id); 5324 5322 if (!mrioc->fwevt_worker_thread) { 5325 5323 ioc_err(mrioc, "failure at %s:%d/%s()!\n", 5326 5324 __FILE__, __LINE__, __func__);
+2 -2
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 846 846 snprintf(ioc->fault_reset_work_q_name, 847 847 sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status", 848 848 ioc->driver_name, ioc->id); 849 - ioc->fault_reset_work_q = 850 - create_singlethread_workqueue(ioc->fault_reset_work_q_name); 849 + ioc->fault_reset_work_q = alloc_ordered_workqueue( 850 + "%s", WQ_MEM_RECLAIM, ioc->fault_reset_work_q_name); 851 851 if (!ioc->fault_reset_work_q) { 852 852 ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__); 853 853 return;
+1 -3
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 1162 1162 * @fault_reset_work_q_name: fw fault work queue 1163 1163 * @fault_reset_work_q: "" 1164 1164 * @fault_reset_work: "" 1165 - * @firmware_event_name: fw event work queue 1166 - * @firmware_event_thread: "" 1165 + * @firmware_event_thread: fw event work queue 1167 1166 * @fw_event_lock: 1168 1167 * @fw_event_list: list of fw events 1169 1168 * @current_evet: current processing firmware event ··· 1350 1351 struct delayed_work fault_reset_work; 1351 1352 1352 1353 /* fw event handler */ 1353 - char firmware_event_name[20]; 1354 1354 struct workqueue_struct *firmware_event_thread; 1355 1355 spinlock_t fw_event_lock; 1356 1356 struct list_head fw_event_list;
+1 -3
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 12301 12301 scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); 12302 12302 12303 12303 /* event thread */ 12304 - snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), 12305 - "fw_event_%s%d", ioc->driver_name, ioc->id); 12306 12304 ioc->firmware_event_thread = alloc_ordered_workqueue( 12307 - ioc->firmware_event_name, 0); 12305 + "fw_event_%s%d", 0, ioc->driver_name, ioc->id); 12308 12306 if (!ioc->firmware_event_thread) { 12309 12307 ioc_err(ioc, "failure at %s:%d/%s()!\n", 12310 12308 __FILE__, __LINE__, __func__);
+2 -3
drivers/scsi/myrb.c
··· 112 112 return false; 113 113 } 114 114 115 - snprintf(cb->work_q_name, sizeof(cb->work_q_name), 116 - "myrb_wq_%d", cb->host->host_no); 117 - cb->work_q = create_singlethread_workqueue(cb->work_q_name); 115 + cb->work_q = alloc_ordered_workqueue("myrb_wq_%d", WQ_MEM_RECLAIM, 116 + cb->host->host_no); 118 117 if (!cb->work_q) { 119 118 dma_pool_destroy(cb->dcdb_pool); 120 119 cb->dcdb_pool = NULL;
-1
drivers/scsi/myrb.h
··· 712 712 struct Scsi_Host *host; 713 713 714 714 struct workqueue_struct *work_q; 715 - char work_q_name[20]; 716 715 struct delayed_work monitor_work; 717 716 unsigned long primary_monitor_time; 718 717 unsigned long secondary_monitor_time;
+2 -3
drivers/scsi/myrs.c
··· 2206 2206 return false; 2207 2207 } 2208 2208 2209 - snprintf(cs->work_q_name, sizeof(cs->work_q_name), 2210 - "myrs_wq_%d", shost->host_no); 2211 - cs->work_q = create_singlethread_workqueue(cs->work_q_name); 2209 + cs->work_q = alloc_ordered_workqueue("myrs_wq_%d", WQ_MEM_RECLAIM, 2210 + shost->host_no); 2212 2211 if (!cs->work_q) { 2213 2212 dma_pool_destroy(cs->dcdb_pool); 2214 2213 cs->dcdb_pool = NULL;
-1
drivers/scsi/myrs.h
··· 904 904 bool disable_enc_msg; 905 905 906 906 struct workqueue_struct *work_q; 907 - char work_q_name[20]; 908 907 struct delayed_work monitor_work; 909 908 unsigned long primary_monitor_time; 910 909 unsigned long secondary_monitor_time;
+9 -11
drivers/scsi/qedf/qedf_main.c
··· 3372 3372 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n", 3373 3373 qedf->io_mempool); 3374 3374 3375 - sprintf(host_buf, "qedf_%u_link", 3376 - qedf->lport->host->host_no); 3377 - qedf->link_update_wq = create_workqueue(host_buf); 3375 + qedf->link_update_wq = alloc_workqueue("qedf_%u_link", WQ_MEM_RECLAIM, 3376 + 1, qedf->lport->host->host_no); 3378 3377 INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update); 3379 3378 INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery); 3380 3379 INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump); ··· 3583 3584 ether_addr_copy(params.ll2_mac_address, qedf->mac); 3584 3585 3585 3586 /* Start LL2 processing thread */ 3586 - snprintf(host_buf, 20, "qedf_%d_ll2", host->host_no); 3587 - qedf->ll2_recv_wq = 3588 - create_workqueue(host_buf); 3587 + qedf->ll2_recv_wq = alloc_workqueue("qedf_%d_ll2", WQ_MEM_RECLAIM, 1, 3588 + host->host_no); 3589 3589 if (!qedf->ll2_recv_wq) { 3590 3590 QEDF_ERR(&(qedf->dbg_ctx), "Failed to LL2 workqueue.\n"); 3591 3591 rc = -ENOMEM; ··· 3625 3627 } 3626 3628 } 3627 3629 3628 - sprintf(host_buf, "qedf_%u_timer", qedf->lport->host->host_no); 3629 - qedf->timer_work_queue = 3630 - create_workqueue(host_buf); 3630 + qedf->timer_work_queue = alloc_workqueue("qedf_%u_timer", 3631 + WQ_MEM_RECLAIM, 1, qedf->lport->host->host_no); 3631 3632 if (!qedf->timer_work_queue) { 3632 3633 QEDF_ERR(&(qedf->dbg_ctx), "Failed to start timer " 3633 3634 "workqueue.\n"); ··· 3638 3641 if (mode != QEDF_MODE_RECOVERY) { 3639 3642 sprintf(host_buf, "qedf_%u_dpc", 3640 3643 qedf->lport->host->host_no); 3641 - qedf->dpc_wq = create_workqueue(host_buf); 3644 + qedf->dpc_wq = 3645 + alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, host_buf); 3642 3646 } 3643 3647 INIT_DELAYED_WORK(&qedf->recovery_work, qedf_recovery_handler); 3644 3648 ··· 4180 4182 goto err3; 4181 4183 } 4182 4184 4183 - qedf_io_wq = create_workqueue("qedf_io_wq"); 4185 + qedf_io_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, "qedf_io_wq"); 4184 4186 if (!qedf_io_wq) { 4185 4187 QEDF_ERR(NULL, "Could not create qedf_io_wq.\n"); 4186 4188 goto err4;
+5 -3
drivers/scsi/qedi/qedi_main.c
··· 2767 2767 } 2768 2768 2769 2769 sprintf(host_buf, "host_%d", qedi->shost->host_no); 2770 - qedi->tmf_thread = create_singlethread_workqueue(host_buf); 2770 + qedi->tmf_thread = 2771 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, host_buf); 2771 2772 if (!qedi->tmf_thread) { 2772 2773 QEDI_ERR(&qedi->dbg_ctx, 2773 2774 "Unable to start tmf thread!\n"); ··· 2776 2775 goto free_cid_que; 2777 2776 } 2778 2777 2779 - sprintf(host_buf, "qedi_ofld%d", qedi->shost->host_no); 2780 - qedi->offload_thread = create_workqueue(host_buf); 2778 + qedi->offload_thread = alloc_workqueue("qedi_ofld%d", 2779 + WQ_MEM_RECLAIM, 2780 + 1, qedi->shost->host_no); 2781 2781 if (!qedi->offload_thread) { 2782 2782 QEDI_ERR(&qedi->dbg_ctx, 2783 2783 "Unable to start offload thread!\n");
-1
drivers/scsi/qla2xxx/qla_def.h
··· 2621 2621 struct kref sess_kref; 2622 2622 struct qla_tgt *tgt; 2623 2623 unsigned long expires; 2624 - struct list_head del_list_entry; 2625 2624 struct work_struct free_work; 2626 2625 struct work_struct reg_work; 2627 2626 uint64_t jiffies_at_registration;
+4 -2
drivers/scsi/qla2xxx/qla_os.c
··· 3501 3501 3502 3502 if (IS_QLA8031(ha) || IS_MCTP_CAPABLE(ha)) { 3503 3503 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); 3504 - ha->dpc_lp_wq = create_singlethread_workqueue(wq_name); 3504 + ha->dpc_lp_wq = 3505 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name); 3505 3506 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); 3506 3507 3507 3508 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); 3508 - ha->dpc_hp_wq = create_singlethread_workqueue(wq_name); 3509 + ha->dpc_hp_wq = 3510 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, wq_name); 3509 3511 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); 3510 3512 INIT_WORK(&ha->idc_state_handler, 3511 3513 qla83xx_idc_state_handler_work);
+1 -1
drivers/scsi/qla4xxx/ql4_os.c
··· 8806 8806 DEBUG2(printk("scsi: %s: Starting kernel thread for " 8807 8807 "qla4xxx_dpc\n", __func__)); 8808 8808 sprintf(buf, "qla4xxx_%lu_dpc", ha->host_no); 8809 - ha->dpc_thread = create_singlethread_workqueue(buf); 8809 + ha->dpc_thread = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, buf); 8810 8810 if (!ha->dpc_thread) { 8811 8811 ql4_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n"); 8812 8812 ret = -ENODEV;
+3 -8
drivers/scsi/scsi_transport_fc.c
··· 441 441 fc_host->next_vport_number = 0; 442 442 fc_host->npiv_vports_inuse = 0; 443 443 444 - snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name), 445 - "fc_wq_%d", shost->host_no); 446 - fc_host->work_q = alloc_workqueue("%s", 0, 0, fc_host->work_q_name); 444 + fc_host->work_q = alloc_workqueue("fc_wq_%d", 0, 0, shost->host_no); 447 445 if (!fc_host->work_q) 448 446 return -ENOMEM; 449 447 450 448 fc_host->dev_loss_tmo = fc_dev_loss_tmo; 451 - snprintf(fc_host->devloss_work_q_name, 452 - sizeof(fc_host->devloss_work_q_name), 453 - "fc_dl_%d", shost->host_no); 454 - fc_host->devloss_work_q = alloc_workqueue("%s", 0, 0, 455 - fc_host->devloss_work_q_name); 449 + fc_host->devloss_work_q = alloc_workqueue("fc_dl_%d", 0, 0, 450 + shost->host_no); 456 451 if (!fc_host->devloss_work_q) { 457 452 destroy_workqueue(fc_host->work_q); 458 453 fc_host->work_q = NULL;
+1 -1
drivers/scsi/sd.c
··· 1382 1382 if (protect && sdkp->protection_type == T10_PI_TYPE2_PROTECTION) { 1383 1383 ret = sd_setup_rw32_cmnd(cmd, write, lba, nr_blocks, 1384 1384 protect | fua, dld); 1385 - } else if (rq->cmd_flags & REQ_ATOMIC && write) { 1385 + } else if (rq->cmd_flags & REQ_ATOMIC) { 1386 1386 ret = sd_setup_atomic_cmnd(cmd, lba, nr_blocks, 1387 1387 sdkp->use_atomic_write_boundary, 1388 1388 protect | fua);
+27 -12
drivers/scsi/smartpqi/smartpqi.h
··· 505 505 __le64 buffer_address; 506 506 __le32 buffer_length; 507 507 u8 reserved[40]; 508 - } ofa_memory_allocation; 508 + } host_memory_allocation; 509 509 } data; 510 510 }; 511 511 ··· 517 517 u8 reserved[2]; 518 518 }; 519 519 520 - #define PQI_VENDOR_GENERAL_CONFIG_TABLE_UPDATE 0 521 - #define PQI_VENDOR_GENERAL_HOST_MEMORY_UPDATE 1 520 + #define PQI_VENDOR_GENERAL_CONFIG_TABLE_UPDATE 0 521 + #define PQI_VENDOR_GENERAL_OFA_MEMORY_UPDATE 1 522 + #define PQI_VENDOR_GENERAL_CTRL_LOG_MEMORY_UPDATE 2 522 523 523 524 #define PQI_OFA_VERSION 1 524 525 #define PQI_OFA_SIGNATURE "OFA_QRM" 525 - #define PQI_OFA_MAX_SG_DESCRIPTORS 64 526 + #define PQI_CTRL_LOG_VERSION 1 527 + #define PQI_CTRL_LOG_SIGNATURE "FW_DATA" 528 + #define PQI_HOST_MAX_SG_DESCRIPTORS 64 526 529 527 - struct pqi_ofa_memory { 528 - __le64 signature; /* "OFA_QRM" */ 530 + struct pqi_host_memory { 531 + __le64 signature; /* "OFA_QRM", "FW_DATA", etc. */ 529 532 __le16 version; /* version of this struct (1 = 1st version) */ 530 533 u8 reserved[62]; 531 534 __le32 bytes_allocated; /* total allocated memory in bytes */ 532 535 __le16 num_memory_descriptors; 533 536 u8 reserved1[2]; 534 - struct pqi_sg_descriptor sg_descriptor[PQI_OFA_MAX_SG_DESCRIPTORS]; 537 + struct pqi_sg_descriptor sg_descriptor[PQI_HOST_MAX_SG_DESCRIPTORS]; 538 + }; 539 + 540 + struct pqi_host_memory_descriptor { 541 + struct pqi_host_memory *host_memory; 542 + dma_addr_t host_memory_dma_handle; 543 + void **host_chunk_virt_address; 535 544 }; 536 545 537 546 struct pqi_aio_error_info { ··· 876 867 #define PQI_FIRMWARE_FEATURE_FW_TRIAGE 17 877 868 #define PQI_FIRMWARE_FEATURE_RPL_EXTENDED_FORMAT_4_5 18 878 869 #define PQI_FIRMWARE_FEATURE_MULTI_LUN_DEVICE_SUPPORT 21 879 - #define PQI_FIRMWARE_FEATURE_MAXIMUM 21 870 + #define PQI_FIRMWARE_FEATURE_CTRL_LOGGING 22 871 + #define PQI_FIRMWARE_FEATURE_MAXIMUM 22 880 872 881 873 struct pqi_config_table_debug { 882 874 struct pqi_config_table_section_header header; ··· 1106 1096 u8 scsi_opcode; 1107 1097 }; 1108 1098 1099 + struct pqi_raid_io_stats { 1100 + u64 raid_bypass_cnt; 1101 + u64 write_stream_cnt; 1102 + }; 1103 + 1109 1104 struct pqi_scsi_dev { 1110 1105 int devtype; /* as reported by INQUIRY command */ 1111 1106 u8 device_type; /* as reported by */ ··· 1173 1158 1174 1159 struct pqi_stream_data stream_data[NUM_STREAMS_PER_LUN]; 1175 1160 atomic_t scsi_cmds_outstanding[PQI_MAX_LUNS_PER_DEVICE]; 1176 - unsigned int raid_bypass_cnt; 1161 + struct pqi_raid_io_stats __percpu *raid_io_stats; 1177 1162 1178 1163 struct pqi_tmf_work tmf_work[PQI_MAX_LUNS_PER_DEVICE]; 1179 1164 }; ··· 1372 1357 u8 firmware_triage_supported : 1; 1373 1358 u8 rpl_extended_format_4_5_supported : 1; 1374 1359 u8 multi_lun_device_supported : 1; 1360 + u8 ctrl_logging_supported : 1; 1375 1361 u8 enable_r1_writes : 1; 1376 1362 u8 enable_r5_writes : 1; 1377 1363 u8 enable_r6_writes : 1; ··· 1414 1398 wait_queue_head_t block_requests_wait; 1415 1399 1416 1400 struct mutex ofa_mutex; 1417 - struct pqi_ofa_memory *pqi_ofa_mem_virt_addr; 1418 - dma_addr_t pqi_ofa_mem_dma_handle; 1419 - void **pqi_ofa_chunk_virt_addr; 1420 1401 struct work_struct ofa_memory_alloc_work; 1421 1402 struct work_struct ofa_quiesce_work; 1422 1403 u32 ofa_bytes_requested; 1423 1404 u16 ofa_cancel_reason; 1405 + struct pqi_host_memory_descriptor ofa_memory; 1406 + struct pqi_host_memory_descriptor ctrl_log_memory; 1424 1407 enum pqi_ctrl_removal_state ctrl_removal_state; 1425 1408 }; 1426 1409
+451 -215
drivers/scsi/smartpqi/smartpqi_init.c
··· 33 33 #define BUILD_TIMESTAMP 34 34 #endif 35 35 36 - #define DRIVER_VERSION "2.1.26-030" 36 + #define DRIVER_VERSION "2.1.30-031" 37 37 #define DRIVER_MAJOR 2 38 38 #define DRIVER_MINOR 1 39 - #define DRIVER_RELEASE 26 40 - #define DRIVER_REVISION 30 39 + #define DRIVER_RELEASE 30 40 + #define DRIVER_REVISION 31 41 41 42 42 #define DRIVER_NAME "Microchip SmartPQI Driver (v" \ 43 43 DRIVER_VERSION BUILD_TIMESTAMP ")" ··· 92 92 static void pqi_ofa_ctrl_quiesce(struct pqi_ctrl_info *ctrl_info); 93 93 static void pqi_ofa_ctrl_unquiesce(struct pqi_ctrl_info *ctrl_info); 94 94 static int pqi_ofa_ctrl_restart(struct pqi_ctrl_info *ctrl_info, unsigned int delay_secs); 95 - static void pqi_ofa_setup_host_buffer(struct pqi_ctrl_info *ctrl_info); 96 - static void pqi_ofa_free_host_buffer(struct pqi_ctrl_info *ctrl_info); 97 - static int pqi_ofa_host_memory_update(struct pqi_ctrl_info *ctrl_info); 95 + static void pqi_host_setup_buffer(struct pqi_ctrl_info *ctrl_info, struct pqi_host_memory_descriptor *host_memory_descriptor, u32 total_size, u32 min_size); 96 + static void pqi_host_free_buffer(struct pqi_ctrl_info *ctrl_info, struct pqi_host_memory_descriptor *host_memory_descriptor); 97 + static int pqi_host_memory_update(struct pqi_ctrl_info *ctrl_info, struct pqi_host_memory_descriptor *host_memory_descriptor, u16 function_code); 98 98 static int pqi_device_wait_for_pending_io(struct pqi_ctrl_info *ctrl_info, 99 99 struct pqi_scsi_dev *device, u8 lun, unsigned long timeout_msecs); 100 100 static void pqi_fail_all_outstanding_requests(struct pqi_ctrl_info *ctrl_info); ··· 1508 1508 if (rc) 1509 1509 goto error; 1510 1510 1511 + device->raid_io_stats = alloc_percpu(struct pqi_raid_io_stats); 1512 + if (!device->raid_io_stats) { 1513 + rc = -ENOMEM; 1514 + goto error; 1515 + } 1516 + 1511 1517 device->raid_map = raid_map; 1512 1518 1513 1519 return 0; ··· 2105 2099 /* To prevent this from being freed later. */ 2106 2100 new_device->raid_map = NULL; 2107 2101 } 2102 + if (new_device->raid_bypass_enabled && existing_device->raid_io_stats == NULL) { 2103 + existing_device->raid_io_stats = new_device->raid_io_stats; 2104 + new_device->raid_io_stats = NULL; 2105 + } 2108 2106 existing_device->raid_bypass_configured = new_device->raid_bypass_configured; 2109 2107 existing_device->raid_bypass_enabled = new_device->raid_bypass_enabled; 2110 2108 } ··· 2131 2121 static inline void pqi_free_device(struct pqi_scsi_dev *device) 2132 2122 { 2133 2123 if (device) { 2124 + free_percpu(device->raid_io_stats); 2134 2125 kfree(device->raid_map); 2135 2126 kfree(device); 2136 2127 } ··· 2303 2292 * queue depth, device size. 2304 2293 */ 2305 2294 list_for_each_entry(device, &ctrl_info->scsi_device_list, scsi_device_list_entry) { 2295 + /* 2296 + * Check for queue depth change. 2297 + */ 2306 2298 if (device->sdev && device->queue_depth != device->advertised_queue_depth) { 2307 2299 device->advertised_queue_depth = device->queue_depth; 2308 2300 scsi_change_queue_depth(device->sdev, device->advertised_queue_depth); 2309 - spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); 2310 - if (pqi_volume_rescan_needed(device)) { 2311 - device->rescan = false; 2312 - spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 2313 - scsi_rescan_device(device->sdev); 2314 - } else { 2315 - spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 2316 - } 2301 + } 2302 + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); 2303 + /* 2304 + * Check for changes in the device, such as size. 2305 + */ 2306 + if (pqi_volume_rescan_needed(device)) { 2307 + device->rescan = false; 2308 + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 2309 + scsi_rescan_device(device->sdev); 2310 + } else { 2311 + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 2317 2312 } 2318 2313 } 2319 2314 ··· 2369 2352 static inline void pqi_mask_device(u8 *scsi3addr) 2370 2353 { 2371 2354 scsi3addr[3] |= 0xc0; 2372 - } 2373 - 2374 - static inline bool pqi_is_multipath_device(struct pqi_scsi_dev *device) 2375 - { 2376 - if (pqi_is_logical_device(device)) 2377 - return false; 2378 - 2379 - return (device->path_map & (device->path_map - 1)) != 0; 2380 2355 } 2381 2356 2382 2357 static inline bool pqi_expose_device(struct pqi_scsi_dev *device) ··· 3253 3244 sense_data_length); 3254 3245 } 3255 3246 3247 + if (pqi_cmd_priv(scmd)->this_residual && 3248 + !pqi_is_logical_device(scmd->device->hostdata) && 3249 + scsi_status == SAM_STAT_CHECK_CONDITION && 3250 + host_byte == DID_OK && 3251 + sense_data_length && 3252 + scsi_normalize_sense(error_info->data, sense_data_length, &sshdr) && 3253 + sshdr.sense_key == ILLEGAL_REQUEST && 3254 + sshdr.asc == 0x26 && 3255 + sshdr.ascq == 0x0) { 3256 + host_byte = DID_NO_CONNECT; 3257 + pqi_take_device_offline(scmd->device, "AIO"); 3258 + scsi_build_sense_buffer(0, scmd->sense_buffer, HARDWARE_ERROR, 0x3e, 0x1); 3259 + } 3260 + 3256 3261 scmd->result = scsi_status; 3257 3262 set_host_byte(scmd, host_byte); 3258 3263 } ··· 3281 3258 int residual_count; 3282 3259 int xfer_count; 3283 3260 bool device_offline; 3284 - struct pqi_scsi_dev *device; 3285 3261 3286 3262 scmd = io_request->scmd; 3287 3263 error_info = io_request->error_info; 3288 3264 host_byte = DID_OK; 3289 3265 sense_data_length = 0; 3290 3266 device_offline = false; 3291 - device = scmd->device->hostdata; 3292 3267 3293 3268 switch (error_info->service_response) { 3294 3269 case PQI_AIO_SERV_RESPONSE_COMPLETE: ··· 3311 3290 break; 3312 3291 case PQI_AIO_STATUS_AIO_PATH_DISABLED: 3313 3292 pqi_aio_path_disabled(io_request); 3314 - if (pqi_is_multipath_device(device)) { 3315 - pqi_device_remove_start(device); 3316 - host_byte = DID_NO_CONNECT; 3317 - scsi_status = SAM_STAT_CHECK_CONDITION; 3318 - } else { 3319 - scsi_status = SAM_STAT_GOOD; 3320 - io_request->status = -EAGAIN; 3321 - } 3293 + scsi_status = SAM_STAT_GOOD; 3294 + io_request->status = -EAGAIN; 3322 3295 break; 3323 3296 case PQI_AIO_STATUS_NO_PATH_TO_DEVICE: 3324 3297 case PQI_AIO_STATUS_INVALID_DEVICE: ··· 3640 3625 ctrl_info->pqi_mode_enabled = false; 3641 3626 pqi_save_ctrl_mode(ctrl_info, SIS_MODE); 3642 3627 rc = pqi_ofa_ctrl_restart(ctrl_info, delay_secs); 3643 - pqi_ofa_free_host_buffer(ctrl_info); 3628 + pqi_host_free_buffer(ctrl_info, &ctrl_info->ofa_memory); 3644 3629 pqi_ctrl_ofa_done(ctrl_info); 3645 3630 dev_info(&ctrl_info->pci_dev->dev, 3646 3631 "Online Firmware Activation: %s\n", ··· 3651 3636 "Online Firmware Activation ABORTED\n"); 3652 3637 if (ctrl_info->soft_reset_handshake_supported) 3653 3638 pqi_clear_soft_reset_status(ctrl_info); 3654 - pqi_ofa_free_host_buffer(ctrl_info); 3639 + pqi_host_free_buffer(ctrl_info, &ctrl_info->ofa_memory); 3655 3640 pqi_ctrl_ofa_done(ctrl_info); 3656 3641 pqi_ofa_ctrl_unquiesce(ctrl_info); 3657 3642 break; ··· 3661 3646 dev_err(&ctrl_info->pci_dev->dev, 3662 3647 "unexpected Online Firmware Activation reset status: 0x%x\n", 3663 3648 reset_status); 3664 - pqi_ofa_free_host_buffer(ctrl_info); 3649 + pqi_host_free_buffer(ctrl_info, &ctrl_info->ofa_memory); 3665 3650 pqi_ctrl_ofa_done(ctrl_info); 3666 3651 pqi_ofa_ctrl_unquiesce(ctrl_info); 3667 3652 pqi_take_ctrl_offline(ctrl_info, PQI_OFA_RESPONSE_TIMEOUT); ··· 3676 3661 ctrl_info = container_of(work, struct pqi_ctrl_info, ofa_memory_alloc_work); 3677 3662 3678 3663 pqi_ctrl_ofa_start(ctrl_info); 3679 - pqi_ofa_setup_host_buffer(ctrl_info); 3680 - pqi_ofa_host_memory_update(ctrl_info); 3664 + pqi_host_setup_buffer(ctrl_info, &ctrl_info->ofa_memory, ctrl_info->ofa_bytes_requested, ctrl_info->ofa_bytes_requested); 3665 + pqi_host_memory_update(ctrl_info, &ctrl_info->ofa_memory, PQI_VENDOR_GENERAL_OFA_MEMORY_UPDATE); 3681 3666 } 3682 3667 3683 3668 static void pqi_ofa_quiesce_worker(struct work_struct *work) ··· 3717 3702 dev_info(&ctrl_info->pci_dev->dev, 3718 3703 "received Online Firmware Activation cancel request: reason: %u\n", 3719 3704 ctrl_info->ofa_cancel_reason); 3720 - pqi_ofa_free_host_buffer(ctrl_info); 3705 + pqi_host_free_buffer(ctrl_info, &ctrl_info->ofa_memory); 3721 3706 pqi_ctrl_ofa_done(ctrl_info); 3722 3707 break; 3723 3708 default: ··· 5948 5933 int rc; 5949 5934 struct pqi_scsi_dev *device; 5950 5935 struct pqi_stream_data *pqi_stream_data; 5951 - struct pqi_scsi_dev_raid_map_data rmd; 5936 + struct pqi_scsi_dev_raid_map_data rmd = { 0 }; 5952 5937 5953 5938 if (!ctrl_info->enable_stream_detection) 5954 5939 return false; ··· 5990 5975 pqi_stream_data->next_lba = rmd.first_block + 5991 5976 rmd.block_cnt; 5992 5977 pqi_stream_data->last_accessed = jiffies; 5978 + per_cpu_ptr(device->raid_io_stats, smp_processor_id())->write_stream_cnt++; 5993 5979 return true; 5994 5980 } 5995 5981 ··· 6041 6025 6042 6026 ctrl_info = shost_to_hba(shost); 6043 6027 6044 - if (pqi_ctrl_offline(ctrl_info) || pqi_device_in_remove(device)) { 6028 + if (pqi_ctrl_offline(ctrl_info) || pqi_device_offline(device) || pqi_device_in_remove(device)) { 6045 6029 set_host_byte(scmd, DID_NO_CONNECT); 6046 6030 pqi_scsi_done(scmd); 6047 6031 return 0; ··· 6069 6053 rc = pqi_raid_bypass_submit_scsi_cmd(ctrl_info, device, scmd, queue_group); 6070 6054 if (rc == 0 || rc == SCSI_MLQUEUE_HOST_BUSY) { 6071 6055 raid_bypassed = true; 6072 - device->raid_bypass_cnt++; 6056 + per_cpu_ptr(device->raid_io_stats, smp_processor_id())->raid_bypass_cnt++; 6073 6057 } 6074 6058 } 6075 6059 if (!raid_bypassed) ··· 6206 6190 continue; 6207 6191 6208 6192 scsi_device = scmd->device->hostdata; 6209 - if (scsi_device != device) 6210 - continue; 6211 - 6212 - if ((u8)scmd->device->lun != lun) 6213 - continue; 6214 6193 6215 6194 list_del(&io_request->request_list_entry); 6216 - set_host_byte(scmd, DID_RESET); 6195 + if (scsi_device == device && (u8)scmd->device->lun == lun) 6196 + set_host_byte(scmd, DID_RESET); 6197 + else 6198 + set_host_byte(scmd, DID_REQUEUE); 6217 6199 pqi_free_io_request(io_request); 6218 6200 scsi_dma_unmap(scmd); 6219 6201 pqi_scsi_done(scmd); ··· 7364 7350 struct scsi_device *sdev; 7365 7351 struct pqi_scsi_dev *device; 7366 7352 unsigned long flags; 7367 - unsigned int raid_bypass_cnt; 7353 + u64 raid_bypass_cnt; 7354 + int cpu; 7368 7355 7369 7356 sdev = to_scsi_device(dev); 7370 7357 ctrl_info = shost_to_hba(sdev->host); ··· 7381 7366 return -ENODEV; 7382 7367 } 7383 7368 7384 - raid_bypass_cnt = device->raid_bypass_cnt; 7369 + raid_bypass_cnt = 0; 7370 + 7371 + if (device->raid_io_stats) { 7372 + for_each_online_cpu(cpu) { 7373 + raid_bypass_cnt += per_cpu_ptr(device->raid_io_stats, cpu)->raid_bypass_cnt; 7374 + } 7375 + } 7385 7376 7386 7377 spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 7387 7378 7388 - return scnprintf(buffer, PAGE_SIZE, "0x%x\n", raid_bypass_cnt); 7379 + return scnprintf(buffer, PAGE_SIZE, "0x%llx\n", raid_bypass_cnt); 7389 7380 } 7390 7381 7391 7382 static ssize_t pqi_sas_ncq_prio_enable_show(struct device *dev, ··· 7473 7452 return scnprintf(buffer, PAGE_SIZE, "%d\n", ctrl_info->numa_node); 7474 7453 } 7475 7454 7455 + static ssize_t pqi_write_stream_cnt_show(struct device *dev, 7456 + struct device_attribute *attr, char *buffer) 7457 + { 7458 + struct pqi_ctrl_info *ctrl_info; 7459 + struct scsi_device *sdev; 7460 + struct pqi_scsi_dev *device; 7461 + unsigned long flags; 7462 + u64 write_stream_cnt; 7463 + int cpu; 7464 + 7465 + sdev = to_scsi_device(dev); 7466 + ctrl_info = shost_to_hba(sdev->host); 7467 + 7468 + if (pqi_ctrl_offline(ctrl_info)) 7469 + return -ENODEV; 7470 + 7471 + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); 7472 + 7473 + device = sdev->hostdata; 7474 + if (!device) { 7475 + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 7476 + return -ENODEV; 7477 + } 7478 + 7479 + write_stream_cnt = 0; 7480 + 7481 + if (device->raid_io_stats) { 7482 + for_each_online_cpu(cpu) { 7483 + write_stream_cnt += per_cpu_ptr(device->raid_io_stats, cpu)->write_stream_cnt; 7484 + } 7485 + } 7486 + 7487 + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); 7488 + 7489 + return scnprintf(buffer, PAGE_SIZE, "0x%llx\n", write_stream_cnt); 7490 + } 7491 + 7476 7492 static DEVICE_ATTR(lunid, 0444, pqi_lunid_show, NULL); 7477 7493 static DEVICE_ATTR(unique_id, 0444, pqi_unique_id_show, NULL); 7478 7494 static DEVICE_ATTR(path_info, 0444, pqi_path_info_show, NULL); ··· 7520 7462 static DEVICE_ATTR(sas_ncq_prio_enable, 0644, 7521 7463 pqi_sas_ncq_prio_enable_show, pqi_sas_ncq_prio_enable_store); 7522 7464 static DEVICE_ATTR(numa_node, 0444, pqi_numa_node_show, NULL); 7465 + static DEVICE_ATTR(write_stream_cnt, 0444, pqi_write_stream_cnt_show, NULL); 7523 7466 7524 7467 static struct attribute *pqi_sdev_attrs[] = { 7525 7468 &dev_attr_lunid.attr, ··· 7532 7473 &dev_attr_raid_bypass_cnt.attr, 7533 7474 &dev_attr_sas_ncq_prio_enable.attr, 7534 7475 &dev_attr_numa_node.attr, 7476 + &dev_attr_write_stream_cnt.attr, 7535 7477 NULL 7536 7478 }; 7537 7479 ··· 7923 7863 case PQI_FIRMWARE_FEATURE_MULTI_LUN_DEVICE_SUPPORT: 7924 7864 ctrl_info->multi_lun_device_supported = firmware_feature->enabled; 7925 7865 break; 7866 + case PQI_FIRMWARE_FEATURE_CTRL_LOGGING: 7867 + ctrl_info->ctrl_logging_supported = firmware_feature->enabled; 7868 + break; 7926 7869 } 7927 7870 7928 7871 pqi_firmware_feature_status(ctrl_info, firmware_feature); ··· 8031 7968 .feature_bit = PQI_FIRMWARE_FEATURE_MULTI_LUN_DEVICE_SUPPORT, 8032 7969 .feature_status = pqi_ctrl_update_feature_flags, 8033 7970 }, 7971 + { 7972 + .feature_name = "Controller Data Logging", 7973 + .feature_bit = PQI_FIRMWARE_FEATURE_CTRL_LOGGING, 7974 + .feature_status = pqi_ctrl_update_feature_flags, 7975 + }, 8034 7976 }; 8035 7977 8036 7978 static void pqi_process_firmware_features( ··· 8138 8070 ctrl_info->firmware_triage_supported = false; 8139 8071 ctrl_info->rpl_extended_format_4_5_supported = false; 8140 8072 ctrl_info->multi_lun_device_supported = false; 8073 + ctrl_info->ctrl_logging_supported = false; 8141 8074 } 8142 8075 8143 8076 static int pqi_process_config_table(struct pqi_ctrl_info *ctrl_info) ··· 8279 8210 } 8280 8211 } 8281 8212 8213 + #define PQI_CTRL_LOG_TOTAL_SIZE (4 * 1024 * 1024) 8214 + #define PQI_CTRL_LOG_MIN_SIZE (PQI_CTRL_LOG_TOTAL_SIZE / PQI_HOST_MAX_SG_DESCRIPTORS) 8215 + 8282 8216 static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info) 8283 8217 { 8284 8218 int rc; ··· 8290 8218 if (reset_devices) { 8291 8219 if (pqi_is_fw_triage_supported(ctrl_info)) { 8292 8220 rc = sis_wait_for_fw_triage_completion(ctrl_info); 8221 + if (rc) 8222 + return rc; 8223 + } 8224 + if (sis_is_ctrl_logging_supported(ctrl_info)) { 8225 + sis_notify_kdump(ctrl_info); 8226 + rc = sis_wait_for_ctrl_logging_completion(ctrl_info); 8293 8227 if (rc) 8294 8228 return rc; 8295 8229 } ··· 8479 8401 rc = pqi_register_scsi(ctrl_info); 8480 8402 if (rc) 8481 8403 return rc; 8404 + 8405 + if (ctrl_info->ctrl_logging_supported && !reset_devices) { 8406 + pqi_host_setup_buffer(ctrl_info, &ctrl_info->ctrl_log_memory, PQI_CTRL_LOG_TOTAL_SIZE, PQI_CTRL_LOG_MIN_SIZE); 8407 + pqi_host_memory_update(ctrl_info, &ctrl_info->ctrl_log_memory, PQI_VENDOR_GENERAL_CTRL_LOG_MEMORY_UPDATE); 8408 + } 8482 8409 8483 8410 rc = pqi_get_ctrl_product_details(ctrl_info); 8484 8411 if (rc) { ··· 8669 8586 return rc; 8670 8587 } 8671 8588 8672 - if (pqi_ofa_in_progress(ctrl_info)) 8589 + if (pqi_ofa_in_progress(ctrl_info)) { 8673 8590 pqi_ctrl_unblock_scan(ctrl_info); 8591 + if (ctrl_info->ctrl_logging_supported) { 8592 + if (!ctrl_info->ctrl_log_memory.host_memory) 8593 + pqi_host_setup_buffer(ctrl_info, 8594 + &ctrl_info->ctrl_log_memory, 8595 + PQI_CTRL_LOG_TOTAL_SIZE, 8596 + PQI_CTRL_LOG_MIN_SIZE); 8597 + pqi_host_memory_update(ctrl_info, 8598 + &ctrl_info->ctrl_log_memory, PQI_VENDOR_GENERAL_CTRL_LOG_MEMORY_UPDATE); 8599 + } else { 8600 + if (ctrl_info->ctrl_log_memory.host_memory) 8601 + pqi_host_free_buffer(ctrl_info, 8602 + &ctrl_info->ctrl_log_memory); 8603 + } 8604 + } 8674 8605 8675 8606 pqi_scan_scsi_devices(ctrl_info); 8676 8607 ··· 8874 8777 pqi_fail_all_outstanding_requests(ctrl_info); 8875 8778 ctrl_info->pqi_mode_enabled = false; 8876 8779 } 8780 + pqi_host_free_buffer(ctrl_info, &ctrl_info->ctrl_log_memory); 8877 8781 pqi_unregister_scsi(ctrl_info); 8878 8782 if (ctrl_info->pqi_mode_enabled) 8879 8783 pqi_revert_to_sis_mode(ctrl_info); ··· 8900 8802 pqi_ctrl_unblock_scan(ctrl_info); 8901 8803 } 8902 8804 8903 - static int pqi_ofa_alloc_mem(struct pqi_ctrl_info *ctrl_info, u32 total_size, u32 chunk_size) 8904 - { 8905 - int i; 8906 - u32 sg_count; 8907 - struct device *dev; 8908 - struct pqi_ofa_memory *ofap; 8909 - struct pqi_sg_descriptor *mem_descriptor; 8910 - dma_addr_t dma_handle; 8911 - 8912 - ofap = ctrl_info->pqi_ofa_mem_virt_addr; 8913 - 8914 - sg_count = DIV_ROUND_UP(total_size, chunk_size); 8915 - if (sg_count == 0 || sg_count > PQI_OFA_MAX_SG_DESCRIPTORS) 8916 - goto out; 8917 - 8918 - ctrl_info->pqi_ofa_chunk_virt_addr = kmalloc_array(sg_count, sizeof(void *), GFP_KERNEL); 8919 - if (!ctrl_info->pqi_ofa_chunk_virt_addr) 8920 - goto out; 8921 - 8922 - dev = &ctrl_info->pci_dev->dev; 8923 - 8924 - for (i = 0; i < sg_count; i++) { 8925 - ctrl_info->pqi_ofa_chunk_virt_addr[i] = 8926 - dma_alloc_coherent(dev, chunk_size, &dma_handle, GFP_KERNEL); 8927 - if (!ctrl_info->pqi_ofa_chunk_virt_addr[i]) 8928 - goto out_free_chunks; 8929 - mem_descriptor = &ofap->sg_descriptor[i]; 8930 - put_unaligned_le64((u64)dma_handle, &mem_descriptor->address); 8931 - put_unaligned_le32(chunk_size, &mem_descriptor->length); 8932 - } 8933 - 8934 - put_unaligned_le32(CISS_SG_LAST, &mem_descriptor->flags); 8935 - put_unaligned_le16(sg_count, &ofap->num_memory_descriptors); 8936 - put_unaligned_le32(sg_count * chunk_size, &ofap->bytes_allocated); 8937 - 8938 - return 0; 8939 - 8940 - out_free_chunks: 8941 - while (--i >= 0) { 8942 - mem_descriptor = &ofap->sg_descriptor[i]; 8943 - dma_free_coherent(dev, chunk_size, 8944 - ctrl_info->pqi_ofa_chunk_virt_addr[i], 8945 - get_unaligned_le64(&mem_descriptor->address)); 8946 - } 8947 - kfree(ctrl_info->pqi_ofa_chunk_virt_addr); 8948 - 8949 - out: 8950 - return -ENOMEM; 8951 - } 8952 - 8953 - static int pqi_ofa_alloc_host_buffer(struct pqi_ctrl_info *ctrl_info) 8954 - { 8955 - u32 total_size; 8956 - u32 chunk_size; 8957 - u32 min_chunk_size; 8958 - 8959 - if (ctrl_info->ofa_bytes_requested == 0) 8960 - return 0; 8961 - 8962 - total_size = PAGE_ALIGN(ctrl_info->ofa_bytes_requested); 8963 - min_chunk_size = DIV_ROUND_UP(total_size, PQI_OFA_MAX_SG_DESCRIPTORS); 8964 - min_chunk_size = PAGE_ALIGN(min_chunk_size); 8965 - 8966 - for (chunk_size = total_size; chunk_size >= min_chunk_size;) { 8967 - if (pqi_ofa_alloc_mem(ctrl_info, total_size, chunk_size) == 0) 8968 - return 0; 8969 - chunk_size /= 2; 8970 - chunk_size = PAGE_ALIGN(chunk_size); 8971 - } 8972 - 8973 - return -ENOMEM; 8974 - } 8975 - 8976 - static void pqi_ofa_setup_host_buffer(struct pqi_ctrl_info *ctrl_info) 8977 - { 8978 - struct device *dev; 8979 - struct pqi_ofa_memory *ofap; 8980 - 8981 - dev = &ctrl_info->pci_dev->dev; 8982 - 8983 - ofap = dma_alloc_coherent(dev, sizeof(*ofap), 8984 - &ctrl_info->pqi_ofa_mem_dma_handle, GFP_KERNEL); 8985 - if (!ofap) 8986 - return; 8987 - 8988 - ctrl_info->pqi_ofa_mem_virt_addr = ofap; 8989 - 8990 - if (pqi_ofa_alloc_host_buffer(ctrl_info) < 0) { 8991 - dev_err(dev, 8992 - "failed to allocate host buffer for Online Firmware Activation\n"); 8993 - dma_free_coherent(dev, sizeof(*ofap), ofap, ctrl_info->pqi_ofa_mem_dma_handle); 8994 - ctrl_info->pqi_ofa_mem_virt_addr = NULL; 8995 - return; 8996 - } 8997 - 8998 - put_unaligned_le16(PQI_OFA_VERSION, &ofap->version); 8999 - memcpy(&ofap->signature, PQI_OFA_SIGNATURE, sizeof(ofap->signature)); 9000 - } 9001 - 9002 - static void pqi_ofa_free_host_buffer(struct pqi_ctrl_info *ctrl_info) 9003 - { 9004 - unsigned int i; 9005 - struct device *dev; 9006 - struct pqi_ofa_memory *ofap; 9007 - struct pqi_sg_descriptor *mem_descriptor; 9008 - unsigned int num_memory_descriptors; 9009 - 9010 - ofap = ctrl_info->pqi_ofa_mem_virt_addr; 9011 - if (!ofap) 9012 - return; 9013 - 9014 - dev = &ctrl_info->pci_dev->dev; 9015 - 9016 - if (get_unaligned_le32(&ofap->bytes_allocated) == 0) 9017 - goto out; 9018 - 9019 - mem_descriptor = ofap->sg_descriptor; 9020 - num_memory_descriptors = 9021 - get_unaligned_le16(&ofap->num_memory_descriptors); 9022 - 9023 - for (i = 0; i < num_memory_descriptors; i++) { 9024 - dma_free_coherent(dev, 9025 - get_unaligned_le32(&mem_descriptor[i].length), 9026 - ctrl_info->pqi_ofa_chunk_virt_addr[i], 9027 - get_unaligned_le64(&mem_descriptor[i].address)); 9028 - } 9029 - kfree(ctrl_info->pqi_ofa_chunk_virt_addr); 9030 - 9031 - out: 9032 - dma_free_coherent(dev, sizeof(*ofap), ofap, 9033 - ctrl_info->pqi_ofa_mem_dma_handle); 9034 - ctrl_info->pqi_ofa_mem_virt_addr = NULL; 9035 - } 9036 - 9037 - static int pqi_ofa_host_memory_update(struct pqi_ctrl_info *ctrl_info) 9038 - { 9039 - u32 buffer_length; 9040 - struct pqi_vendor_general_request request; 9041 - struct pqi_ofa_memory *ofap; 9042 - 9043 - memset(&request, 0, sizeof(request)); 9044 - 9045 - request.header.iu_type = PQI_REQUEST_IU_VENDOR_GENERAL; 9046 - put_unaligned_le16(sizeof(request) - PQI_REQUEST_HEADER_LENGTH, 9047 - &request.header.iu_length); 9048 - put_unaligned_le16(PQI_VENDOR_GENERAL_HOST_MEMORY_UPDATE, 9049 - &request.function_code); 9050 - 9051 - ofap = ctrl_info->pqi_ofa_mem_virt_addr; 9052 - 9053 - if (ofap) { 9054 - buffer_length = offsetof(struct pqi_ofa_memory, sg_descriptor) + 9055 - get_unaligned_le16(&ofap->num_memory_descriptors) * 9056 - sizeof(struct pqi_sg_descriptor); 9057 - 9058 - put_unaligned_le64((u64)ctrl_info->pqi_ofa_mem_dma_handle, 9059 - &request.data.ofa_memory_allocation.buffer_address); 9060 - put_unaligned_le32(buffer_length, 9061 - &request.data.ofa_memory_allocation.buffer_length); 9062 - } 9063 - 9064 - return pqi_submit_raid_request_synchronous(ctrl_info, &request.header, 0, NULL); 9065 - } 9066 - 9067 8805 static int pqi_ofa_ctrl_restart(struct pqi_ctrl_info *ctrl_info, unsigned int delay_secs) 9068 8806 { 9069 8807 ssleep(delay_secs); 9070 8808 9071 8809 return pqi_ctrl_init_resume(ctrl_info); 8810 + } 8811 + 8812 + static int pqi_host_alloc_mem(struct pqi_ctrl_info *ctrl_info, 8813 + struct pqi_host_memory_descriptor *host_memory_descriptor, 8814 + u32 total_size, u32 chunk_size) 8815 + { 8816 + int i; 8817 + u32 sg_count; 8818 + struct device *dev; 8819 + struct pqi_host_memory *host_memory; 8820 + struct pqi_sg_descriptor *mem_descriptor; 8821 + dma_addr_t dma_handle; 8822 + 8823 + sg_count = DIV_ROUND_UP(total_size, chunk_size); 8824 + if (sg_count == 0 || sg_count > PQI_HOST_MAX_SG_DESCRIPTORS) 8825 + goto out; 8826 + 8827 + host_memory_descriptor->host_chunk_virt_address = kmalloc(sg_count * sizeof(void *), GFP_KERNEL); 8828 + if (!host_memory_descriptor->host_chunk_virt_address) 8829 + goto out; 8830 + 8831 + dev = &ctrl_info->pci_dev->dev; 8832 + host_memory = host_memory_descriptor->host_memory; 8833 + 8834 + for (i = 0; i < sg_count; i++) { 8835 + host_memory_descriptor->host_chunk_virt_address[i] = dma_alloc_coherent(dev, chunk_size, &dma_handle, GFP_KERNEL); 8836 + if (!host_memory_descriptor->host_chunk_virt_address[i]) 8837 + goto out_free_chunks; 8838 + mem_descriptor = &host_memory->sg_descriptor[i]; 8839 + put_unaligned_le64((u64)dma_handle, &mem_descriptor->address); 8840 + put_unaligned_le32(chunk_size, &mem_descriptor->length); 8841 + } 8842 + 8843 + put_unaligned_le32(CISS_SG_LAST, &mem_descriptor->flags); 8844 + put_unaligned_le16(sg_count, &host_memory->num_memory_descriptors); 8845 + put_unaligned_le32(sg_count * chunk_size, &host_memory->bytes_allocated); 8846 + 8847 + return 0; 8848 + 8849 + out_free_chunks: 8850 + while (--i >= 0) { 8851 + mem_descriptor = &host_memory->sg_descriptor[i]; 8852 + dma_free_coherent(dev, chunk_size, 8853 + host_memory_descriptor->host_chunk_virt_address[i], 8854 + get_unaligned_le64(&mem_descriptor->address)); 8855 + } 8856 + kfree(host_memory_descriptor->host_chunk_virt_address); 8857 + out: 8858 + return -ENOMEM; 8859 + } 8860 + 8861 + static int pqi_host_alloc_buffer(struct pqi_ctrl_info *ctrl_info, 8862 + struct pqi_host_memory_descriptor *host_memory_descriptor, 8863 + u32 total_required_size, u32 min_required_size) 8864 + { 8865 + u32 chunk_size; 8866 + u32 min_chunk_size; 8867 + 8868 + if (total_required_size == 0 || min_required_size == 0) 8869 + return 0; 8870 + 8871 + total_required_size = PAGE_ALIGN(total_required_size); 8872 + min_required_size = PAGE_ALIGN(min_required_size); 8873 + min_chunk_size = DIV_ROUND_UP(total_required_size, PQI_HOST_MAX_SG_DESCRIPTORS); 8874 + min_chunk_size = PAGE_ALIGN(min_chunk_size); 8875 + 8876 + while (total_required_size >= min_required_size) { 8877 + for (chunk_size = total_required_size; chunk_size >= min_chunk_size;) { 8878 + if (pqi_host_alloc_mem(ctrl_info, 8879 + host_memory_descriptor, total_required_size, 8880 + chunk_size) == 0) 8881 + return 0; 8882 + chunk_size /= 2; 8883 + chunk_size = PAGE_ALIGN(chunk_size); 8884 + } 8885 + total_required_size /= 2; 8886 + total_required_size = PAGE_ALIGN(total_required_size); 8887 + } 8888 + 8889 + return -ENOMEM; 8890 + } 8891 + 8892 + static void pqi_host_setup_buffer(struct pqi_ctrl_info *ctrl_info, 8893 + struct pqi_host_memory_descriptor *host_memory_descriptor, 8894 + u32 total_size, u32 min_size) 8895 + { 8896 + struct device *dev; 8897 + struct pqi_host_memory *host_memory; 8898 + 8899 + dev = &ctrl_info->pci_dev->dev; 8900 + 8901 + host_memory = dma_alloc_coherent(dev, sizeof(*host_memory), 8902 + &host_memory_descriptor->host_memory_dma_handle, GFP_KERNEL); 8903 + if (!host_memory) 8904 + return; 8905 + 8906 + host_memory_descriptor->host_memory = host_memory; 8907 + 8908 + if (pqi_host_alloc_buffer(ctrl_info, host_memory_descriptor, 8909 + total_size, min_size) < 0) { 8910 + dev_err(dev, "failed to allocate firmware usable host buffer\n"); 8911 + dma_free_coherent(dev, sizeof(*host_memory), host_memory, 8912 + host_memory_descriptor->host_memory_dma_handle); 8913 + host_memory_descriptor->host_memory = NULL; 8914 + return; 8915 + } 8916 + } 8917 + 8918 + static void pqi_host_free_buffer(struct pqi_ctrl_info *ctrl_info, 8919 + struct pqi_host_memory_descriptor *host_memory_descriptor) 8920 + { 8921 + unsigned int i; 8922 + struct device *dev; 8923 + struct pqi_host_memory *host_memory; 8924 + struct pqi_sg_descriptor *mem_descriptor; 8925 + unsigned int num_memory_descriptors; 8926 + 8927 + host_memory = host_memory_descriptor->host_memory; 8928 + if (!host_memory) 8929 + return; 8930 + 8931 + dev = &ctrl_info->pci_dev->dev; 8932 + 8933 + if (get_unaligned_le32(&host_memory->bytes_allocated) == 0) 8934 + goto out; 8935 + 8936 + mem_descriptor = host_memory->sg_descriptor; 8937 + num_memory_descriptors = get_unaligned_le16(&host_memory->num_memory_descriptors); 8938 + 8939 + for (i = 0; i < num_memory_descriptors; i++) { 8940 + dma_free_coherent(dev, 8941 + get_unaligned_le32(&mem_descriptor[i].length), 8942 + host_memory_descriptor->host_chunk_virt_address[i], 8943 + get_unaligned_le64(&mem_descriptor[i].address)); 8944 + } 8945 + kfree(host_memory_descriptor->host_chunk_virt_address); 8946 + 8947 + out: 8948 + dma_free_coherent(dev, sizeof(*host_memory), host_memory, 8949 + host_memory_descriptor->host_memory_dma_handle); 8950 + host_memory_descriptor->host_memory = NULL; 8951 + } 8952 + 8953 + static int pqi_host_memory_update(struct pqi_ctrl_info *ctrl_info, 8954 + struct pqi_host_memory_descriptor *host_memory_descriptor, 8955 + u16 function_code) 8956 + { 8957 + u32 buffer_length; 8958 + struct pqi_vendor_general_request request; 8959 + struct pqi_host_memory *host_memory; 8960 + 8961 + memset(&request, 0, sizeof(request)); 8962 + 8963 + request.header.iu_type = PQI_REQUEST_IU_VENDOR_GENERAL; 8964 + put_unaligned_le16(sizeof(request) - PQI_REQUEST_HEADER_LENGTH, &request.header.iu_length); 8965 + put_unaligned_le16(function_code, &request.function_code); 8966 + 8967 + host_memory = host_memory_descriptor->host_memory; 8968 + 8969 + if (host_memory) { 8970 + buffer_length = offsetof(struct pqi_host_memory, sg_descriptor) + get_unaligned_le16(&host_memory->num_memory_descriptors) * sizeof(struct pqi_sg_descriptor); 8971 + put_unaligned_le64((u64)host_memory_descriptor->host_memory_dma_handle, &request.data.host_memory_allocation.buffer_address); 8972 + put_unaligned_le32(buffer_length, &request.data.host_memory_allocation.buffer_length); 8973 + 8974 + if (function_code == PQI_VENDOR_GENERAL_OFA_MEMORY_UPDATE) { 8975 + put_unaligned_le16(PQI_OFA_VERSION, &host_memory->version); 8976 + memcpy(&host_memory->signature, PQI_OFA_SIGNATURE, sizeof(host_memory->signature)); 8977 + } else if (function_code == PQI_VENDOR_GENERAL_CTRL_LOG_MEMORY_UPDATE) { 8978 + put_unaligned_le16(PQI_CTRL_LOG_VERSION, &host_memory->version); 8979 + memcpy(&host_memory->signature, PQI_CTRL_LOG_SIGNATURE, sizeof(host_memory->signature)); 8980 + } 8981 + } 8982 + 8983 + return pqi_submit_raid_request_synchronous(ctrl_info, &request.header, 0, NULL); 9072 8984 } 9073 8985 9074 8986 static struct pqi_raid_error_info pqi_ctrl_offline_raid_error_info = { ··· 9554 9446 }, 9555 9447 { 9556 9448 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9449 + 0x193d, 0x0462) 9450 + }, 9451 + { 9452 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9557 9453 0x193d, 0x1104) 9558 9454 }, 9559 9455 { ··· 9586 9474 }, 9587 9475 { 9588 9476 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9477 + 0x193d, 0x1110) 9478 + }, 9479 + { 9480 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9589 9481 0x193d, 0x8460) 9590 9482 }, 9591 9483 { 9592 9484 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9593 9485 0x193d, 0x8461) 9486 + }, 9487 + { 9488 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9489 + 0x193d, 0x8462) 9594 9490 }, 9595 9491 { 9596 9492 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, ··· 9707 9587 { 9708 9588 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9709 9589 0x1bd4, 0x0089) 9590 + }, 9591 + { 9592 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9593 + 0x1ff9, 0x00a1) 9594 + }, 9595 + { 9596 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 9597 + 0x1f3a, 0x0104) 9710 9598 }, 9711 9599 { 9712 9600 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, ··· 10310 10182 }, 10311 10183 { 10312 10184 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10185 + 0x1137, 0x02fe) 10186 + }, 10187 + { 10188 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10189 + 0x1137, 0x02ff) 10190 + }, 10191 + { 10192 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10193 + 0x1137, 0x0300) 10194 + }, 10195 + { 10196 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10197 + 0x1ff9, 0x0045) 10198 + }, 10199 + { 10200 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10201 + 0x1ff9, 0x0046) 10202 + }, 10203 + { 10204 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10205 + 0x1ff9, 0x0047) 10206 + }, 10207 + { 10208 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10209 + 0x1ff9, 0x0048) 10210 + }, 10211 + { 10212 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10213 + 0x1ff9, 0x004a) 10214 + }, 10215 + { 10216 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10217 + 0x1ff9, 0x004b) 10218 + }, 10219 + { 10220 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10221 + 0x1ff9, 0x004c) 10222 + }, 10223 + { 10224 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10225 + 0x1ff9, 0x004f) 10226 + }, 10227 + { 10228 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10229 + 0x1ff9, 0x0051) 10230 + }, 10231 + { 10232 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10233 + 0x1ff9, 0x0052) 10234 + }, 10235 + { 10236 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10237 + 0x1ff9, 0x0053) 10238 + }, 10239 + { 10240 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10241 + 0x1ff9, 0x0054) 10242 + }, 10243 + { 10244 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10245 + 0x1ff9, 0x006b) 10246 + }, 10247 + { 10248 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10249 + 0x1ff9, 0x006c) 10250 + }, 10251 + { 10252 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10253 + 0x1ff9, 0x006d) 10254 + }, 10255 + { 10256 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10257 + 0x1ff9, 0x006f) 10258 + }, 10259 + { 10260 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10261 + 0x1ff9, 0x0070) 10262 + }, 10263 + { 10264 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10265 + 0x1ff9, 0x0071) 10266 + }, 10267 + { 10268 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10269 + 0x1ff9, 0x0072) 10270 + }, 10271 + { 10272 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10273 + 0x1ff9, 0x0086) 10274 + }, 10275 + { 10276 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10277 + 0x1ff9, 0x0087) 10278 + }, 10279 + { 10280 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10281 + 0x1ff9, 0x0088) 10282 + }, 10283 + { 10284 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10285 + 0x1ff9, 0x0089) 10286 + }, 10287 + { 10288 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10313 10289 0x1e93, 0x1000) 10314 10290 }, 10315 10291 { ··· 10495 10263 { 10496 10264 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10497 10265 0x1f51, 0x1045) 10266 + }, 10267 + { 10268 + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 10269 + 0x1ff9, 0x00a3) 10498 10270 }, 10499 10271 { 10500 10272 PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f,
+60
drivers/scsi/smartpqi/smartpqi_sis.c
··· 29 29 #define SIS_ENABLE_INTX 0x80 30 30 #define SIS_SOFT_RESET 0x100 31 31 #define SIS_CMD_READY 0x200 32 + #define SIS_NOTIFY_KDUMP 0x400 32 33 #define SIS_TRIGGER_SHUTDOWN 0x800000 33 34 #define SIS_PQI_RESET_QUIESCE 0x1000000 34 35 ··· 53 52 #define SIS_BASE_STRUCT_ALIGNMENT 16 54 53 55 54 #define SIS_CTRL_KERNEL_FW_TRIAGE 0x3 55 + #define SIS_CTRL_KERNEL_CTRL_LOGGING 0x4 56 + #define SIS_CTRL_KERNEL_CTRL_LOGGING_STATUS 0x18 56 57 #define SIS_CTRL_KERNEL_UP 0x80 57 58 #define SIS_CTRL_KERNEL_PANIC 0x100 58 59 #define SIS_CTRL_READY_TIMEOUT_SECS 180 ··· 66 63 FW_TRIAGE_STARTED, 67 64 FW_TRIAGE_COND_INVALID, 68 65 FW_TRIAGE_COMPLETED 66 + }; 67 + 68 + enum sis_ctrl_logging_status { 69 + CTRL_LOGGING_NOT_STARTED = 0, 70 + CTRL_LOGGING_STARTED, 71 + CTRL_LOGGING_COND_INVALID, 72 + CTRL_LOGGING_COMPLETED 69 73 }; 70 74 71 75 #pragma pack(1) ··· 452 442 SIS_CTRL_KERNEL_FW_TRIAGE)); 453 443 } 454 444 445 + bool sis_is_ctrl_logging_supported(struct pqi_ctrl_info *ctrl_info) 446 + { 447 + return readl(&ctrl_info->registers->sis_firmware_status) & SIS_CTRL_KERNEL_CTRL_LOGGING; 448 + } 449 + 450 + void sis_notify_kdump(struct pqi_ctrl_info *ctrl_info) 451 + { 452 + sis_set_doorbell_bit(ctrl_info, SIS_NOTIFY_KDUMP); 453 + } 454 + 455 + static inline enum sis_ctrl_logging_status sis_read_ctrl_logging_status(struct pqi_ctrl_info *ctrl_info) 456 + { 457 + return ((enum sis_ctrl_logging_status)((readl(&ctrl_info->registers->sis_firmware_status) & SIS_CTRL_KERNEL_CTRL_LOGGING_STATUS) >> 3)); 458 + } 459 + 455 460 void sis_soft_reset(struct pqi_ctrl_info *ctrl_info) 456 461 { 457 462 writel(SIS_SOFT_RESET, ··· 504 479 } 505 480 506 481 ssleep(SIS_FW_TRIAGE_STATUS_POLL_INTERVAL_SECS); 482 + } 483 + 484 + return rc; 485 + } 486 + 487 + #define SIS_CTRL_LOGGING_STATUS_TIMEOUT_SECS 180 488 + #define SIS_CTRL_LOGGING_STATUS_POLL_INTERVAL_SECS 1 489 + 490 + int sis_wait_for_ctrl_logging_completion(struct pqi_ctrl_info *ctrl_info) 491 + { 492 + int rc; 493 + enum sis_ctrl_logging_status status; 494 + unsigned long timeout; 495 + 496 + timeout = (SIS_CTRL_LOGGING_STATUS_TIMEOUT_SECS * HZ) + jiffies; 497 + while (1) { 498 + status = sis_read_ctrl_logging_status(ctrl_info); 499 + if (status == CTRL_LOGGING_COND_INVALID) { 500 + dev_err(&ctrl_info->pci_dev->dev, 501 + "controller data logging condition invalid\n"); 502 + rc = -EINVAL; 503 + break; 504 + } else if (status == CTRL_LOGGING_COMPLETED) { 505 + rc = 0; 506 + break; 507 + } 508 + 509 + if (time_after(jiffies, timeout)) { 510 + dev_err(&ctrl_info->pci_dev->dev, 511 + "timed out waiting for controller data logging status\n"); 512 + rc = -ETIMEDOUT; 513 + break; 514 + } 515 + 516 + ssleep(SIS_CTRL_LOGGING_STATUS_POLL_INTERVAL_SECS); 507 517 } 508 518 509 519 return rc;
+3
drivers/scsi/smartpqi/smartpqi_sis.h
··· 31 31 void sis_soft_reset(struct pqi_ctrl_info *ctrl_info); 32 32 u32 sis_get_product_id(struct pqi_ctrl_info *ctrl_info); 33 33 int sis_wait_for_fw_triage_completion(struct pqi_ctrl_info *ctrl_info); 34 + bool sis_is_ctrl_logging_supported(struct pqi_ctrl_info *ctrl_info); 35 + void sis_notify_kdump(struct pqi_ctrl_info *ctrl_info); 36 + int sis_wait_for_ctrl_logging_completion(struct pqi_ctrl_info *ctrl_info); 34 37 35 38 extern unsigned int sis_ctrl_ready_timeout_secs; 36 39
+5 -5
drivers/scsi/snic/snic_main.c
··· 300 300 } 301 301 302 302 SNIC_BUG_ON(shost->work_q != NULL); 303 - snprintf(shost->work_q_name, sizeof(shost->work_q_name), "scsi_wq_%d", 304 - shost->host_no); 305 - shost->work_q = create_singlethread_workqueue(shost->work_q_name); 303 + shost->work_q = alloc_ordered_workqueue("scsi_wq_%d", WQ_MEM_RECLAIM, 304 + shost->host_no); 306 305 if (!shost->work_q) { 307 306 SNIC_HOST_ERR(shost, "Failed to Create ScsiHost wq.\n"); 308 307 ··· 872 873 snic_glob->req_cache[SNIC_REQ_CACHE_MAX_SGL] = cachep; 873 874 874 875 len = sizeof(struct snic_host_req); 875 - cachep = kmem_cache_create("snic_req_maxsgl", len, SNIC_SG_DESC_ALIGN, 876 + cachep = kmem_cache_create("snic_req_tm", len, SNIC_SG_DESC_ALIGN, 876 877 SLAB_HWCACHE_ALIGN, NULL); 877 878 if (!cachep) { 878 879 SNIC_ERR("Failed to create snic tm req slab\n"); ··· 883 884 snic_glob->req_cache[SNIC_REQ_TM_CACHE] = cachep; 884 885 885 886 /* snic_event queue */ 886 - snic_glob->event_q = create_singlethread_workqueue("snic_event_wq"); 887 + snic_glob->event_q = 888 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, "snic_event_wq"); 887 889 if (!snic_glob->event_q) { 888 890 SNIC_ERR("snic event queue create failed\n"); 889 891 ret = -ENOMEM;
+2 -4
drivers/scsi/stex.c
··· 334 334 struct st_ccb *wait_ccb; 335 335 __le32 *scratch; 336 336 337 - char work_q_name[20]; 338 337 struct workqueue_struct *work_q; 339 338 struct work_struct reset_work; 340 339 wait_queue_head_t reset_waitq; ··· 1794 1795 hba->pdev = pdev; 1795 1796 init_waitqueue_head(&hba->reset_waitq); 1796 1797 1797 - snprintf(hba->work_q_name, sizeof(hba->work_q_name), 1798 - "stex_wq_%d", host->host_no); 1799 - hba->work_q = create_singlethread_workqueue(hba->work_q_name); 1798 + hba->work_q = alloc_ordered_workqueue("stex_wq_%d", WQ_MEM_RECLAIM, 1799 + host->host_no); 1800 1800 if (!hba->work_q) { 1801 1801 printk(KERN_ERR DRV_NAME "(%s): create workqueue failed\n", 1802 1802 pci_name(pdev));
+1 -1
drivers/scsi/sun3_scsi.c
··· 304 304 sun3_udc_write(UDC_INT_ENABLE, UDC_CSR); 305 305 #endif 306 306 307 - return count; 307 + return count; 308 308 309 309 } 310 310
+2 -1
drivers/scsi/vmw_pvscsi.c
··· 1137 1137 snprintf(name, sizeof(name), 1138 1138 "vmw_pvscsi_wq_%u", adapter->host->host_no); 1139 1139 1140 - adapter->workqueue = create_singlethread_workqueue(name); 1140 + adapter->workqueue = 1141 + alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name); 1141 1142 if (!adapter->workqueue) { 1142 1143 printk(KERN_ERR "vmw_pvscsi: failed to create work queue\n"); 1143 1144 return 0;
-2
drivers/target/iscsi/iscsi_target.h
··· 15 15 struct sockaddr_storage; 16 16 17 17 extern struct iscsi_tiqn *iscsit_get_tiqn_for_login(unsigned char *); 18 - extern struct iscsi_tiqn *iscsit_get_tiqn(unsigned char *, int); 19 18 extern void iscsit_put_tiqn_for_login(struct iscsi_tiqn *); 20 19 extern struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *); 21 20 extern void iscsit_del_tiqn(struct iscsi_tiqn *); ··· 34 35 extern int iscsit_logout_closesession(struct iscsit_cmd *, struct iscsit_conn *); 35 36 extern int iscsit_logout_closeconnection(struct iscsit_cmd *, struct iscsit_conn *); 36 37 extern int iscsit_logout_removeconnforrecovery(struct iscsit_cmd *, struct iscsit_conn *); 37 - extern int iscsit_send_async_msg(struct iscsit_conn *, u16, u8, u8); 38 38 extern int iscsit_build_r2ts_for_cmd(struct iscsit_conn *, struct iscsit_cmd *, bool recovery); 39 39 extern void iscsit_thread_get_cpumask(struct iscsit_conn *); 40 40 extern int iscsi_target_tx_thread(void *);
-1
drivers/target/iscsi/iscsi_target_login.h
··· 24 24 extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsit_conn *, u8); 25 25 extern void iscsi_target_login_sess_out(struct iscsit_conn *, bool, bool); 26 26 extern int iscsi_target_login_thread(void *); 27 - extern void iscsi_handle_login_thread_timeout(struct timer_list *t); 28 27 29 28 #endif /*** ISCSI_TARGET_LOGIN_H ***/
-2
drivers/target/iscsi/iscsi_target_nego.h
··· 15 15 unsigned char *); 16 16 extern int iscsi_target_check_login_request(struct iscsit_conn *, 17 17 struct iscsi_login *); 18 - extern int iscsi_target_get_initial_payload(struct iscsit_conn *, 19 - struct iscsi_login *); 20 18 extern int iscsi_target_locate_portal(struct iscsi_np *, struct iscsit_conn *, 21 19 struct iscsi_login *); 22 20 extern int iscsi_target_start_negotiation(
-5
drivers/target/iscsi/iscsi_target_tpg.h
··· 24 24 int); 25 25 extern int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *); 26 26 extern int iscsit_tpg_disable_portal_group(struct iscsi_portal_group *, int); 27 - extern struct iscsi_node_acl *iscsit_tpg_add_initiator_node_acl( 28 - struct iscsi_portal_group *, const char *, u32); 29 - extern void iscsit_tpg_del_initiator_node_acl(struct iscsi_portal_group *, 30 - struct se_node_acl *); 31 27 extern struct iscsi_node_attrib *iscsit_tpg_get_node_attrib(struct iscsit_session *); 32 - extern void iscsit_tpg_del_external_nps(struct iscsi_tpg_np *); 33 28 extern struct iscsi_tpg_np *iscsit_tpg_locate_child_np(struct iscsi_tpg_np *, int); 34 29 extern struct iscsi_tpg_np *iscsit_tpg_add_network_portal(struct iscsi_portal_group *, 35 30 struct sockaddr_storage *, struct iscsi_tpg_np *,
-5
drivers/target/iscsi/iscsi_target_util.h
··· 17 17 extern struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsit_cmd *); 18 18 extern void iscsit_free_r2t(struct iscsi_r2t *, struct iscsit_cmd *); 19 19 extern void iscsit_free_r2ts_from_list(struct iscsit_cmd *); 20 - extern struct iscsit_cmd *iscsit_alloc_cmd(struct iscsit_conn *, gfp_t); 21 20 extern struct iscsit_cmd *iscsit_allocate_cmd(struct iscsit_conn *, int); 22 21 extern struct iscsi_seq *iscsit_get_seq_holder_for_datain(struct iscsit_cmd *, u32); 23 22 extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsit_cmd *); ··· 33 34 extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsit_conn *); 34 35 extern int iscsit_add_cmd_to_response_queue(struct iscsit_cmd *, struct iscsit_conn *, u8); 35 36 extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsit_conn *); 36 - extern void iscsit_remove_cmd_from_tx_queues(struct iscsit_cmd *, struct iscsit_conn *); 37 37 extern bool iscsit_conn_all_queues_empty(struct iscsit_conn *); 38 38 extern void iscsit_free_queue_reqs_for_conn(struct iscsit_conn *); 39 39 extern void iscsit_release_cmd(struct iscsit_cmd *); ··· 62 64 extern int iscsit_fe_sendpage_sg(struct iscsit_cmd *, struct iscsit_conn *); 63 65 extern int iscsit_tx_login_rsp(struct iscsit_conn *, u8, u8); 64 66 extern void iscsit_print_session_params(struct iscsit_session *); 65 - extern int iscsit_print_dev_to_proc(char *, char **, off_t, int); 66 - extern int iscsit_print_sessions_to_proc(char *, char **, off_t, int); 67 - extern int iscsit_print_tpg_to_proc(char *, char **, off_t, int); 68 67 extern int rx_data(struct iscsit_conn *, struct kvec *, int, int); 69 68 extern int tx_data(struct iscsit_conn *, struct kvec *, int, int); 70 69 extern void iscsit_collect_login_stats(struct iscsit_conn *, u8, u8);
+75 -16
drivers/ufs/core/ufs-sysfs.c
··· 198 198 FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, scale); 199 199 } 200 200 201 + static int ufshcd_read_hci_reg(struct ufs_hba *hba, u32 *val, unsigned int reg) 202 + { 203 + down(&hba->host_sem); 204 + if (!ufshcd_is_user_access_allowed(hba)) { 205 + up(&hba->host_sem); 206 + return -EBUSY; 207 + } 208 + 209 + ufshcd_rpm_get_sync(hba); 210 + ufshcd_hold(hba); 211 + *val = ufshcd_readl(hba, reg); 212 + ufshcd_release(hba); 213 + ufshcd_rpm_put_sync(hba); 214 + 215 + up(&hba->host_sem); 216 + return 0; 217 + } 218 + 201 219 static ssize_t auto_hibern8_show(struct device *dev, 202 220 struct device_attribute *attr, char *buf) 203 221 { ··· 226 208 if (!ufshcd_is_auto_hibern8_supported(hba)) 227 209 return -EOPNOTSUPP; 228 210 229 - down(&hba->host_sem); 230 - if (!ufshcd_is_user_access_allowed(hba)) { 231 - ret = -EBUSY; 232 - goto out; 233 - } 211 + ret = ufshcd_read_hci_reg(hba, &ahit, REG_AUTO_HIBERNATE_IDLE_TIMER); 212 + if (ret) 213 + return ret; 234 214 235 - pm_runtime_get_sync(hba->dev); 236 - ufshcd_hold(hba); 237 - ahit = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER); 238 - ufshcd_release(hba); 239 - pm_runtime_put_sync(hba->dev); 240 - 241 - ret = sysfs_emit(buf, "%d\n", ufshcd_ahit_to_us(ahit)); 242 - 243 - out: 244 - up(&hba->host_sem); 245 - return ret; 215 + return sysfs_emit(buf, "%d\n", ufshcd_ahit_to_us(ahit)); 246 216 } 247 217 248 218 static ssize_t auto_hibern8_store(struct device *dev, ··· 523 517 static const struct attribute_group ufs_sysfs_capabilities_group = { 524 518 .name = "capabilities", 525 519 .attrs = ufs_sysfs_capabilities_attrs, 520 + }; 521 + 522 + static ssize_t version_show(struct device *dev, 523 + struct device_attribute *attr, char *buf) 524 + { 525 + struct ufs_hba *hba = dev_get_drvdata(dev); 526 + 527 + return sysfs_emit(buf, "0x%x\n", hba->ufs_version); 528 + } 529 + 530 + static ssize_t product_id_show(struct device *dev, 531 + struct device_attribute *attr, char *buf) 532 + { 533 + int ret; 534 + u32 val; 535 + struct ufs_hba *hba = dev_get_drvdata(dev); 536 + 537 + ret = ufshcd_read_hci_reg(hba, &val, REG_CONTROLLER_PID); 538 + if (ret) 539 + return ret; 540 + 541 + return sysfs_emit(buf, "0x%x\n", val); 542 + } 543 + 544 + static ssize_t man_id_show(struct device *dev, 545 + struct device_attribute *attr, char *buf) 546 + { 547 + int ret; 548 + u32 val; 549 + struct ufs_hba *hba = dev_get_drvdata(dev); 550 + 551 + ret = ufshcd_read_hci_reg(hba, &val, REG_CONTROLLER_MID); 552 + if (ret) 553 + return ret; 554 + 555 + return sysfs_emit(buf, "0x%x\n", val); 556 + } 557 + 558 + static DEVICE_ATTR_RO(version); 559 + static DEVICE_ATTR_RO(product_id); 560 + static DEVICE_ATTR_RO(man_id); 561 + 562 + static struct attribute *ufs_sysfs_ufshci_cap_attrs[] = { 563 + &dev_attr_version.attr, 564 + &dev_attr_product_id.attr, 565 + &dev_attr_man_id.attr, 566 + NULL 567 + }; 568 + 569 + static const struct attribute_group ufs_sysfs_ufshci_group = { 570 + .name = "ufshci_capabilities", 571 + .attrs = ufs_sysfs_ufshci_cap_attrs, 526 572 }; 527 573 528 574 static ssize_t monitor_enable_show(struct device *dev, ··· 1560 1502 static const struct attribute_group *ufs_sysfs_groups[] = { 1561 1503 &ufs_sysfs_default_group, 1562 1504 &ufs_sysfs_capabilities_group, 1505 + &ufs_sysfs_ufshci_group, 1563 1506 &ufs_sysfs_monitor_group, 1564 1507 &ufs_sysfs_power_info_group, 1565 1508 &ufs_sysfs_device_descriptor_group,
+39 -46
drivers/ufs/core/ufshcd.c
··· 39 39 #include <asm/unaligned.h> 40 40 41 41 #define CREATE_TRACE_POINTS 42 - #include <trace/events/ufs.h> 42 + #include "ufs_trace.h" 43 43 44 44 #define UFSHCD_ENABLE_INTRS (UTP_TRANSFER_REQ_COMPL |\ 45 45 UTP_TASK_REQ_COMPL |\ ··· 51 51 52 52 53 53 /* UIC command timeout, unit: ms */ 54 - #define UIC_CMD_TIMEOUT 500 55 - 54 + enum { 55 + UIC_CMD_TIMEOUT_DEFAULT = 500, 56 + UIC_CMD_TIMEOUT_MAX = 2000, 57 + }; 56 58 /* NOP OUT retries waiting for NOP IN response */ 57 59 #define NOP_OUT_RETRIES 10 58 60 /* Timeout after 50 msecs if NOP OUT hangs without response */ ··· 117 115 118 116 module_param(use_mcq_mode, bool, 0644); 119 117 MODULE_PARM_DESC(use_mcq_mode, "Control MCQ mode for controllers starting from UFSHCI 4.0. 1 - enable MCQ, 0 - disable MCQ. MCQ is enabled by default"); 118 + 119 + static unsigned int uic_cmd_timeout = UIC_CMD_TIMEOUT_DEFAULT; 120 + 121 + static int uic_cmd_timeout_set(const char *val, const struct kernel_param *kp) 122 + { 123 + return param_set_uint_minmax(val, kp, UIC_CMD_TIMEOUT_DEFAULT, 124 + UIC_CMD_TIMEOUT_MAX); 125 + } 126 + 127 + static const struct kernel_param_ops uic_cmd_timeout_ops = { 128 + .set = uic_cmd_timeout_set, 129 + .get = param_get_uint, 130 + }; 131 + 132 + module_param_cb(uic_cmd_timeout, &uic_cmd_timeout_ops, &uic_cmd_timeout, 0644); 133 + MODULE_PARM_DESC(uic_cmd_timeout, 134 + "UFS UIC command timeout in milliseconds. Defaults to 500ms. Supported values range from 500ms to 2 seconds inclusively"); 120 135 121 136 #define ufshcd_toggle_vreg(_dev, _vreg, _on) \ 122 137 ({ \ ··· 1804 1785 1805 1786 static void ufshcd_init_clk_scaling(struct ufs_hba *hba) 1806 1787 { 1807 - char wq_name[sizeof("ufs_clkscaling_00")]; 1808 - 1809 1788 if (!ufshcd_is_clkscaling_supported(hba)) 1810 1789 return; 1811 1790 ··· 1815 1798 INIT_WORK(&hba->clk_scaling.resume_work, 1816 1799 ufshcd_clk_scaling_resume_work); 1817 1800 1818 - snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d", 1819 - hba->host->host_no); 1820 - hba->clk_scaling.workq = create_singlethread_workqueue(wq_name); 1801 + hba->clk_scaling.workq = alloc_ordered_workqueue( 1802 + "ufs_clkscaling_%d", WQ_MEM_RECLAIM, hba->host->host_no); 1821 1803 1822 1804 hba->clk_scaling.is_initialized = true; 1823 1805 } ··· 2140 2124 2141 2125 static void ufshcd_init_clk_gating(struct ufs_hba *hba) 2142 2126 { 2143 - char wq_name[sizeof("ufs_clk_gating_00")]; 2144 - 2145 2127 if (!ufshcd_is_clkgating_allowed(hba)) 2146 2128 return; 2147 2129 ··· 2149 2135 INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work); 2150 2136 INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work); 2151 2137 2152 - snprintf(wq_name, ARRAY_SIZE(wq_name), "ufs_clk_gating_%d", 2153 - hba->host->host_no); 2154 - hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name, 2155 - WQ_MEM_RECLAIM | WQ_HIGHPRI); 2138 + hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue( 2139 + "ufs_clk_gating_%d", WQ_MEM_RECLAIM | WQ_HIGHPRI, 2140 + hba->host->host_no); 2156 2141 2157 2142 ufshcd_init_clk_gating_sysfs(hba); 2158 2143 ··· 2465 2452 { 2466 2453 u32 val; 2467 2454 int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY, 2468 - 500, UIC_CMD_TIMEOUT * 1000, false, hba, 2455 + 500, uic_cmd_timeout * 1000, false, hba, 2469 2456 REG_CONTROLLER_STATUS); 2470 2457 return ret == 0; 2471 2458 } ··· 2525 2512 lockdep_assert_held(&hba->uic_cmd_mutex); 2526 2513 2527 2514 if (wait_for_completion_timeout(&uic_cmd->done, 2528 - msecs_to_jiffies(UIC_CMD_TIMEOUT))) { 2515 + msecs_to_jiffies(uic_cmd_timeout))) { 2529 2516 ret = uic_cmd->argument2 & MASK_UIC_COMMAND_RESULT; 2530 2517 } else { 2531 2518 ret = -ETIMEDOUT; ··· 4298 4285 } 4299 4286 4300 4287 if (!wait_for_completion_timeout(hba->uic_async_done, 4301 - msecs_to_jiffies(UIC_CMD_TIMEOUT))) { 4288 + msecs_to_jiffies(uic_cmd_timeout))) { 4302 4289 dev_err(hba->dev, 4303 4290 "pwr ctrl cmd 0x%x with mode 0x%x completion timeout\n", 4304 4291 cmd->command, cmd->argument3); ··· 5889 5876 /** 5890 5877 * ufshcd_bkops_ctrl - control the auto bkops based on current bkops status 5891 5878 * @hba: per-adapter instance 5892 - * @status: bkops_status value 5893 5879 * 5894 5880 * Read the bkops_status from the UFS device and Enable fBackgroundOpsEn 5895 5881 * flag in the device to permit background operations if the device 5896 - * bkops_status is greater than or equal to "status" argument passed to 5897 - * this function, disable otherwise. 5882 + * bkops_status is greater than or equal to the "hba->urgent_bkops_lvl", 5883 + * disable otherwise. 5898 5884 * 5899 5885 * Return: 0 for success, non-zero in case of failure. 5900 5886 * ··· 5901 5889 * to know whether auto bkops is enabled or disabled after this function 5902 5890 * returns control to it. 5903 5891 */ 5904 - static int ufshcd_bkops_ctrl(struct ufs_hba *hba, 5905 - enum bkops_status status) 5892 + static int ufshcd_bkops_ctrl(struct ufs_hba *hba) 5906 5893 { 5907 - int err; 5894 + enum bkops_status status = hba->urgent_bkops_lvl; 5908 5895 u32 curr_status = 0; 5896 + int err; 5909 5897 5910 5898 err = ufshcd_get_bkops_status(hba, &curr_status); 5911 5899 if (err) { ··· 5925 5913 err = ufshcd_disable_auto_bkops(hba); 5926 5914 out: 5927 5915 return err; 5928 - } 5929 - 5930 - /** 5931 - * ufshcd_urgent_bkops - handle urgent bkops exception event 5932 - * @hba: per-adapter instance 5933 - * 5934 - * Enable fBackgroundOpsEn flag in the device to permit background 5935 - * operations. 5936 - * 5937 - * If BKOPs is enabled, this function returns 0, 1 if the bkops in not enabled 5938 - * and negative error value for any other failure. 5939 - * 5940 - * Return: 0 upon success; < 0 upon failure. 5941 - */ 5942 - static int ufshcd_urgent_bkops(struct ufs_hba *hba) 5943 - { 5944 - return ufshcd_bkops_ctrl(hba, hba->urgent_bkops_lvl); 5945 5916 } 5946 5917 5947 5918 static inline int ufshcd_get_ee_status(struct ufs_hba *hba, u32 *status) ··· 9687 9692 * allow background operations if bkops status shows 9688 9693 * that performance might be impacted. 9689 9694 */ 9690 - ret = ufshcd_urgent_bkops(hba); 9695 + ret = ufshcd_bkops_ctrl(hba); 9691 9696 if (ret) { 9692 9697 /* 9693 9698 * If return err in suspend flow, IO will hang. ··· 9876 9881 * If BKOPs operations are urgently needed at this moment then 9877 9882 * keep auto-bkops enabled or else disable it. 9878 9883 */ 9879 - ufshcd_urgent_bkops(hba); 9884 + ufshcd_bkops_ctrl(hba); 9880 9885 9881 9886 if (hba->ee_usr_mask) 9882 9887 ufshcd_write_ee_control(hba); ··· 10390 10395 int err; 10391 10396 struct Scsi_Host *host = hba->host; 10392 10397 struct device *dev = hba->dev; 10393 - char eh_wq_name[sizeof("ufs_eh_wq_00")]; 10394 10398 10395 10399 /* 10396 10400 * dev_set_drvdata() must be called before any callbacks are registered ··· 10456 10462 hba->max_pwr_info.is_valid = false; 10457 10463 10458 10464 /* Initialize work queues */ 10459 - snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d", 10460 - hba->host->host_no); 10461 - hba->eh_wq = create_singlethread_workqueue(eh_wq_name); 10465 + hba->eh_wq = alloc_ordered_workqueue("ufs_eh_wq_%d", WQ_MEM_RECLAIM, 10466 + hba->host->host_no); 10462 10467 if (!hba->eh_wq) { 10463 10468 dev_err(hba->dev, "%s: failed to create eh workqueue\n", 10464 10469 __func__);
+5 -9
drivers/ufs/host/ufshcd-pltfrm.c
··· 31 31 const char *name; 32 32 u32 *clkfreq = NULL; 33 33 struct ufs_clk_info *clki; 34 - int len = 0; 35 - size_t sz = 0; 34 + ssize_t sz = 0; 36 35 37 36 if (!np) 38 37 goto out; ··· 49 50 if (cnt <= 0) 50 51 goto out; 51 52 52 - if (!of_get_property(np, "freq-table-hz", &len)) { 53 + sz = of_property_count_u32_elems(np, "freq-table-hz"); 54 + if (sz <= 0) { 53 55 dev_info(dev, "freq-table-hz property not specified\n"); 54 56 goto out; 55 57 } 56 58 57 - if (len <= 0) 58 - goto out; 59 - 60 - sz = len / sizeof(*clkfreq); 61 59 if (sz != 2 * cnt) { 62 60 dev_err(dev, "%s len mismatch\n", "freq-table-hz"); 63 61 ret = -EINVAL; ··· 268 272 const char **clk_names; 269 273 int cnt, i, ret; 270 274 271 - if (!of_find_property(np, "operating-points-v2", NULL)) 275 + if (!of_property_present(np, "operating-points-v2")) 272 276 return 0; 273 277 274 - if (of_find_property(np, "freq-table-hz", NULL)) { 278 + if (of_property_present(np, "freq-table-hz")) { 275 279 dev_err(dev, "%s: operating-points and freq-table-hz are incompatible\n", 276 280 __func__); 277 281 return -EINVAL;
-2
include/scsi/fcoe_sysfs.h
··· 50 50 struct fcoe_sysfs_function_template *f; 51 51 52 52 struct list_head fcfs; 53 - char work_q_name[20]; 54 53 struct workqueue_struct *work_q; 55 - char devloss_work_q_name[20]; 56 54 struct workqueue_struct *devloss_work_q; 57 55 struct mutex lock; 58 56
-7
include/scsi/scsi_dbg.h
··· 24 24 const char **); 25 25 extern const char *scsi_mlreturn_string(int); 26 26 extern const char *scsi_hostbyte_string(int); 27 - extern const char *scsi_driverbyte_string(int); 28 27 #else 29 28 static inline bool 30 29 scsi_opcode_sa_name(int cmd, int sa, ··· 71 72 72 73 static inline const char * 73 74 scsi_hostbyte_string(int result) 74 - { 75 - return NULL; 76 - } 77 - 78 - static inline const char * 79 - scsi_driverbyte_string(int result) 80 75 { 81 76 return NULL; 82 77 }
-1
include/scsi/scsi_host.h
··· 677 677 /* 678 678 * Optional work queue to be utilized by the transport 679 679 */ 680 - char work_q_name[20]; 681 680 struct workqueue_struct *work_q; 682 681 683 682 /*
-6
include/scsi/scsi_transport_fc.h
··· 575 575 u16 npiv_vports_inuse; 576 576 577 577 /* work queues for rport state manipulation */ 578 - char work_q_name[20]; 579 578 struct workqueue_struct *work_q; 580 - char devloss_work_q_name[20]; 581 579 struct workqueue_struct *devloss_work_q; 582 580 583 581 /* bsg support */ ··· 652 654 (((struct fc_host_attrs *)(x)->shost_data)->next_vport_number) 653 655 #define fc_host_npiv_vports_inuse(x) \ 654 656 (((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse) 655 - #define fc_host_work_q_name(x) \ 656 - (((struct fc_host_attrs *)(x)->shost_data)->work_q_name) 657 657 #define fc_host_work_q(x) \ 658 658 (((struct fc_host_attrs *)(x)->shost_data)->work_q) 659 - #define fc_host_devloss_work_q_name(x) \ 660 - (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name) 661 659 #define fc_host_devloss_work_q(x) \ 662 660 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) 663 661 #define fc_host_dev_loss_tmo(x) \
+6
include/trace/events/ufs.h drivers/ufs/core/ufs_trace.h
··· 9 9 #if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) 10 10 #define _TRACE_UFS_H 11 11 12 + #include <ufs/ufs.h> 12 13 #include <linux/tracepoint.h> 13 14 14 15 #define str_opcode(opcode) \ ··· 395 394 ); 396 395 397 396 #endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */ 397 + 398 + #undef TRACE_INCLUDE_PATH 399 + #define TRACE_INCLUDE_PATH ../../drivers/ufs/core 400 + #undef TRACE_INCLUDE_FILE 401 + #define TRACE_INCLUDE_FILE ufs_trace 398 402 399 403 /* This part must be outside protection */ 400 404 #include <trace/define_trace.h>
+2 -2
include/ufs/ufs.h
··· 597 597 }; 598 598 599 599 /* 600 - * This enum is used in string mapping in include/trace/events/ufs.h. 600 + * This enum is used in string mapping in ufs_trace.h. 601 601 */ 602 602 enum ufs_trace_str_t { 603 603 UFS_CMD_SEND, UFS_CMD_COMP, UFS_DEV_COMP, ··· 607 607 608 608 /* 609 609 * Transaction Specific Fields (TSF) type in the UPIU package, this enum is 610 - * used in include/trace/events/ufs.h for UFS command trace. 610 + * used in ufs_trace.h for UFS command trace. 611 611 */ 612 612 enum ufs_trace_tsf_t { 613 613 UFS_TSF_CDB, UFS_TSF_OSF, UFS_TSF_TM_INPUT, UFS_TSF_TM_OUTPUT
+3 -2
include/ufs/ufshci.h
··· 25 25 REG_CONTROLLER_CAPABILITIES = 0x00, 26 26 REG_MCQCAP = 0x04, 27 27 REG_UFS_VERSION = 0x08, 28 - REG_CONTROLLER_DEV_ID = 0x10, 29 - REG_CONTROLLER_PROD_ID = 0x14, 28 + REG_EXT_CONTROLLER_CAPABILITIES = 0x0C, 29 + REG_CONTROLLER_PID = 0x10, 30 + REG_CONTROLLER_MID = 0x14, 30 31 REG_AUTO_HIBERNATE_IDLE_TIMER = 0x18, 31 32 REG_INTERRUPT_STATUS = 0x20, 32 33 REG_INTERRUPT_ENABLE = 0x24,