Skip to content

Commit df49fd0

Browse files
committed
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()
2 parents c93d921 + 388b4e6 commit df49fd0

File tree

10 files changed

+70
-35
lines changed

10 files changed

+70
-35
lines changed

drivers/scsi/3w-9xxx.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
20092009
struct Scsi_Host *host = NULL;
20102010
TW_Device_Extension *tw_dev;
20112011
unsigned long mem_addr, mem_len;
2012-
int retval = -ENODEV;
2012+
int retval;
20132013

20142014
retval = pci_enable_device(pdev);
20152015
if (retval) {
@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
20202020
pci_set_master(pdev);
20212021
pci_try_set_mwi(pdev);
20222022

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) {
20252027
TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
20262028
retval = -ENODEV;
20272029
goto out_disable_device;
@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev)
22402242
pci_set_master(pdev);
22412243
pci_try_set_mwi(pdev);
22422244

2243-
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
2244-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
2245+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
2246+
if (retval)
2247+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2248+
if (retval) {
22452249
TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
22462250
retval = -ENODEV;
22472251
goto out_disable_device;

drivers/scsi/3w-sas.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,8 +1573,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
15731573
pci_set_master(pdev);
15741574
pci_try_set_mwi(pdev);
15751575

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) {
15781580
TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
15791581
retval = -ENODEV;
15801582
goto out_disable_device;
@@ -1805,8 +1807,10 @@ static int twl_resume(struct pci_dev *pdev)
18051807
pci_set_master(pdev);
18061808
pci_try_set_mwi(pdev);
18071809

1808-
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1809-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1810+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1811+
if (retval)
1812+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1813+
if (retval) {
18101814
TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
18111815
retval = -ENODEV;
18121816
goto out_disable_device;

drivers/scsi/aic94xx/aic94xx_init.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
769769
if (err)
770770
goto Err_remove;
771771

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;
775777
asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
776778
goto Err_remove;
777779
}

drivers/scsi/bfa/bfad.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad)
727727
int
728728
bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
729729
{
730-
int rc = -ENODEV;
730+
int rc = -ENODEV;
731731

732732
if (pci_enable_device(pdev)) {
733733
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)
739739

740740
pci_set_master(pdev);
741741

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;
744748
printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
745749
goto out_release_region;
746750
}
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15341538
{
15351539
struct bfad_s *bfad = pci_get_drvdata(pdev);
15361540
u8 byte;
1541+
int rc;
15371542

15381543
dev_printk(KERN_ERR, &pdev->dev,
15391544
"bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags);
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15611566
pci_save_state(pdev);
15621567
pci_set_master(pdev);
15631568

1564-
if (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)))
1569+
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
1570+
if (rc)
1571+
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
1572+
DMA_BIT_MASK(32));
1573+
if (rc)
15661574
goto out_disable_device;
15671575

15681576
if (restart_bfa(bfad) == -1)

drivers/scsi/csiostor/csio_init.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
210210
pci_set_master(pdev);
211211
pci_try_set_mwi(pdev);
212212

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;
215218
dev_err(&pdev->dev, "No suitable DMA available.\n");
216219
goto err_release_regions;
217220
}

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
23232323
struct Scsi_Host *shost;
23242324
struct hisi_hba *hisi_hba;
23252325
struct device *dev = &pdev->dev;
2326+
int error;
23262327

23272328
shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba));
23282329
if (!shost) {
@@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
23432344
if (hisi_sas_get_fw_info(hisi_hba) < 0)
23442345
goto err_out;
23452346

2346-
if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) &&
2347-
dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
2347+
error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
2348+
if (error)
2349+
error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
2350+
2351+
if (error) {
23482352
dev_err(dev, "No usable DMA addressing method\n");
23492353
goto err_out;
23502354
}

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,10 +2447,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
24472447
if (rc)
24482448
goto err_out_disable_device;
24492449

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) {
24522454
dev_err(dev, "No usable DMA addressing method\n");
2453-
rc = -EIO;
2455+
rc = -ENODEV;
24542456
goto err_out_regions;
24552457
}
24562458

drivers/scsi/hptiop.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
12921292
dma_addr_t start_phy;
12931293
void *start_virt;
12941294
u32 offset, i, req_size;
1295+
int rc;
12951296

12961297
dprintk("hptiop_probe(%p)\n", pcidev);
12971298

@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
13081309

13091310
/* Enable 64bit DMA if possible */
13101311
iop_ops = (struct hptiop_adapter_ops *)id->driver_data;
1311-
if (dma_set_mask(&pcidev->dev,
1312-
DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) ||
1313-
dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) {
1312+
rc = dma_set_mask(&pcidev->dev,
1313+
DMA_BIT_MASK(iop_ops->hw_dma_bit_mask));
1314+
if (rc)
1315+
rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32));
1316+
1317+
if (rc) {
13141318
printk(KERN_ERR "hptiop: fail to set dma_mask\n");
13151319
goto disable_pci_device;
13161320
}

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7361,15 +7361,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
73617361
unsigned long bar0map_len, bar2map_len;
73627362
int i, hbq_count;
73637363
void *ptr;
7364-
int error = -ENODEV;
7364+
int error;
73657365

73667366
if (!pdev)
7367-
return error;
7367+
return -ENODEV;
73687368

73697369
/* 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)
73727374
return error;
7375+
error = -ENODEV;
73737376

73747377
/* Get the bus address of Bar0 and Bar2 and the number of bytes
73757378
* required by each mapping.
@@ -9742,11 +9745,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
97429745
uint32_t if_type;
97439746

97449747
if (!pdev)
9745-
return error;
9748+
return -ENODEV;
97469749

97479750
/* Set the device DMA mask size */
9748-
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
9749-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
9751+
error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
9752+
if (error)
9753+
error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
9754+
if (error)
97509755
return error;
97519756

97529757
/*

drivers/scsi/scsi_lib.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,6 @@ void scsi_device_resume(struct scsi_device *sdev)
25982598
* device deleted during suspend)
25992599
*/
26002600
mutex_lock(&sdev->state_mutex);
2601-
WARN_ON_ONCE(!sdev->quiesced_by);
26022601
sdev->quiesced_by = NULL;
26032602
blk_clear_pm_only(sdev->request_queue);
26042603
if (sdev->sdev_state == SDEV_QUIESCE)

0 commit comments

Comments
 (0)