Commit df49fd0f authored by Linus Torvalds's avatar Linus Torvalds

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()
parents c93d9218 388b4e6a
...@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) ...@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
struct Scsi_Host *host = NULL; struct Scsi_Host *host = NULL;
TW_Device_Extension *tw_dev; TW_Device_Extension *tw_dev;
unsigned long mem_addr, mem_len; unsigned long mem_addr, mem_len;
int retval = -ENODEV; int retval;
retval = pci_enable_device(pdev); retval = pci_enable_device(pdev);
if (retval) { if (retval) {
...@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) ...@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
pci_set_master(pdev); pci_set_master(pdev);
pci_try_set_mwi(pdev); pci_try_set_mwi(pdev);
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (retval)
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
retval = -ENODEV; retval = -ENODEV;
goto out_disable_device; goto out_disable_device;
...@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev) ...@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev)
pci_set_master(pdev); pci_set_master(pdev);
pci_try_set_mwi(pdev); pci_try_set_mwi(pdev);
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (retval)
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
retval = -ENODEV; retval = -ENODEV;
goto out_disable_device; goto out_disable_device;
......
...@@ -1573,8 +1573,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) ...@@ -1573,8 +1573,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
pci_set_master(pdev); pci_set_master(pdev);
pci_try_set_mwi(pdev); pci_try_set_mwi(pdev);
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (retval)
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
retval = -ENODEV; retval = -ENODEV;
goto out_disable_device; goto out_disable_device;
...@@ -1805,8 +1807,10 @@ static int twl_resume(struct pci_dev *pdev) ...@@ -1805,8 +1807,10 @@ static int twl_resume(struct pci_dev *pdev)
pci_set_master(pdev); pci_set_master(pdev);
pci_try_set_mwi(pdev); pci_try_set_mwi(pdev);
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (retval)
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
retval = -ENODEV; retval = -ENODEV;
goto out_disable_device; goto out_disable_device;
......
...@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (err) if (err)
goto Err_remove; goto Err_remove;
err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64));
if (err)
err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
if (err) {
err = -ENODEV; err = -ENODEV;
if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) ||
dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {
asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
goto Err_remove; goto Err_remove;
} }
......
...@@ -739,8 +739,12 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) ...@@ -739,8 +739,12 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
pci_set_master(pdev); pci_set_master(pdev);
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (rc)
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (rc) {
rc = -ENODEV;
printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
goto out_release_region; goto out_release_region;
} }
...@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev) ...@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
{ {
struct bfad_s *bfad = pci_get_drvdata(pdev); struct bfad_s *bfad = pci_get_drvdata(pdev);
u8 byte; u8 byte;
int rc;
dev_printk(KERN_ERR, &pdev->dev, dev_printk(KERN_ERR, &pdev->dev,
"bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags); "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags);
...@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev) ...@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
pci_save_state(pdev); pci_save_state(pdev);
pci_set_master(pdev); pci_set_master(pdev);
if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) || rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32))) if (rc)
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
DMA_BIT_MASK(32));
if (rc)
goto out_disable_device; goto out_disable_device;
if (restart_bfa(bfad) == -1) if (restart_bfa(bfad) == -1)
......
...@@ -210,8 +210,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars) ...@@ -210,8 +210,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
pci_set_master(pdev); pci_set_master(pdev);
pci_try_set_mwi(pdev); pci_try_set_mwi(pdev);
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (rv)
rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (rv) {
rv = -ENODEV;
dev_err(&pdev->dev, "No suitable DMA available.\n"); dev_err(&pdev->dev, "No suitable DMA available.\n");
goto err_release_regions; goto err_release_regions;
} }
......
...@@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, ...@@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
struct Scsi_Host *shost; struct Scsi_Host *shost;
struct hisi_hba *hisi_hba; struct hisi_hba *hisi_hba;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int error;
shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba)); shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba));
if (!shost) { if (!shost) {
...@@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, ...@@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
if (hisi_sas_get_fw_info(hisi_hba) < 0) if (hisi_sas_get_fw_info(hisi_hba) < 0)
goto err_out; goto err_out;
if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) && error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { if (error)
error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (error) {
dev_err(dev, "No usable DMA addressing method\n"); dev_err(dev, "No usable DMA addressing method\n");
goto err_out; goto err_out;
} }
......
...@@ -2447,10 +2447,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2447,10 +2447,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (rc) if (rc)
goto err_out_disable_device; goto err_out_disable_device;
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { if (rc)
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (rc) {
dev_err(dev, "No usable DMA addressing method\n"); dev_err(dev, "No usable DMA addressing method\n");
rc = -EIO; rc = -ENODEV;
goto err_out_regions; goto err_out_regions;
} }
......
...@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id) ...@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
dma_addr_t start_phy; dma_addr_t start_phy;
void *start_virt; void *start_virt;
u32 offset, i, req_size; u32 offset, i, req_size;
int rc;
dprintk("hptiop_probe(%p)\n", pcidev); dprintk("hptiop_probe(%p)\n", pcidev);
...@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id) ...@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
/* Enable 64bit DMA if possible */ /* Enable 64bit DMA if possible */
iop_ops = (struct hptiop_adapter_ops *)id->driver_data; iop_ops = (struct hptiop_adapter_ops *)id->driver_data;
if (dma_set_mask(&pcidev->dev, rc = dma_set_mask(&pcidev->dev,
DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) || DMA_BIT_MASK(iop_ops->hw_dma_bit_mask));
dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) { if (rc)
rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32));
if (rc) {
printk(KERN_ERR "hptiop: fail to set dma_mask\n"); printk(KERN_ERR "hptiop: fail to set dma_mask\n");
goto disable_pci_device; goto disable_pci_device;
} }
......
...@@ -7361,15 +7361,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) ...@@ -7361,15 +7361,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
unsigned long bar0map_len, bar2map_len; unsigned long bar0map_len, bar2map_len;
int i, hbq_count; int i, hbq_count;
void *ptr; void *ptr;
int error = -ENODEV; int error;
if (!pdev) if (!pdev)
return error; return -ENODEV;
/* Set the device DMA mask size */ /* Set the device DMA mask size */
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) if (error)
error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (error)
return error; return error;
error = -ENODEV;
/* Get the bus address of Bar0 and Bar2 and the number of bytes /* Get the bus address of Bar0 and Bar2 and the number of bytes
* required by each mapping. * required by each mapping.
...@@ -9742,11 +9745,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) ...@@ -9742,11 +9745,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
uint32_t if_type; uint32_t if_type;
if (!pdev) if (!pdev)
return error; return -ENODEV;
/* Set the device DMA mask size */ /* Set the device DMA mask size */
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) if (error)
error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (error)
return error; return error;
/* /*
......
...@@ -2598,7 +2598,6 @@ void scsi_device_resume(struct scsi_device *sdev) ...@@ -2598,7 +2598,6 @@ void scsi_device_resume(struct scsi_device *sdev)
* device deleted during suspend) * device deleted during suspend)
*/ */
mutex_lock(&sdev->state_mutex); mutex_lock(&sdev->state_mutex);
WARN_ON_ONCE(!sdev->quiesced_by);
sdev->quiesced_by = NULL; sdev->quiesced_by = NULL;
blk_clear_pm_only(sdev->request_queue); blk_clear_pm_only(sdev->request_queue);
if (sdev->sdev_state == SDEV_QUIESCE) if (sdev->sdev_state == SDEV_QUIESCE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment