Re: [PATCH 11/18] megaraid_sas: Offload Aero RAID5/6 division calculations to driver
Hi Chandrakanth, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on mkp-scsi/for-next] [also build test WARNING on next-20190618] [cannot apply to v5.2-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Chandrakanth-Patil/megaraid_sas-driver-updates-to-07-710-06-00-rc1/20190618-174435 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-rc1-7-g2b96cd8-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) drivers/scsi/megaraid/megaraid_sas_fp.c:752:60: sparse: sparse: incorrect type in assignment (different base types) @@expected unsigned short [usertype] r1_alt_dev_handle @@got short [usertype] r1_alt_dev_handle @@ drivers/scsi/megaraid/megaraid_sas_fp.c:752:60: sparse:expected unsigned short [usertype] r1_alt_dev_handle drivers/scsi/megaraid/megaraid_sas_fp.c:752:60: sparse:got restricted __le16 drivers/scsi/megaraid/megaraid_sas_fp.c:194:72: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:199:33: sparse: sparse: cast to restricted __le16 drivers/scsi/megaraid/megaraid_sas_fp.c:207:25: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:208:25: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:210:33: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:211:33: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:214:79: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:215:33: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:223:41: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:224:49: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:226:49: sparse: sparse: cast to restricted __le16 drivers/scsi/megaraid/megaraid_sas_fp.c:232:58: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:233:33: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:242:41: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:243:33: sparse: sparse: cast to restricted __le32 drivers/scsi/megaraid/megaraid_sas_fp.c:868:60: sparse: sparse: incorrect type in assignment (different base types) @@expected unsigned short [usertype] r1_alt_dev_handle @@got short [usertype] r1_alt_dev_handle @@ drivers/scsi/megaraid/megaraid_sas_fp.c:868:60: sparse:expected unsigned short [usertype] r1_alt_dev_handle drivers/scsi/megaraid/megaraid_sas_fp.c:868:60: sparse:got restricted __le16 >> drivers/scsi/megaraid/megaraid_sas_fp.c:964:41: sparse: sparse: incorrect >> type in assignment (different base types) @@expected unsigned long long >> [usertype] reg_lock_row_lba @@got nsigned long long [usertype] >> reg_lock_row_lba @@ >> drivers/scsi/megaraid/megaraid_sas_fp.c:964:41: sparse:expected unsigned >> long long [usertype] reg_lock_row_lba drivers/scsi/megaraid/megaraid_sas_fp.c:964:41: sparse:got restricted __le64 [usertype] drivers/scsi/megaraid/megaraid_sas_fp.c:1201:28: sparse: sparse: restricted __le16 degrades to integer drivers/scsi/megaraid/megaraid_sas_fp.c:1392:24: sparse: sparse: incorrect type in assignment (different base types) @@expected unsigned short [usertype] pd1_dev_handle @@got short [usertype] pd1_dev_handle @@ drivers/scsi/megaraid/megaraid_sas_fp.c:1392:24: sparse:expected unsigned short [usertype] pd1_dev_handle drivers/scsi/megaraid/megaraid_sas_fp.c:1392:24: sparse:got restricted __le16 drivers/scsi/megaraid/megaraid_sas_fp.c:1361:4: sparse: sparse: symbol 'megasas_get_best_arm_pd' was not declared. Should it be static? vim +964 drivers/scsi/megaraid/megaraid_sas_fp.c 903 904 /* 905 * mr_get_phy_params_r56_rmw - Calculate parameters for R56 CTIO write operation 906 * @instance: Adapter soft state 907 * @ld: LD index 908 * @stripNo:Strip Number 909 * @io_info:IO info structure pointer 910 * pRAID_Context: RAID context pointer 911 * map: RAID map pointer 912 * 913 * This routine calculates the logical arm, data Arm, row number and parity arm 914 * for R56 CTIO write operation. 915 */ 916 static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance, 917
[PATCH 11/18] megaraid_sas: Offload Aero RAID5/6 division calculations to driver
For RAID5/RAID6 volumes configured behind Aero, driver will be doing 64bit division operations on behalf of firmware as controller's ARM CPU is very slow in this division. Later, driver calculate Q-ARM, P-ARM and Log-ARM and pass those values to firmware by writing these values to RAID_CONTEXT. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_base.c | 10 +++- drivers/scsi/megaraid/megaraid_sas_fp.c | 78 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +-- drivers/scsi/megaraid/megaraid_sas_fusion.h | 22 ++-- 4 files changed, 107 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5244b6e..81e708b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5777,8 +5777,16 @@ static int megasas_init_fw(struct megasas_instance *instance) MR_MAX_RAID_MAP_SIZE_MASK); } - if (instance->adapter_type == VENTURA_SERIES) + switch (instance->adapter_type) { + case VENTURA_SERIES: fusion->pcie_bw_limitation = true; + break; + case AERO_SERIES: + fusion->r56_div_offload = true; + break; + default: + break; + } /* Check if MSI-X is supported while in ready state */ msix_enable = (instance->instancet->read_fw_status_reg(instance) & diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index d296255..43a2e49 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -902,6 +902,77 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, } /* + * mr_get_phy_params_r56_rmw - Calculate parameters for R56 CTIO write operation + * @instance: Adapter soft state + * @ld:LD index + * @stripNo: Strip Number + * @io_info: IO info structure pointer + * pRAID_Context: RAID context pointer + * map:RAID map pointer + * + * This routine calculates the logical arm, data Arm, row number and parity arm + * for R56 CTIO write operation. + */ +static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance, + u32 ld, u64 stripNo, + struct IO_REQUEST_INFO *io_info, + struct RAID_CONTEXT_G35 *pRAID_Context, + struct MR_DRV_RAID_MAP_ALL *map) +{ + struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); + u8 span, dataArms, arms, dataArm, logArm; + s8 rightmostParityArm, PParityArm; + u64 rowNum; + u64 *pdBlock = &io_info->pdBlock; + + dataArms = raid->rowDataSize; + arms = raid->rowSize; + + rowNum = mega_div64_32(stripNo, dataArms); + /* parity disk arm, first arm is 0 */ + rightmostParityArm = (arms - 1) - mega_mod64(rowNum, arms); + + /* logical arm within row */ + logArm = mega_mod64(stripNo, dataArms); + /* physical arm for data */ + dataArm = mega_mod64((rightmostParityArm + 1 + logArm), arms); + + if (raid->spanDepth == 1) { + span = 0; + } else { + span = (u8)MR_GetSpanBlock(ld, rowNum, pdBlock, map); + if (span == SPAN_INVALID) + return; + } + + if (raid->level == 6) { + /* P Parity arm, note this can go negative adjust if negative */ + PParityArm = (arms - 2) - mega_mod64(rowNum, arms); + + if (PParityArm < 0) + PParityArm += arms; + + /* rightmostParityArm is P-Parity for RAID 5 and Q-Parity for RAID */ + pRAID_Context->flow_specific.r56_arm_map = rightmostParityArm; + pRAID_Context->flow_specific.r56_arm_map |= + (u16)(PParityArm << RAID_CTX_R56_P_ARM_SHIFT); + } else { + pRAID_Context->flow_specific.r56_arm_map |= + (u16)(rightmostParityArm << RAID_CTX_R56_P_ARM_SHIFT); + } + + pRAID_Context->reg_lock_row_lba = cpu_to_le64(rowNum); + pRAID_Context->flow_specific.r56_arm_map |= + (u16)(logArm << RAID_CTX_R56_LOG_ARM_SHIFT); + cpu_to_le16s(&pRAID_Context->flow_specific.r56_arm_map); + pRAID_Context->span_arm = (span << RAID_CTX_SPANARM_SPAN_SHIFT) | dataArm; + pRAID_Context->raid_flags = (MR_RAID_FLAGS_IO_SUB_TYPE_R56_DIV_OFFLOAD << + MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT); + + return; +} + +/* ** * * MR_BuildRaidContext funct