From: Magnus Lindholm <linmag7@gmail.com>
To: linux-scsi@vger.kernel.org,
James.Bottomley@hansenpartnership.com,
martin.petersen@oracle.com
Cc: linmag7@gmail.com
Subject: [PATCH v3] scsi: qla1280.c
Date: Mon, 4 Nov 2024 21:46:00 +0100 [thread overview]
Message-ID: <20241104204845.1785-1-linmag7@gmail.com> (raw)
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@gmail.com>
---
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
next reply other threads:[~2024-11-04 20:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 20:46 Magnus Lindholm [this message]
2024-11-04 21:52 ` [PATCH v3] scsi: qla1280.c Maciej W. Rozycki
2024-11-05 8:33 ` Thomas Bogendoerfer
2024-11-06 12:48 ` Maciej W. Rozycki
2024-11-05 1:49 ` Martin K. Petersen
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=20241104204845.1785-1-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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