aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-02 14:39:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-02 14:39:54 -0500
commitdf49fd0ff83a0c20c5ce68a790a4f43601ecdc4a (patch)
treef115dd3858dff2eb9a6cf87505e773d6f6a67c66
parentc93d9218ea561d6a91b23449cfd637ddec91dc23 (diff)
parent388b4e6a00bb3097278ed1648ac5a1cb48c894e6 (diff)
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()
-rw-r--r--drivers/scsi/3w-9xxx.c14
-rw-r--r--drivers/scsi/3w-sas.c12
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c8
-rw-r--r--drivers/scsi/bfa/bfad.c18
-rw-r--r--drivers/scsi/csiostor/csio_init.c7
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_main.c8
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_v3_hw.c8
-rw-r--r--drivers/scsi/hptiop.c10
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c19
-rw-r--r--drivers/scsi/scsi_lib.c1
10 files changed, 70 insertions, 35 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index a3c20e3a8b7c..3337b1e80412 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
2009 struct Scsi_Host *host = NULL; 2009 struct Scsi_Host *host = NULL;
2010 TW_Device_Extension *tw_dev; 2010 TW_Device_Extension *tw_dev;
2011 unsigned long mem_addr, mem_len; 2011 unsigned long mem_addr, mem_len;
2012 int retval = -ENODEV; 2012 int retval;
2013 2013
2014 retval = pci_enable_device(pdev); 2014 retval = pci_enable_device(pdev);
2015 if (retval) { 2015 if (retval) {
@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
2020 pci_set_master(pdev); 2020 pci_set_master(pdev);
2021 pci_try_set_mwi(pdev); 2021 pci_try_set_mwi(pdev);
2022 2022
2023 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2023 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
2024 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2024 if (retval)
2025 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2026 if (retval) {
2025 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); 2027 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
2026 retval = -ENODEV; 2028 retval = -ENODEV;
2027 goto out_disable_device; 2029 goto out_disable_device;
@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev)
2240 pci_set_master(pdev); 2242 pci_set_master(pdev);
2241 pci_try_set_mwi(pdev); 2243 pci_try_set_mwi(pdev);
2242 2244
2243 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2245 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
2244 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2246 if (retval)
2247 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2248 if (retval) {
2245 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); 2249 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
2246 retval = -ENODEV; 2250 retval = -ENODEV;
2247 goto out_disable_device; 2251 goto out_disable_device;
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index cd096104bcec..dda6fa857709 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1573,8 +1573,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1573 pci_set_master(pdev); 1573 pci_set_master(pdev);
1574 pci_try_set_mwi(pdev); 1574 pci_try_set_mwi(pdev);
1575 1575
1576 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 1576 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1577 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 1577 if (retval)
1578 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1579 if (retval) {
1578 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); 1580 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
1579 retval = -ENODEV; 1581 retval = -ENODEV;
1580 goto out_disable_device; 1582 goto out_disable_device;
@@ -1805,8 +1807,10 @@ static int twl_resume(struct pci_dev *pdev)
1805 pci_set_master(pdev); 1807 pci_set_master(pdev);
1806 pci_try_set_mwi(pdev); 1808 pci_try_set_mwi(pdev);
1807 1809
1808 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 1810 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1809 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 1811 if (retval)
1812 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1813 if (retval) {
1810 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); 1814 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
1811 retval = -ENODEV; 1815 retval = -ENODEV;
1812 goto out_disable_device; 1816 goto out_disable_device;
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 07efcb9b5b94..bbdae67774f0 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
769 if (err) 769 if (err)
770 goto Err_remove; 770 goto Err_remove;
771 771
772 err = -ENODEV; 772 err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64));
773 if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) || 773 if (err)
774 dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) { 774 err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
775 if (err) {
776 err = -ENODEV;
775 asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); 777 asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
776 goto Err_remove; 778 goto Err_remove;
777 } 779 }
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 42a0caf6740d..88880a66a189 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad)
727int 727int
728bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) 728bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
729{ 729{
730 int rc = -ENODEV; 730 int rc = -ENODEV;
731 731
732 if (pci_enable_device(pdev)) { 732 if (pci_enable_device(pdev)) {
733 printk(KERN_ERR "pci_enable_device fail %p\n", pdev); 733 printk(KERN_ERR "pci_enable_device fail %p\n", pdev);
@@ -739,8 +739,12 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
739 739
740 pci_set_master(pdev); 740 pci_set_master(pdev);
741 741
742 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 742 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
743 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 743 if (rc)
744 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
745
746 if (rc) {
747 rc = -ENODEV;
744 printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); 748 printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
745 goto out_release_region; 749 goto out_release_region;
746 } 750 }
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
1534{ 1538{
1535 struct bfad_s *bfad = pci_get_drvdata(pdev); 1539 struct bfad_s *bfad = pci_get_drvdata(pdev);
1536 u8 byte; 1540 u8 byte;
1541 int rc;
1537 1542
1538 dev_printk(KERN_ERR, &pdev->dev, 1543 dev_printk(KERN_ERR, &pdev->dev,
1539 "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags); 1544 "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags);
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
1561 pci_save_state(pdev); 1566 pci_save_state(pdev);
1562 pci_set_master(pdev); 1567 pci_set_master(pdev);
1563 1568
1564 if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) || 1569 rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
1565 dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32))) 1570 if (rc)
1571 rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
1572 DMA_BIT_MASK(32));
1573 if (rc)
1566 goto out_disable_device; 1574 goto out_disable_device;
1567 1575
1568 if (restart_bfa(bfad) == -1) 1576 if (restart_bfa(bfad) == -1)
diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
index cf629380a981..616b25bf7941 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -210,8 +210,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
210 pci_set_master(pdev); 210 pci_set_master(pdev);
211 pci_try_set_mwi(pdev); 211 pci_try_set_mwi(pdev);
212 212
213 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 213 rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
214 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 214 if (rv)
215 rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
216 if (rv) {
217 rv = -ENODEV;
215 dev_err(&pdev->dev, "No suitable DMA available.\n"); 218 dev_err(&pdev->dev, "No suitable DMA available.\n");
216 goto err_release_regions; 219 goto err_release_regions;
217 } 220 }
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index eed7fc5b3389..bc17fa0d8375 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
2323 struct Scsi_Host *shost; 2323 struct Scsi_Host *shost;
2324 struct hisi_hba *hisi_hba; 2324 struct hisi_hba *hisi_hba;
2325 struct device *dev = &pdev->dev; 2325 struct device *dev = &pdev->dev;
2326 int error;
2326 2327
2327 shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba)); 2328 shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba));
2328 if (!shost) { 2329 if (!shost) {
@@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
2343 if (hisi_sas_get_fw_info(hisi_hba) < 0) 2344 if (hisi_sas_get_fw_info(hisi_hba) < 0)
2344 goto err_out; 2345 goto err_out;
2345 2346
2346 if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) && 2347 error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
2347 dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { 2348 if (error)
2349 error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
2350
2351 if (error) {
2348 dev_err(dev, "No usable DMA addressing method\n"); 2352 dev_err(dev, "No usable DMA addressing method\n");
2349 goto err_out; 2353 goto err_out;
2350 } 2354 }
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index c92b3822c408..e0570fd8466e 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2447,10 +2447,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2447 if (rc) 2447 if (rc)
2448 goto err_out_disable_device; 2448 goto err_out_disable_device;
2449 2449
2450 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2450 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
2451 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2451 if (rc)
2452 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2453 if (rc) {
2452 dev_err(dev, "No usable DMA addressing method\n"); 2454 dev_err(dev, "No usable DMA addressing method\n");
2453 rc = -EIO; 2455 rc = -ENODEV;
2454 goto err_out_regions; 2456 goto err_out_regions;
2455 } 2457 }
2456 2458
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 3eedfd4f8f57..251c084a6ff0 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
1292 dma_addr_t start_phy; 1292 dma_addr_t start_phy;
1293 void *start_virt; 1293 void *start_virt;
1294 u32 offset, i, req_size; 1294 u32 offset, i, req_size;
1295 int rc;
1295 1296
1296 dprintk("hptiop_probe(%p)\n", pcidev); 1297 dprintk("hptiop_probe(%p)\n", pcidev);
1297 1298
@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
1308 1309
1309 /* Enable 64bit DMA if possible */ 1310 /* Enable 64bit DMA if possible */
1310 iop_ops = (struct hptiop_adapter_ops *)id->driver_data; 1311 iop_ops = (struct hptiop_adapter_ops *)id->driver_data;
1311 if (dma_set_mask(&pcidev->dev, 1312 rc = dma_set_mask(&pcidev->dev,
1312 DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) || 1313 DMA_BIT_MASK(iop_ops->hw_dma_bit_mask));
1313 dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) { 1314 if (rc)
1315 rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32));
1316
1317 if (rc) {
1314 printk(KERN_ERR "hptiop: fail to set dma_mask\n"); 1318 printk(KERN_ERR "hptiop: fail to set dma_mask\n");
1315 goto disable_pci_device; 1319 goto disable_pci_device;
1316 } 1320 }
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index bede11e16349..e1129260ed18 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -7361,15 +7361,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
7361 unsigned long bar0map_len, bar2map_len; 7361 unsigned long bar0map_len, bar2map_len;
7362 int i, hbq_count; 7362 int i, hbq_count;
7363 void *ptr; 7363 void *ptr;
7364 int error = -ENODEV; 7364 int error;
7365 7365
7366 if (!pdev) 7366 if (!pdev)
7367 return error; 7367 return -ENODEV;
7368 7368
7369 /* Set the device DMA mask size */ 7369 /* Set the device DMA mask size */
7370 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 7370 error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
7371 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) 7371 if (error)
7372 error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
7373 if (error)
7372 return error; 7374 return error;
7375 error = -ENODEV;
7373 7376
7374 /* Get the bus address of Bar0 and Bar2 and the number of bytes 7377 /* Get the bus address of Bar0 and Bar2 and the number of bytes
7375 * required by each mapping. 7378 * required by each mapping.
@@ -9742,11 +9745,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
9742 uint32_t if_type; 9745 uint32_t if_type;
9743 9746
9744 if (!pdev) 9747 if (!pdev)
9745 return error; 9748 return -ENODEV;
9746 9749
9747 /* Set the device DMA mask size */ 9750 /* Set the device DMA mask size */
9748 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 9751 error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
9749 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) 9752 if (error)
9753 error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
9754 if (error)
9750 return error; 9755 return error;
9751 9756
9752 /* 9757 /*
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f8d51c3d5582..a6828391d6b3 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2598,7 +2598,6 @@ void scsi_device_resume(struct scsi_device *sdev)
2598 * device deleted during suspend) 2598 * device deleted during suspend)
2599 */ 2599 */
2600 mutex_lock(&sdev->state_mutex); 2600 mutex_lock(&sdev->state_mutex);
2601 WARN_ON_ONCE(!sdev->quiesced_by);
2602 sdev->quiesced_by = NULL; 2601 sdev->quiesced_by = NULL;
2603 blk_clear_pm_only(sdev->request_queue); 2602 blk_clear_pm_only(sdev->request_queue);
2604 if (sdev->sdev_state == SDEV_QUIESCE) 2603 if (sdev->sdev_state == SDEV_QUIESCE)