lpfc: fix calls to dma_set_mask_and_coherent()
Subsystems (7)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/8 lpfc: fix calls to dma_set_mask_and_coherent()
The change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in NVMe/FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
--- drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +12 -7
@@ -7693,15 +7693,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)unsigned long bar0map_len, bar2map_len;int i, hbq_count;void *ptr; -int error = -ENODEV ; +int error;if (!pdev) -return error; +return -ENODEV ;/* Set the device DMA mask size */ -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (error)return error; + error = -ENODEV ;/* Get the bus address of Bar0 and Bar2 and the number of bytes * required by each mapping.
@@ -10053,11 +10056,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)uint32_t if_type;if (!pdev) -return error; +return -ENODEV ;/* Set the device DMA mask size */ -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (error)return error;/*
Signature · 1 line
2.16.4
Looks good,
The change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in NVMe/FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
--- drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +12 -7
@@ -7693,15 +7693,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)unsigned long bar0map_len, bar2map_len;int i, hbq_count;void *ptr; -int error = -ENODEV ; +int error;if (!pdev) -return error; +return -ENODEV ;/* Set the device DMA mask size */ -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (error)return error; + error = -ENODEV ;/* Get the bus address of Bar0 and Bar2 and the number of bytes * required by each mapping.
@@ -10053,11 +10056,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)uint32_t if_type;if (!pdev) -return error; +return -ENODEV ;/* Set the device DMA mask size */ -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (error)return error;/*
Signature · 3 lines
2.16.4 Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 2/8 3w-9xxx: fix calls to dma_set_mask_and_coherent()
In reply to a message not in the archiveThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/3w-9xxx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/3w-9xxx.c +9 -5
@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)struct Scsi_Host *host =NULL ;TW_Device_Extension *tw_dev;unsigned long mem_addr, mem_len; -int retval = -ENODEV ; +int retval; retval =pci_enable_device (pdev);if (retval) {
@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
Signature · 1 line
2.16.4
Re: [PATCH 2/8] 3w-9xxx: fix calls to dma_set_mask_and_coherent()
Quoted 3 lines · Hannes Reinecke
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
Looks good,
Re: [PATCH 2/8] 3w-9xxx: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/3w-9xxx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/3w-9xxx.c +9 -5
@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)struct Scsi_Host *host =NULL ;TW_Device_Extension *tw_dev;unsigned long mem_addr, mem_len; -int retval = -ENODEV ; +int retval; retval =pci_enable_device (pdev);if (retval) {
@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
Signature · 3 lines
2.16.4 Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 3/8 3w-sas: fix calls to dma_set_mask_and_coherent()
In reply to a message not in the archiveThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/3w-sas.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/3w-sas.c +8 -4
@@ -1572,8 +1572,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
@@ -1804,8 +1806,10 @@ static int twl_resume(struct pci_dev *pdev)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
Signature · 1 line
2.16.4
Re: [PATCH 3/8] 3w-sas: fix calls to dma_set_mask_and_coherent()
Quoted 3 lines · Hannes Reinecke
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
Looks good,
Re: [PATCH 3/8] 3w-sas: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/3w-sas.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/3w-sas.c +8 -4
@@ -1572,8 +1572,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
@@ -1804,8 +1806,10 @@ static int twl_resume(struct pci_dev *pdev)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + retval =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); retval = -ENODEV ; goto out_disable_device;
Signature · 3 lines
2.16.4 Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 4/8 3w-sas: fix calls to dma_set_mask_and_coherent()
In reply to a message not in the archiveThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/aic94xx/aic94xx_init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/aic94xx/aic94xx_init.c +5 -3
@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)if (err) goto Err_remove; - 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 ))) { + 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 ;asd_printk ("no suitable DMA mask for %s\n" ,pci_name (dev)); goto Err_remove; }
Signature · 1 line
2.16.4
Re: [PATCH 4/8] 3w-sas: fix calls to dma_set_mask_and_coherent()
Quoted 3 lines · Hannes Reinecke
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
Looks good,
Re: [PATCH 4/8] 3w-sas: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/aic94xx/aic94xx_init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/aic94xx/aic94xx_init.c +5 -3
@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)if (err) goto Err_remove; - 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 ))) { + 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 ;asd_printk ("no suitable DMA mask for %s\n" ,pci_name (dev)); goto Err_remove; }
Signature · 5 lines
2.16.4 The patch subject should be "aic94xx:", Martin, can you fix this up? Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 5/8 bfa: fix calls to dma_set_mask_and_coherent()
In reply to a message not in the archiveThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
--- drivers/scsi/bfa/bfad.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/scsi/bfa/bfad.c +13 -5
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad)int bfad_pci_init (struct pci_dev *pdev,struct bfad_s *bfad) { -int rc = -ENODEV ; +int rc = -ENODEV ;if (pci_enable_device (pdev)) {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)pci_set_master (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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); goto out_release_region; }
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev) {struct bfad_s *bfad =pci_get_drvdata (pdev);u8 byte; +int rc;dev_printk (KERN_ERR , &pdev->dev,"bfad_pci_slot_reset flags: 0x%x\n" , bfad->bfad_flags);
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)pci_save_state (pdev);pci_set_master (pdev); -if (dma_set_mask_and_coherent (&bfad->pcidev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&bfad->pcidev->dev,DMA_BIT_MASK (32 ))) + rc =dma_set_mask_and_coherent (&bfad->pcidev->dev,DMA_BIT_MASK (64 )); +if (rc) + rc =dma_set_mask_and_coherent (&bfad->pcidev->dev, +DMA_BIT_MASK (32 )); +if (rc) goto out_disable_device;if (restart_bfa (bfad) ==-1 )
Signature · 1 line
2.16.4
Re: [PATCH 5/8] bfa: fix calls to dma_set_mask_and_coherent()
Quoted 4 lines · Hannes Reinecke
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
Looks good,
Re: [PATCH 5/8] bfa: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
--- drivers/scsi/bfa/bfad.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/scsi/bfa/bfad.c +13 -5
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad)int bfad_pci_init (struct pci_dev *pdev,struct bfad_s *bfad) { -int rc = -ENODEV ; +int rc = -ENODEV ;if (pci_enable_device (pdev)) {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)pci_set_master (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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); goto out_release_region; }
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev) {struct bfad_s *bfad =pci_get_drvdata (pdev);u8 byte; +int rc;dev_printk (KERN_ERR , &pdev->dev,"bfad_pci_slot_reset flags: 0x%x\n" , bfad->bfad_flags);
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)pci_save_state (pdev);pci_set_master (pdev); -if (dma_set_mask_and_coherent (&bfad->pcidev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&bfad->pcidev->dev,DMA_BIT_MASK (32 ))) + rc =dma_set_mask_and_coherent (&bfad->pcidev->dev,DMA_BIT_MASK (64 )); +if (rc) + rc =dma_set_mask_and_coherent (&bfad->pcidev->dev, +DMA_BIT_MASK (32 )); +if (rc) goto out_disable_device;if (restart_bfa (bfad) ==-1 )
Signature · 5 lines
2.16.4 Can we remove the last sentence "This resulted in...", Martin? Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 6/8 csiostor: fix calls to dma_set_mask_and_coherent()
In reply to a message not in the archiveThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/csiostor/csio_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/csiostor/csio_init.c +5 -2
@@ -206,8 +206,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rv =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); goto err_release_regions; }
Signature · 1 line
2.16.4
Re: [PATCH 6/8] csiostor: fix calls to dma_set_mask_and_coherent()
Quoted 3 lines · Hannes Reinecke
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
Looks good,
Re: [PATCH 6/8] csiostor: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/csiostor/csio_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/csiostor/csio_init.c +5 -2
@@ -206,8 +206,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars)pci_set_master (pdev);pci_try_set_mwi (pdev); -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rv =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); goto err_release_regions; }
Signature · 3 lines
2.16.4 Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 7/8 hisi_sas: fix calls to dma_set_mask_and_coherent()
In reply to a message not in the archiveThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +6 -2
@@ -2484,6 +2484,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,struct Scsi_Host *shost;struct hisi_hba *hisi_hba;struct device *dev = &pdev->dev; +int error; shost =scsi_host_alloc (hw->sht,sizeof (*hisi_hba));if (!shost) {
@@ -2504,8 +2505,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,if (hisi_sas_get_fw_info (hisi_hba) <0 ) goto err_out; -if (dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )) && -dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ))) { + error =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 )); + +if (error) {dev_err (dev,"No usable DMA addressing method\n" ); goto err_out; }
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +5 -3
@@ -2742,10 +2742,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (rc) goto err_out_disable_device; -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); - rc = -EIO ; + rc = -ENODEV ; goto err_out_regions; }
Signature · 1 line
2.16.4
Re: [PATCH 7/8] hisi_sas: fix calls to dma_set_mask_and_coherent()
On 18/02/2019 07:34, Hannes Reinecke wrote:
Hi Hannes,
Thanks for this. I have some comments, below.
Quoted 3 lines
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
And the second call to dma_set_mask_and_coherent() is not done if first fails, and we just bail out.
This resulted in FC connections failing due
Quoted 2 lines
to corrupted data buffers, and various other SCSI/FCP I/O errors.
Not relevant.
Quoted 2 lines
Fixes e4db40e7a1a2 ("scsi: hisi_sas: use dma_set_mask_and_coherent")Cc <[email protected]>
e4db40e7a1a2 only went into 5.0, so I don't know which stable kernel we're trying to fix. I am assuming that we can get this fix into 5.0.
Quoted 22 lines
Suggested-by Ewan D. Milne <[email protected]>Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-)drivers/scsi/hisi_sas/hisi_sas_main.c +1
-0@@ -2484,6 +2484,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,struct Scsi_Host *shost;struct hisi_hba *hisi_hba;struct device *dev = &pdev->dev; +int error; shost =scsi_host_alloc (hw->sht,sizeof (*hisi_hba));if (!shost) {@@ -2504,8 +2505,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,if (hisi_sas_get_fw_info (hisi_hba) <0 ) goto err_out;
drivers/scsi/hisi_sas/hisi_sas_main.c static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, · line 2514
Quoted 10 lines
drivers/scsi/hisi_sas/hisi_sas_main.c +5
-2-if (dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )) && -dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ))) { + error =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 )); + +if (error) {dev_err (dev,"No usable DMA addressing method\n" ); goto err_out;
This code was ok as is, so we're not really fixing anything. And certainly not fixing e4db40e7a1a2, so I am unsure if this should be included.
Quoted 22 lines
drivers/scsi/hisi_sas/hisi_sas_main.c +0
-0}drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +5
-3@@ -2742,10 +2742,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (rc) goto err_out_disable_device; -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); - rc = -EIO ; + rc = -ENODEV ; goto err_out_regions; }
Re: [PATCH 7/8] hisi_sas: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeQuoted 4 lines · Hannes Reinecke
The change to use
dma_set_mask_and_coherent()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
Looks good (modulo the FCP copy and paste noticed by John):
Re: [PATCH 7/8] hisi_sas: fix calls to dma_set_mask_and_coherent()
In reply to Hannes ReineckeThe change to use dma_set_mask_and_coherent() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded. This resulted in FC connections failing due to corrupted data buffers, and various other SCSI/FCP I/O errors.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +6 -2
@@ -2484,6 +2484,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,struct Scsi_Host *shost;struct hisi_hba *hisi_hba;struct device *dev = &pdev->dev; +int error; shost =scsi_host_alloc (hw->sht,sizeof (*hisi_hba));if (!shost) {
@@ -2504,8 +2505,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,if (hisi_sas_get_fw_info (hisi_hba) <0 ) goto err_out; -if (dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )) && -dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ))) { + error =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )); +if (error) + error =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 )); + +if (error) {dev_err (dev,"No usable DMA addressing method\n" ); goto err_out; }
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +5 -3
@@ -2742,10 +2742,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (rc) goto err_out_disable_device; -if (dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )) || -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +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" ); - rc = -EIO ; + rc = -ENODEV ; goto err_out_regions; }
Signature · 5 lines
2.16.4 Can we remove the last sentence "This resulted in...", Martin? Reviewed-by: Ewan D. Milne <[email protected]>
PATCH 8/8 hptiop: fix calls to dma_set_mask()
In reply to a message not in the archiveThe change to use dma_set_mask() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/hptiop.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/scsi/hptiop.c +7 -3
@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)dma_addr_t start_phy;void *start_virt;u32 offset, i, req_size; +int rc;dprintk ("hptiop_probe(%p)\n" , pcidev);
@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)/* Enable 64bit DMA if possible */ iop_ops = (struct hptiop_adapter_ops *)id->driver_data; -if (dma_set_mask (&pcidev->dev, -DMA_BIT_MASK (iop_ops->hw_dma_bit_mask)) || -dma_set_mask (&pcidev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask (&pcidev->dev, +DMA_BIT_MASK (iop_ops->hw_dma_bit_mask)); +if (rc) + rc =dma_set_mask (&pcidev->dev,DMA_BIT_MASK (32 )); + +if (rc) {printk (KERN_ERR "hptiop: fail to set dma_mask\n" ); goto disable_pci_device; }
Signature · 1 line
2.16.4
Re: [PATCH 8/8] hptiop: fix calls to dma_set_mask()
Quoted 2 lines · Hannes Reinecke
The change to use
dma_set_mask()incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
Looks good,
Re: [PATCH 8/8] hptiop: fix calls to dma_set_mask()
In reply to Hannes ReineckeThe change to use dma_set_mask() incorrectly made a second call with the 32 bit DMA mask value when the call with the 64 bit DMA mask value succeeded.
--- drivers/scsi/hptiop.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/scsi/hptiop.c +7 -3
@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)dma_addr_t start_phy;void *start_virt;u32 offset, i, req_size; +int rc;dprintk ("hptiop_probe(%p)\n" , pcidev);
@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)/* Enable 64bit DMA if possible */ iop_ops = (struct hptiop_adapter_ops *)id->driver_data; -if (dma_set_mask (&pcidev->dev, -DMA_BIT_MASK (iop_ops->hw_dma_bit_mask)) || -dma_set_mask (&pcidev->dev,DMA_BIT_MASK (32 ))) { + rc =dma_set_mask (&pcidev->dev, +DMA_BIT_MASK (iop_ops->hw_dma_bit_mask)); +if (rc) + rc =dma_set_mask (&pcidev->dev,DMA_BIT_MASK (32 )); + +if (rc) {printk (KERN_ERR "hptiop: fail to set dma_mask\n" ); goto disable_pci_device; }
Signature · 3 lines
2.16.4 Reviewed-by: Ewan D. Milne <[email protected]>