Message ID | 20240909095646.3756308-1-avri.altman@wdc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb | expand |
On 9/9/24 2:56 AM, Avri Altman wrote: > Replace manual offset calculations for response_upiu and prd_table in > ufshcd_init_lrb() with pre-calculated offsets already stored in the > utp_transfer_req_desc structure. The pre-calculated offsets are set > differently in ufshcd_host_memory_configure() based on the > UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk, ensuring correct alignment and > access. Please add Fixes: and Cc: stable tags. Thanks, Bart.
Hi Avri, kernel test robot noticed the following build warnings: [auto build test WARNING on mkp-scsi/for-next] [also build test WARNING on jejb-scsi/for-next linus/master v6.11-rc7 next-20240909] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Avri-Altman/scsi-ufs-Use-pre-calculated-offsets-in-ufshcd_init_lrb/20240909-180037 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next patch link: https://lore.kernel.org/r/20240909095646.3756308-1-avri.altman%40wdc.com patch subject: [PATCH] scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb config: x86_64-randconfig-121-20240910 (https://download.01.org/0day-ci/archive/20240910/202409101048.isDGxmBR-lkp@intel.com/config) compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240910/202409101048.isDGxmBR-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202409101048.isDGxmBR-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/ufs/core/ufshcd.c:2922:40: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [usertype] response_offset @@ got restricted __le16 [usertype] response_upiu_offset @@ drivers/ufs/core/ufshcd.c:2922:40: sparse: expected unsigned short [usertype] response_offset drivers/ufs/core/ufshcd.c:2922:40: sparse: got restricted __le16 [usertype] response_upiu_offset >> drivers/ufs/core/ufshcd.c:2923:36: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [usertype] prdt_offset @@ got restricted __le16 [usertype] prd_table_offset @@ drivers/ufs/core/ufshcd.c:2923:36: sparse: expected unsigned short [usertype] prdt_offset drivers/ufs/core/ufshcd.c:2923:36: sparse: got restricted __le16 [usertype] prd_table_offset vim +2922 drivers/ufs/core/ufshcd.c 2914 2915 static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i) 2916 { 2917 struct utp_transfer_cmd_desc *cmd_descp = (void *)hba->ucdl_base_addr + 2918 i * ufshcd_get_ucd_size(hba); 2919 struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr; 2920 dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr + 2921 i * ufshcd_get_ucd_size(hba); > 2922 u16 response_offset = utrdlp[i].response_upiu_offset; > 2923 u16 prdt_offset = utrdlp[i].prd_table_offset; 2924 2925 lrb->utr_descriptor_ptr = utrdlp + i; 2926 lrb->utrd_dma_addr = hba->utrdl_dma_addr + 2927 i * sizeof(struct utp_transfer_req_desc); 2928 lrb->ucd_req_ptr = (struct utp_upiu_req *)cmd_descp->command_upiu; 2929 lrb->ucd_req_dma_addr = cmd_desc_element_addr; 2930 lrb->ucd_rsp_ptr = (struct utp_upiu_rsp *)cmd_descp->response_upiu; 2931 lrb->ucd_rsp_dma_addr = cmd_desc_element_addr + response_offset; 2932 lrb->ucd_prdt_ptr = (struct ufshcd_sg_entry *)cmd_descp->prd_table; 2933 lrb->ucd_prdt_dma_addr = cmd_desc_element_addr + prdt_offset; 2934 } 2935
> On 9/9/24 2:56 AM, Avri Altman wrote: > > Replace manual offset calculations for response_upiu and prd_table in > > ufshcd_init_lrb() with pre-calculated offsets already stored in the > > utp_transfer_req_desc structure. The pre-calculated offsets are set > > differently in ufshcd_host_memory_configure() based on the > > UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk, ensuring correct alignment and > > access. > > Please add Fixes: and Cc: stable tags. Done. Thanks, Avri > > Thanks, > > Bart.
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 8ea5a82503a9..e7ed3625710e 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2919,9 +2919,8 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i) struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr; dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr + i * ufshcd_get_ucd_size(hba); - u16 response_offset = offsetof(struct utp_transfer_cmd_desc, - response_upiu); - u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc, prd_table); + u16 response_offset = utrdlp[i].response_upiu_offset; + u16 prdt_offset = utrdlp[i].prd_table_offset; lrb->utr_descriptor_ptr = utrdlp + i; lrb->utrd_dma_addr = hba->utrdl_dma_addr +
Replace manual offset calculations for response_upiu and prd_table in ufshcd_init_lrb() with pre-calculated offsets already stored in the utp_transfer_req_desc structure. The pre-calculated offsets are set differently in ufshcd_host_memory_configure() based on the UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk, ensuring correct alignment and access. Signed-off-by: Avri Altman <avri.altman@wdc.com> --- drivers/ufs/core/ufshcd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)