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

Pull SCSI fixes from James Bottomley:
"Nine small fixes.

The resume fix is a cosmetic removal of a warning with an incorrect
condition causing it to alarm people wrongly.

The other eight patches correct a thinko in Christoph Hellwig's DMA
conversion series. Without it all these drivers end up with 32 bit DMA
masks meaning they bounce any page over 4GB before sending it to the
controller.

Nowadays, even laptops mostly have memory above 4GB, so this can lead
to significant performance degradation with all the bouncing"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: core: Avoid that system resume triggers a kernel warning
scsi: hptiop: fix calls to dma_set_mask()
scsi: hisi_sas: fix calls to dma_set_mask_and_coherent()
scsi: csiostor: fix calls to dma_set_mask_and_coherent()
scsi: bfa: fix calls to dma_set_mask_and_coherent()
scsi: aic94xx: fix calls to dma_set_mask_and_coherent()
scsi: 3w-sas: fix calls to dma_set_mask_and_coherent()
scsi: 3w-9xxx: fix calls to dma_set_mask_and_coherent()
scsi: lpfc: fix calls to dma_set_mask_and_coherent()

Changed files
+70 -35
drivers
+9 -5
drivers/scsi/3w-9xxx.c
··· 2009 2009 struct Scsi_Host *host = NULL; 2010 2010 TW_Device_Extension *tw_dev; 2011 2011 unsigned long mem_addr, mem_len; 2012 - int retval = -ENODEV; 2012 + int retval; 2013 2013 2014 2014 retval = pci_enable_device(pdev); 2015 2015 if (retval) { ··· 2020 2020 pci_set_master(pdev); 2021 2021 pci_try_set_mwi(pdev); 2022 2022 2023 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2024 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2023 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 2024 + if (retval) 2025 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2026 + if (retval) { 2025 2027 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); 2026 2028 retval = -ENODEV; 2027 2029 goto out_disable_device; ··· 2242 2240 pci_set_master(pdev); 2243 2241 pci_try_set_mwi(pdev); 2244 2242 2245 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2246 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2243 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 2244 + if (retval) 2245 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2246 + if (retval) { 2247 2247 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); 2248 2248 retval = -ENODEV; 2249 2249 goto out_disable_device;
+8 -4
drivers/scsi/3w-sas.c
··· 1573 1573 pci_set_master(pdev); 1574 1574 pci_try_set_mwi(pdev); 1575 1575 1576 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 1577 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 1576 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 1577 + if (retval) 1578 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 1579 + if (retval) { 1578 1580 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); 1579 1581 retval = -ENODEV; 1580 1582 goto out_disable_device; ··· 1807 1805 pci_set_master(pdev); 1808 1806 pci_try_set_mwi(pdev); 1809 1807 1810 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 1811 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 1808 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 1809 + if (retval) 1810 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 1811 + if (retval) { 1812 1812 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); 1813 1813 retval = -ENODEV; 1814 1814 goto out_disable_device;
+5 -3
drivers/scsi/aic94xx/aic94xx_init.c
··· 769 769 if (err) 770 770 goto Err_remove; 771 771 772 - err = -ENODEV; 773 - if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) || 774 - dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) { 772 + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)); 773 + if (err) 774 + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); 775 + if (err) { 776 + err = -ENODEV; 775 777 asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); 776 778 goto Err_remove; 777 779 }
+13 -5
drivers/scsi/bfa/bfad.c
··· 727 727 int 728 728 bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) 729 729 { 730 - int rc = -ENODEV; 730 + int rc = -ENODEV; 731 731 732 732 if (pci_enable_device(pdev)) { 733 733 printk(KERN_ERR "pci_enable_device fail %p\n", pdev); ··· 739 739 740 740 pci_set_master(pdev); 741 741 742 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 743 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 742 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 743 + if (rc) 744 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 745 + 746 + if (rc) { 747 + rc = -ENODEV; 744 748 printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); 745 749 goto out_release_region; 746 750 } ··· 1538 1534 { 1539 1535 struct bfad_s *bfad = pci_get_drvdata(pdev); 1540 1536 u8 byte; 1537 + int rc; 1541 1538 1542 1539 dev_printk(KERN_ERR, &pdev->dev, 1543 1540 "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags); ··· 1566 1561 pci_save_state(pdev); 1567 1562 pci_set_master(pdev); 1568 1563 1569 - if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) || 1570 - dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32))) 1564 + rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)); 1565 + if (rc) 1566 + rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, 1567 + DMA_BIT_MASK(32)); 1568 + if (rc) 1571 1569 goto out_disable_device; 1572 1570 1573 1571 if (restart_bfa(bfad) == -1)
+5 -2
drivers/scsi/csiostor/csio_init.c
··· 210 210 pci_set_master(pdev); 211 211 pci_try_set_mwi(pdev); 212 212 213 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 214 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 213 + rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 214 + if (rv) 215 + rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 216 + if (rv) { 217 + rv = -ENODEV; 215 218 dev_err(&pdev->dev, "No suitable DMA available.\n"); 216 219 goto err_release_regions; 217 220 }
+6 -2
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 2323 2323 struct Scsi_Host *shost; 2324 2324 struct hisi_hba *hisi_hba; 2325 2325 struct device *dev = &pdev->dev; 2326 + int error; 2326 2327 2327 2328 shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba)); 2328 2329 if (!shost) { ··· 2344 2343 if (hisi_sas_get_fw_info(hisi_hba) < 0) 2345 2344 goto err_out; 2346 2345 2347 - if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) && 2348 - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { 2346 + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); 2347 + if (error) 2348 + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); 2349 + 2350 + if (error) { 2349 2351 dev_err(dev, "No usable DMA addressing method\n"); 2350 2352 goto err_out; 2351 2353 }
+5 -3
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
··· 2447 2447 if (rc) 2448 2448 goto err_out_disable_device; 2449 2449 2450 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2451 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2450 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 2451 + if (rc) 2452 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2453 + if (rc) { 2452 2454 dev_err(dev, "No usable DMA addressing method\n"); 2453 - rc = -EIO; 2455 + rc = -ENODEV; 2454 2456 goto err_out_regions; 2455 2457 } 2456 2458
+7 -3
drivers/scsi/hptiop.c
··· 1292 1292 dma_addr_t start_phy; 1293 1293 void *start_virt; 1294 1294 u32 offset, i, req_size; 1295 + int rc; 1295 1296 1296 1297 dprintk("hptiop_probe(%p)\n", pcidev); 1297 1298 ··· 1309 1308 1310 1309 /* Enable 64bit DMA if possible */ 1311 1310 iop_ops = (struct hptiop_adapter_ops *)id->driver_data; 1312 - if (dma_set_mask(&pcidev->dev, 1313 - DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) || 1314 - dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) { 1311 + rc = dma_set_mask(&pcidev->dev, 1312 + DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)); 1313 + if (rc) 1314 + rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32)); 1315 + 1316 + if (rc) { 1315 1317 printk(KERN_ERR "hptiop: fail to set dma_mask\n"); 1316 1318 goto disable_pci_device; 1317 1319 }
+12 -7
drivers/scsi/lpfc/lpfc_init.c
··· 7361 7361 unsigned long bar0map_len, bar2map_len; 7362 7362 int i, hbq_count; 7363 7363 void *ptr; 7364 - int error = -ENODEV; 7364 + int error; 7365 7365 7366 7366 if (!pdev) 7367 - return error; 7367 + return -ENODEV; 7368 7368 7369 7369 /* Set the device DMA mask size */ 7370 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 7371 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) 7370 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 7371 + if (error) 7372 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 7373 + if (error) 7372 7374 return error; 7375 + error = -ENODEV; 7373 7376 7374 7377 /* Get the bus address of Bar0 and Bar2 and the number of bytes 7375 7378 * required by each mapping. ··· 9745 9742 uint32_t if_type; 9746 9743 9747 9744 if (!pdev) 9748 - return error; 9745 + return -ENODEV; 9749 9746 9750 9747 /* Set the device DMA mask size */ 9751 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 9752 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) 9748 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 9749 + if (error) 9750 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 9751 + if (error) 9753 9752 return error; 9754 9753 9755 9754 /*
-1
drivers/scsi/scsi_lib.c
··· 2598 2598 * device deleted during suspend) 2599 2599 */ 2600 2600 mutex_lock(&sdev->state_mutex); 2601 - WARN_ON_ONCE(!sdev->quiesced_by); 2602 2601 sdev->quiesced_by = NULL; 2603 2602 blk_clear_pm_only(sdev->request_queue); 2604 2603 if (sdev->sdev_state == SDEV_QUIESCE)