[SCSI] be2iscsi : Fix DMA Out of SW-IOMMU space error
authorJayamohan Kallickal <jayamohan.kallickal@emulex.com>
Wed, 29 Jan 2014 07:16:45 +0000 (02:16 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Sat, 15 Mar 2014 17:19:11 +0000 (10:19 -0700)
Setting DMA bit mask 64 and roll back to 32 if not supported.

Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/be2iscsi/be_main.c

index 7b2bd16c81563fba3399ee18965b97aaa7de292a..3cd4693bc2b407b3dab1a99e2edf49316a5980e8 100644 (file)
@@ -679,8 +679,19 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev)
        }
 
        pci_set_master(pcidev);
-       if (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64))) {
-               ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32));
+       ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64));
+       if (ret) {
+               ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));
+               if (ret) {
+                       dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
+                       pci_disable_device(pcidev);
+                       return ret;
+               } else {
+                       ret = pci_set_consistent_dma_mask(pcidev,
+                                                         DMA_BIT_MASK(32));
+               }
+       } else {
+               ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64));
                if (ret) {
                        dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
                        pci_disable_device(pcidev);