Message ID | 1516365462-14708-5-git-send-email-suganath-prabu.subramani@broadcom.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Hi Suganath, I love your patch! Perhaps something to improve: [auto build test WARNING on scsi/for-next] [also build test WARNING on v4.15-rc8 next-20180119] [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/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: i386-randconfig-i1-201802 (attached as .config) compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys': drivers/scsi/mpt3sas/mpt3sas_base.c:188:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] base_chain_phys = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET + ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries': drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean 'mpt3sas_scsih_issue_locked_tm'? [-Werror=implicit-function-declaration] scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mpt3sas_scsih_issue_locked_tm drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion] scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:378:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] sgel->Address = (dma_addr_t)dst_addr_phys; ^ drivers/scsi/mpt3sas/mpt3sas_base.c:389:7: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] (dma_addr_t)buff_ptr_phys; ^ drivers/scsi/mpt3sas/mpt3sas_base.c:395:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] (dma_addr_t)buff_ptr_phys; ^ At top level: drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used [-Wunused-function] static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, ^~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +378 drivers/scsi/mpt3sas/mpt3sas_base.c 265 266 /** 267 * _clone_sg_entries - MPI EP's scsiio and config requests 268 * are handled here. Base function for 269 * double buffering, before submitting 270 * the requests. 271 * 272 * @ioc: per adapter object. 273 * @mpi_request: mf request pointer. 274 * @smid: system request message index. 275 * 276 * @Returns: Nothing. 277 */ 278 static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, 279 void *mpi_request, u16 smid) 280 { 281 Mpi2SGESimple32_t *sgel, *sgel_next; 282 u32 sgl_flags, sge_chain_count = 0; 283 bool is_write = 0; 284 u16 i = 0; 285 void *buffer_iomem, *buffer_iomem_phys; 286 void *buff_ptr, *buff_ptr_phys; 287 void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO]; 288 void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys; 289 MPI2RequestHeader_t *request_hdr; 290 struct scsi_cmnd *scmd; 291 struct scatterlist *sg_scmd = NULL; 292 int is_scsiio_req = 0; 293 294 request_hdr = (MPI2RequestHeader_t *) mpi_request; 295 296 if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) { 297 Mpi25SCSIIORequest_t *scsiio_request = 298 (Mpi25SCSIIORequest_t *)mpi_request; 299 sgel = (Mpi2SGESimple32_t *) &scsiio_request->SGL; 300 is_scsiio_req = 1; 301 } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) { 302 Mpi2ConfigRequest_t *config_req = 303 (Mpi2ConfigRequest_t *)mpi_request; 304 sgel = (Mpi2SGESimple32_t *) &config_req->PageBufferSGE; 305 } else 306 return; 307 308 /* From smid we can get scsi_cmd, once we have sg_scmd, 309 * we just need to get sg_virt and sg_next to get virual 310 * address associated with sgel->Address. 311 */ 312 313 if (is_scsiio_req) { 314 /* Get scsi_cmd using smid */ > 315 scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); 316 if (scmd == NULL) { 317 pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name); 318 return; 319 } 320 321 /* Get sg_scmd from scmd provided */ 322 sg_scmd = scsi_sglist(scmd); 323 } 324 325 /* 326 * 0 - 255 System register 327 * 256 - 4352 MPI Frame. (This is based on maxCredit 32) 328 * 4352 - 4864 Reply_free pool (512 byte is reserved 329 * considering maxCredit 32. Reply need extra 330 * room, for mCPU case kept four times of 331 * maxCredit). 332 * 4864 - 17152 SGE chain element. (32cmd * 3 chain of 333 * 128 byte size = 12288) 334 * 17152 - x Host buffer mapped with smid. 335 * (Each smid can have 64K Max IO.) 336 * BAR0+Last 1K MSIX Addr and Data 337 * Total size in use 2113664 bytes of 4MB BAR0 338 */ 339 340 buffer_iomem = _base_get_buffer_bar0(ioc, smid); 341 buffer_iomem_phys = _base_get_buffer_phys_bar0(ioc, smid); 342 343 buff_ptr = buffer_iomem; 344 buff_ptr_phys = buffer_iomem_phys; 345 346 if (sgel->FlagsLength & 347 (MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT)) 348 is_write = 1; 349 350 for (i = 0; i < MPT_MIN_PHYS_SEGMENTS + ioc->facts.MaxChainDepth; i++) { 351 352 sgl_flags = (sgel->FlagsLength >> MPI2_SGE_FLAGS_SHIFT); 353 354 switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK) { 355 case MPI2_SGE_FLAGS_CHAIN_ELEMENT: 356 /* 357 * Helper function which on passing 358 * chain_buffer_dma returns chain_buffer. Get 359 * the virtual address for sgel->Address 360 */ 361 sgel_next = 362 _base_get_chain_buffer_dma_to_chain_buffer(ioc, 363 sgel->Address); 364 if (sgel_next == NULL) 365 return; 366 /* 367 * This is coping 128 byte chain 368 * frame (not a host buffer) 369 */ 370 dst_chain_addr[sge_chain_count] = 371 _base_get_chain(ioc, 372 smid, sge_chain_count); 373 src_chain_addr[sge_chain_count] = 374 (void *) sgel_next; 375 dst_addr_phys = 376 _base_get_chain_phys(ioc, 377 smid, sge_chain_count); > 378 sgel->Address = (dma_addr_t)dst_addr_phys; 379 sgel = sgel_next; 380 sge_chain_count++; 381 break; 382 case MPI2_SGE_FLAGS_SIMPLE_ELEMENT: 383 if (is_write) { 384 if (is_scsiio_req) { 385 _base_clone_to_sys_mem(buff_ptr, 386 sg_virt(sg_scmd), 387 (sgel->FlagsLength & 0x00ffffff)); 388 sgel->Address = 389 (dma_addr_t)buff_ptr_phys; 390 } else { 391 _base_clone_to_sys_mem(buff_ptr, 392 ioc->config_vaddr, 393 (sgel->FlagsLength & 0x00ffffff)); 394 sgel->Address = 395 (dma_addr_t)buff_ptr_phys; 396 } 397 } 398 buff_ptr += (sgel->FlagsLength & 0x00ffffff); 399 buff_ptr_phys += (sgel->FlagsLength & 0x00ffffff); 400 if ((sgel->FlagsLength & 401 (MPI2_SGE_FLAGS_END_OF_BUFFER 402 << MPI2_SGE_FLAGS_SHIFT))) 403 goto eob_clone_chain; 404 else { 405 /* 406 * Every single element in MPT will have 407 * associated sg_next. Better to sanity that 408 * sg_next is not NULL, but it will be a bug 409 * if it is null. 410 */ 411 if (is_scsiio_req) { 412 sg_scmd = sg_next(sg_scmd); 413 if (sg_scmd) 414 sgel++; 415 else 416 goto eob_clone_chain; 417 } 418 } 419 break; 420 } 421 } 422 423 eob_clone_chain: 424 for (i = 0; i < sge_chain_count; i++) { 425 if (is_scsiio_req) 426 _base_clone_to_sys_mem(dst_chain_addr[i], 427 src_chain_addr[i], ioc->request_sz); 428 } 429 } 430 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Suganath, I love your patch! Perhaps something to improve: [auto build test WARNING on scsi/for-next] [also build test WARNING on v4.15-rc8 next-20180119] [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/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 <noident> >> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@ drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address space of expression drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get' drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@ drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@ drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address space of expression drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted __le16 drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted __le16 drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted __le16 drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type! drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries': drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mpt3sas_scsih_issue_locked_tm drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); ^ At top level: drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used static void _clone_sg_entries(struct MPT3SAS_ADAPTER ^~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +142 drivers/scsi/mpt3sas/mpt3sas_base.c 103 104 /** 105 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. 106 * 107 */ 108 static int 109 _scsih_set_fwfault_debug(const char *val, const struct kernel_param *kp) 110 { 111 int ret = param_set_int(val, kp); 112 struct MPT3SAS_ADAPTER *ioc; 113 114 if (ret) 115 return ret; 116 117 /* global ioc spinlock to protect controller list on list operations */ 118 pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug); 119 spin_lock(&gioc_lock); 120 list_for_each_entry(ioc, &mpt3sas_ioc_list, list) 121 ioc->fwfault_debug = mpt3sas_fwfault_debug; 122 spin_unlock(&gioc_lock); 123 return 0; 124 } 125 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug, 126 param_get_int, &mpt3sas_fwfault_debug, 0644); 127 128 /** 129 * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region 130 * 131 * @dst_iomem: Pointer to the destinaltion location in BAR0 space. 132 * @src: Pointer to the Source data. 133 * @size: Size of data to be copied. 134 */ 135 static void 136 _base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size) 137 { 138 int i; 139 __le32 *src_virt_mem = (__le32 *)(src); 140 141 for (i = 0; i < size/4; i++) > 142 writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4)); 143 } 144 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi All, We tried to reproduce below error "drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);" with base code and Make file flags (sparse) as mentioned under reproduce in auto build test log. We are not seeing this error. We have reviewed the code and it seems to be fine. Let us know if we miss something here. base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries': drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mpt3sas_scsih_issue_locked_tm drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); ^ At top level: drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used static void _clone_sg_entries(struct MPT3SAS_ADAPTER ^~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors Thanks, Suganath Prabu S On Sat, Jan 20, 2018 at 11:37 PM, kbuild test robot <lkp@intel.com> wrote: > Hi Suganath, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on scsi/for-next] > [also build test WARNING on v4.15-rc8 next-20180119] > [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/Suganath-Prabu-S/mpt3sas-Add-PCI-device-ID-for-Andromeda/20180121-002454 > base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next > reproduce: > # apt-get install sparse > make ARCH=x86_64 allmodconfig > make C=1 CF=-D__CHECK_ENDIAN__ > > > sparse warnings: (new ones prefixed by >>) > >>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: cast from restricted __le32 > drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: expected unsigned int val > drivers/scsi/mpt3sas/mpt3sas_base.c:142:24: got restricted __le32 <noident> >>> drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: expected void volatile > drivers/scsi/mpt3sas/mpt3sas_base.c:142:64: got void COPYING CREDITS Documentation Kbuild Kconfig MAINTAINERS Makefile README arch block certs crypto drivers firmware fs include init ipc kernel lib mm net samples scripts security sound tools usr virt > drivers/scsi/mpt3sas/mpt3sas_base.c:162:24: sparse: cast removes address space of expression > drivers/scsi/mpt3sas/mpt3sas_base.c:315:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get' > drivers/scsi/mpt3sas/mpt3sas_base.c:1164:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:1165:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:1383:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:1432:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:2964:32: sparse: cast removes address space of expression > drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3256:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3411:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3433:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3456:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3477:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:3498:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:4950:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:4971:20: sparse: cast to restricted __le16 > drivers/scsi/mpt3sas/mpt3sas_base.c:4980:20: sparse: cast to restricted __le16 > drivers/scsi/mpt3sas/mpt3sas_base.c:4994:36: sparse: cast to restricted __le16 > drivers/scsi/mpt3sas/mpt3sas_base.c:6175:55: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ > drivers/scsi/mpt3sas/mpt3sas_base.c:315:53: sparse: call with no type! > drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries': > drivers/scsi/mpt3sas/mpt3sas_base.c:315:10: error: implicit declaration of function 'mpt3sas_scsih_scsi_lookup_get'; did you mean > scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > mpt3sas_scsih_issue_locked_tm > drivers/scsi/mpt3sas/mpt3sas_base.c:315:8: warning: assignment makes pointer from integer without a cast > scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); > ^ > At top level: > drivers/scsi/mpt3sas/mpt3sas_base.c:278:13: warning: '_clone_sg_entries' defined but not used > static void _clone_sg_entries(struct MPT3SAS_ADAPTER > ^~~~~~~~~~~~~~~~~ > cc1: some warnings being treated as errors > > vim +142 drivers/scsi/mpt3sas/mpt3sas_base.c > > 103 > 104 /** > 105 * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. > 106 * > 107 */ > 108 static int > 109 _scsih_set_fwfault_debug(const char *val, const struct kernel_param *kp) > 110 { > 111 int ret = param_set_int(val, kp); > 112 struct MPT3SAS_ADAPTER *ioc; > 113 > 114 if (ret) > 115 return ret; > 116 > 117 /* global ioc spinlock to protect controller list on list operations */ > 118 pr_info("setting fwfault_debug(%d)\n", mpt3sas_fwfault_debug); > 119 spin_lock(&gioc_lock); > 120 list_for_each_entry(ioc, &mpt3sas_ioc_list, list) > 121 ioc->fwfault_debug = mpt3sas_fwfault_debug; > 122 spin_unlock(&gioc_lock); > 123 return 0; > 124 } > 125 module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug, > 126 param_get_int, &mpt3sas_fwfault_debug, 0644); > 127 > 128 /** > 129 * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region > 130 * > 131 * @dst_iomem: Pointer to the destinaltion location in BAR0 space. > 132 * @src: Pointer to the Source data. > 133 * @size: Size of data to be copied. > 134 */ > 135 static void > 136 _base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size) > 137 { > 138 int i; > 139 __le32 *src_virt_mem = (__le32 *)(src); > 140 > 141 for (i = 0; i < size/4; i++) > > 142 writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4)); > 143 } > 144 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index dc289c0..40a1806 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -126,6 +126,23 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug, param_get_int, &mpt3sas_fwfault_debug, 0644); /** + * _base_clone_to_sys_mem - Writes/copies data to system/BAR0 region + * + * @dst_iomem: Pointer to the destinaltion location in BAR0 space. + * @src: Pointer to the Source data. + * @size: Size of data to be copied. + */ +static void +_base_clone_to_sys_mem(void *dst_iomem, void *src, u32 size) +{ + int i; + __le32 *src_virt_mem = (__le32 *)(src); + + for (i = 0; i < size/4; i++) + writel(cpu_to_le32(src_virt_mem[i]), dst_iomem + (i * 4)); +} + +/** * _base_get_chain - Calculates and Returns virtual chain address * for the provided smid in BAR0 space. * @@ -219,6 +236,199 @@ _base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid) } /** + * _base_get_chain_buffer_dma_to_chain_buffer - Iterates chain + * lookup list and Provides chain_buffer + * address for the matching dma address. + * (Each smid can have 64K starts from 17024) + * + * @ioc: per adapter object + * @chain_buffer_dma: Chain buffer dma address. + * + * @Returns - Pointer to chain buffer. Or Null on Failure. + */ +static void * +_base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc, + dma_addr_t chain_buffer_dma) +{ + u16 index; + + for (index = 0; index < ioc->chain_depth; index++) { + if (ioc->chain_lookup[index].chain_buffer_dma == + chain_buffer_dma) + return ioc->chain_lookup[index].chain_buffer; + } + pr_info(MPT3SAS_FMT + "Provided chain_buffer_dma address is not in the lookup list\n", + ioc->name); + return NULL; +} + +/** + * _clone_sg_entries - MPI EP's scsiio and config requests + * are handled here. Base function for + * double buffering, before submitting + * the requests. + * + * @ioc: per adapter object. + * @mpi_request: mf request pointer. + * @smid: system request message index. + * + * @Returns: Nothing. + */ +static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, + void *mpi_request, u16 smid) +{ + Mpi2SGESimple32_t *sgel, *sgel_next; + u32 sgl_flags, sge_chain_count = 0; + bool is_write = 0; + u16 i = 0; + void *buffer_iomem, *buffer_iomem_phys; + void *buff_ptr, *buff_ptr_phys; + void *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO]; + void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys; + MPI2RequestHeader_t *request_hdr; + struct scsi_cmnd *scmd; + struct scatterlist *sg_scmd = NULL; + int is_scsiio_req = 0; + + request_hdr = (MPI2RequestHeader_t *) mpi_request; + + if (request_hdr->Function == MPI2_FUNCTION_SCSI_IO_REQUEST) { + Mpi25SCSIIORequest_t *scsiio_request = + (Mpi25SCSIIORequest_t *)mpi_request; + sgel = (Mpi2SGESimple32_t *) &scsiio_request->SGL; + is_scsiio_req = 1; + } else if (request_hdr->Function == MPI2_FUNCTION_CONFIG) { + Mpi2ConfigRequest_t *config_req = + (Mpi2ConfigRequest_t *)mpi_request; + sgel = (Mpi2SGESimple32_t *) &config_req->PageBufferSGE; + } else + return; + + /* From smid we can get scsi_cmd, once we have sg_scmd, + * we just need to get sg_virt and sg_next to get virual + * address associated with sgel->Address. + */ + + if (is_scsiio_req) { + /* Get scsi_cmd using smid */ + scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); + if (scmd == NULL) { + pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name); + return; + } + + /* Get sg_scmd from scmd provided */ + sg_scmd = scsi_sglist(scmd); + } + + /* + * 0 - 255 System register + * 256 - 4352 MPI Frame. (This is based on maxCredit 32) + * 4352 - 4864 Reply_free pool (512 byte is reserved + * considering maxCredit 32. Reply need extra + * room, for mCPU case kept four times of + * maxCredit). + * 4864 - 17152 SGE chain element. (32cmd * 3 chain of + * 128 byte size = 12288) + * 17152 - x Host buffer mapped with smid. + * (Each smid can have 64K Max IO.) + * BAR0+Last 1K MSIX Addr and Data + * Total size in use 2113664 bytes of 4MB BAR0 + */ + + buffer_iomem = _base_get_buffer_bar0(ioc, smid); + buffer_iomem_phys = _base_get_buffer_phys_bar0(ioc, smid); + + buff_ptr = buffer_iomem; + buff_ptr_phys = buffer_iomem_phys; + + if (sgel->FlagsLength & + (MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT)) + is_write = 1; + + for (i = 0; i < MPT_MIN_PHYS_SEGMENTS + ioc->facts.MaxChainDepth; i++) { + + sgl_flags = (sgel->FlagsLength >> MPI2_SGE_FLAGS_SHIFT); + + switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK) { + case MPI2_SGE_FLAGS_CHAIN_ELEMENT: + /* + * Helper function which on passing + * chain_buffer_dma returns chain_buffer. Get + * the virtual address for sgel->Address + */ + sgel_next = + _base_get_chain_buffer_dma_to_chain_buffer(ioc, + sgel->Address); + if (sgel_next == NULL) + return; + /* + * This is coping 128 byte chain + * frame (not a host buffer) + */ + dst_chain_addr[sge_chain_count] = + _base_get_chain(ioc, + smid, sge_chain_count); + src_chain_addr[sge_chain_count] = + (void *) sgel_next; + dst_addr_phys = + _base_get_chain_phys(ioc, + smid, sge_chain_count); + sgel->Address = (dma_addr_t)dst_addr_phys; + sgel = sgel_next; + sge_chain_count++; + break; + case MPI2_SGE_FLAGS_SIMPLE_ELEMENT: + if (is_write) { + if (is_scsiio_req) { + _base_clone_to_sys_mem(buff_ptr, + sg_virt(sg_scmd), + (sgel->FlagsLength & 0x00ffffff)); + sgel->Address = + (dma_addr_t)buff_ptr_phys; + } else { + _base_clone_to_sys_mem(buff_ptr, + ioc->config_vaddr, + (sgel->FlagsLength & 0x00ffffff)); + sgel->Address = + (dma_addr_t)buff_ptr_phys; + } + } + buff_ptr += (sgel->FlagsLength & 0x00ffffff); + buff_ptr_phys += (sgel->FlagsLength & 0x00ffffff); + if ((sgel->FlagsLength & + (MPI2_SGE_FLAGS_END_OF_BUFFER + << MPI2_SGE_FLAGS_SHIFT))) + goto eob_clone_chain; + else { + /* + * Every single element in MPT will have + * associated sg_next. Better to sanity that + * sg_next is not NULL, but it will be a bug + * if it is null. + */ + if (is_scsiio_req) { + sg_scmd = sg_next(sg_scmd); + if (sg_scmd) + sgel++; + else + goto eob_clone_chain; + } + } + break; + } + } + +eob_clone_chain: + for (i = 0; i < sge_chain_count; i++) { + if (is_scsiio_req) + _base_clone_to_sys_mem(dst_chain_addr[i], + src_chain_addr[i], ioc->request_sz); + } +} + +/** * mpt3sas_remove_dead_ioc_func - kthread context to remove dead ioc * @arg: input argument, used to derive ioc * @@ -3295,7 +3505,7 @@ _base_put_smid_nvme_encap_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid) /** * _base_put_smid_default - Default, primarily used for config pages - * use Atomic Request Descriptor + * use Atomic Request Descriptor * @ioc: per adapter object * @smid: system request message index * diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 2529d25..4fd582b 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -95,6 +95,8 @@ #define MPT_MIN_PHYS_SEGMENTS 16 #define MPT_KDUMP_MIN_PHYS_SEGMENTS 32 +#define MCPU_MAX_CHAINS_PER_IO 3 + #ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE #define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE #else @@ -1238,6 +1240,7 @@ struct MPT3SAS_ADAPTER { u16 config_page_sz; void *config_page; dma_addr_t config_page_dma; + void *config_vaddr; /* scsiio request */ u16 hba_queue_depth; diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c b/drivers/scsi/mpt3sas/mpt3sas_config.c index 1c747cf..0dba3c4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_config.c +++ b/drivers/scsi/mpt3sas/mpt3sas_config.c @@ -219,6 +219,7 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc, mem->page = ioc->config_page; mem->page_dma = ioc->config_page_dma; } + ioc->config_vaddr = mem->page; return r; }
All scsi IO's and config requests data buffer and sgl are cloned to system memory in _clone_sg_entries before submitting it to Firmware. Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com> --- drivers/scsi/mpt3sas/mpt3sas_base.c | 212 +++++++++++++++++++++++++++++++++- drivers/scsi/mpt3sas/mpt3sas_base.h | 3 + drivers/scsi/mpt3sas/mpt3sas_config.c | 1 + 3 files changed, 215 insertions(+), 1 deletion(-)