diff mbox series

[v2] scsi: qla1280.c

Message ID 20241031125506.20215-1-linmag7@gmail.com (mailing list archive)
State New
Headers show
Series [v2] scsi: qla1280.c | expand

Commit Message

Magnus Lindholm Oct. 31, 2024, 12:54 p.m. UTC
In order to prevent file system corruption on disks attached
to 32-bit ISP1020/1040 cards in 64-bit enabled systems, while maintaing the
possibility to run other qlogic cards in 64-bit mode, limit DMA_BIT_MASK to 32-bit.

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

Comments

Thomas Bogendoerfer Oct. 31, 2024, 2:39 p.m. UTC | #1
On Thu, 31 Oct 2024 13:54:08 +0100
Magnus Lindholm <linmag7@gmail.com> wrote:

> In order to prevent file system corruption on disks attached
> to 32-bit ISP1020/1040 cards in 64-bit enabled systems, while maintaing the
> possibility to run other qlogic cards in 64-bit mode, limit DMA_BIT_MASK to 32-bit.
> [..]
>  #ifdef QLA_64BIT_PTR
> -	if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) {
> -		if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
> +	/* for 1020 and 1040, force 32-bit DMA mask */
> +	if (IS_ISP1040(ha))
> +		mask = DMA_BIT_MASK(32);
> +	else
> +		mask = DMA_BIT_MASK(64);


this breaks SGI Octane and SGI Origin systems:

qla1280: QLA1040 found on PCI bus 0, dev 0
qla1280 0000:00:00.0: enabling device (0006 -> 0007)
qla1280: Failed to get request memory
qla1280 0000:00:00.0: probe with driver qla1280 failed with error -12
qla1280: QLA1040 found on PCI bus 0, dev 1
qla1280 0000:00:01.0: enabling device (0006 -> 0007)
qla1280: Failed to get request memory
qla1280 0000:00:01.0: probe with driver qla1280 failed with error -12

They need 64bit DMA addresses.

Thomas.
Magnus Lindholm Oct. 31, 2024, 3:24 p.m. UTC | #2
Thanks so much for testing! I'll need to look more into why this fails
on Alpha then.

Magnus



> this breaks SGI Octane and SGI Origin systems:
>
> qla1280: QLA1040 found on PCI bus 0, dev 0
> qla1280 0000:00:00.0: enabling device (0006 -> 0007)
> qla1280: Failed to get request memory
> qla1280 0000:00:00.0: probe with driver qla1280 failed with error -12
> qla1280: QLA1040 found on PCI bus 0, dev 1
> qla1280 0000:00:01.0: enabling device (0006 -> 0007)
> qla1280: Failed to get request memory
> qla1280 0000:00:01.0: probe with driver qla1280 failed with error -12
>
> They need 64bit DMA addresses.
>
> Thomas.
>
> --
> SUSE Software Solutions Germany GmbH
> HRB 36809 (AG Nürnberg)
> Geschäftsführer: Ivo Totev, Andrew McDonald, Werner Knoblich
diff mbox series

Patch

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8958547ac111..a732aaa3658a 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -8,9 +8,12 @@ 
 * Copyright (C) 2003-2004 Christoph Hellwig
 *
 ******************************************************************************/
-#define QLA1280_VERSION      "3.27.1"
+#define QLA1280_VERSION      "3.27.2"
 /*****************************************************************************
     Revision History:
+    Rev  3.27.2, October 31, 2024, Magnus Lindholm
+	- Limit DMA_BIT_MASK to 32-bit for QLA1020 and QLA1040 cards in order to prevent
+	  file system corruption on some platforms
     Rev  3.27.1, February 8, 2010, Michael Reed
 	- Retain firmware image for error recovery.
     Rev  3.27, February 10, 2009, Michael Reed
@@ -4142,6 +4145,7 @@  qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	struct qla_boards *bdp = &ql1280_board_tbl[devnum];
 	struct Scsi_Host *host;
 	struct scsi_qla_host *ha;
+	u64 mask;
 	int error = -ENODEV;
 
 	/* Bypass all AMI SUBSYS VENDOR IDs */
@@ -4177,8 +4181,13 @@  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))) {
-		if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
+	/* for 1020 and 1040, force 32-bit DMA mask */
+	if (IS_ISP1040(ha))
+		mask = DMA_BIT_MASK(32);
+	else
+		mask = DMA_BIT_MASK(64);
+	if (dma_set_mask_and_coherent(&ha->pdev->dev, mask)) {
+		if (dma_set_mask(&ha->pdev->dev, mask)) {
 			printk(KERN_WARNING "scsi(%li): Unable to set a "
 			       "suitable DMA mask - aborting\n", ha->host_no);
 			error = -ENODEV;