Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Magnus Lindholm <linmag7@gmail.com>
To: linux-scsi@vger.kernel.org,
	James.Bottomley@HansenPartnership.com, mdr@sgi.com,
	martin.petersen@oracle.com, linmag7@gmail.com
Subject: [PATCH v2] scsi: qla1280.c
Date: Thu, 31 Oct 2024 13:54:08 +0100	[thread overview]
Message-ID: <20241031125506.20215-1-linmag7@gmail.com> (raw)

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(-)

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;
-- 
2.47.0


             reply	other threads:[~2024-10-31 12:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 12:54 Magnus Lindholm [this message]
2024-10-31 14:39 ` [PATCH v2] scsi: qla1280.c Thomas Bogendoerfer
2024-10-31 15:24   ` Magnus Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241031125506.20215-1-linmag7@gmail.com \
    --to=linmag7@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mdr@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox