Skip to contentSkip to conversation

megaraid_sas: addded support for big endian architecture

PATCH In review [email protected] 2 participants 3 messages Sep 6, 2013 – Sep 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megaraid_sas: addded support for big endian architecture

This patch will add big endian architecture support to megaraid_sas driver. The support added is for LSI MegaRAID all generation controllers- (3Gb/s, 6Gb/s and 12 Gb/s controllers).

This patch will be applied on top of recently submitted patch for High Avaibility support- http://marc.info/?l=linux-scsi&m=137799326426659&w=2
We have done basic sanity test @ppc64 arch and @x86_64. Additional testing/observations are welcome.

---

drivers/scsi/megaraid/megaraid_sas.h +64 -15
index 21e747a..3675b17 100644
@@ -492,21 +492,39 @@ struct megasas_ctrl_prop {
 	* a bit in the following structure.
 	*/
 	struct {
-		u32     copyBackDisabled            : 1;
-		u32     SMARTerEnabled              : 1;
-		u32     prCorrectUnconfiguredAreas  : 1;
-		u32     useFdeOnly                  : 1;
-		u32     disableNCQ                  : 1;
-		u32     SSDSMARTerEnabled           : 1;
-		u32     SSDPatrolReadEnabled        : 1;
-		u32     enableSpinDownUnconfigured  : 1;
-		u32     autoEnhancedImport          : 1;
-		u32     enableSecretKeyControl      : 1;
-		u32     disableOnlineCtrlReset      : 1;
-		u32     allowBootWithPinnedCache    : 1;
-		u32     disableSpinDownHS           : 1;
-		u32     enableJBOD                  : 1;
-		u32     reserved                    :18;
+#if   defined(__BIG_ENDIAN_BITFIELD)
+		u32     reserved:18;
+		u32     enableJBOD:1;
+		u32     disableSpinDownHS:1;
+		u32     allowBootWithPinnedCache:1;
+		u32     disableOnlineCtrlReset:1;
+		u32     enableSecretKeyControl:1;
+		u32     autoEnhancedImport:1;
+		u32     enableSpinDownUnconfigured:1;
+		u32     SSDPatrolReadEnabled:1;
+		u32     SSDSMARTerEnabled:1;
+		u32     disableNCQ:1;
+		u32     useFdeOnly:1;
+		u32     prCorrectUnconfiguredAreas:1;
+		u32     SMARTerEnabled:1;
+		u32     copyBackDisabled:1;
+#else
+		u32     copyBackDisabled:1;
+		u32     SMARTerEnabled:1;
+		u32     prCorrectUnconfiguredAreas:1;
+		u32     useFdeOnly:1;
+		u32     disableNCQ:1;
+		u32     SSDSMARTerEnabled:1;
+		u32     SSDPatrolReadEnabled:1;
+		u32     enableSpinDownUnconfigured:1;
+		u32     autoEnhancedImport:1;
+		u32     enableSecretKeyControl:1;
+		u32     disableOnlineCtrlReset:1;
+		u32     allowBootWithPinnedCache:1;
+		u32     disableSpinDownHS:1;
+		u32     enableJBOD:1;
+		u32     reserved:18;
+#endif
 	} OnOffProperties;
 	u8 autoSnapVDSpace;
 	u8 viewSpace;
@@ -820,6 +838,30 @@ struct megasas_ctrl_info {
 	u16 cacheMemorySize;                    /*7A2h */
 
 	struct {                                /*7A4h */
+#if   defined(__BIG_ENDIAN_BITFIELD)
+		u32     reserved:11;
+		u32     supportUnevenSpans:1;
+		u32     dedicatedHotSparesLimited:1;
+		u32     headlessMode:1;
+		u32     supportEmulatedDrives:1;
+		u32     supportResetNow:1;
+		u32     realTimeScheduler:1;
+		u32     supportSSDPatrolRead:1;
+		u32     supportPerfTuning:1;
+		u32     disableOnlinePFKChange:1;
+		u32     supportJBOD:1;
+		u32     supportBootTimePFKChange:1;
+		u32     supportSetLinkSpeed:1;
+		u32     supportEmergencySpares:1;
+		u32     supportSuspendResumeBGops:1;
+		u32     blockSSDWriteCacheChange:1;
+		u32     supportShieldState:1;
+		u32     supportLdBBMInfo:1;
+		u32     supportLdPIType3:1;
+		u32     supportLdPIType2:1;
+		u32     supportLdPIType1:1;
+		u32     supportPIcontroller:1;
+#else
 		u32     supportPIcontroller:1;
 		u32     supportLdPIType1:1;
 		u32     supportLdPIType2:1;
@@ -845,6 +887,7 @@ struct megasas_ctrl_info {
 
 		u32     supportUnevenSpans:1;
 		u32     reserved:11;
+#endif
 	} adapterOperations2;
 
 	u8  driverVersion[32];                  /*7A8h */
@@ -1069,9 +1112,15 @@ union megasas_sgl_frame {
 
 typedef union _MFI_CAPABILITIES {
 	struct {
+#if   defined(__BIG_ENDIAN_BITFIELD)
+		u32     reserved:30;
+		u32     support_additional_msix:1;
+		u32     support_fp_remote_lun:1;
+#else
 		u32     support_fp_remote_lun:1;
 		u32     support_additional_msix:1;
 		u32     reserved:30;
+#endif
 	} mfi_capabilities;
 	u32     reg;
 } MFI_CAPABILITIES;
drivers/scsi/megaraid/megaraid_sas_base.c +185 -139

735 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fp.c +72 -62

299 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.c +63 -66

333 lines not on this page · raw message

drivers/scsi/megaraid/megaraid_sas_fusion.h +24 -0
index 92b4daa..e88d935 100644
@@ -93,8 +93,13 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
  */
 
 struct RAID_CONTEXT {
+#if   defined(__BIG_ENDIAN_BITFIELD)
+	u8	nseg:4;
+	u8	Type:4;
+#else
 	u8	Type:4;
 	u8	nseg:4;
+#endif
 	u8	resvd0;
 	u16     timeoutValue;
 	u8      regLockFlags;
@@ -298,8 +303,13 @@ struct MPI2_RAID_SCSI_IO_REQUEST {
  * MPT RAID MFA IO Descriptor.
  */
 struct MEGASAS_RAID_MFA_IO_REQUEST_DESCRIPTOR {
+#if   defined(__BIG_ENDIAN_BITFIELD)
+	u32     MessageAddress1:24; /* bits 31:8*/
+	u32     RequestFlags:8;
+#else
 	u32     RequestFlags:8;
 	u32     MessageAddress1:24; /* bits 31:8*/
+#endif
 	u32     MessageAddress2;      /* bits 61:32 */
 };
 
@@ -518,6 +528,19 @@ struct MR_SPAN_BLOCK_INFO {
 
 struct MR_LD_RAID {
 	struct {
+#if   defined(__BIG_ENDIAN_BITFIELD)
+		u32     reserved4:7;
+		u32	fpNonRWCapable:1;
+		u32     fpReadAcrossStripe:1;
+		u32     fpWriteAcrossStripe:1;
+		u32     fpReadCapable:1;
+		u32     fpWriteCapable:1;
+		u32     encryptionType:8;
+		u32     pdPiMode:4;
+		u32     ldPiMode:4;
+		u32     reserved5:3;
+		u32     fpCapable:1;
+#else
 		u32     fpCapable:1;
 		u32     reserved5:3;
 		u32     ldPiMode:4;
@@ -529,6 +552,7 @@ struct MR_LD_RAID {
 		u32     fpReadAcrossStripe:1;
 		u32	fpNonRWCapable:1;
 		u32     reserved4:7;
+#endif
 	} capability;
 	u32     reserved6;
 	u64     size;
#1 lore raw
Quoted 5 lines · On Fri, 2013-09-06 at 15:50 +0530, [email protected] wrote:

This patch will add big endian architecture support to megaraid_sas driver. The support added is for LSI MegaRAID all generation controllers- (3Gb/s, 6Gb/s and 12 Gb/s controllers).

This patch will be applied on top of recently submitted patch for High Avaibility support- http://marc.info/?l=linux-scsi&m=137799326426659&w=2
We have done basic sanity test @ppc64 arch and @x86_64. Additional testing/observations are welcome.

Well, no it won't actually; it gives a rejection here:

Quoted 4 lines
scsi/megaraid/megaraid_sas_base.c +0 -0
@@ -5097,8 +5142,9 @@
 

scsi/megaraid/megaraid_sas_base.c line 5150

Quoted 10 lines
scsi/megaraid/megaraid_sas_base.c +3 -2
 	for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
 		dma_free_coherent(&instance->pdev->dev,
-				    kern_sge32[i].length,
-				    kbuff_arr[i], kern_sge32[i].phys_addr);
+				  le32_to_cpu(kern_sge32[i].length),
+				  kbuff_arr[i],
+				  le32_to_cpu(kern_sge32[i].phys_addr));
 	}
 
 	megasas_return_cmd(instance, cmd);

Because you didn't take into account this patch:

Author: Bjørn Mork <[email protected]>
Date:   Wed Nov 21 09:54:48 2012 +0100

[SCSI] megaraid_sas: fix memory leak if SGL has zero length entries

I fixed it up this time, but could you please work against the misc branch of the scsi git repo to prevent this type of problem in future?

Thanks,

James

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 40 lines

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, September 11, 2013 3:42 AM
To: Saxena, Sumit
Cc: [email protected]; Desai, Kashyap; [email protected]
Subject: Re: [PATCH][SCSI] megaraid_sas: addded support for big endian architecture

Quoted 2 lines · On Fri, 2013-09-06 at 15:50 +0530, [email protected] wrote:

This patch will add big endian architecture support to megaraid_sas driver. The support added is for LSI MegaRAID all generation

controllers- (3Gb/s, 6Gb/s and 12 Gb/s controllers).

Quoted 5 lines

This patch will be applied on top of recently submitted patch for High Avaibility support-
http://marc.info/?l=linux-scsi&m=137799326426659&w=2
We have done basic sanity test @ppc64 arch and @x86_64. Additional

testing/observations are welcome.

Well, no it won't actually; it gives a rejection here:

Quoted 4 lines
scsi/megaraid/megaraid_sas_base.c +0 -0
@@ -5097,8 +5142,9 @@
 

scsi/megaraid/megaraid_sas_base.c line 5150

Quoted 10 lines
scsi/megaraid/megaraid_sas_base.c +3 -2
 	for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
 		dma_free_coherent(&instance->pdev->dev,
-				    kern_sge32[i].length,
-				    kbuff_arr[i], kern_sge32[i].phys_addr);
+				  le32_to_cpu(kern_sge32[i].length),
+				  kbuff_arr[i],
+				  le32_to_cpu(kern_sge32[i].phys_addr));
 	}
 
 	megasas_return_cmd(instance, cmd);

Because you didn't take into account this patch:

Quoted 7 lines
Author: Bjørn Mork <[email protected]>
Date:   Wed Nov 21 09:54:48 2012 +0100

[SCSI] megaraid_sas: fix memory leak if SGL has zero length entries

I fixed it up this time, but could you please work against the misc branch of the scsi git repo to prevent this type of problem in future?

Sorry for inconvenience. In future, I will take care of this.

Quoted 5 lines

Thanks,

James

Thanks,
Sumit

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html