aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-01-23Merge patch series "Enable DMA clustering in the UFS driver"Martin K. Petersen3-6/+13
Bart Van Assche <[email protected]> says: The third patch in this series enables DMA clustering in the UFS driver since UFS host controllers support DMA clustering. The first two patches fix bugs in the Exynos host controller driver. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-23scsi: ufs: core: Enable DMA clusteringBart Van Assche1-1/+0
All UFS host controllers support DMA clustering. Hence enable DMA clustering. Notes: - The max_segment_size parameter implements the 256 KiB limit for the PRDT. The dma_boundary parameter represents a boundary that must not be crossed by DMA scatter/gather lists. I'm not aware of any restrictions on DMA scatter/gather lists in the UFSHCI specification other than the 256 KiB limit for the PRDT and the 32-bit address restriction for controllers that only support 32-bits DMA. The latter restriction is already handled by ufshcd_set_dma_mask(). - Without patch "scsi: ufs: exynos: Fix the maximum segment size", this patch breaks support for the Exynos controller. The history of the dma_boundary parameter in the UFS driver is as follows: * The initial UFS driver did not set the dma_boundary parameter. * Commit 4dd4130a722f ("scsi: make sure all drivers set the use_clustering flag") set the .use_clustering flag. * Commit 4af14d113bcf ("scsi: remove the use_clustering flag") removed the use_clustering flag and set the dma_boundary parameter instead. Cc: Avri Altman <[email protected]> Cc: Alim Akhtar <[email protected]> Cc: Kiwoong Kim <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Acked-by: Adrian Hunter <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-23scsi: ufs: exynos: Fix the maximum segment sizeBart Van Assche1-0/+8
Prepare for enabling DMA clustering and also for supporting PAGE_SIZE != 4096 by declaring explicitly that the maximum segment size is 4096 bytes for Exynos UFS host controllers. Add this code in exynos_ufs_hce_enable_notify() such that it happens after scsi_host_alloc() and before __scsi_init_queue() is called by the LUN scanning code. Cc: Alim Akhtar <[email protected]> Cc: Kiwoong Kim <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Tested-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-23scsi: ufs: exynos: Fix DMA alignment for PAGE_SIZE != 4096Bart Van Assche3-5/+5
The Exynos UFS controller only supports scatter/gather list elements that are aligned on a 4 KiB boundary. Fix DMA alignment in case PAGE_SIZE != 4096. Rename UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE into UFSHCD_QUIRK_4KB_DMA_ALIGNMENT. Cc: Kiwoong Kim <[email protected]> Fixes: 2b2bfc8aa519 ("scsi: ufs: Introduce a quirk to allow only page-aligned sg entries") Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Tested-by: Alim Akhtar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-23scsi: qla2xxx: Simplify if condition evaluationDeepak R Varma1-2/+1
A logical evaluation of type (!A || A && B) can be simplified as (!A || B). Improvement by suggested by excluded_middle.cocci Coccinelel semantic patch. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Deepak R Varma <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-23scsi: qla2xxx: Use a variable for repeated mem_size computationDeepak R Varma1-7/+6
Use a variable to compute memory size to be allocated once instead of repeatedly computing it at different locations in the function. Issue identified using the array_size_dup Coccinelle semantic patch. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Deepak R Varma <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-23scsi: elx: libefc_sli: Use "/*" for non-kernel-doc commentRandy Dunlap1-1/+1
Don't use "/**" to begin non-kernel-doc comments. Prevent a kernel-doc warning: drivers/scsi/elx/libefc_sli/sli4.c:13: warning: cannot understand function prototype: 'struct sli4_asic_entry_t sli4_asic_table[] = ' Signed-off-by: Randy Dunlap <[email protected]> Cc: James Smart <[email protected]> Cc: Ram Vegesna <[email protected]> Cc: [email protected] Cc: "James E.J. Bottomley" <[email protected]> Cc: "Martin K. Petersen" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: ufs: qcom: dt-bindings: Allow 'dma-coherent' propertyJohan Hovold1-0/+2
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 <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: qla2xxx: Make qla_trim_buf() and __qla_adjust_buf() staticTom Rix1-2/+2
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: ipr: Replace kmap() with kmap_local_page()Fabio M. De Francesco1-7/+2
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 <[email protected]> Signed-off-by: Fabio M. De Francesco <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: ips: Replace kmap_atomic() with kmap_local_page()Fabio M. De Francesco1-6/+5
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 <[email protected]> Signed-off-by: Fabio M. De Francesco <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: mpt3sas: Demote log level for trace buffer allocation to infoPaul Menzel1-1/+1
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: [email protected] Signed-off-by: Paul Menzel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: qla2xxx: Fix printk() format stringArnd Bergmann1-1/+1
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 <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Himanshu Madhani <[email protected] <mailto:[email protected]>> Reviewed-by: Nick Desaulniers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: MAINTAINERS: Add entry for Exynos UFS driverAlim Akhtar1-0/+6
Add maintainer entry for Exynos UFS driver. Signed-off-by: Alim Akhtar <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: ufs: ufs: Remove duplicate entryAlim Akhtar1-1/+0
PA_GRANULARITY is duplicated, delete one of the entries. Signed-off-by: Alim Akhtar <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: megaraid_sas: Add flexible array member for SGLsKees Cook2-2/+5
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 <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Cc: Kashyap Desai <[email protected]> Cc: Sumit Saxena <[email protected]> Cc: Shivasharan S <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: "Martin K. Petersen" <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]> Tested-by: Holger Kiehl <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18Merge patch series "scsi: Add struct for args to execution functions"Martin K. Petersen22-237/+307
Mike Christie <[email protected]> says: The following patches were made over Martin's scsi-staging/next branch. They add a struct that contains optinal arguments to the scsi_execute* functions. This will be needed for the patches that allow the SCSI passthrough users to control retries because I'm adding a new optional argument. I separated the 2 sets to make it easier to review and post. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: core: Remove scsi_execute_req()/scsi_execute() functionsMike Christie1-31/+0
scsi_execute() and scsi_execute_req() are no longer used so remove them. Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-18scsi: cxlflash: Convert to scsi_execute_cmd()Mike Christie2-32/+34
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 <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: target: target_core_pscsi: Convert to scsi_execute_cmd()Mike Christie1-7/+5
scsi_execute_req() is going to be removed. Convert pscsi to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: virtio_scsi: Convert to scsi_execute_cmd()Mike Christie1-2/+2
scsi_execute_req() is going to be removed. Convert virtio_scsi to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: sr: Convert to scsi_execute_cmd()Mike Christie2-11/+17
scsi_execute*() is going to be removed. Convert sr to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ses: Convert to scsi_execute_cmd()Mike Christie1-4/+10
scsi_execute_req() is going to be removed. Convert ses to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: zbc: Convert to scsi_execute_cmd()Mike Christie1-3/+5
scsi_execute_req() is going to be removed. Conver zbc to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: sd: Convert to scsi_execute_cmd()Mike Christie1-28/+55
scsi_execute*() is going to be removed. Convert sd_mod to use scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: spi: Convert to scsi_execute_cmd()Mike Christie1-16/+15
scsi_execute() is going to be removed. Convert to the SPI class to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: core: Convert to scsi_execute_cmd()Mike Christie4-26/+45
scsi_execute_req() is going to be removed. Convert SCSI midlayer to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: scsi_dh: Convert to scsi_execute_cmd()Mike Christie4-28/+45
scsi_execute() is going to be removed. Convert the scsi_dh users to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ch: Convert to scsi_execute_cmd()Mike Christie1-15/+15
scsi_execute_req() is going to be removed. Convert ch to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: hwmon: drivetemp: Convert to scsi_execute_cmd()Mike Christie1-6/+5
scsi_execute_req() is going to be removed. Convert drivetemp to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ata: libata-scsi: Convert to scsi_execute_cmd()Mike Christie1-9/+14
scsi_execute_req() is going to be removed. Convert libata to scsi_execute_cmd(). Signed-off-by: Mike Christie <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Acked-by: Damien Le Moal <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: core: Add struct for args to execution functionsMike Christie2-41/+62
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 <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13Merge patch series "Add support for UFS Event Specific Interrupt"Martin K. Petersen7-0/+141
Can Guo <[email protected]> says: This patch series is to enable Event Specific Interrupt (ESI) which can used in MCQ mode. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13Merge patch series "Add Multi Circular Queue Support"Martin K. Petersen9-60/+1177
Asutosh Das <[email protected]> says: This patch series is an implementation of UFS Multi-Circular Queue. Please consider this series for next merge window. This implementation has been verified on a Qualcomm & MediaTek platform. UFS Multi-Circular Queue (MCQ) has been added in UFSHCI v4.0 to improve storage performance. The implementation uses the shared tagging mechanism so that tags are shared among the hardware queues. The number of hardware queues is configurable. This series doesn't include the ESI implementation for completion handling. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: qcom: Add MCQ ESI config vendor specific opsCan Guo2-0/+102
Add MCQ ESI config vendor specific ops. Co-developed-by: Asutosh Das <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Signed-off-by: Can Guo <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Add Event Specific Interrupt enable and config functionsCan Guo3-0/+24
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 <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: Add Event Specific Interrupt configuration vendor specific opsCan Guo3-0/+15
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 <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Enable multi-circular queueAsutosh Das1-0/+6
Enable MCQ in the Host Controller. Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Add completion support in pollAsutosh Das4-0/+24
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: mcq: Add completion support of a CQEAsutosh Das7-0/+169
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: Prepare for completion in MCQAsutosh Das2-31/+51
Modify completion path APIs and add completion queue entry. Co-developed-by: Can Guo <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Find hardware queue to queue requestAsutosh Das3-0/+25
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: Prepare ufshcd_send_command() for MCQAsutosh Das4-11/+43
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Use shared tags for MCQ modeAsutosh Das2-12/+18
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Configure operation and runtime interfaceAsutosh Das6-0/+247
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Allocate memory for MCQ modeAsutosh Das5-5/+145
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Calculate queue depthAsutosh Das8-1/+73
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Configure resource regionsAsutosh Das4-0/+142
Define the MCQ resources and add support to ioremap the resource regions. Co-developed-by: Can Guo <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: mcq: Add support to allocate multiple queuesAsutosh Das5-1/+142
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-01-13scsi: ufs: core: Defer adding host to SCSI if MCQ is supportedAsutosh Das2-4/+21
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 <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>