@@ -1888,7 +1888,7 @@ static struct megasas_instance *megasas_lookup_instance(u16 host_no)
18881888* Returns void
18891889*/
18901890void megasas_set_dynamic_target_properties (struct scsi_device * sdev ,
1891- bool is_target_prop )
1891+ struct queue_limits * lim , bool is_target_prop )
18921892{
18931893 u16 pd_index = 0 , ld ;
18941894 u32 device_id ;
@@ -1915,8 +1915,10 @@ void megasas_set_dynamic_target_properties(struct scsi_device *sdev,
19151915 return ;
19161916 raid = MR_LdRaidGet (ld , local_map_ptr );
19171917
1918- if (raid -> capability .ldPiMode == MR_PROT_INFO_TYPE_CONTROLLER )
1919- blk_queue_update_dma_alignment (sdev -> request_queue , 0x7 );
1918+ if (raid -> capability .ldPiMode == MR_PROT_INFO_TYPE_CONTROLLER ) {
1919+ if (lim )
1920+ lim -> dma_alignment = 0x7 ;
1921+ }
19201922
19211923 mr_device_priv_data -> is_tm_capable =
19221924 raid -> capability .tmCapable ;
@@ -1967,7 +1969,8 @@ void megasas_set_dynamic_target_properties(struct scsi_device *sdev,
19671969 *
19681970 */
19691971static inline void
1970- megasas_set_nvme_device_properties (struct scsi_device * sdev , u32 max_io_size )
1972+ megasas_set_nvme_device_properties (struct scsi_device * sdev ,
1973+ struct queue_limits * lim , u32 max_io_size )
19711974{
19721975 struct megasas_instance * instance ;
19731976 u32 mr_nvme_pg_size ;
@@ -1976,10 +1979,10 @@ megasas_set_nvme_device_properties(struct scsi_device *sdev, u32 max_io_size)
19761979 mr_nvme_pg_size = max_t (u32 , instance -> nvme_page_size ,
19771980 MR_DEFAULT_NVME_PAGE_SIZE );
19781981
1979- blk_queue_max_hw_sectors (sdev -> request_queue , (max_io_size / 512 ));
1982+ lim -> max_hw_sectors = max_io_size / 512 ;
1983+ lim -> virt_boundary_mask = mr_nvme_pg_size - 1 ;
19801984
19811985 blk_queue_flag_set (QUEUE_FLAG_NOMERGES , sdev -> request_queue );
1982- blk_queue_virt_boundary (sdev -> request_queue , mr_nvme_pg_size - 1 );
19831986}
19841987
19851988/*
@@ -2041,7 +2044,7 @@ static void megasas_set_fw_assisted_qd(struct scsi_device *sdev,
20412044 * @is_target_prop true, if fw provided target properties.
20422045 */
20432046static void megasas_set_static_target_properties (struct scsi_device * sdev ,
2044- bool is_target_prop )
2047+ struct queue_limits * lim , bool is_target_prop )
20452048{
20462049 u32 max_io_size_kb = MR_DEFAULT_NVME_MDTS_KB ;
20472050 struct megasas_instance * instance ;
@@ -2060,13 +2063,15 @@ static void megasas_set_static_target_properties(struct scsi_device *sdev,
20602063 max_io_size_kb = le32_to_cpu (instance -> tgt_prop -> max_io_size_kb );
20612064
20622065 if (instance -> nvme_page_size && max_io_size_kb )
2063- megasas_set_nvme_device_properties (sdev , (max_io_size_kb << 10 ));
2066+ megasas_set_nvme_device_properties (sdev , lim ,
2067+ max_io_size_kb << 10 );
20642068
20652069 megasas_set_fw_assisted_qd (sdev , is_target_prop );
20662070}
20672071
20682072
2069- static int megasas_slave_configure (struct scsi_device * sdev )
2073+ static int megasas_device_configure (struct scsi_device * sdev ,
2074+ struct queue_limits * lim )
20702075{
20712076 u16 pd_index = 0 ;
20722077 struct megasas_instance * instance ;
@@ -2096,10 +2101,10 @@ static int megasas_slave_configure(struct scsi_device *sdev)
20962101 ret_target_prop = megasas_get_target_prop (instance , sdev );
20972102
20982103 is_target_prop = (ret_target_prop == DCMD_SUCCESS ) ? true : false;
2099- megasas_set_static_target_properties (sdev , is_target_prop );
2104+ megasas_set_static_target_properties (sdev , lim , is_target_prop );
21002105
21012106 /* This sdev property may change post OCR */
2102- megasas_set_dynamic_target_properties (sdev , is_target_prop );
2107+ megasas_set_dynamic_target_properties (sdev , lim , is_target_prop );
21032108
21042109 mutex_unlock (& instance -> reset_mutex );
21052110
@@ -3507,7 +3512,7 @@ static const struct scsi_host_template megasas_template = {
35073512 .module = THIS_MODULE ,
35083513 .name = "Avago SAS based MegaRAID driver" ,
35093514 .proc_name = "megaraid_sas" ,
3510- .slave_configure = megasas_slave_configure ,
3515+ .device_configure = megasas_device_configure ,
35113516 .slave_alloc = megasas_slave_alloc ,
35123517 .slave_destroy = megasas_slave_destroy ,
35133518 .queuecommand = megasas_queue_command ,
0 commit comments