Re: [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply.
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:148:35: sparse: cast removes address space of expression drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: sparse: cast from restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: expected unsigned int val drivers/scsi/mpt3sas/mpt3sas_base.c:151:16: got restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@ drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: expected void volatile drivers/scsi/mpt3sas/mpt3sas_base.c:151:36: got void drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: sparse: cast from restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: expected unsigned int val drivers/scsi/mpt3sas/mpt3sas_base.c:169:24: got restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@ drivers/scsi/mpt3sas/mpt3sas_base.c:169:64: expected void volatile drivers/scsi/mpt3sas/mpt3sas_base.c:169: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:186:24: sparse: cast from restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: expected unsigned int val drivers/scsi/mpt3sas/mpt3sas_base.c:186:24: got restricted __le32 drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got @@ drivers/scsi/mpt3sas/mpt3sas_base.c:186:64: expected void volatile drivers/scsi/mpt3sas/mpt3sas_base.c:186: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:206:24: sparse: cast removes address space of expression drivers/scsi/mpt3sas/mpt3sas_base.c:359:24: sparse: undefined identifier 'mpt3sas_scsih_scsi_lookup_get' drivers/scsi/mpt3sas/mpt3sas_base.c:1208:42: sparse: incorrect type in assignment (different base types) @@ expected unsigned short Event @@ got short Event @@ drivers/scsi/mpt3sas/mpt3sas_base.c:1209:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int EventContext @@ got ed int EventContext @@ >> drivers/scsi/mpt3sas/mpt3sas_base.c:1404:75: sparse: incorrect type in >> argument 2 (different base types) @@ expected restricted __le32 reply @@ got >> unsigned int [unsrestricted __le32 reply @@ drivers/scsi/mpt3sas/mpt3sas_base.c:1430:64: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ drivers/scsi/mpt3sas/mpt3sas_base.c:1479:52: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile @@ got oid volatile @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3011:32: sparse: cast removes address space of expression drivers/scsi/mpt3sas/mpt3sas_base.c:3359:26: sparse: cast removes address space of expression drivers/scsi/mpt3sas/mpt3sas_base.c:3303:26: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long data_out @@ got g long data_out @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3326:16: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/scsi/mpt3sas/mpt3sas_base.c:3443:34: sparse: cast
[PATCH 6/6] mpt3sas: Introduce function to clone mpi reply.
If the posted request has an error of any type, the IOC writes a Reply message into a host-based system reply message frame. This functions clone it in the BAR0 mapped region. Signed-off-by: Suganath Prabu S--- drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 0248058..fa13916 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -126,6 +126,32 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug, param_get_int, _fwfault_debug, 0644); /** + * _base_clone_reply_to_sys_mem - copies reply to reply free iomem + * in BAR0 space. + * + * @ioc: per adapter object + * @reply: reply message frame(lower 32bit addr) + * @index: System request message index. + * + * @Returns - Nothing + */ +static void +_base_clone_reply_to_sys_mem(struct MPT3SAS_ADAPTER *ioc, U32 reply, + u32 index) +{ + /* +* 256 is offset within sys register. +* 256 offset MPI frame starts. Max MPI frame supported is 32. +* 32 * 128 = 4K. From here, Clone of reply free for mcpu starts +*/ + u16 cmd_credit = ioc->facts.RequestCredit + 1; + void *reply_free_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET + + (cmd_credit * ioc->request_sz) + (index * sizeof(u32)); + + writel(cpu_to_le32(reply), reply_free_iomem); +} + +/** * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames * to system/BAR0 region. * @@ -1396,6 +1422,9 @@ _base_interrupt(int irq, void *bus_id) 0 : ioc->reply_free_host_index + 1; ioc->reply_free[ioc->reply_free_host_index] = cpu_to_le32(reply); + if (ioc->is_mcpu_endpoint) + _base_clone_reply_to_sys_mem(ioc, reply, + ioc->reply_free_host_index); writel(ioc->reply_free_host_index, >chip->ReplyFreeHostIndex); } @@ -6244,8 +6273,11 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) /* initialize Reply Free Queue */ for (i = 0, reply_address = (u32)ioc->reply_dma ; i < ioc->reply_free_queue_depth ; i++, reply_address += - ioc->reply_sz) + ioc->reply_sz) { ioc->reply_free[i] = cpu_to_le32(reply_address); + if (ioc->is_mcpu_endpoint) + _base_clone_reply_to_sys_mem(ioc, reply_address, i); + } /* initialize reply queues */ if (ioc->is_driver_loading) -- 2.5.5