commit 85e182b48a33a44f3e0cfe6e7ee9da15baa0afce Author: Johan Hovold Date: Mon Jan 16 17:42:36 2023 +0100 scsi: ufs: qcom: dt-bindings: Allow 'dma-coherent' property UFS controllers may be cache coherent and must be marked as such in the devicetree to avoid data corruption. This is specifically needed on recent Qualcomm platforms like SC8280XP. Reviewed-by: Rob Herring Reviewed-by: Bjorn Andersson Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20230116164236.18958-1-johan+linaro@kernel.org Signed-off-by: Martin K. Petersen commit 54c51253b3d5544943fc3ec072cd0194915bac30 Author: Tom Rix Date: Fri Jan 13 20:37:24 2023 -0500 scsi: qla2xxx: Make qla_trim_buf() and __qla_adjust_buf() static Smatch reports: drivers/scsi/qla2xxx/qla_mid.c:1189:6: warning: symbol 'qla_trim_buf' was not declared. Should it be static? drivers/scsi/qla2xxx/qla_mid.c:1221:6: warning: symbol '__qla_adjust_buf' was not declared. Should it be static? These functions are only used in qla_mid.c, so they should be static. Fixes: 1f8f9c34127e ("scsi: qla2xxx: edif: Reduce memory usage during low I/O") Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20230114013724.3943580-1-trix@redhat.com Signed-off-by: Martin K. Petersen commit a3e2e248fd77a00931320875910ef73e071ac7dd Author: Fabio M. De Francesco Date: Tue Jan 3 19:25:56 2023 +0100 scsi: ipr: Replace kmap() with kmap_local_page() The use of kmap() is deprecated in favor of kmap_local_page(). There are two main problems with kmap(): (1) It comes with an overhead as the mapping space is restricted and protected by a global lock for synchronization and (2) it also requires global TLB invalidation when the kmap’s pool wraps and it might block when the mapping space is fully utilized until a slot becomes available. With kmap_local_page() the mappings are per thread, CPU local, can take page faults, and can be called from any context (including interrupts). It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore, the tasks can be preempted and, when they are scheduled to run again, the kernel virtual addresses are restored and still valid. Therefore, replace kmap() with kmap_local_page() in ipr_copy_ucode_buffer() and, instead of open-coding local mappings + memcpy() + local un-mappings, use the better suited memcpy_to_page() helper. Suggested-by: Ira Weiny Signed-off-by: Fabio M. De Francesco Link: https://lore.kernel.org/r/20230103182556.29080-1-fmdefrancesco@gmail.com Signed-off-by: Martin K. Petersen commit 7edd053b3327a3d4e3378c9f932cf959d3249c7f Author: Fabio M. De Francesco Date: Tue Jan 3 18:31:31 2023 +0100 scsi: ips: Replace kmap_atomic() with kmap_local_page() kmap_atomic() is deprecated in favor of kmap_local_page(). Therefore, replace kmap_atomic() with kmap_local_page() in ips_is_passthru(). In the meantime remove an unnecessary comment, align code, and remove spaces. kmap_atomic() is implemented like a kmap_local_page() which also disables page-faults and preemption (the latter only for !PREEMPT_RT kernels). The code within the mapping/unmapping in ips_is_passthru() is already in atomic context because of a call to local_irq_save() and kmap_local_page() can be called in atomic context too (including interrupts). Therefore, a mere replacement of the old API with the new one is all it is required (i.e., there is no need to explicitly add any calls to pagefault_disable() and/or preempt_disable()). Suggested-by: Ira Weiny Signed-off-by: Fabio M. De Francesco Reviewed-by: Ira Weiny Link: https://lore.kernel.org/r/20230103173131.21259-1-fmdefrancesco@gmail.com Signed-off-by: Martin K. Petersen commit 1eeedfad9a14898dd1522a6c77d8b33ac2e4b780 Author: Paul Menzel Date: Tue Jan 3 16:04:37 2023 +0100 scsi: mpt3sas: Demote log level for trace buffer allocation to info Linux logs the error below: $ dmesg --level=err | grep mpt [ 7.647675] mpt3sas_cm0: Trace buffer memory 2048 KB allocated This state does not denote an error condition (and also no warning), so demote the level from error to info. Cc: it+linux-scsi@molgen.mpg.de Signed-off-by: Paul Menzel Link: https://lore.kernel.org/r/20230103150438.45922-1-pmenzel@molgen.mpg.de Signed-off-by: Martin K. Petersen commit d794a23113b1a198e3d05f144aeba5b6ac87fe99 Author: Arnd Bergmann Date: Tue Jan 17 18:00:15 2023 +0100 scsi: qla2xxx: Fix printk() format string Printing a size_t value that is the result of the sizeof() operator requires using the %z format string modifier to avoid a warning on 32-bit architectures: drivers/scsi/qla2xxx/qla_mid.c: In function 'qla_create_buf_pool': drivers/scsi/qla2xxx/qla_mid.c:1094:51: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=] 1094 | "Failed to allocate buf_map(%ld).\n", sz * sizeof(unsigned long)); | ~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | long int unsigned int | %d Fixes: 82d8dfd2a238 ("scsi: qla2xxx: edif: Fix performance dip due to lock contention") Signed-off-by: Arnd Bergmann Reviewed-by: Bart Van Assche Reviewed-by: Himanshu Madhani > Reviewed-by: Nick Desaulniers Link: https://lore.kernel.org/r/20230117170029.2387516-1-arnd@kernel.org Signed-off-by: Martin K. Petersen commit fd5df558c31e2212b5bdd7a71afcc48f3e2c62dd Author: Alim Akhtar Date: Sat Jan 14 13:32:47 2023 +0530 scsi: MAINTAINERS: Add entry for Exynos UFS driver Add maintainer entry for Exynos UFS driver. Signed-off-by: Alim Akhtar Reviewed-by: Bart Van Assche Link: https://lore.kernel.org/r/20230114080247.601312-1-alim.akhtar@samsung.com Signed-off-by: Martin K. Petersen commit 3730bea883cd8f74fd9b2b31d51665c74cf73362 Author: Alim Akhtar Date: Sat Jan 14 07:50:10 2023 +0530 scsi: ufs: ufs: Remove duplicate entry PA_GRANULARITY is duplicated, delete one of the entries. Signed-off-by: Alim Akhtar Reviewed-by: Bart Van Assche Link: https://lore.kernel.org/r/20230114022010.27088-1-alim.akhtar@samsung.com Signed-off-by: Martin K. Petersen commit a9a3629592ab7442a2e9d40281420b51c453ea9b Author: Kees Cook Date: Thu Jan 5 21:32:00 2023 -0800 scsi: megaraid_sas: Add flexible array member for SGLs struct MPI2_RAID_SCSI_IO_REQUEST ends with a single SGL, but expects to copy multiple. Add a flexible array member so the compiler can reason about the size of the memcpy(). This will avoid the run-time false positive warning: memcpy: detected field-spanning write (size 128) of single field "&r1_cmd->io_request->SGL" at drivers/scsi/megaraid/megaraid_sas_fusion.c:3326 (size 16) This change results in no binary output differences. Reported-by: Holger Kiehl Link: https://lore.kernel.org/all/88de8faa-56c4-693d-2d3-67152ee72057@diagnostix.dwd.de/ Cc: Kashyap Desai Cc: Sumit Saxena Cc: Shivasharan S Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: megaraidlinux.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org Link: https://lore.kernel.org/r/20230106053153.never.999-kees@kernel.org Signed-off-by: Kees Cook Tested-by: Holger Kiehl Signed-off-by: Martin K. Petersen commit 946a10511f6588c20bbd312be15d64cc3c3fc796 Author: Mike Christie Date: Thu Dec 29 13:01:54 2022 -0600 scsi: core: Remove scsi_execute_req()/scsi_execute() functions scsi_execute() and scsi_execute_req() are no longer used so remove them. Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 1035c9893f15e801456dddd547ea52ae8f6a1e1f Author: Mike Christie Date: Thu Dec 29 13:01:53 2022 -0600 scsi: cxlflash: Convert to scsi_execute_cmd() scsi_execute() is going to be removed. Convert cxlflash to use scsi_execute_cmd(). [mkp: roll in fix for issue reported by sfr] Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit e335795f27d0ab5260e4681f14be8f8c915ac1a7 Author: Mike Christie Date: Thu Dec 29 13:01:52 2022 -0600 scsi: target: target_core_pscsi: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert pscsi to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 5314ce761fbf3bef2b5aae5e5562e782a5026e7c Author: Mike Christie Date: Thu Dec 29 13:01:51 2022 -0600 scsi: virtio_scsi: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert virtio_scsi to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 49d33b6245d91a2ca20755cd4edf86dd0e49649e Author: Mike Christie Date: Thu Dec 29 13:01:50 2022 -0600 scsi: sr: Convert to scsi_execute_cmd() scsi_execute*() is going to be removed. Convert sr to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit ae4145a5f25e56b0248b38f913c5cc370cde723a Author: Mike Christie Date: Thu Dec 29 13:01:49 2022 -0600 scsi: ses: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert ses to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 6ff236e847aa7817a985122ccef7e0f422eb8564 Author: Mike Christie Date: Thu Dec 29 13:01:48 2022 -0600 scsi: zbc: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Conver zbc to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit af16cd63d9d3b790ecfce3c053595a98f181e025 Author: Mike Christie Date: Thu Dec 29 13:01:47 2022 -0600 scsi: sd: Convert to scsi_execute_cmd() scsi_execute*() is going to be removed. Convert sd_mod to use scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit c9ee828aad6919b7eee7ef2059489c7221edf68a Author: Mike Christie Date: Thu Dec 29 13:01:46 2022 -0600 scsi: spi: Convert to scsi_execute_cmd() scsi_execute() is going to be removed. Convert to the SPI class to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 7dfe0b5e7ca67c659475883712c1d0449f900f9c Author: Mike Christie Date: Thu Dec 29 13:01:45 2022 -0600 scsi: core: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert SCSI midlayer to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 31fc28c6b13eedb6da2c60414088c007432436d1 Author: Mike Christie Date: Thu Dec 29 13:01:44 2022 -0600 scsi: scsi_dh: Convert to scsi_execute_cmd() scsi_execute() is going to be removed. Convert the scsi_dh users to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit ed226f0889a3c79d059564ba3fc1dcf5825f655c Author: Mike Christie Date: Thu Dec 29 13:01:43 2022 -0600 scsi: ch: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert ch to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 08e95a2ba4bbbb968e7ee0cc946e7d2c51742e92 Author: Mike Christie Date: Thu Dec 29 13:01:42 2022 -0600 scsi: hwmon: drivetemp: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert drivetemp to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit 5fa7b072677513e934242eab85772c0bfc84859b Author: Mike Christie Date: Thu Dec 29 13:01:41 2022 -0600 scsi: ata: libata-scsi: Convert to scsi_execute_cmd() scsi_execute_req() is going to be removed. Convert libata to scsi_execute_cmd(). Signed-off-by: Mike Christie Reviewed-by: John Garry Reviewed-by: Bart Van Assche Acked-by: Damien Le Moal Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen commit d0949565811f0896c1c7e781ab2ad99d34273fdf Author: Mike Christie Date: Thu Dec 29 13:01:40 2022 -0600 scsi: core: Add struct for args to execution functions Move the SCSI execution functions to use a struct for passing in optional args. This commit adds the new struct, temporarily converts scsi_execute() and scsi_execute_req() ands a new helper, scsi_execute_cmd(), which takes the scsi_exec_args struct. There should be no change in behavior. We no longer allow users to pass in any request->rq_flags value, but they were only passing in RQF_PM which we do support by allowing users to pass in the BLK_MQ_REQ flags used by blk_mq_alloc_request(). Subsequent commits will convert scsi_execute() and scsi_execute_req() users to the new helpers then remove scsi_execute() and scsi_execute_req(). Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Signed-off-by: Martin K. Petersen commit 519b6274a7775f5fe00a086f189efb8f063467d1 Author: Can Guo Date: Wed Dec 14 19:06:22 2022 -0800 scsi: ufs: qcom: Add MCQ ESI config vendor specific ops Add MCQ ESI config vendor specific ops. Co-developed-by: Asutosh Das Signed-off-by: Asutosh Das Signed-off-by: Can Guo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit e02288e0265fe316a16d48ec6dd7b7fd54d66e3e Author: Can Guo Date: Wed Dec 14 19:06:21 2022 -0800 scsi: ufs: core: mcq: Add Event Specific Interrupt enable and config functions Add and export two functions to enable ESI and config ESI base addresses. The calls to these exported functions will be added by the next patch in this series. Signed-off-by: Can Guo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit edb0db05607ce05a5e0df00518b58a811e9f548e Author: Can Guo Date: Wed Dec 14 19:06:20 2022 -0800 scsi: ufs: core: Add Event Specific Interrupt configuration vendor specific ops As Event Specific Interrupt message format is not defined in UFSHCI JEDEC specs, and the ESI handling highly depends on how the format is designed, hence add a vendor specific ops such that SoC vendors can configure their own ESI handlers. If ESI vops is not provided or returning error, go with the legacy (central) interrupt way. Signed-off-by: Can Guo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit eacb139b77ff75b973cb99573b33a7adb1f4ca38 Author: Asutosh Das Date: Fri Jan 13 12:48:52 2023 -0800 scsi: ufs: core: mcq: Enable multi-circular queue Enable MCQ in the Host Controller. Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit ed975065c31c2a0372e13c19e8140b69814a98ba Author: Asutosh Das Date: Fri Jan 13 12:48:51 2023 -0800 scsi: ufs: core: mcq: Add completion support in poll Complete CQE requests in poll. Assumption is that several poll completion may happen in different CPUs for the same completion queue. Hence a spin lock protection is added. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit f87b2c41822aad09aadac31b8ba22c0c0e639eee Author: Asutosh Das Date: Fri Jan 13 12:48:50 2023 -0800 scsi: ufs: mcq: Add completion support of a CQE Add support for completing requests from Completion Queue. Some host controllers support vendor specific registers that provide a bitmap of all CQs which have at least one completed CQE. Add this support. The MCQ specification doesn't provide the Task Tag or its equivalent in the Completion Queue Entry. So use an indirect method to find the Task Tag from the Completion Queue Entry. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit c30d8d010b5efd1d526ae94c9fbbfc0f74cec9fe Author: Asutosh Das Date: Fri Jan 13 12:48:49 2023 -0800 scsi: ufs: core: Prepare for completion in MCQ Modify completion path APIs and add completion queue entry. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit 854f84e7feebc0c5a63e4c1f29ddf201fd2a57bc Author: Asutosh Das Date: Fri Jan 13 12:48:48 2023 -0800 scsi: ufs: core: mcq: Find hardware queue to queue request Add support to find the hardware queue on which the request would be queued. Since the very first queue is to serve device commands, an offset of 1 is added to the index of the hardware queue. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 22a2d563de1425ea294e9abfa104dbf20c83a28a Author: Asutosh Das Date: Fri Jan 13 12:48:47 2023 -0800 scsi: ufs: core: Prepare ufshcd_send_command() for MCQ Add support to send commands using multiple submission queues in MCQ mode. Modify the functions that use ufshcd_send_command(). Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit 0d33728fc0e77adeea95de6e53cf26a4f741e594 Author: Asutosh Das Date: Fri Jan 13 12:48:46 2023 -0800 scsi: ufs: core: mcq: Use shared tags for MCQ mode Enable shared tags for MCQ. For UFS, this should not have a huge performance impact. It however simplifies the MCQ implementation and reuses most of the existing code in the issue and completion path. Also add multiple queue mapping to map_queue(). Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit 2468da61ea095162067ed408824298ba9c3661c8 Author: Asutosh Das Date: Fri Jan 13 12:48:45 2023 -0800 scsi: ufs: core: mcq: Configure operation and runtime interface Runtime and operation registers are defined per Submission and Completion queue. The location of these registers is not defined in the spec; meaning the offsets and stride may vary for different HC vendors. Establish the stride, base address, and doorbell address offsets from vendor host driver and program it. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 4682abfae2eb3a1c138130cfd6d71411d81aaa00 Author: Asutosh Das Date: Fri Jan 13 12:48:44 2023 -0800 scsi: ufs: core: mcq: Allocate memory for MCQ mode To read the bqueuedepth, the device descriptor is fetched in Single Doorbell Mode. This allocated memory may not be enough for MCQ mode because the number of tags supported in MCQ mode may be larger than in SDB mode. Hence, release the memory allocated in SDB mode and allocate memory for MCQ mode operation. Define the UFS hardware queue and Completion Queue Entry. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 7224c806876e46cfaf46b1c90da8d5c2e1f2108f Author: Asutosh Das Date: Fri Jan 13 12:48:43 2023 -0800 scsi: ufs: core: mcq: Calculate queue depth The UFS device defines the supported queuedepth by bqueuedepth which has a max value of 256. The HC defines MAC (Max Active Commands) that defines the max number of commands that in flight to the UFS device. Calculate and configure the nutrs based on both these values. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit c263b4ef737e622e2a908c58ca4bb68a89376387 Author: Asutosh Das Date: Fri Jan 13 12:48:42 2023 -0800 scsi: ufs: core: mcq: Configure resource regions Define the MCQ resources and add support to ioremap the resource regions. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit 57b1c0ef89ac9d9e7475df7843aeb7672ebcd197 Author: Asutosh Das Date: Fri Jan 13 12:48:41 2023 -0800 scsi: ufs: core: mcq: Add support to allocate multiple queues Multi-circular queue (MCQ) has been added in UFSHC v4.0 standard in addition to the Single Doorbell mode. The MCQ mode supports multiple submission and completion queues. Add support to allocate and configure the queues. Add module parameters support to configure the queues. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 0cab4023ec7b49b18145f74ab8389678d6d58878 Author: Asutosh Das Date: Fri Jan 13 12:48:40 2023 -0800 scsi: ufs: core: Defer adding host to SCSI if MCQ is supported If MCQ support is present, enabling it after MCQ support has been configured would require reallocating tags and memory. It would also free up the already allocated memory in Single Doorbell Mode. So defer invoking scsi_add_host() until MCQ is configured. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 305a357d3595d39be7c001f72e135bc94cbd85da Author: Asutosh Das Date: Fri Jan 13 12:48:39 2023 -0800 scsi: ufs: core: Introduce multi-circular queue capability Add support to check for MCQ capability in the UFSHC. Add a module parameter to disable MCQ if needed. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit 6e1d850acff9477ae4c18a73c19ef52841ac2010 Author: Asutosh Das Date: Fri Jan 13 12:48:38 2023 -0800 scsi: ufs: core: Probe for EXT_IID support Task Tag is limited to 8 bits and this restricts the number of active I/Os to 255. In multi-circular queue mode, this may not be enough. The specification provides EXT_IID which can be used to increase the number of I/Os if the UFS device and UFSHC support it. This patch adds support to probe for EXT_IID support in UFS device and UFSHC. Co-developed-by: Can Guo Signed-off-by: Can Guo Signed-off-by: Asutosh Das Reviewed-by: Bart Van Assche Reviewed-by: Avri Altman Reviewed-by: Manivannan Sadhasivam Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit 64b6deadc938b37717aa1338715cb7ef5e7d444c Author: Kees Cook Date: Thu Jan 5 15:30:46 2023 -0800 scsi: uapi: Replace 0-length array with flexible array Zero-length arrays are deprecated[1]. Replace struct fc_bsg_host_vendor_reply's "vendor_rsp" 0-length array with a flexible array. Detected with GCC 13, using -fstrict-flex-arrays=3: drivers/scsi/qla2xxx/qla_isr.c: In function 'qla25xx_process_bidir_status_iocb.isra': drivers/scsi/qla2xxx/qla_isr.c:3117:54: warning: array subscript 0 is outside array bounds of '__u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=] 3117 | bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from drivers/scsi/qla2xxx/qla_def.h:34, from drivers/scsi/qla2xxx/qla_isr.c:6: include/uapi/scsi/scsi_bsg_fc.h:219:15: note: while referencing 'vendor_rsp' 219 | __u32 vendor_rsp[0]; | ^~~~~~~~~~ [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays Cc: Martin K. Petersen Cc: Dan Williams Cc: "Gustavo A. R. Silva" Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20230105233042.never.913-kees@kernel.org Signed-off-by: Martin K. Petersen commit 201e0a7c7f36ccb70b532e04ea2f48031f219e74 Author: Kees Cook Date: Wed Jan 4 17:11:50 2023 -0800 scsi: mvumi: Replace 1-element arrays with flexible array members One-element arrays (and multi-element arrays being treated as dynamically sized) are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. Replace one-element arrays with flexible-array member in struct mvumi_msg_frame, struct mvumi_rsp_frame, and struct mvumi_hs_header, adjusting the explicit sizing calculations at the same time. This results in no functional differences in binary output. An explicit add is now folded into the size calculation: │ mov 0x1070(%r14),%eax │ - add $0x4,%eax │ - movabs $0xfffffffdc,%rbx │ + movabs $0xfffffffe0,%rbx │ add %rax,%rbx [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: "Gustavo A. R. Silva" Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20230105011143.never.569-kees@kernel.org Signed-off-by: Martin K. Petersen commit 45b379f20bc0fecccad63c25bfe28d75d6bc5b0d Author: Kees Cook Date: Wed Jan 4 16:48:01 2023 -0800 scsi: 3w-sas: Replace 1-element arrays with flexible array members One-element arrays (and multi-element arrays being treated as dynamically sized) are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. Replace one-element arrays with flexible-array member in TW_Ioctl_Buf_Apache and TW_Param_Apache, adjusting the explicit sizing calculations at the same time. This results in no differences in binary output. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays Cc: Adam Radford Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: "Gustavo A. R. Silva" Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20230105004757.never.017-kees@kernel.org Signed-off-by: Martin K. Petersen commit 191b5a38771d9e92eae62ad76f70628952c757ef Author: Justin Tee Date: Mon Jan 9 15:33:17 2023 -0800 scsi: lpfc: Copyright updates for 14.2.0.10 patches Update copyrights to 2023 for files modified in the 14.2.0.10 patch set. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit 41cf6bbe3d998f580e6f23dd2d07823399b0a5dc Author: Justin Tee Date: Mon Jan 9 15:33:16 2023 -0800 scsi: lpfc: Update lpfc version to 14.2.0.10 Update lpfc version to 14.2.0.10 Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit 96fb8c34e5c12361d1966768bf9aadc935600c62 Author: Justin Tee Date: Mon Jan 9 15:33:15 2023 -0800 scsi: lpfc: Introduce new attention types for lpfc_sli4_async_fc_evt() handler Define new FC Link ACQE with new attention types 0x8 (Link Activation Failure) and 0x9 (Link Reset Protocol Event). Both attention types are meant to be informational-only type ACQEs with no action required. 0x8 is reported for diagnostic purposes, while 0x9 is posted during a normal link up transition when activating BB Credit Recovery feature. As such, modify lpfc_sli4_async_fc_evt() logic to log the attention types according to its severity and early return when informational-only attention types are encountered. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit f1d2337d3e58955ecbbf392ba09fabb3e72db945 Author: Justin Tee Date: Mon Jan 9 15:33:14 2023 -0800 scsi: lpfc: Reinitialize internal VMID data structures after FLOGI completion After enabling VMID, an issue LIP test was erasing fabric switch VMID information. Introduce a lpfc_reinit_vmid() routine, which reinitializes all VMID data structures upon FLOGI completion in fabric topology. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit 21681b81b9ae548c5dae7ae00d931197a27f480c Author: Justin Tee Date: Mon Jan 9 15:33:13 2023 -0800 scsi: lpfc: Fix use-after-free KFENCE violation during sysfs firmware write During the sysfs firmware write process, a use-after-free read warning is logged from the lpfc_wr_object() routine: BUG: KFENCE: use-after-free read in lpfc_wr_object+0x235/0x310 [lpfc] Use-after-free read at 0x0000000000cf164d (in kfence-#111): lpfc_wr_object+0x235/0x310 [lpfc] lpfc_write_firmware.cold+0x206/0x30d [lpfc] lpfc_sli4_request_firmware_update+0xa6/0x100 [lpfc] lpfc_request_firmware_upgrade_store+0x66/0xb0 [lpfc] kernfs_fop_write_iter+0x121/0x1b0 new_sync_write+0x11c/0x1b0 vfs_write+0x1ef/0x280 ksys_write+0x5f/0xe0 do_syscall_64+0x59/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The driver accessed wr_object pointer data, which was initialized into mailbox payload memory, after the mailbox object was released back to the mailbox pool. Fix by moving the mailbox free calls to the end of the routine ensuring that we don't reference internal mailbox memory after release. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit c051f1a424a15b73c493090a9f1c0273398b1637 Author: Justin Tee Date: Mon Jan 9 15:33:12 2023 -0800 scsi: lpfc: Exit PRLI completion handling early if ndlp not in PRLI_ISSUE state In a large SAN testing configuration, frequent target port toggle tests are occasionally resulting in missing lun path rediscoveries. An outstanding PRLI can be inflight when a target RSCN dissappearance occurs, causing the driver to retry PRLIs using invalid rpi contexts. Fix by verifying that an ndlp's state was not restarted from PRLI_ISSUE due to an intermediate RSCN. If not in a valid state, early exit PRLI completion handling. The last follow up RSCN indicating target reappearance retriggers PLOGI/PRLI with a valid rpi context and is expected to succeed in LUN path rediscovery. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit ecdf4ddf4eb7a9135abdb358e98a8e6c1e8effe6 Author: Justin Tee Date: Mon Jan 9 15:33:11 2023 -0800 scsi: lpfc: Remove duplicate ndlp kref decrement in lpfc_cleanup_rpis() With faulty cables in PT2PT topology, an unintentional ndlp double kref decrement can occur. If a FLOGI request is outstanding before the link goes down, the missing FLOGI_ACC causes an F_Port ndlp to remain in the UNUSED state. During link down, lpfc_cleanup_rpis() is called and decrements an ndlp kref. Additionally, when the driver later decides to abort the FLOGI, the FLOGI completion handler decrements the ndlp kref a second time. Remove duplicate clean up logic in lpfc_cleanup_rpis() because the updated FLOGI completion handler already handles the ndlp kref decrement. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit f81395570e6c08ec1ef11eda433856c1a6805077 Author: Justin Tee Date: Mon Jan 9 15:33:10 2023 -0800 scsi: lpfc: Remove redundant clean up code in disable_vport() The disable_vport() path calls the discovery state machine on all ndlps, puts them into NPR state, and then calls lpfc_cleanup_rpis() with the remove flag set. This unintentionally decrements an ndlp's kref twice and can result in premature release of an ndlp because lpfc_dev_loss_tmo_handler() triggers clean up of the ndlp again later. Remove redundant code in disable_vport() that sets all the ndlps to NPR, and change the call to lpfc_cleanup_rpis() to not remove the ndlps. lpfc_dev_loss_tmo_handler() will handle final removal of the ndlps. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit b5c894cf430e779826612cf2acb508d78bf210ce Author: Justin Tee Date: Mon Jan 9 15:33:09 2023 -0800 scsi: lpfc: Set max DMA segment size to HBA supported SGE length During I/O, the following warning message occasionally appears: DMA-API: lpfc 0000:04:00.0: mapping sg segment longer than device claims to support [len=131072] [max=65536] The HBA is capable of supporting 131,072 bytes, so notify DMA layer via the dma_set_max_seg_size() API during hba initialization. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit 7ab07683aa4ccf324dc369808ceb0b138d590f07 Author: Justin Tee Date: Mon Jan 9 15:33:08 2023 -0800 scsi: lpfc: Resolve miscellaneous variable set but not used compiler warnings The local variables called curr_data are incremented, but not actually used for anything so they are removed. The return value of lpfc_sli4_poll_eq is not used anywhere and is not called outside of lpfc_sli.c. Thus, its declaration is removed from lpfc_crtn.h Also, lpfc_sli4_poll_eq's path argument is not used in the routine so it is removed along with corresponding macros. Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit 1f7b5f94f8d0c97f9b6d10e5ba47e15459ff74ff Author: Justin Tee Date: Mon Jan 9 15:33:07 2023 -0800 scsi: lpfc: Replace outdated strncpy() with strscpy() The kernel test robot pointed out non-NULL terminated string possibilities when using strncpy() in lpfc_xcvr_data_show() routine. Although we manually set the NULL character after strncpy(), strncpy() usage is outdated. Replace all strncpy() usages with the preferred strscpy() API. Reported-by: kernel test robot Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit 6058304a66baae4470188337700392d6404079b3 Author: Justin Tee Date: Mon Jan 9 15:33:06 2023 -0800 scsi: lpfc: Fix space indentation in lpfc_xcvr_data_show() The kernel test robot detected inconsistent indentations for an if statement block in the lpfc_xcvr_data_show() routine. This patch reduces the extraneous tabs used for the if statement block in question. Reported-by: kernel test robot Signed-off-by: Justin Tee Signed-off-by: Martin K. Petersen commit f7d1ba350fb3bca7b158d6cb9963acc1cf00d729 Author: Nilesh Javali Date: Wed Dec 21 20:39:33 2022 -0800 scsi: qla2xxx: Update version to 10.02.08.200-k Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit 1d201c81d4cc6840735bbcc99e6031503e5cf3b8 Author: Shreyas Deodhar Date: Wed Dec 21 20:39:32 2022 -0800 scsi: qla2xxx: Select qpair depending on which CPU post_cmd() gets called In current I/O path, Tx and Rx may not be processed on same CPU. This may lead to thrashing and optimum performance may not be achieved. Pick qpair such that Tx and Rx are processed on same CPU. Signed-off-by: Shreyas Deodhar Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit 2f5fab1b6c3a8efc93ba52c28539c45a8d0142ad Author: Quinn Tran Date: Wed Dec 21 20:39:31 2022 -0800 scsi: qla2xxx: edif: Fix clang warning clang warning: drivers/scsi/qla2xxx/qla_edif_bsg.h:93:12: warning: field remote_pid within 'struct app_pinfo_req' is less aligned than 'port_id_t' and is usually due to 'struct app_pinfo_req' being packed, which can lead to unaligned accesses [-Wunaligned-access] port_id_t remote_pid; ^ 2 warnings generated. Remove u32 field in remote_pid to silence warning. Reported-by: kernel test robot Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit 1f8f9c34127e9fae20c29a2b57f56fd47dbb43e4 Author: Quinn Tran Date: Wed Dec 21 20:39:30 2022 -0800 scsi: qla2xxx: edif: Reduce memory usage during low I/O For edif, each I/O requires a secondary buffer to carry the FCP cmnd. During high traffic time, these buffers are cached in the qpair. As traffic dies down, these buffers will be trimmed as needed. If traffic is reduced to none over 2 consecutive intervals, then these buffers will be further trimmed. Free FCP cmnd buffers to reduce memory usage during slow I/O time. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit 129a7c40294fd4ab9e9bccf76e8002818f492d8a Author: Quinn Tran Date: Wed Dec 21 20:39:29 2022 -0800 scsi: qla2xxx: edif: Fix stall session after app start For N2N, qla2x00_wait_for_sess_deletion call flushes a session which accidentally clear the scan_flag and thus prevents re-login to occur and causes session to stall. Use session delete to avoid the accidental clearing of scan_flag. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit 82d8dfd2a238261e06759ee792417dc99b93d60d Author: Quinn Tran Date: Wed Dec 21 20:39:28 2022 -0800 scsi: qla2xxx: edif: Fix performance dip due to lock contention User experienced performance dip on measuring IOPS while EDIF enabled. During I/O time, driver uses dma_pool_zalloc() call to allocate a chunk of memory. This call contains a lock behind the scene which contribute to lock contention. Save the allocated memory for reuse and avoid the lock. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 430eef03a763e5e76a371ba6d02779ae4a64b6ea Author: Quinn Tran Date: Wed Dec 21 20:39:27 2022 -0800 scsi: qla2xxx: Relocate/rename vp map There is no functional change in this patch. VP map resource is renamed and relocated so it is not viewed as just a target mode resource. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 87f6dafd50fb6d7214c32596a11b983138b09123 Author: Quinn Tran Date: Wed Dec 21 20:39:26 2022 -0800 scsi: qla2xxx: Remove dead code (GNN ID) Remove stale/unused code (GNN ID). Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit b9d87b60aaeb08ded3a8cfd4538085e6e2bc814f Author: Quinn Tran Date: Wed Dec 21 20:39:25 2022 -0800 scsi: qla2xxx: Remove dead code (GPNID) Remove stale unused code for GPNID. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit efd1bd12a04d7fffcb31662298e5e3e814bff49c Author: Quinn Tran Date: Wed Dec 21 20:39:24 2022 -0800 scsi: qla2xxx: Remove dead code Removing drport field and FCPORT_UPDATE_NEEDED signals. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 8fe66badf036d7505f9f4a03420d39b3ad819965 Author: Dan Carpenter Date: Thu Jan 5 13:53:35 2023 +0300 scsi: libsas: Fix an error code in sas_ata_add_dev() This code accidentally returns success instead of -ENOMEM. Fixes: 7cc7646b4b24 ("scsi: libsas: Factor out sas_ata_add_dev()") Link: https://lore.kernel.org/r/Y7asLxzVwQ56G+ya@kili Signed-off-by: Dan Carpenter Reviewed-by: Jason Yan Signed-off-by: Martin K. Petersen commit e2cb6e8db69e96c1514c2992e2d4fd6c8c1b8820 Author: Bean Huo Date: Sun Jan 8 23:40:57 2023 +0100 scsi: ufs: core: bsg: Fix cast to restricted __be16 warning Fix the following sparse endianness warning: "sparse warnings: drivers/ufs/core/ufs_bsg.c:91:25: sparse: sparse: cast to restricted __be16." For consistency with endianness annotations of other UFS data structures, change __u16/32 to __be16/32 in UFS ARPMB data structures. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Reported-by: kernel test robot Signed-off-by: Bean Huo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit f3e57da528127febae7eb03d9c87408d572b0fd8 Author: Bean Huo Date: Sun Jan 8 23:40:56 2023 +0100 scsi: core: Fix invisible definition compilation warning In 'include/ufs/ufshcd.h' file, 'enum dma_data_direction' will be used, which is defined in linux/dma-direction.h, however, this header file is not included in ufshcd.h, thus causing the following compilation warning: "warning: ‘enum dma_data_direction’ declared inside parameter list will not be visible outside of this definition or declaration" Fix this warning by including 'linux/dma-direction.h'. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Reported-by: Xiaosen He Reported-by: Bart Van Assche Signed-off-by: Bean Huo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 5e87c51f186ef70b17201f97db11044e3e7ffa46 Author: Bean Huo Date: Sun Jan 8 23:40:55 2023 +0100 scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Compilation complains that two possible variables are used without initialization: drivers/ufs/core/ufs_bsg.c:112:6: warning: variable 'sg_cnt' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] drivers/ufs/core/ufs_bsg.c:112:6: warning: variable 'sg_list' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Fix both warnings by adding initialization with sg_cnt = 0, sg_list = NULL. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Signed-off-by: Bean Huo Reported-by: kernel test robot Reported-by: Xiaosen He Reviewed-by: Alim Akhtar Reviewed-by: Nick Desaulniers Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 679062c65b2c7824b5bf6cef9d286ef101466122 Author: Deepak R Varma Date: Fri Dec 9 01:41:43 2022 +0530 scsi: pm8001: Use sysfs_emit() in show function callbacks According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should use sysfs_emit() instead of the sprintf() family of functions. Issue identified using the coccinelle device_attr_show.cocci script. Link: https://lore.kernel.org/r/Y5JE/xI2NNbnox/A@qemulion Signed-off-by: Deepak R Varma Acked-by: Jack Wang Signed-off-by: Martin K. Petersen commit 39beef59128f6cf6a5d49e4c0dfd69dabe50b0c5 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:40:01 2022 +0530 scsi: MAINTAINERS: Add myself as the maintainer for Qcom UFS drivers Qcom UFS drivers are left unmaintained till now. I'd like to step up to maintain the drivers and the binding. Acked-by: Bjorn Andersson Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 2c407fe97015a063855fa518bd790f024f818277 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:40:00 2022 +0530 scsi: ufs: ufs-qcom: Add support for finding max gear on new platforms Starting from Qcom UFS version 4.0, vendor specific REG_UFS_PARAM0 register can be used to determine the maximum gear supported by the controller. Suggested-by: Can Guo Reviewed-by: Andrew Halaney Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit baf5ddac90dc1983bc376b7ca6fe1afde702ff29 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:59 2022 +0530 scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device Starting from Qualcomm UFS version 4, the UFS device needs to be reinitialized after switching to maximum gear by the UFS core. Hence, add support for it by enabling the UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH quirk, implementing reinit_notify() callback and using the agreed gear speed for setting the PHY mode. Suggested-by: Can Guo Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit c270986527f9fccb140826cbf3eff2cb1fccf463 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:58 2022 +0530 scsi: ufs: ufs-qcom: Factor out the logic finding the HS Gear In the preparation of adding support for new gears, move the logic that finds the gear for each platform to a new function. This helps with code readability and also allows the logic to be used in other places of the driver in future. While at it, make it clear that this driver only supports symmetric gear setting (hs_tx_gear == hs_rx_gear). Reviewed-by: Andrew Halaney Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 96a7141da33207672d7a354c885d65af4f0f9b6c Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:57 2022 +0530 scsi: ufs: core: Add support for reinitializing the UFS device Some platforms like Qcom, requires the UFS device to be reinitialized after switching to maximum gear speed. So add support for that in UFS core by introducing a new quirk (UFSHCD_CAP_REINIT_AFTER_MAX_GEAR_SWITCH) and doing the reinitialization, if the quirk is enabled by the controller driver. Suggested-by: Can Guo Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit c2c38c573a2e6184f9acd10e98305d3cb5f1c62b Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:56 2022 +0530 scsi: ufs: core: Add reinit_notify() callback reinit_notify() callback can be used by the UFS controller drivers to perform changes required for UFSHCD reinit that can happen during max gear switch. Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 7959587f3284bf163e4f1baff3c6fa71fc6a55b1 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:55 2022 +0530 scsi: ufs: ufs-qcom: Fix the Qcom register name for offset 0xD0 On newer UFS revisions, the register at offset 0xD0 is called, REG_UFS_PARAM0. Since the existing register, RETRY_TIMER_REG is not used anywhere, it is safe to use the new name. Reviewed-by: Andrew Halaney Reviewed-by: Asutosh Das Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 132b027205ef94a1d933d0f08a4109b1e321bda2 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:54 2022 +0530 scsi: ufs: ufs-qcom: Use dev_err_probe() for printing probe error Make use of dev_err_probe() for printing the probe error. Reviewed-by: Andrew Halaney Reviewed-by: Asutosh Das Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 18fe2ab79bcf00c17d00460ca3f8c179d0aa87a4 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:53 2022 +0530 scsi: ufs: ufs-qcom: Use bitfields where appropriate Use bitfield macros where appropriate to simplify the driver. Reviewed-by: Dmitry Baryshkov Reviewed-by: Asutosh Das Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit a98c2183e81d746d8d4d4443359a7c2876a14e3f Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:52 2022 +0530 scsi: ufs: ufs-qcom: Remove unnecessary WARN_ON() In the reset assert and deassert callbacks, the supplied "id" is not used at all and only the HBA reset is performed all the time. So there is no reason to use a WARN_ON() on the "id". Reviewed-by: Andrew Halaney Reviewed-by: Asutosh Das Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 031312dbc6950a6a661f2f9ecfbc21fbc2e0e3e3 Author: Manivannan Sadhasivam Date: Thu Dec 22 19:39:51 2022 +0530 scsi: ufs: ufs-qcom: Remove unnecessary goto statements A goto statement in an error path is useful if the function needs to do cleanup other than returning the error code. But in this driver, goto statements are used for just returning the error code in many places. This really makes it hard to read the code. Get rid of those goto statements and just return the error code directly. Reviewed-by: Dmitry Baryshkov Reviewed-by: Asutosh Das Tested-by: Andrew Halaney # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit f590c2554c7764a91e83f29347a1e27c4d9f1335 Author: Nilesh Javali Date: Mon Dec 19 03:07:48 2022 -0800 scsi: qla2xxx: Update version to 10.02.08.100-k Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 1e27648c848235046cfd83e656c1c0d360861f25 Author: Nilesh Javali Date: Mon Dec 19 03:07:47 2022 -0800 scsi: qla2xxx: Fix IOCB resource check warning Make qla_get_iocbs_resource() static to fix the warning: >> drivers/scsi/qla2xxx/qla_iocb.c:3820:5: warning: no previous prototype for >> 'qla_get_iocbs_resource' [-Wmissing-prototypes] 3820 | int qla_get_iocbs_resource(struct srb *sp) | ^~~~~~~~~~~~~~~~~~~~~~ Reported-by: kernel test robot Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit d676a9e3d9efb7e93df460bcf4c445496c16314f Author: Saurav Kashyap Date: Mon Dec 19 03:07:46 2022 -0800 scsi: qla2xxx: Remove increment of interface err cnt Residual underrun is not an interface error, hence no need to increment that count. Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port") Cc: stable@vger.kernel.org Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 3fbc74feb642deb688cc97f76d40b7287ddd4cb1 Author: Quinn Tran Date: Mon Dec 19 03:07:45 2022 -0800 scsi: qla2xxx: Fix erroneous link down If after an adapter reset the appearance of link is not recovered, the devices are not rediscovered. This is result of a race condition between adapter reset (abort_isp) and the topology scan. During adapter reset, the ABORT_ISP_ACTIVE flag is set. Topology scan usually occurred after adapter reset. In this case, the topology scan came earlier than usual where it ran into problem due to ABORT_ISP_ACTIVE flag was still set. kernel: qla2xxx [0000:13:00.0]-1005:1: Cmd 0x6a aborted with timeout since ISP Abort is pending kernel: qla2xxx [0000:13:00.0]-28a0:1: MBX_GET_PORT_NAME failed, No FL Port. kernel: qla2xxx [0000:13:00.0]-286b:1: qla2x00_configure_loop: exiting normally. local port wwpn 51402ec0123d9a80 id 012300) kernel: qla2xxx [0000:13:00.0]-8017:1: ADAPTER RESET SUCCEEDED nexus=1:0:15. Allow adapter reset to complete before any scan can start. Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 7e8a936a2d0f98dd6e5d05d4838affabe606cabc Author: Quinn Tran Date: Mon Dec 19 03:07:44 2022 -0800 scsi: qla2xxx: Remove unintended flag clearing FCF_ASYNC_SENT flag is used in session management. This flag is cleared in task management path by accident. Remove unintended flag clearing. Fixes: 388a49959ee4 ("scsi: qla2xxx: Fix panic from use after free in qla2x00_async_tm_cmd") Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 40f5b1b9a4af2917f97bd98f277baebad8cde323 Author: Quinn Tran Date: Mon Dec 19 03:07:43 2022 -0800 scsi: qla2xxx: Fix stalled login If a login failed due to low FW resources, the session can stall and will not be connected. Reset session state to allow relogin logic to redrive the connection. Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 5f63a163ed2f12c34dd4ae9b2757962ec7bb86e5 Author: Quinn Tran Date: Mon Dec 19 03:07:42 2022 -0800 scsi: qla2xxx: Fix exchange oversubscription for management commands Add resource checking for management (non-I/O) commands. Fixes: 89c72f4245a8 ("scsi: qla2xxx: Add IOCB resource tracking") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen commit 41e5afe51f75f2858f5563145348f6c26d307b8f Author: Quinn Tran Date: Mon Dec 19 03:07:41 2022 -0800 scsi: qla2xxx: Fix exchange oversubscription In large environment, it is possible to experience command timeout and escalation of path recovery. Currently the driver does not track the number of exchanges/commands sent to FW. If there is a delay for commands at the head of the queue, then this will create back pressure for commands at the back of the queue. Check for exchange availability before command submission. Fixes: 89c72f4245a8 ("scsi: qla2xxx: Add IOCB resource tracking") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit c75e6aef5039830cce5d4cf764dd204522f89e6b Author: Arun Easi Date: Mon Dec 19 03:07:40 2022 -0800 scsi: qla2xxx: Fix DMA-API call trace on NVMe LS requests The following message and call trace was seen with debug kernels: DMA-API: qla2xxx 0000:41:00.0: device driver failed to check map error [device address=0x00000002a3ff38d8] [size=1024 bytes] [mapped as single] WARNING: CPU: 0 PID: 2930 at kernel/dma/debug.c:1017 check_unmap+0xf42/0x1990 Call Trace: debug_dma_unmap_page+0xc9/0x100 qla_nvme_ls_unmap+0x141/0x210 [qla2xxx] Remove DMA mapping from the driver altogether, as it is already done by FC layer. This prevents the warning. Fixes: c85ab7d9e27a ("scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit b1ae65c082f74536ec292b15766f2846f0238373 Author: Quinn Tran Date: Mon Dec 19 03:07:39 2022 -0800 scsi: qla2xxx: Fix link failure in NPIV environment User experienced symptoms of adapter failure in NPIV environment. NPIV hosts were allowed to trigger chip reset back to back due to NPIV link state being slow to come online. Fix link failure in NPIV environment by removing NPIV host from directly being able to perform chip reset. kernel: qla2xxx [0000:04:00.1]-6009:261: Loop down - aborting ISP. kernel: qla2xxx [0000:04:00.1]-6009:262: Loop down - aborting ISP. kernel: qla2xxx [0000:04:00.1]-6009:281: Loop down - aborting ISP. kernel: qla2xxx [0000:04:00.1]-6009:285: Loop down - aborting ISP Fixes: 0d6e61bc6a4f ("[SCSI] qla2xxx: Correct various NPIV issues.") Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit 0c227dc22ca18856055983f27594feb2e0149965 Author: Shreyas Deodhar Date: Mon Dec 19 03:07:38 2022 -0800 scsi: qla2xxx: Check if port is online before sending ELS CT Ping and ELS cmds fail for NVMe targets. Check if port is online before sending ELS instead of sending login. Cc: stable@vger.kernel.org Signed-off-by: Shreyas Deodhar Signed-off-by: Nilesh Javali Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen commit df7320bac37e837f43883a51ce879c07c4429180 Author: Zhe Wang Date: Fri Dec 9 20:41:21 2022 +0800 scsi: ufs: ufs-unisoc: Add support for Unisoc UFS host controller Add driver code for Unisoc UFS host controller, along with UFS initialization. Signed-off-by: Zhe Wang Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit aa67971b2736e1eb0e09bb71212f4ccd536b0a63 Author: Zhe Wang Date: Fri Dec 9 20:41:20 2022 +0800 scsi: ufs: dt-bindings: Add document for Unisoc UFS host controller Add Unisoc ums9620 UFS host controller devicetree document. Signed-off-by: Zhe Wang Reviewed-by: Krzysztof Kozlowski Signed-off-by: Martin K. Petersen commit 16ed9d312b42180242476d159dd2fab05129029a Author: Arthur Simchaev Date: Sun Dec 11 15:05:11 2022 +0200 scsi: ufs: core: Remove ufshcd_map_desc_id_to_length() There shouldn't be any restriction of the descriptor size (not the descriptor id for that matter) up to QUERY_DESC_MAX_SIZE. According to the spec, the caller can use any descriptor size, and it is up to the device to return the actual size. Therefore there shouldn't be any sizes hardcoded in the kernel, nor any need to cache it, hence the ufshcd_map_desc_id_to_length() function is redundant. Always read the descriptors with QUERY_DESC_MAX_SIZE size. Reviewed-by: Bart Van Assche Reviewed-by: Bean Huo Suggested-by: Bean Huo Signed-off-by: Arthur Simchaev Signed-off-by: Martin K. Petersen commit 01a0d515b7d93f6f5259c0333e48ac0ed8f0aa92 Author: Arthur Simchaev Date: Sun Dec 11 15:05:10 2022 +0200 scsi: ufs: core: Remove len parameter from ufshcd_set_active_icc_lvl() len argument is not used anymore in ufshcd_set_active_icc_lvl() function. Signed-off-by: Arthur Simchaev Reviewed-by: Bart Van Assche Reviewed-by: Bean Huo Signed-off-by: Martin K. Petersen commit f2a89b071b26b79abbe892ce88c4d674d1f21f63 Author: Arthur Simchaev Date: Sun Dec 11 15:05:09 2022 +0200 scsi: ufs: core: Remove redundant desc_size variable from hba Always read the descriptor with QUERY_DESC_MAX_SIZE. According to the spec, the device returns the actual size. Signed-off-by: Arthur Simchaev Reviewed-by: Bean Huo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 358ae02f47783c1d2a8033e50563ea1a9d176c15 Author: Arthur Simchaev Date: Sun Dec 11 15:05:08 2022 +0200 scsi: ufs: core: Remove redundant wb check We used to use the extended-feature field in the device descriptor as an indication that the device supported UFS 2.2 or later. Remove that as this check is specifically done few lines above. Signed-off-by: Arthur Simchaev Reviewed-by: Bart Van Assche Reviewed-by: Bean Huo Reviewed-by: Stanley Chu Signed-off-by: Martin K. Petersen commit ada1e653a5eae7361d95781ed812caa0c8e07dbb Author: Eric Biggers Date: Thu Dec 8 15:43:58 2022 -0800 scsi: ufs: core: Allow UFS host drivers to override the sg entry size Modify the UFSHCD core to allow 'struct ufshcd_sg_entry' to be variable-length. The default is the standard length, but variants can override ufs_hba::sg_entry_size with a larger value if there are vendor-specific fields following the standard ones. This is needed to support inline encryption with ufs-exynos (FMP). Cc: Eric Biggers Reviewed-by: Avri Altman Signed-off-by: Eric Biggers [ bvanassche: edited commit message and introduced CONFIG_SCSI_UFS_VARIABLE_SG_ENTRY_SIZE ] Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit b434ecfb73ee84fbc5996d0784a4436e75b8d0fe Author: Bart Van Assche Date: Thu Dec 8 15:43:57 2022 -0800 scsi: ufs: core: Pass the clock scaling timeout as an argument Prepare for adding an additional ufshcd_clock_scaling_prepare() call with a different timeout. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 2000bc309703b34ab776c7c00dfb5865721eb257 Author: Bart Van Assche Date: Thu Dec 8 15:43:56 2022 -0800 scsi: ufs: core: Reduce the clock scaling latency Wait at most 20 ms before rechecking the doorbells instead of waiting for a potentially long time between doorbell checks. Reviewed-by: Avri Altman Reviewed-by: Stanley Chu Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 1026f7d366785d0a1edae731a3d06e9924c3e71d Author: Andrew Halaney Date: Thu Dec 1 17:08:10 2022 -0600 scsi: ufs: ufs-qcom: Use dev_err() where possible dev_err() statements are better to use than pr_err(), so switch to those. In a similar vein, the check on the dev_req_params pointer here is not needed, the two places this function is called never pass in a NULL pointer, so instead of using dev_err() there just remove it. Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam Reviewed-by: Asutosh Das Signed-off-by: Martin K. Petersen commit e4ce23fba366e5b0629b13d9c42e68fab7fda002 Author: Andrew Halaney Date: Thu Dec 1 17:08:09 2022 -0600 scsi: ufs: ufs-qcom: Remove usage of dbg_print_en This bitmask is unconditionally set in the current driver, so all conditionals using it can be considered bit rot. Let's take the current default conditional path everywhere and remove dbg_print_en from the driver. Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam Reviewed-by: Asutosh Das Signed-off-by: Martin K. Petersen commit 50a427a00c85995009a134d443949e5128a84191 Author: Andrew Halaney Date: Thu Dec 1 17:08:08 2022 -0600 scsi: ufs: ufs-qcom: Clean up dbg_register_dump The current implementation has abstractions that don't give any benefits. The print_fn callback (and its only callback implementation, ufs_qcom_dump_regs_wrapper()) was only used by ufs_qcom_print_hw_debug_reg_all() and just multiplies len by 4 before calling ufshcd_dump_regs(). ufs_qcom_print_hw_debug_reg_all() is only called by ufs_qcom_dump_dbg_regs(). There's no real gain in those abstractions, so let's just do the work directly in ufs_qcom_dump_dbg_regs() (the dbg_register_dump callback). Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam Reviewed-by: Asutosh Das Signed-off-by: Martin K. Petersen commit 921a880827498e501921bf034012a97e554550d2 Author: Andrew Halaney Date: Thu Dec 1 17:08:07 2022 -0600 scsi: ufs: ufs-qcom: Drop unnecessary NULL checks This code path is only called through one function, and the HBA struct is already accessed in ufshcd_vops_dbg_register_dump() prior to calling so there is no way for it to be NULL. Likewise, the print_fn callback is always supplied within this driver and is always provided. Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam Reviewed-by: Asutosh Das Signed-off-by: Martin K. Petersen commit 6ff265fc5ef660499e0edc4641647e99eed3f519 Author: Bean Huo Date: Thu Dec 1 15:04:37 2022 +0100 scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg Add advanced RPMB support in ufs_bsg: 1. According to the UFS specification, only one RPMB operation can be performed at any time. We can ensure this by using reserved slot and its dev_cmd sync operation protection mechanism. 2. For Advanced RPMB, RPMB metadata is packaged in an EHS (Extra Header Segment) of a command UPIU, and the corresponding reply EHS (from the device) should also be returned to the user space. bsg_job->request and bsg_job->reply allow us to pass and return EHS from/back to userspace. Compared to normal/legacy RPMB, the advantages of advanced RPMB are: 1. The data length in the Advanced RPMB data read/write command can be larger than 4KB. For the legacy RPMB, the data length in a single RPMB data transfer is 256 bytes. 2. All of the advanced RPMB operations will be a single command. For legacy RPMB, take the read write-counter value as an example, you need two commands (first SECURITY PROTOCOL OUT, then second SECURITY PROTOCOL IN). Signed-off-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Martin K. Petersen commit a4b1c9b9b38c92da099aba234c96e818f8d2e4dd Author: Bean Huo Date: Thu Dec 1 15:04:36 2022 +0100 scsi: ufs: core: Pass EHS length into ufshcd_prepare_req_desc_hdr() We need to fill in the total EHS length in UTP Transfer Request Descriptor. Add this functionality to ufshcd_prepare_req_desc_hdr(). Signed-off-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Martin K. Petersen commit f6b9d0fe5c0573ddd0cbf3071a2003897325c86c Author: Bean Huo Date: Thu Dec 1 15:04:35 2022 +0100 scsi: ufs: core: Advanced RPMB detection Check UFS Advanced RPMB LU enablement during ufshcd_lu_init(). Signed-off-by: Bean Huo Signed-off-by: Martin K. Petersen commit 7a4df79d0bfd6d7b4af0badf6254af5e4157094b Author: Bean Huo Date: Thu Dec 1 15:04:34 2022 +0100 scsi: ufs: core: Split ufshcd_map_sg() Take out the "map scatter-gather list to prdt" part of the code in ufshcd_map_sg() and split it into a new function ufshcd_sgl_to_prdt(). Signed-off-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Martin K. Petersen commit 765ab00dac2c37070d8a4209e017ae81e1d8e9bb Author: Bean Huo Date: Thu Dec 1 15:04:33 2022 +0100 scsi: ufs: bsg: Clean up ufs_bsg_request() Move sg_copy_from_buffer() below its associated case statement. Signed-off-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Martin K. Petersen commit 64d4864714c2cd2af35b48ab5b28a28ee863219a Author: Bean Huo Date: Thu Dec 1 15:04:32 2022 +0100 scsi: ufs: bsg: Remove unnecessary length checkup Remove checks on job->request_len and job->reply_len because msgcode checks in a subseqent commit will rule out malicious requests. Signed-off-by: Bean Huo Acked-by: Avri Altman Signed-off-by: Martin K. Petersen commit 3f5145a6152388ca612461ca96db4f995fa816d2 Author: Bean Huo Date: Thu Dec 1 15:04:31 2022 +0100 scsi: ufs: bsg: Let result in struct ufs_bsg_reply be signed int According to the comments in struct ufs_bsg_reply and its usage, the result should be signed int, not __u32. Signed-off-by: Bean Huo Signed-off-by: Martin K. Petersen commit 5d39b77c33b19089351f74a524fbb828c7d8ba81 Author: Jason Yan Date: Wed Dec 14 21:38:08 2022 +0800 scsi: libsas: Factor out sas_ex_add_dev() Factor out sas_ex_add_dev() to be consistent with sas_ata_add_dev() and unify the error handling. Cc: John Garry Signed-off-by: Jason Yan Reviewed-by: John Garry Signed-off-by: Martin K. Petersen commit 7cc7646b4b24430437e0cff104fadeafd470a7ce Author: Jason Yan Date: Wed Dec 14 21:38:07 2022 +0800 scsi: libsas: Factor out sas_ata_add_dev() Factor out sas_ata_add_dev() and put it in sas_ata.c since it is a SATA related interface. Also follow the standard coding style to define an inline empty function when CONFIG_SCSI_SAS_ATA is not enabled. Cc: John Garry Signed-off-by: Jason Yan Reviewed-by: John Garry Signed-off-by: Martin K. Petersen commit 8d2c9d25b725a699479d388da7e116d1d2bc0ea1 Author: Jason Yan Date: Wed Dec 14 21:38:06 2022 +0800 scsi: libsas: Remove useless dev_list delete in sas_ex_discover_end_dev() The domain device 'child' is allocated in sas_ex_discover_end_dev() and used to be added to the dev_list in this function. After the following two fixes the device is added to the disco_list instead. As a result, the list_del() and locking left behind is now redundant. Fixes: 87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery competing with ata error handling") Fixes: 92625f9bff38 ("[SCSI] libsas: restore scan order") Cc: John Garry Signed-off-by: Jason Yan Reviewed-by: John Garry Signed-off-by: Martin K. Petersen commit ffebb38efee3e6bbcccd0b7babf0ede8890794cd Author: Jason Yan Date: Wed Dec 14 21:38:05 2022 +0800 scsi: libsas: Change the coding style of sas_discover_sata() The coding style where calling this interface is inconsistent with other interfaces for SATA devices. The standard style for other SATA interfaces is like: #ifdefine CONFIG_SCSI_SAS_ATA void sas_ata_task_abort(struct sas_task *task); #else static inline void sas_ata_task_abort(struct sas_task *task) { } #endif And the callers does not have to do things like "#ifdefine CONFIG_SCSI_SAS_ATA" and may call the interface directly. So follow the standard style here. Cc: John Garry Signed-off-by: Jason Yan Reviewed-by: Jack Wang Reviewed-by: John Garry Signed-off-by: Martin K. Petersen commit 6c90466e2803d93ed47a980fbf184d35e012d895 Author: Jason Yan Date: Wed Dec 14 21:38:04 2022 +0800 scsi: libsas: Move sas_get_ata_command_set() up to save the declaration There is a sas_get_ata_command_set() declaration above sas_get_ata_info() to make it compile. However, this function is defined in the same file. Move it up to save the forward declaration. Also remove the variable 'fis' which is not needed in this function. Cc: John Garry Signed-off-by: Jason Yan Reviewed-by: John Garry Reviewed-by: Jack Wang Signed-off-by: Martin K. Petersen