All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Unbreak mpt3sas on big-endian machines
@ 2022-09-16 13:01 Damien Le Moal
  2022-09-16 13:01 ` [PATCH 1/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix writel() use" Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Damien Le Moal @ 2022-09-16 13:01 UTC (permalink / raw)
  To: linux-scsi, Martin K . Petersen; +Cc: matoro_mailinglist_kernel

Patches b4efbec4c2a ("scsi: mpt3sas: Fix writel() use") and
7ab4d2441b9 ("scsi: mpt3sas: Fix ioc->base_readl() use"), while aiming
at only fixign sparse warnings without any functional change, broke the
mpt3sas driver on big endian machines. This series reverts both patches,
until someone more knowledgeable of the Broadcom HBA controller
interface can properly fix register endianness control to avoid the
compilation warnings.

Damien Le Moal (2):
  scsi: mpt3sas: Revert "scsi: mpt3sas: Fix writel() use"
  scsi: mpt3sas: Revert "scsi: mpt3sas: Fix ioc->base_readl() use"

 drivers/scsi/mpt3sas/mpt3sas_base.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

-- 
2.37.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix writel() use"
  2022-09-16 13:01 [PATCH 0/2] Unbreak mpt3sas on big-endian machines Damien Le Moal
@ 2022-09-16 13:01 ` Damien Le Moal
  2022-09-16 13:01 ` [PATCH 2/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix ioc->base_readl() use" Damien Le Moal
  2022-09-25 17:38 ` [PATCH 0/2] Unbreak mpt3sas on big-endian machines Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2022-09-16 13:01 UTC (permalink / raw)
  To: linux-scsi, Martin K . Petersen; +Cc: matoro_mailinglist_kernel

This reverts commit b4efbec4c2a75b619fae4e8768be379e88c78687 as it is
breaking the mpt3sas driver on big-endian machines.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 565339a0811d..1c02159e45ac 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -4313,7 +4313,7 @@ _base_put_smid_scsi_io_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid,
 	descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid);
 	descriptor.SMID = cpu_to_le16(smid);
 
-	writel(*request, &ioc->chip->AtomicRequestDescriptorPost);
+	writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
 }
 
 /**
@@ -4335,7 +4335,7 @@ _base_put_smid_fast_path_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid,
 	descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid);
 	descriptor.SMID = cpu_to_le16(smid);
 
-	writel(*request, &ioc->chip->AtomicRequestDescriptorPost);
+	writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
 }
 
 /**
@@ -4358,7 +4358,7 @@ _base_put_smid_hi_priority_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid,
 	descriptor.MSIxIndex = msix_task;
 	descriptor.SMID = cpu_to_le16(smid);
 
-	writel(*request, &ioc->chip->AtomicRequestDescriptorPost);
+	writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
 }
 
 /**
@@ -4379,7 +4379,7 @@ _base_put_smid_default_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid)
 	descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid);
 	descriptor.SMID = cpu_to_le16(smid);
 
-	writel(*request, &ioc->chip->AtomicRequestDescriptorPost);
+	writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost);
 }
 
 /**
@@ -6895,7 +6895,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
 
 	/* send message 32-bits at a time */
 	for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) {
-		writel(request[i], &ioc->chip->Doorbell);
+		writel(cpu_to_le32(request[i]), &ioc->chip->Doorbell);
 		if ((_base_wait_for_doorbell_ack(ioc, 5)))
 			failed = 1;
 	}
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix ioc->base_readl() use"
  2022-09-16 13:01 [PATCH 0/2] Unbreak mpt3sas on big-endian machines Damien Le Moal
  2022-09-16 13:01 ` [PATCH 1/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix writel() use" Damien Le Moal
@ 2022-09-16 13:01 ` Damien Le Moal
  2022-09-25 17:38 ` [PATCH 0/2] Unbreak mpt3sas on big-endian machines Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2022-09-16 13:01 UTC (permalink / raw)
  To: linux-scsi, Martin K . Petersen; +Cc: matoro_mailinglist_kernel

This reverts commit 7ab4d2441b952977556672c2fe3f4c2a698cbb37 as it is
breaking the mpt3sas driver on big-endian machines.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 1c02159e45ac..f0088a0cb685 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -6914,16 +6914,16 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
 	}
 
 	/* read the first two 16-bits, it gives the total length of the reply */
-	reply[0] = ioc->base_readl(&ioc->chip->Doorbell)
-		& MPI2_DOORBELL_DATA_MASK;
+	reply[0] = le16_to_cpu(ioc->base_readl(&ioc->chip->Doorbell)
+	    & MPI2_DOORBELL_DATA_MASK);
 	writel(0, &ioc->chip->HostInterruptStatus);
 	if ((_base_wait_for_doorbell_int(ioc, 5))) {
 		ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
 			__LINE__);
 		return -EFAULT;
 	}
-	reply[1] = ioc->base_readl(&ioc->chip->Doorbell)
-		& MPI2_DOORBELL_DATA_MASK;
+	reply[1] = le16_to_cpu(ioc->base_readl(&ioc->chip->Doorbell)
+	    & MPI2_DOORBELL_DATA_MASK);
 	writel(0, &ioc->chip->HostInterruptStatus);
 
 	for (i = 2; i < default_reply->MsgLength * 2; i++)  {
@@ -6935,8 +6935,9 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
 		if (i >=  reply_bytes/2) /* overflow case */
 			ioc->base_readl(&ioc->chip->Doorbell);
 		else
-			reply[i] = ioc->base_readl(&ioc->chip->Doorbell)
-				& MPI2_DOORBELL_DATA_MASK;
+			reply[i] = le16_to_cpu(
+			    ioc->base_readl(&ioc->chip->Doorbell)
+			    & MPI2_DOORBELL_DATA_MASK);
 		writel(0, &ioc->chip->HostInterruptStatus);
 	}
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Unbreak mpt3sas on big-endian machines
  2022-09-16 13:01 [PATCH 0/2] Unbreak mpt3sas on big-endian machines Damien Le Moal
  2022-09-16 13:01 ` [PATCH 1/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix writel() use" Damien Le Moal
  2022-09-16 13:01 ` [PATCH 2/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix ioc->base_readl() use" Damien Le Moal
@ 2022-09-25 17:38 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-09-25 17:38 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-scsi, Martin K . Petersen, matoro_mailinglist_kernel


Damien,

> Patches b4efbec4c2a ("scsi: mpt3sas: Fix writel() use") and
> 7ab4d2441b9 ("scsi: mpt3sas: Fix ioc->base_readl() use"), while aiming
> at only fixign sparse warnings without any functional change, broke
> the mpt3sas driver on big endian machines. This series reverts both
> patches, until someone more knowledgeable of the Broadcom HBA
> controller interface can properly fix register endianness control to
> avoid the compilation warnings.

Applied to 6.1/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-25 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 13:01 [PATCH 0/2] Unbreak mpt3sas on big-endian machines Damien Le Moal
2022-09-16 13:01 ` [PATCH 1/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix writel() use" Damien Le Moal
2022-09-16 13:01 ` [PATCH 2/2] scsi: mpt3sas: Revert "scsi: mpt3sas: Fix ioc->base_readl() use" Damien Le Moal
2022-09-25 17:38 ` [PATCH 0/2] Unbreak mpt3sas on big-endian machines Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.