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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull more SCSI updates from James Bottomley:
"This is the final round of mostly small fixes and performance
improvements to our initial submit.

The main regression fix is the ia64 simscsi build failure which was
missed in the serial number elimination conversion"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (24 commits)
scsi: ia64: simscsi: use request tag instead of serial_number
scsi: aacraid: Fix performance issue on logical drives
scsi: lpfc: Fix error codes in lpfc_sli4_pci_mem_setup()
scsi: libiscsi: Hold back_lock when calling iscsi_complete_task
scsi: hisi_sas: Change SERDES_CFG init value to increase reliability of HiLink
scsi: hisi_sas: Send HARD RESET to clear the previous affiliation of STP target port
scsi: hisi_sas: Set PHY linkrate when disconnected
scsi: hisi_sas: print PHY RX errors count for later revision of v3 hw
scsi: hisi_sas: Fix a timeout race of driver internal and SMP IO
scsi: hisi_sas: Change return variable type in phy_up_v3_hw()
scsi: qla2xxx: check for kstrtol() failure
scsi: lpfc: fix 32-bit format string warning
scsi: lpfc: fix unused variable warning
scsi: target: tcmu: Switch to bitmap_zalloc()
scsi: libiscsi: fall back to sendmsg for slab pages
scsi: qla2xxx: avoid printf format warning
scsi: lpfc: resolve static checker warning in lpfc_sli4_hba_unset
scsi: lpfc: Correct __lpfc_sli_issue_iocb_s4 lockdep check
scsi: ufs: hisi: fix ufs_hba_variant_ops passing
scsi: qla2xxx: Fix panic in qla_dfs_tgt_counters_show
...

+210 -80
+4 -3
arch/ia64/hp/sim/simscsi.c
··· 105 105 atomic_dec(&num_reqs); 106 106 queue[rd].sc = NULL; 107 107 if (DBG) 108 - printk("simscsi_interrupt: done with %ld\n", sc->serial_number); 108 + printk("simscsi_interrupt: done with %u\n", 109 + sc->request->tag); 109 110 (*sc->scsi_done)(sc); 110 111 rd = (rd + 1) % SIMSCSI_REQ_QUEUE_LEN; 111 112 } ··· 215 214 register long sp asm ("sp"); 216 215 217 216 if (DBG) 218 - printk("simscsi_queuecommand: target=%d,cmnd=%u,sc=%lu,sp=%lx,done=%p\n", 219 - target_id, sc->cmnd[0], sc->serial_number, sp, done); 217 + printk("simscsi_queuecommand: target=%d,cmnd=%u,sc=%u,sp=%lx,done=%p\n", 218 + target_id, sc->cmnd[0], sc->request->tag, sp, done); 220 219 #endif 221 220 222 221 sc->result = DID_BAD_TARGET << 16;
+8 -5
drivers/scsi/aacraid/linit.c
··· 413 413 if (chn < AAC_MAX_BUSES && tid < AAC_MAX_TARGETS && aac->sa_firmware) { 414 414 devtype = aac->hba_map[chn][tid].devtype; 415 415 416 - if (devtype == AAC_DEVTYPE_NATIVE_RAW) 416 + if (devtype == AAC_DEVTYPE_NATIVE_RAW) { 417 417 depth = aac->hba_map[chn][tid].qd_limit; 418 - else if (devtype == AAC_DEVTYPE_ARC_RAW) 418 + set_timeout = 1; 419 + goto common_config; 420 + } 421 + if (devtype == AAC_DEVTYPE_ARC_RAW) { 419 422 set_qd_dev_type = true; 420 - 421 - set_timeout = 1; 422 - goto common_config; 423 + set_timeout = 1; 424 + goto common_config; 425 + } 423 426 } 424 427 425 428 if (aac->jbod && (sdev->type == TYPE_DISK))
+8
drivers/scsi/hisi_sas/hisi_sas.h
··· 18 18 #include <linux/dmapool.h> 19 19 #include <linux/iopoll.h> 20 20 #include <linux/lcm.h> 21 + #include <linux/libata.h> 21 22 #include <linux/mfd/syscon.h> 22 23 #include <linux/module.h> 23 24 #include <linux/of_address.h> ··· 95 94 PORT_TYPE_SATA = (1U << 0), 96 95 }; 97 96 97 + enum dev_status { 98 + HISI_SAS_DEV_INIT, 99 + HISI_SAS_DEV_NORMAL, 100 + }; 101 + 98 102 enum { 99 103 HISI_SAS_INT_ABT_CMD = 0, 100 104 HISI_SAS_INT_ABT_DEV = 1, ··· 167 161 u8 in_reset; 168 162 u8 reserved[2]; 169 163 u32 phy_type; 164 + u32 code_violation_err_count; 170 165 enum sas_linkrate minimum_linkrate; 171 166 enum sas_linkrate maximum_linkrate; 172 167 }; ··· 201 194 struct hisi_sas_dq *dq; 202 195 struct list_head list; 203 196 enum sas_device_type dev_type; 197 + enum dev_status dev_status; 204 198 int device_id; 205 199 int sata_idx; 206 200 spinlock_t lock; /* For protecting slots */
+53 -4
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 10 10 */ 11 11 12 12 #include "hisi_sas.h" 13 + #include "../libsas/sas_internal.h" 13 14 #define DRV_NAME "hisi_sas" 14 15 15 16 #define DEV_IS_GONE(dev) \ ··· 708 707 709 708 hisi_hba->devices[i].device_id = i; 710 709 sas_dev = &hisi_hba->devices[i]; 710 + sas_dev->dev_status = HISI_SAS_DEV_INIT; 711 711 sas_dev->dev_type = device->dev_type; 712 712 sas_dev->hisi_hba = hisi_hba; 713 713 sas_dev->sas_device = device; ··· 733 731 struct hisi_sas_tmf_task tmf_task; 734 732 int retry = HISI_SAS_SRST_ATA_DISK_CNT; 735 733 struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); 734 + struct device *dev = hisi_hba->dev; 735 + struct sas_phy *local_phy; 736 736 737 737 switch (device->dev_type) { 738 738 case SAS_END_DEVICE: ··· 750 746 case SAS_SATA_PM: 751 747 case SAS_SATA_PM_PORT: 752 748 case SAS_SATA_PENDING: 749 + /* 750 + * send HARD RESET to clear previous affiliation of 751 + * STP target port 752 + */ 753 + local_phy = sas_get_local_phy(device); 754 + if (!scsi_is_sas_phy_local(local_phy)) { 755 + unsigned long deadline = ata_deadline(jiffies, 20000); 756 + struct sata_device *sata_dev = &device->sata_dev; 757 + struct ata_host *ata_host = sata_dev->ata_host; 758 + struct ata_port_operations *ops = ata_host->ops; 759 + struct ata_port *ap = sata_dev->ap; 760 + struct ata_link *link; 761 + unsigned int classes; 762 + 763 + ata_for_each_link(link, ap, EDGE) 764 + rc = ops->hardreset(link, &classes, 765 + deadline); 766 + } 767 + sas_put_local_phy(local_phy); 768 + if (rc) { 769 + dev_warn(dev, "SATA disk hardreset fail: 0x%x\n", 770 + rc); 771 + return rc; 772 + } 773 + 753 774 while (retry-- > 0) { 754 775 rc = hisi_sas_softreset_ata_disk(device); 755 776 if (!rc) ··· 837 808 rc = hisi_sas_init_device(device); 838 809 if (rc) 839 810 goto err_out; 811 + sas_dev->dev_status = HISI_SAS_DEV_NORMAL; 840 812 return 0; 841 813 842 814 err_out: ··· 1010 980 spin_lock_irqsave(&task->task_state_lock, flags); 1011 981 task->task_state_flags &= 1012 982 ~(SAS_TASK_STATE_PENDING | SAS_TASK_AT_INITIATOR); 1013 - task->task_state_flags |= SAS_TASK_STATE_DONE; 983 + if (!slot->is_internal && task->task_proto != SAS_PROTOCOL_SMP) 984 + task->task_state_flags |= SAS_TASK_STATE_DONE; 1014 985 spin_unlock_irqrestore(&task->task_state_lock, flags); 1015 986 } 1016 987 ··· 1744 1713 static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) 1745 1714 { 1746 1715 struct sas_phy *local_phy = sas_get_local_phy(device); 1747 - int rc, reset_type = (device->dev_type == SAS_SATA_DEV || 1748 - (device->tproto & SAS_PROTOCOL_STP)) ? 0 : 1; 1716 + struct hisi_sas_device *sas_dev = device->lldd_dev; 1749 1717 struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); 1750 1718 struct sas_ha_struct *sas_ha = &hisi_hba->sha; 1751 1719 struct asd_sas_phy *sas_phy = sas_ha->sas_phy[local_phy->number]; 1752 1720 struct hisi_sas_phy *phy = container_of(sas_phy, 1753 1721 struct hisi_sas_phy, sas_phy); 1754 1722 DECLARE_COMPLETION_ONSTACK(phyreset); 1723 + int rc, reset_type; 1755 1724 1756 1725 if (scsi_is_sas_phy_local(local_phy)) { 1757 1726 phy->in_reset = 1; 1758 1727 phy->reset_completion = &phyreset; 1759 1728 } 1729 + 1730 + reset_type = (sas_dev->dev_status == HISI_SAS_DEV_INIT || 1731 + !dev_is_sata(device)) ? 1 : 0; 1760 1732 1761 1733 rc = sas_phy_reset(local_phy, reset_type); 1762 1734 sas_put_local_phy(local_phy); ··· 1776 1742 /* report PHY down if timed out */ 1777 1743 if (!ret) 1778 1744 hisi_sas_phy_down(hisi_hba, sas_phy->id, 0); 1779 - } else 1745 + } else if (sas_dev->dev_status != HISI_SAS_DEV_INIT) { 1746 + /* 1747 + * If in init state, we rely on caller to wait for link to be 1748 + * ready; otherwise, delay. 1749 + */ 1780 1750 msleep(2000); 1751 + } 1781 1752 1782 1753 return rc; 1783 1754 } ··· 2164 2125 2165 2126 static void hisi_sas_phy_disconnected(struct hisi_sas_phy *phy) 2166 2127 { 2128 + struct asd_sas_phy *sas_phy = &phy->sas_phy; 2129 + struct sas_phy *sphy = sas_phy->phy; 2130 + struct sas_phy_data *d = sphy->hostdata; 2131 + 2167 2132 phy->phy_attached = 0; 2168 2133 phy->phy_type = 0; 2169 2134 phy->port = NULL; 2135 + 2136 + if (d->enable) 2137 + sphy->negotiated_linkrate = SAS_LINK_RATE_UNKNOWN; 2138 + else 2139 + sphy->negotiated_linkrate = SAS_PHY_DISABLED; 2170 2140 } 2171 2141 2172 2142 void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy) ··· 2301 2253 for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) { 2302 2254 hisi_hba->devices[i].dev_type = SAS_PHY_UNUSED; 2303 2255 hisi_hba->devices[i].device_id = i; 2256 + hisi_hba->devices[i].dev_status = HISI_SAS_DEV_INIT; 2304 2257 } 2305 2258 2306 2259 for (i = 0; i < hisi_hba->queue_count; i++) {
+1
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
··· 868 868 869 869 hisi_hba->devices[i].device_id = i; 870 870 sas_dev = &hisi_hba->devices[i]; 871 + sas_dev->dev_status = HISI_SAS_DEV_INIT; 871 872 sas_dev->dev_type = device->dev_type; 872 873 sas_dev->hisi_hba = hisi_hba; 873 874 sas_dev->sas_device = device;
+63 -26
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
··· 129 129 #define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF) 130 130 #define CMD_HDR_PIR_OFF 8 131 131 #define CMD_HDR_PIR_MSK (0x1 << CMD_HDR_PIR_OFF) 132 + #define SERDES_CFG (PORT_BASE + 0x1c) 132 133 #define SL_CFG (PORT_BASE + 0x84) 133 134 #define AIP_LIMIT (PORT_BASE + 0x90) 134 135 #define SL_CONTROL (PORT_BASE + 0x94) ··· 182 181 #define CHL_INT1_DMAC_RX_AXI_RD_ERR_OFF 22 183 182 #define CHL_INT2 (PORT_BASE + 0x1bc) 184 183 #define CHL_INT2_SL_IDAF_TOUT_CONF_OFF 0 184 + #define CHL_INT2_RX_DISP_ERR_OFF 28 185 + #define CHL_INT2_RX_CODE_ERR_OFF 29 185 186 #define CHL_INT2_RX_INVLD_DW_OFF 30 186 187 #define CHL_INT2_STP_LINK_TIMEOUT_OFF 31 187 188 #define CHL_INT0_MSK (PORT_BASE + 0x1c0) ··· 526 523 } 527 524 hisi_sas_phy_write32(hisi_hba, i, PROG_PHY_LINK_RATE, 528 525 prog_phy_link_rate); 526 + hisi_sas_phy_write32(hisi_hba, i, SERDES_CFG, 0xffc00); 529 527 hisi_sas_phy_write32(hisi_hba, i, SAS_RX_TRAIN_TIMER, 0x13e80); 530 528 hisi_sas_phy_write32(hisi_hba, i, CHL_INT0, 0xffffffff); 531 529 hisi_sas_phy_write32(hisi_hba, i, CHL_INT1, 0xffffffff); ··· 548 544 hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, 0x7f7a120); 549 545 hisi_sas_phy_write32(hisi_hba, i, CON_CFG_DRIVER, 0x2a0a01); 550 546 hisi_sas_phy_write32(hisi_hba, i, SAS_SSP_CON_TIMER_CFG, 0x32); 547 + hisi_sas_phy_write32(hisi_hba, i, SAS_EC_INT_COAL_TIME, 548 + 0x30f4240); 551 549 /* used for 12G negotiate */ 552 550 hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e); 553 551 hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff); ··· 1350 1344 1351 1345 static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) 1352 1346 { 1353 - int i, res; 1347 + int i; 1348 + irqreturn_t res; 1354 1349 u32 context, port_id, link_rate; 1355 1350 struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; 1356 1351 struct asd_sas_phy *sas_phy = &phy->sas_phy; ··· 1582 1575 hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT1, irq_value); 1583 1576 } 1584 1577 1578 + static void phy_get_events_v3_hw(struct hisi_hba *hisi_hba, int phy_no) 1579 + { 1580 + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; 1581 + struct asd_sas_phy *sas_phy = &phy->sas_phy; 1582 + struct sas_phy *sphy = sas_phy->phy; 1583 + unsigned long flags; 1584 + u32 reg_value; 1585 + 1586 + spin_lock_irqsave(&phy->lock, flags); 1587 + 1588 + /* loss dword sync */ 1589 + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_DWS_LOST); 1590 + sphy->loss_of_dword_sync_count += reg_value; 1591 + 1592 + /* phy reset problem */ 1593 + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_RESET_PROB); 1594 + sphy->phy_reset_problem_count += reg_value; 1595 + 1596 + /* invalid dword */ 1597 + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_INVLD_DW); 1598 + sphy->invalid_dword_count += reg_value; 1599 + 1600 + /* disparity err */ 1601 + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_DISP_ERR); 1602 + sphy->running_disparity_error_count += reg_value; 1603 + 1604 + /* code violation error */ 1605 + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_CODE_ERR); 1606 + phy->code_violation_err_count += reg_value; 1607 + 1608 + spin_unlock_irqrestore(&phy->lock, flags); 1609 + } 1610 + 1585 1611 static void handle_chl_int2_v3_hw(struct hisi_hba *hisi_hba, int phy_no) 1586 1612 { 1587 1613 u32 irq_msk = hisi_sas_phy_read32(hisi_hba, phy_no, CHL_INT2_MSK); ··· 1622 1582 struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; 1623 1583 struct pci_dev *pci_dev = hisi_hba->pci_dev; 1624 1584 struct device *dev = hisi_hba->dev; 1585 + static const u32 msk = BIT(CHL_INT2_RX_DISP_ERR_OFF) | 1586 + BIT(CHL_INT2_RX_CODE_ERR_OFF) | 1587 + BIT(CHL_INT2_RX_INVLD_DW_OFF); 1625 1588 1626 1589 irq_value &= ~irq_msk; 1627 1590 if (!irq_value) ··· 1643 1600 phy_no, reg_value); 1644 1601 if (reg_value & BIT(4)) 1645 1602 hisi_sas_notify_phy_event(phy, HISI_PHYE_LINK_RESET); 1603 + } 1604 + 1605 + if (pci_dev->revision > 0x20 && (irq_value & msk)) { 1606 + struct asd_sas_phy *sas_phy = &phy->sas_phy; 1607 + struct sas_phy *sphy = sas_phy->phy; 1608 + 1609 + phy_get_events_v3_hw(hisi_hba, phy_no); 1610 + 1611 + if (irq_value & BIT(CHL_INT2_RX_INVLD_DW_OFF)) 1612 + dev_info(dev, "phy%d invalid dword cnt: %u\n", phy_no, 1613 + sphy->invalid_dword_count); 1614 + 1615 + if (irq_value & BIT(CHL_INT2_RX_CODE_ERR_OFF)) 1616 + dev_info(dev, "phy%d code violation cnt: %u\n", phy_no, 1617 + phy->code_violation_err_count); 1618 + 1619 + if (irq_value & BIT(CHL_INT2_RX_DISP_ERR_OFF)) 1620 + dev_info(dev, "phy%d disparity error cnt: %u\n", phy_no, 1621 + sphy->running_disparity_error_count); 1646 1622 } 1647 1623 1648 1624 if ((irq_value & BIT(CHL_INT2_RX_INVLD_DW_OFF)) && ··· 2290 2228 static u32 get_phys_state_v3_hw(struct hisi_hba *hisi_hba) 2291 2229 { 2292 2230 return hisi_sas_read32(hisi_hba, PHY_STATE); 2293 - } 2294 - 2295 - static void phy_get_events_v3_hw(struct hisi_hba *hisi_hba, int phy_no) 2296 - { 2297 - struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; 2298 - struct asd_sas_phy *sas_phy = &phy->sas_phy; 2299 - struct sas_phy *sphy = sas_phy->phy; 2300 - u32 reg_value; 2301 - 2302 - /* loss dword sync */ 2303 - reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_DWS_LOST); 2304 - sphy->loss_of_dword_sync_count += reg_value; 2305 - 2306 - /* phy reset problem */ 2307 - reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_RESET_PROB); 2308 - sphy->phy_reset_problem_count += reg_value; 2309 - 2310 - /* invalid dword */ 2311 - reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_INVLD_DW); 2312 - sphy->invalid_dword_count += reg_value; 2313 - 2314 - /* disparity err */ 2315 - reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_DISP_ERR); 2316 - sphy->running_disparity_error_count += reg_value; 2317 - 2318 2231 } 2319 2232 2320 2233 static int disable_host_v3_hw(struct hisi_hba *hisi_hba)
+20 -2
drivers/scsi/libiscsi.c
··· 798 798 * @datalen: len of buffer 799 799 * 800 800 * iscsi_cmd_rsp sets up the scsi_cmnd fields based on the PDU and 801 - * then completes the command and task. 801 + * then completes the command and task. called under back_lock 802 802 **/ 803 803 static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, 804 804 struct iscsi_task *task, char *data, ··· 894 894 * @conn: iscsi connection 895 895 * @hdr: iscsi pdu 896 896 * @task: scsi command task 897 + * 898 + * iscsi_data_in_rsp sets up the scsi_cmnd fields based on the data received 899 + * then completes the command and task. called under back_lock 897 900 **/ 898 901 static void 899 902 iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ··· 981 978 return 0; 982 979 } 983 980 981 + /** 982 + * iscsi_nop_out_rsp - SCSI NOP Response processing 983 + * @task: scsi command task 984 + * @nop: the nop structure 985 + * @data: where to put the data 986 + * @datalen: length of data 987 + * 988 + * iscsi_nop_out_rsp handles nop response from use or 989 + * from user space. called under back_lock 990 + **/ 984 991 static int iscsi_nop_out_rsp(struct iscsi_task *task, 985 992 struct iscsi_nopin *nop, char *data, int datalen) 986 993 { ··· 1763 1750 return 0; 1764 1751 1765 1752 prepd_reject: 1753 + spin_lock_bh(&session->back_lock); 1766 1754 iscsi_complete_task(task, ISCSI_TASK_REQUEUE_SCSIQ); 1755 + spin_unlock_bh(&session->back_lock); 1767 1756 reject: 1768 1757 spin_unlock_bh(&session->frwd_lock); 1769 1758 ISCSI_DBG_SESSION(session, "cmd 0x%x rejected (%d)\n", ··· 1773 1758 return SCSI_MLQUEUE_TARGET_BUSY; 1774 1759 1775 1760 prepd_fault: 1761 + spin_lock_bh(&session->back_lock); 1776 1762 iscsi_complete_task(task, ISCSI_TASK_REQUEUE_SCSIQ); 1763 + spin_unlock_bh(&session->back_lock); 1777 1764 fault: 1778 1765 spin_unlock_bh(&session->frwd_lock); 1779 1766 ISCSI_DBG_SESSION(session, "iscsi: cmd 0x%x is not queued (%d)\n", ··· 3092 3075 state = ISCSI_TASK_ABRT_SESS_RECOV; 3093 3076 if (task->state == ISCSI_TASK_PENDING) 3094 3077 state = ISCSI_TASK_COMPLETED; 3078 + spin_lock_bh(&session->back_lock); 3095 3079 iscsi_complete_task(task, state); 3096 - 3080 + spin_unlock_bh(&session->back_lock); 3097 3081 } 3098 3082 } 3099 3083
+8 -3
drivers/scsi/libiscsi_tcp.c
··· 129 129 BUG_ON(sg->length == 0); 130 130 131 131 /* 132 + * We always map for the recv path. 133 + * 132 134 * If the page count is greater than one it is ok to send 133 135 * to the network layer's zero copy send path. If not we 134 - * have to go the slow sendmsg path. We always map for the 135 - * recv path. 136 + * have to go the slow sendmsg path. 137 + * 138 + * Same goes for slab pages: skb_can_coalesce() allows 139 + * coalescing neighboring slab objects into a single frag which 140 + * triggers one of hardened usercopy checks. 136 141 */ 137 - if (page_count(sg_page(sg)) >= 1 && !recv) 142 + if (!recv && page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg))) 138 143 return; 139 144 140 145 if (recv) {
+12 -9
drivers/scsi/lpfc/lpfc_init.c
··· 4090 4090 /* Sanity check to ensure our sizing is right for both SCSI and NVME */ 4091 4091 if (sizeof(struct lpfc_io_buf) > LPFC_COMMON_IO_BUF_SZ) { 4092 4092 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 4093 - "6426 Common buffer size %ld exceeds %d\n", 4093 + "6426 Common buffer size %zd exceeds %d\n", 4094 4094 sizeof(struct lpfc_io_buf), 4095 4095 LPFC_COMMON_IO_BUF_SZ); 4096 4096 return 0; ··· 10052 10052 { 10053 10053 struct pci_dev *pdev = phba->pcidev; 10054 10054 unsigned long bar0map_len, bar1map_len, bar2map_len; 10055 - int error = -ENODEV; 10055 + int error; 10056 10056 uint32_t if_type; 10057 10057 10058 10058 if (!pdev) ··· 10071 10071 */ 10072 10072 if (pci_read_config_dword(pdev, LPFC_SLI_INTF, 10073 10073 &phba->sli4_hba.sli_intf.word0)) { 10074 - return error; 10074 + return -ENODEV; 10075 10075 } 10076 10076 10077 10077 /* There is no SLI3 failback for SLI4 devices. */ ··· 10081 10081 "2894 SLI_INTF reg contents invalid " 10082 10082 "sli_intf reg 0x%x\n", 10083 10083 phba->sli4_hba.sli_intf.word0); 10084 - return error; 10084 + return -ENODEV; 10085 10085 } 10086 10086 10087 10087 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); ··· 10105 10105 dev_printk(KERN_ERR, &pdev->dev, 10106 10106 "ioremap failed for SLI4 PCI config " 10107 10107 "registers.\n"); 10108 - goto out; 10108 + return -ENODEV; 10109 10109 } 10110 10110 phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; 10111 10111 /* Set up BAR0 PCI config space register memory map */ ··· 10116 10116 if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) { 10117 10117 dev_printk(KERN_ERR, &pdev->dev, 10118 10118 "FATAL - No BAR0 mapping for SLI4, if_type 2\n"); 10119 - goto out; 10119 + return -ENODEV; 10120 10120 } 10121 10121 phba->sli4_hba.conf_regs_memmap_p = 10122 10122 ioremap(phba->pci_bar0_map, bar0map_len); ··· 10124 10124 dev_printk(KERN_ERR, &pdev->dev, 10125 10125 "ioremap failed for SLI4 PCI config " 10126 10126 "registers.\n"); 10127 - goto out; 10127 + return -ENODEV; 10128 10128 } 10129 10129 lpfc_sli4_bar0_register_memmap(phba, if_type); 10130 10130 } ··· 10170 10170 if (!phba->sli4_hba.drbl_regs_memmap_p) { 10171 10171 dev_err(&pdev->dev, 10172 10172 "ioremap failed for SLI4 HBA doorbell registers.\n"); 10173 + error = -ENOMEM; 10173 10174 goto out_iounmap_conf; 10174 10175 } 10175 10176 phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; ··· 10220 10219 if (!phba->sli4_hba.dpp_regs_memmap_p) { 10221 10220 dev_err(&pdev->dev, 10222 10221 "ioremap failed for SLI4 HBA dpp registers.\n"); 10222 + error = -ENOMEM; 10223 10223 goto out_iounmap_ctrl; 10224 10224 } 10225 10225 phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; ··· 10251 10249 iounmap(phba->sli4_hba.ctrl_regs_memmap_p); 10252 10250 out_iounmap_conf: 10253 10251 iounmap(phba->sli4_hba.conf_regs_memmap_p); 10254 - out: 10252 + 10255 10253 return error; 10256 10254 } 10257 10255 ··· 11139 11137 lpfc_sli4_ras_dma_free(phba); 11140 11138 11141 11139 /* Stop the SLI4 device port */ 11142 - phba->pport->work_port_events = 0; 11140 + if (phba->pport) 11141 + phba->pport->work_port_events = 0; 11143 11142 } 11144 11143 11145 11144 /**
+2 -1
drivers/scsi/lpfc/lpfc_nvme.c
··· 965 965 struct lpfc_nodelist *ndlp; 966 966 struct lpfc_nvme_fcpreq_priv *freqpriv; 967 967 struct lpfc_nvme_lport *lport; 968 - uint32_t code, status, idx, cpu; 968 + uint32_t code, status, idx; 969 969 uint16_t cid, sqhd, data; 970 970 uint32_t *ptr; 971 971 ··· 1138 1138 lpfc_nvme_ktime(phba, lpfc_ncmd); 1139 1139 } 1140 1140 if (phba->cpucheck_on & LPFC_CHECK_NVME_IO) { 1141 + uint32_t cpu; 1141 1142 idx = lpfc_ncmd->cur_iocbq.hba_wqidx; 1142 1143 cpu = smp_processor_id(); 1143 1144 if (cpu < LPFC_CHECK_CPU_CNT) {
+1 -1
drivers/scsi/lpfc/lpfc_sli.c
··· 9881 9881 * The WQE can be either 64 or 128 bytes, 9882 9882 */ 9883 9883 9884 - lockdep_assert_held(&phba->hbalock); 9884 + lockdep_assert_held(&pring->ring_lock); 9885 9885 9886 9886 if (piocb->sli4_xritag == NO_XRI) { 9887 9887 if (piocb->iocb.ulpCommand == CMD_ABORT_XRI_CN ||
+2 -2
drivers/scsi/megaraid/megaraid_sas_base.c
··· 3924 3924 /* 3925 3925 * The cur_state should not last for more than max_wait secs 3926 3926 */ 3927 - for (i = 0; i < max_wait; i++) { 3927 + for (i = 0; i < max_wait * 50; i++) { 3928 3928 curr_abs_state = instance->instancet-> 3929 3929 read_fw_status_reg(instance); 3930 3930 3931 3931 if (abs_state == curr_abs_state) { 3932 - msleep(1000); 3932 + msleep(20); 3933 3933 } else 3934 3934 break; 3935 3935 }
+2
drivers/scsi/qla2xxx/qla_attr.c
··· 1652 1652 } 1653 1653 1654 1654 rval = kstrtol(buf, 10, &type); 1655 + if (rval) 1656 + return rval; 1655 1657 speed = type; 1656 1658 if (type == 40 || type == 80 || type == 160 || 1657 1659 type == 320) {
+2
drivers/scsi/qla2xxx/qla_dfs.c
··· 193 193 194 194 for (i = 0; i < vha->hw->max_qpairs; i++) { 195 195 qpair = vha->hw->queue_pair_map[i]; 196 + if (!qpair) 197 + continue; 196 198 qla_core_sbt_cmd += qpair->tgt_counters.qla_core_sbt_cmd; 197 199 core_qla_que_buf += qpair->tgt_counters.core_qla_que_buf; 198 200 qla_core_ret_ctio += qpair->tgt_counters.qla_core_ret_ctio;
+2 -2
drivers/scsi/qla2xxx/qla_iocb.c
··· 1132 1132 /* if initiator doing write or target doing read */ 1133 1133 if (direction_to_device) { 1134 1134 for_each_sg(sgl, sg, tot_dsds, i) { 1135 - dma_addr_t sle_phys = sg_phys(sg); 1135 + u64 sle_phys = sg_phys(sg); 1136 1136 1137 1137 /* If SGE addr + len flips bits in upper 32-bits */ 1138 1138 if (MSD(sle_phys + sg->length) ^ MSD(sle_phys)) { ··· 1178 1178 1179 1179 ql_dbg(ql_dbg_tgt + ql_dbg_verbose, vha, 0xe023, 1180 1180 "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n", 1181 - __func__, i, sg_phys(sg), sglen, ldma_sg_len, 1181 + __func__, i, (u64)sg_phys(sg), sglen, ldma_sg_len, 1182 1182 difctx->dif_bundl_len, ldma_needed); 1183 1183 1184 1184 while (sglen) {
+6
drivers/scsi/smartpqi/smartpqi_init.c
··· 2764 2764 sshdr.sense_key == HARDWARE_ERROR && 2765 2765 sshdr.asc == 0x3e && 2766 2766 sshdr.ascq == 0x1) { 2767 + struct pqi_ctrl_info *ctrl_info = shost_to_hba(scmd->device->host); 2768 + struct pqi_scsi_dev *device = scmd->device->hostdata; 2769 + 2770 + if (printk_ratelimit()) 2771 + scmd_printk(KERN_ERR, scmd, "received 'logical unit failure' from controller for scsi %d:%d:%d:%d\n", 2772 + ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); 2767 2773 pqi_take_device_offline(scmd->device, "RAID"); 2768 2774 host_byte = DID_NO_CONNECT; 2769 2775 }
+4 -7
drivers/scsi/ufs/ufs-hisi.c
··· 640 640 return 0; 641 641 } 642 642 643 - static struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { 643 + static const struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { 644 644 .name = "hi3660", 645 645 .init = ufs_hi3660_init, 646 646 .link_startup_notify = ufs_hisi_link_startup_notify, ··· 649 649 .resume = ufs_hisi_resume, 650 650 }; 651 651 652 - static struct ufs_hba_variant_ops ufs_hba_hi3670_vops = { 652 + static const struct ufs_hba_variant_ops ufs_hba_hi3670_vops = { 653 653 .name = "hi3670", 654 654 .init = ufs_hi3670_init, 655 655 .link_startup_notify = ufs_hisi_link_startup_notify, ··· 669 669 static int ufs_hisi_probe(struct platform_device *pdev) 670 670 { 671 671 const struct of_device_id *of_id; 672 - struct ufs_hba_variant_ops *vops; 673 - struct device *dev = &pdev->dev; 674 672 675 - of_id = of_match_node(ufs_hisi_of_match, dev->of_node); 676 - vops = (struct ufs_hba_variant_ops *)of_id->data; 673 + of_id = of_match_node(ufs_hisi_of_match, pdev->dev.of_node); 677 674 678 - return ufshcd_pltfrm_init(pdev, vops); 675 + return ufshcd_pltfrm_init(pdev, of_id->data); 679 676 } 680 677 681 678 static int ufs_hisi_remove(struct platform_device *pdev)
+1 -1
drivers/scsi/ufs/ufshcd-pltfrm.c
··· 297 297 * Returns 0 on success, non-zero value on failure 298 298 */ 299 299 int ufshcd_pltfrm_init(struct platform_device *pdev, 300 - struct ufs_hba_variant_ops *vops) 300 + const struct ufs_hba_variant_ops *vops) 301 301 { 302 302 struct ufs_hba *hba; 303 303 void __iomem *mmio_base;
+1 -1
drivers/scsi/ufs/ufshcd-pltfrm.h
··· 17 17 #include "ufshcd.h" 18 18 19 19 int ufshcd_pltfrm_init(struct platform_device *pdev, 20 - struct ufs_hba_variant_ops *vops); 20 + const struct ufs_hba_variant_ops *vops); 21 21 void ufshcd_pltfrm_shutdown(struct platform_device *pdev); 22 22 23 23 #ifdef CONFIG_PM
+1 -1
drivers/scsi/ufs/ufshcd.h
··· 546 546 int nutrs; 547 547 int nutmrs; 548 548 u32 ufs_version; 549 - struct ufs_hba_variant_ops *vops; 549 + const struct ufs_hba_variant_ops *vops; 550 550 void *priv; 551 551 unsigned int irq; 552 552 bool is_irq_enabled;
-2
drivers/scsi/virtio_scsi.c
··· 586 586 return FAILED; 587 587 588 588 memset(cmd, 0, sizeof(*cmd)); 589 - cmd->sc = sc; 590 589 cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){ 591 590 .type = VIRTIO_SCSI_T_TMF, 592 591 .subtype = cpu_to_virtio32(vscsi->vdev, ··· 644 645 return FAILED; 645 646 646 647 memset(cmd, 0, sizeof(*cmd)); 647 - cmd->sc = sc; 648 648 cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){ 649 649 .type = VIRTIO_SCSI_T_TMF, 650 650 .subtype = VIRTIO_SCSI_T_TMF_ABORT_TASK,
+9 -10
drivers/target/target_core_user.c
··· 1663 1663 WARN_ON(!all_expired); 1664 1664 1665 1665 tcmu_blocks_release(&udev->data_blocks, 0, udev->dbi_max + 1); 1666 - kfree(udev->data_bitmap); 1666 + bitmap_free(udev->data_bitmap); 1667 1667 mutex_unlock(&udev->cmdr_lock); 1668 1668 1669 1669 call_rcu(&dev->rcu_head, tcmu_dev_call_rcu); ··· 1794 1794 1795 1795 ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0, 1796 1796 TCMU_MCGRP_CONFIG, GFP_KERNEL); 1797 - /* We don't care if no one is listening */ 1798 - if (ret == -ESRCH) 1799 - ret = 0; 1800 - if (!ret) 1801 - ret = tcmu_wait_genl_cmd_reply(udev); 1797 + 1798 + /* Wait during an add as the listener may not be up yet */ 1799 + if (ret == 0 || 1800 + (ret == -ESRCH && cmd == TCMU_CMD_ADDED_DEVICE)) 1801 + return tcmu_wait_genl_cmd_reply(udev); 1802 + 1802 1803 return ret; 1803 1804 } 1804 1805 ··· 1871 1870 info = &udev->uio_info; 1872 1871 1873 1872 mutex_lock(&udev->cmdr_lock); 1874 - udev->data_bitmap = kcalloc(BITS_TO_LONGS(udev->max_blocks), 1875 - sizeof(unsigned long), 1876 - GFP_KERNEL); 1873 + udev->data_bitmap = bitmap_zalloc(udev->max_blocks, GFP_KERNEL); 1877 1874 mutex_unlock(&udev->cmdr_lock); 1878 1875 if (!udev->data_bitmap) { 1879 1876 ret = -ENOMEM; ··· 1958 1959 vfree(udev->mb_addr); 1959 1960 udev->mb_addr = NULL; 1960 1961 err_vzalloc: 1961 - kfree(udev->data_bitmap); 1962 + bitmap_free(udev->data_bitmap); 1962 1963 udev->data_bitmap = NULL; 1963 1964 err_bitmap_alloc: 1964 1965 kfree(info->name);