[PATCH v3] scsi: qla1280.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Use dma_get_required_mask() to determine an acceptable DMA_BIT_MASK 
 since on some platforms, qla1040 cards do not work with a 64-bit
 mask. For example, on alpha systems with more than 2GB ram a 64-bit DMA mask
 will result in filesystem corruption, but a 64-bit mask is required on
 IP30/MIPS.

Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
 drivers/scsi/qla1280.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8958547ac111..4ba4084bf252 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -8,9 +8,11 @@
 * Copyright (C) 2003-2004 Christoph Hellwig
 *
 ******************************************************************************/
-#define QLA1280_VERSION      "3.27.1"
+#define QLA1280_VERSION      "3.27.2"
 /*****************************************************************************
     Revision History:
+    Rev  3.27.2, November 3, 2024, Magnus Lindholm
+	- Use dma_get_required_mask() to determine DMA_BIT_MASK if QLA_64BIT_PTR
     Rev  3.27.1, February 8, 2010, Michael Reed
 	- Retain firmware image for error recovery.
     Rev  3.27, February 10, 2009, Michael Reed
@@ -4143,6 +4145,8 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	struct Scsi_Host *host;
 	struct scsi_qla_host *ha;
 	int error = -ENODEV;
+	/* use 32-bit mask as default in case driver is built for 32-only */
+	u64 required_mask = DMA_BIT_MASK(32);
 
 	/* Bypass all AMI SUBSYS VENDOR IDs */
 	if (pdev->subsystem_vendor == PCI_VENDOR_ID_AMI) {
@@ -4177,7 +4181,8 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	ha->devnum = devnum;	/* specifies microcode load address */
 
 #ifdef QLA_64BIT_PTR
-	if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) {
+	required_mask = dma_get_required_mask(&ha->pdev->dev);
+	if (dma_set_mask_and_coherent(&ha->pdev->dev, required_mask)) {
 		if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
 			printk(KERN_WARNING "scsi(%li): Unable to set a "
 			       "suitable DMA mask - aborting\n", ha->host_no);
@@ -4185,10 +4190,10 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 			goto error_put_host;
 		}
 	} else
-		dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n",
-			ha->host_no);
+		dprintk(2, "scsi(%li): %d-bit PCI Addressing Enabled\n",
+			ha->host_no, fls64(required_mask));
 #else
-	if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
+	if (dma_set_mask(&ha->pdev->dev, required_mask)) {
 		printk(KERN_WARNING "scsi(%li): Unable to set a "
 		       "suitable DMA mask - aborting\n", ha->host_no);
 		error = -ENODEV;
-- 
2.47.0





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux