Re: [PATCH V5 06/11] megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers
On 14.12.2016 23:13, Sasikumar Chandrasekaran wrote: > SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to > have different > sizes for different number of supported VDs. > > This patch is depending on patch 5 > Code indentation is fixed for VD_EXT_DEBUG macro > > Signed-off-by: Sasikumar Chandrasekaran> --- > drivers/scsi/megaraid/megaraid_sas.h| 7 + > drivers/scsi/megaraid/megaraid_sas_base.c | 53 -- > drivers/scsi/megaraid/megaraid_sas_fp.c | 254 > +++- > drivers/scsi/megaraid/megaraid_sas_fusion.c | 219 +++- > drivers/scsi/megaraid/megaraid_sas_fusion.h | 240 ++ > 5 files changed, 636 insertions(+), 137 deletions(-) > > diff --git a/drivers/scsi/megaraid/megaraid_sas.h > b/drivers/scsi/megaraid/megaraid_sas.h > index a96889c..6ddf994 100644 > --- a/drivers/scsi/megaraid/megaraid_sas.h > +++ b/drivers/scsi/megaraid/megaraid_sas.h > @@ -1434,6 +1434,12 @@ enum FW_BOOT_CONTEXT { > #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT14 > #define MR_MAX_MSIX_REG_ARRAY 16 > #define MR_RDPQ_MODE_OFFSET 0X0080 > + > +#define MR_MAX_RAID_MAP_SIZE_OFFSET_SHIFT16 > +#define MR_MAX_RAID_MAP_SIZE_MASK0x1FF > +#define MR_MIN_MAP_SIZE 0x1 > +/* 64k */ > + > #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X0100 > > /* > @@ -2151,6 +2157,7 @@ struct megasas_instance { > bool fw_sync_cache_support; > bool is_ventura; > bool msix_combined; > + u16 max_raid_mapsize; > }; > struct MR_LD_VF_MAP { > u32 size; > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c > b/drivers/scsi/megaraid/megaraid_sas_base.c > index 8e20992..92cb02f 100644 > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > @@ -4424,8 +4424,7 @@ int megasas_alloc_cmds(struct megasas_instance > *instance) > static void megasas_update_ext_vd_details(struct megasas_instance *instance) > { > struct fusion_context *fusion; > - u32 old_map_sz; > - u32 new_map_sz; > + u32 ventura_map_sz = 0; > > fusion = instance->ctrl_context; > /* For MFI based controllers return dummy success */ > @@ -4455,21 +4454,34 @@ static void megasas_update_ext_vd_details(struct > megasas_instance *instance) > instance->supportmax256vd ? "Extended VD(240 VD)firmware" : > "Legacy(64 VD) firmware"); > > - old_map_sz = sizeof(struct MR_FW_RAID_MAP) + > - (sizeof(struct MR_LD_SPAN_MAP) * > - (instance->fw_supported_vd_count - 1)); > - new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT); > - fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP) + > - (sizeof(struct MR_LD_SPAN_MAP) * > - (instance->drv_supported_vd_count - 1)); > + if (instance->max_raid_mapsize) { > + ventura_map_sz = instance->max_raid_mapsize * > + MR_MIN_MAP_SIZE; /* 64k */ > + fusion->current_map_sz = ventura_map_sz; > + fusion->max_map_sz = ventura_map_sz; > + } else { > + fusion->old_map_sz = sizeof(struct MR_FW_RAID_MAP) + > + (sizeof(struct MR_LD_SPAN_MAP) * > + (instance->fw_supported_vd_count - 1)); > + fusion->new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT); > > - fusion->max_map_sz = max(old_map_sz, new_map_sz); > + fusion->max_map_sz = > + max(fusion->old_map_sz, fusion->new_map_sz); > > + if (instance->supportmax256vd) > + fusion->current_map_sz = fusion->new_map_sz; > + else > + fusion->current_map_sz = fusion->old_map_sz; > + } > + /* irrespective of FW raid maps, driver raid map is constant */ > + fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP_ALL); > > - if (instance->supportmax256vd) > - fusion->current_map_sz = new_map_sz; > - else > - fusion->current_map_sz = old_map_sz; > +#if VD_EXT_DEBUG > + dev_info(>pdev->dev, "instance->max_raid_mapsize 0x%x\n ", > instance->max_raid_mapsize); > + dev_info(>pdev->dev, "new_map_sz = 0x%x, old_map_sz = > 0x%x\n", fusion->new_map_sz, fusion->old_map_sz); > + dev_info(>pdev->dev, "ventura_map_sz = 0x%x, current_map_sz = > 0x%x\n", ventura_map_sz, fusion->current_map_sz); > + dev_info(>pdev->dev, "fusion->drv_map_sz =0x%x, size of > driver raid map 0x%lx\n", fusion->drv_map_sz, sizeof(struct > MR_DRV_RAID_MAP_ALL)); > +#endif > } > > /** > @@ -4996,7 +5008,7 @@ static int megasas_init_fw(struct megasas_instance > *instance) > { > u32 max_sectors_1; > u32 max_sectors_2; > - u32 tmp_sectors,
[PATCH V5 06/11] megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers
SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to have different sizes for different number of supported VDs. This patch is depending on patch 5 Code indentation is fixed for VD_EXT_DEBUG macro Signed-off-by: Sasikumar Chandrasekaran--- drivers/scsi/megaraid/megaraid_sas.h| 7 + drivers/scsi/megaraid/megaraid_sas_base.c | 53 -- drivers/scsi/megaraid/megaraid_sas_fp.c | 254 +++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 219 +++- drivers/scsi/megaraid/megaraid_sas_fusion.h | 240 ++ 5 files changed, 636 insertions(+), 137 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index a96889c..6ddf994 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1434,6 +1434,12 @@ enum FW_BOOT_CONTEXT { #define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT14 #define MR_MAX_MSIX_REG_ARRAY 16 #define MR_RDPQ_MODE_OFFSET0X0080 + +#define MR_MAX_RAID_MAP_SIZE_OFFSET_SHIFT 16 +#define MR_MAX_RAID_MAP_SIZE_MASK 0x1FF +#define MR_MIN_MAP_SIZE0x1 +/* 64k */ + #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET0X0100 /* @@ -2151,6 +2157,7 @@ struct megasas_instance { bool fw_sync_cache_support; bool is_ventura; bool msix_combined; + u16 max_raid_mapsize; }; struct MR_LD_VF_MAP { u32 size; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 8e20992..92cb02f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4424,8 +4424,7 @@ int megasas_alloc_cmds(struct megasas_instance *instance) static void megasas_update_ext_vd_details(struct megasas_instance *instance) { struct fusion_context *fusion; - u32 old_map_sz; - u32 new_map_sz; + u32 ventura_map_sz = 0; fusion = instance->ctrl_context; /* For MFI based controllers return dummy success */ @@ -4455,21 +4454,34 @@ static void megasas_update_ext_vd_details(struct megasas_instance *instance) instance->supportmax256vd ? "Extended VD(240 VD)firmware" : "Legacy(64 VD) firmware"); - old_map_sz = sizeof(struct MR_FW_RAID_MAP) + - (sizeof(struct MR_LD_SPAN_MAP) * - (instance->fw_supported_vd_count - 1)); - new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT); - fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP) + - (sizeof(struct MR_LD_SPAN_MAP) * - (instance->drv_supported_vd_count - 1)); + if (instance->max_raid_mapsize) { + ventura_map_sz = instance->max_raid_mapsize * + MR_MIN_MAP_SIZE; /* 64k */ + fusion->current_map_sz = ventura_map_sz; + fusion->max_map_sz = ventura_map_sz; + } else { + fusion->old_map_sz = sizeof(struct MR_FW_RAID_MAP) + + (sizeof(struct MR_LD_SPAN_MAP) * + (instance->fw_supported_vd_count - 1)); + fusion->new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT); - fusion->max_map_sz = max(old_map_sz, new_map_sz); + fusion->max_map_sz = + max(fusion->old_map_sz, fusion->new_map_sz); + if (instance->supportmax256vd) + fusion->current_map_sz = fusion->new_map_sz; + else + fusion->current_map_sz = fusion->old_map_sz; + } + /* irrespective of FW raid maps, driver raid map is constant */ + fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP_ALL); - if (instance->supportmax256vd) - fusion->current_map_sz = new_map_sz; - else - fusion->current_map_sz = old_map_sz; +#if VD_EXT_DEBUG + dev_info(>pdev->dev, "instance->max_raid_mapsize 0x%x\n ", instance->max_raid_mapsize); + dev_info(>pdev->dev, "new_map_sz = 0x%x, old_map_sz = 0x%x\n", fusion->new_map_sz, fusion->old_map_sz); + dev_info(>pdev->dev, "ventura_map_sz = 0x%x, current_map_sz = 0x%x\n", ventura_map_sz, fusion->current_map_sz); + dev_info(>pdev->dev, "fusion->drv_map_sz =0x%x, size of driver raid map 0x%lx\n", fusion->drv_map_sz, sizeof(struct MR_DRV_RAID_MAP_ALL)); +#endif } /** @@ -4996,7 +5008,7 @@ static int megasas_init_fw(struct megasas_instance *instance) { u32 max_sectors_1; u32 max_sectors_2; - u32 tmp_sectors, msix_enable, scratch_pad_2; + u32 tmp_sectors, msix_enable, scratch_pad_2, scratch_pad_3; resource_size_t base_addr; struct megasas_register_set __iomem