summaryrefslogtreecommitdiffstats
path: root/drivers/ufs
Commit message (Collapse)AuthorAgeFilesLines
...
* | | scsi: ufs: ufs-qcom: Check host controller stateNitin Rawat2023-08-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 52a518019ca1 ("scsi: ufs: core: Fix missing clk change notification on host reset") added UFS clock scaling notification to ufshcd_host_reset_and_restore(). This invokes hibern8 enter and exit on Qualcomm platform which fails because controller is in reset state. Fix this by checking the Host controller state before sending hibern8 command. __ufshcd_wl_resume() ufshcd_reset_and_restore() ufshcd_host_reset_and_restore() ufshcd_scale_clks() ufshcd_vops_clk_scale_notify() ufs_qcom_clk_scale_notify() ufshcd_uic_hibern8_enter() Fixes: 52a518019ca1 ("scsi: ufs: core: Fix missing clk change notification on host reset") Co-developed-by: Manish Pandey <quic_mapa@quicinc.com> Signed-off-by: Manish Pandey <quic_mapa@quicinc.com> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com> Link: https://lore.kernel.org/r/20230726134140.7180-3-quic_nitirawa@quicinc.com Acked-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: core: Export ufshcd_is_hba_active()Nitin Rawat2023-08-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Export ufshcd_is_hba_active() to allow driver modules to check the state of the host controller. Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com> Link: https://lore.kernel.org/r/20230726134140.7180-2-quic_nitirawa@quicinc.com Acked-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | Merge patch series "Multiple cleanup patches for the UFS driver"Martin K. Petersen2023-07-3114-334/+346
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bart Van Assche <bvanassche@acm.org> says: Hi Martin, This patch includes the following changes, none of which should change the functionality of the UFS host controller driver: - Improve the kernel-doc headers further. - Fix multiple W=2 compiler warnings. - Simplify ufshcd_abort_all(). - Simplify the code for creating and parsing UFS Transport Protocol (UTP) headers. Please consider this patch series for the next merge window. Thanks, Bart. Link: https://lore.kernel.org/r/20230727194457.3152309-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Simplify response header parsingBart Van Assche2023-07-311-93/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the code that parses UTP transfer request headers easier to read by using u8 instead of __be32 where appropriate. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-13-bvanassche@acm.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Simplify transfer request header initializationBart Van Assche2023-07-313-39/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the code that initializes UTP transfer request headers easier to read by using bitfields instead of __le32 where appropriate. Cc: "Bao D. Nguyen" <quic_nguyenb@quicinc.com> Cc: Eric Biggers <ebiggers@google.com> Cc: Avri Altman <avri.altman@wdc.com> Cc: Bean Huo <beanhuo@micron.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-12-bvanassche@acm.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Remove a member variableBart Van Assche2023-07-311-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the 'response' member variable because no code reads its value. Additionally, move the ufs_query_req and ufs_query_res data structure definitions into include/ufs/ufshcd.h because these data structures are related to the UFS host controller driver. Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-11-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Simplify ufshcd_abort_all()Bart Van Assche2023-07-311-26/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify the MCQ and legacy code paths. This patch reworks code introduced by commit ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ mode"). Cc: "Bao D. Nguyen" <quic_nguyenb@quicinc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-10-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Remove a local variable from ufshcd_abort_all()Bart Van Assche2023-07-311-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No functionality is changed. This patch prepares for unifying the MCQ and legacy code paths in this function. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-9-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Improve type safetyBart Van Assche2023-07-312-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assign names to the enumeration types for UPIU types. Use these enumeration types where appropriate. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-8-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Simplify zero-initializationBart Van Assche2023-07-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use { } instead of { { 0 }, } to zero-initialize data structures on the stack. This patch fixes two W=2 warnings. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-7-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Rename a function argumentBart Van Assche2023-07-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch suppresses the following W=2 warning: drivers/ufs/core/ufs-hwmon.c:130:49: warning: declaration of ‘_data’ shadows a global declaration [-Wshadow] Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-5-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Fix kernel-doc headersBart Van Assche2023-07-313-33/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the remaining kernel-doc warnings that are reported when building with W=2. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-4-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Document all return valuesBart Van Assche2023-07-314-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes multiple W=2 kernel-doc warnings. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-3-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | | scsi: ufs: Follow the kernel-doc syntax for documenting return valuesBart Van Assche2023-07-3111-122/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use 'Return:' to document the return value instead of 'Returns' as required by the kernel-doc documentation. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230727194457.3152309-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | | scsi: ufs: qcom: Add support for scaling interconnectsManivannan Sadhasivam2023-07-312-1/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qcom SoCs require scaling the interconnect paths for proper working of the peripherals connected through interconnects. Even for accessing the UFS controller, someone should setup the interconnect paths. So far, the bootloaders used to setup the interconnect paths before booting Linux as they need to access the UFS storage for things like fetching boot firmware. But with the advent of multi boot options, bootloader nowadays like in SA8540p SoC do not setup the interconnect paths at all. So trying to configure UFS in the absence of the interconnect path configuration results in a boot crash. To fix this issue, and also to dynamically scale the interconnects (UFS-DDR and CPU-UFS), interconnect API support is added to the Qcom UFS driver. With this support, the interconnect paths are scaled dynamically based on the gear configuration. During the early stage of ufs_qcom_init(), ufs_qcom_icc_init() will setup the paths to max bandwidth to allow configuring the UFS registers. Touching the registers without configuring the icc paths would result in a crash. However, we don't really need to set max vote for the icc paths as any minimal vote would suffice. But the max value would allow initialization to be done faster. After init, the bandwidth will get updated using ufs_qcom_icc_update_bw() based on the gear and lane configuration. The bandwidth values defined in ufs_qcom_bw_table struct are taken from Qcom downstream vendor devicetree source and are calculated as per the UFS3.1 Spec, Section 6.4.1, HS Gear Rates. So it is fixed across platforms. Cc: Brian Masney <bmasney@redhat.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20230731145020.41262-3-manivannan.sadhasivam@linaro.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | | scsi: ufs: core: Add enums for UFS lanesManivannan Sadhasivam2023-07-312-4/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Since there are enums available for UFS gears, let's add enums for lanes as well to maintain uniformity. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20230731145020.41262-2-manivannan.sadhasivam@linaro.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: Fix residual handlingBart Van Assche2023-07-251-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only call scsi_set_resid() in case of an underflow. Do not call scsi_set_resid() in case of an overflow. Cc: Avri Altman <avri.altman@wdc.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Fixes: cb38845d90fc ("scsi: ufs: core: Set the residual byte count") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230724200843.3376570-2-bvanassche@acm.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: qcom: Remove unused variableArnd Bergmann2023-07-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent change removed the only user of a local variable that needs to now also be removed: drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_mcq_esi_handler': drivers/ufs/host/ufs-qcom.c:1652:31: error: unused variable 'host' [-Werror=unused-variable] Fixes: 8f2b78652d05 ("scsi: ufs: qcom: Get queue ID from MSI index in ESI handler") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/llvm/64c00cd4.630a0220.6ad79.0eac@mx.google.com/ Link: https://lore.kernel.org/r/20230724122029.1430482-1-arnd@kernel.org Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: core: Remove HPB supportBart Van Assche2023-07-236-3083/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interest among UFS users in HPB has reduced significantly. I am not aware of any current users of the HPB functionality. Hence remove HPB support from the kernel. A note: the work in JEDEC on a successor for HPB is nearing completion. Zoned storage for UFS or ZUFS combines the UFS standard with ZBC-2. Acked-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: ChanWoo Lee <cw9316.lee@samsung.com> Cc: Daejun Park <daejun7.park@samsung.com> Cc: Keoseong Park <keosung.park@samsung.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230719165758.2787573-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: ufs-qcom: Change UFS devfreq timer to delayedNitin Rawat2023-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Devfreq uses the default DEVFREQ_TIMER_DEFERRABLE mode which uses the deferred timer for scheduling the devfreq load monitor function. This causes the load monitoring to be done only with non-idle CPUs and not making use of the idle CPUs. Hence, use the DEVFREQ_TIMER_DELAYED mode which uses the delayed timer thereby making use of idle CPUs as well for load monitoring. Co-developed-by: Asutosh Das <quic_asutoshd@quicinc.com> Signed-off-by: Asutosh Das <quic_asutoshd@quicinc.com> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com> Link: https://lore.kernel.org/r/20230720093446.30697-1-quic_nitirawa@quicinc.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: Explicitly include correct DT includesRob Herring2023-07-232-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230714175018.4064957-1-robh@kernel.org Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: core: Fix some kernel-doc commentsYang Li2023-07-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use colons to separate parameter names from their specific meanings to silence the following warnings: drivers/ufs/core/ufs-mcq.c:499: warning: Function parameter or member 'hba' not described in 'ufshcd_mcq_sq_cleanup' drivers/ufs/core/ufs-mcq.c:499: warning: Function parameter or member 'task_tag' not described in 'ufshcd_mcq_sq_cleanup' drivers/ufs/core/ufs-mcq.c:560: warning: Function parameter or member 'utrd' not described in 'ufshcd_mcq_nullify_sqe' drivers/ufs/core/ufs-mcq.c:583: warning: Function parameter or member 'hba' not described in 'ufshcd_mcq_sqe_search' drivers/ufs/core/ufs-mcq.c:583: warning: Function parameter or member 'hwq' not described in 'ufshcd_mcq_sqe_search' drivers/ufs/core/ufs-mcq.c:583: warning: Function parameter or member 'task_tag' not described in 'ufshcd_mcq_sqe_search' drivers/ufs/core/ufs-mcq.c:630: warning: Function parameter or member 'cmd' not described in 'ufshcd_mcq_abort' Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5850 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://lore.kernel.org/r/20230712075836.15375-1-yang.lee@linux.alibaba.com Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: ufs-mediatek: Remove redundant dev_err()Yang Li2023-07-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to call the dev_err() function directly to print a custom message when handling an error from either the platform_get_irq() or platform_get_irq_byname() functions as both are going to display an appropriate error message in case of a failure. ./drivers/ufs/host/ufs-mediatek.c:864:3-10: line 864 is redundant because platform_get_irq() already prints an error Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5846 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://lore.kernel.org/r/20230712064832.44188-1-yang.lee@linux.alibaba.com Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: qcom: Hold the mutex lock when configuring ESIZiqi Chen2023-07-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Lock the MSI descriptor storage of a device when configuring ESI. Otherwise we would see warnings during boot. Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/1689065327-45039-1-git-send-email-quic_ziqichen@quicinc.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: qcom: Get queue ID from MSI index in ESI handlerZiqi Chen2023-07-232-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_msi_domain_alloc_irqs() does not always get consecutive IRQ numbers, hence queue IDs calculated out from IRQ numbers may be incorrect if we assume IRQ numbers are consecutive. Fix this by passing msi_desc to ESI handler to use msi_desc->msi_index as queue ID. Co-developed-by: Can Guo <quic_cang@quicinc.com> Signed-off-by: Can Guo <quic_cang@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/1689062349-77385-1-git-send-email-quic_ziqichen@quicinc.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: ti-j721e: Expose device tree aliasesUdit Kumar2023-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When TI UFS host controller driver is built as kernel module it is not getting auto-loaded due to missing aliases in modules. Add device tree related aliases. Signed-off-by: Udit Kumar <u-kumar1@ti.com> Link: https://lore.kernel.org/r/20230710094801.183149-1-u-kumar1@ti.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: ufs-mediatek: Add MCQ support for MTK platformPo-Wen Kao2023-07-112-2/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add UFS MCQ vops and IRQ handler for MediaTek platform. PM flow is fixed accordingly. Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230701124442.10489-3-powen.kao@mediatek.com Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: core: Export symbols for MTK driver modulePo-Wen Kao2023-07-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Export symbols for MediaTek UFS driver's PM flow and IRQ handler. Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230701124442.10489-2-powen.kao@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | | scsi: ufs: core: Convert UPIU_HEADER_DWORD() into a functionBart Van Assche2023-07-112-8/+7
|/ / | | | | | | | | | | | | | | | | | | This change reduces the number of parentheses that are required in the definition of this function and also when using this function. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230706215054.4113469-1-bvanassche@acm.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds2023-07-081-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull more SCSI updates from James Bottomley: "A few late arriving patches that missed the initial pull request. It's mostly bug fixes (the dt-bindings is a fix for the initial pull)" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ufs: core: Remove unused function declaration scsi: target: docs: Remove tcm_mod_builder.py scsi: target: iblock: Quiet bool conversion warning with pr_preempt use scsi: dt-bindings: ufs: qcom: Fix ICE phandle scsi: core: Simplify scsi_cdl_check_cmd() scsi: isci: Fix comment typo scsi: smartpqi: Replace one-element arrays with flexible-array members scsi: target: tcmu: Replace strlcpy() with strscpy() scsi: ncr53c8xx: Replace strlcpy() with strscpy() scsi: lpfc: Fix lpfc_name struct packing
| * scsi: ufs: core: Remove unused function declarationKeoseong Park2023-06-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | Commit 2468da61ea09 ("scsi: ufs: core: mcq: Configure operation and runtime interface") added ufshcd_mcq_select_mcq_mode(), but it's not used anywhere. So remove it. Signed-off-by: Keoseong Park <keosung.park@samsung.com> Link: https://lore.kernel.org/r/20230627012931epcms2p76f458e0b2ce8a591b56bbcc6a2f1a3bb@epcms2p7 Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds2023-06-3024-553/+739
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull SCSI updates from James Bottomley: "Updates to the usual drivers (ufs, pm80xx, libata-scsi, smartpqi, lpfc, qla2xxx). We have a couple of major core changes impacting other systems: - Command Duration Limits, which spills into block and ATA - block level Persistent Reservation Operations, which touches block, nvme, target and dm Both of these are added with merge commits containing a cover letter explaining what's going on" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (187 commits) scsi: core: Improve warning message in scsi_device_block() scsi: core: Replace scsi_target_block() with scsi_block_targets() scsi: core: Don't wait for quiesce in scsi_device_block() scsi: core: Don't wait for quiesce in scsi_stop_queue() scsi: core: Merge scsi_internal_device_block() and device_block() scsi: sg: Increase number of devices scsi: bsg: Increase number of devices scsi: qla2xxx: Remove unused nvme_ls_waitq wait queue scsi: ufs: ufs-pci: Add support for Intel Arrow Lake scsi: sd: sd_zbc: Use PAGE_SECTORS_SHIFT scsi: ufs: wb: Add explicit flush_threshold sysfs attribute scsi: ufs: ufs-qcom: Switch to the new ICE API scsi: ufs: dt-bindings: qcom: Add ICE phandle scsi: ufs: ufs-mediatek: Set UFSHCD_QUIRK_MCQ_BROKEN_RTC quirk scsi: ufs: ufs-mediatek: Set UFSHCD_QUIRK_MCQ_BROKEN_INTR quirk scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_RTC scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_INTR scsi: ufs: core: Remove dedicated hwq for dev command scsi: ufs: core: mcq: Fix the incorrect OCS value for the device command scsi: ufs: dt-bindings: samsung,exynos: Drop unneeded quotes ...
| * scsi: ufs: ufs-pci: Add support for Intel Arrow LakeAdrian Hunter2023-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | Add PCI ID to support Intel Arrow Lake, same as MTL (Intel Meteor Lake). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20230613170327.61186-1-adrian.hunter@intel.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: wb: Add explicit flush_threshold sysfs attributeLu Hongfei2023-06-161-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three flags that control Write Booster Feature: 1. WB ON/OFF 2. WB Hibern Flush ON/OFF (implicitly) 3. WB Flush ON/OFF (explicit) In the case of "Hibern Flush", one of the conditions for flush WB buffer is that avail_wb_buff < wb_flush_threshold. As we know, different users have different requirements for power consumption and performance. Therefore, we need the ability to manually set wb_flush_threshold, so that users can easily and flexibly adjust the wb_flush_threshold value, thereby achieving a balance between power consumption and performance. So the sysfs attribute that controls this is necessary. wb_flush_threshold represents the threshold for flushing WB buffer, whose value expressed in unit of 10% granularity, such as '1' representing 10%, '2' representing 20%, and so on. Signed-off-by: Lu Hongfei <luhongfei@vivo.com> Link: https://lore.kernel.org/r/20230613022240.16595-1-luhongfei@vivo.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: ufs-qcom: Switch to the new ICE APIAbel Vesa2023-06-165-277/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that there is a new dedicated ICE driver, drop the ufs-qcom-ice and use the new ICE api provided by the Qualcomm soc driver ice. The platforms that already have ICE support will use the API as library since there will not be a devicetree node, but instead they have reg range. In this case, the of_qcom_ice_get will return an ICE instance created for the consumer's device. But if there are platforms that do not have ice reg in the consumer devicetree node and instead provide a dedicated ICE devicetree node, the of_qcom_ice_get will look up the device based on qcom,ice property and will get the ICE instance registered by the probe function of the ice driver. The ICE clock is now handle by the new driver. This is done by enabling it on the creation of the ICE instance and then enabling/disabling it on UFS runtime resume/suspend. Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Link: https://lore.kernel.org/r/20230612192847.1599416-3-abel.vesa@linaro.org Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: ufs-mediatek: Set UFSHCD_QUIRK_MCQ_BROKEN_RTC quirkPo-Wen Kao2023-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | Enable UFSHCD_QUIRK_MCQ_BROKEN_RTC for MediaTek host. Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230612085817.12275-5-powen.kao@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: ufs-mediatek: Set UFSHCD_QUIRK_MCQ_BROKEN_INTR quirkPo-Wen Kao2023-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | Enable UFSHCD_QUIRK_MCQ_BROKEN_INTR for MediaTek host. Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230612085817.12275-4-powen.kao@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_RTCPo-Wen Kao2023-06-161-0/+12
| | | | | | | | | | | | | | | | | | | | | | Some hosts do not implement SQ Run Time Command (SQRTC) register, thus we need this quirk to skip the related flow. Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230612085817.12275-3-powen.kao@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_INTRPo-Wen Kao2023-06-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quirk UFSHCD_QUIRK_MCQ_BROKEN_INTR is introduced for hosts that implement a different interrupt topology from the UFSHCI 4.0 spec. Some hosts raise per hw queue interrupt in addition to CQES (traditional) when ESI is disabled. Enabling this quirk will disable CQES and use only per hw queue interrupt. Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230612085817.12275-2-powen.kao@mediatek.com Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: Remove dedicated hwq for dev commandPo-Wen Kao2023-06-163-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit depends on "scsi: ufs: core: mcq: Fix the incorrect OCS value for the device command" which takes care of the OCS value of dev commands in MCQ mode. It is safe to share first hwq for dev command and I/O request here. Tested-by: Po-Wen Kao <powen.kao@mediatek.com> Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com> Link: https://lore.kernel.org/r/20230610021553.1213-3-powen.kao@mediatek.com Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: mcq: Fix the incorrect OCS value for the device commandStanley Chu2023-06-161-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MCQ mode, when a device command uses a hardware queue shared with other commands, a race condition may occur in the following scenario: 1. A device command is completed in CQx with CQE entry "e". 2. The interrupt handler copies the "cqe" pointer to "hba->dev_cmd.cqe" and completes "hba->dev_cmd.complete". 3. The "ufshcd_wait_for_dev_cmd()" function is awakened and retrieves the OCS value from "hba->dev_cmd.cqe". However, there is a possibility that the CQE entry "e" will be overwritten by newly completed commands in CQx, resulting in an incorrect OCS value being received by "ufshcd_wait_for_dev_cmd()". To avoid this race condition, the OCS value should be immediately copied to the struct "lrb" of the device command. Then "ufshcd_wait_for_dev_cmd()" can retrieve the OCS value from the struct "lrb". Fixes: 57b1c0ef89ac ("scsi: ufs: core: mcq: Add support to allocate multiple queues") Suggested-by: Can Guo <quic_cang@quicinc.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Link: https://lore.kernel.org/r/20230610021553.1213-2-powen.kao@mediatek.com Tested-by: Po-Wen Kao <powen.kao@mediatek.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: Combine ufshcd_mq_poll_cqe functionsStanley Chu2023-06-071-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, ufshcd_mcq_poll_cqe_nolock() is only called by ufshcd_mcq_poll_cqe_lock() with the addition of a spinlock wrapper for ufshcd_mcq_poll_cqe_nolock(). Combining these two functions into one results in cleaner code. Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Link: https://lore.kernel.org/r/20230601225048.12228-1-stanley.chu@mediatek.com Reviewed-by: Keoseong Park <keosung.park@samsung.com> Acked-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: Fix ufshcd_inc_sq_tail() function bugzhanghui2023-06-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | When qdepth is not power of 2, not every bit of the mask is 1, so in sq_tail_slot some bits will be cleared unexpectedly. Signed-off-by: zhanghui <zhanghui31@xiaomi.com> Link: https://lore.kernel.org/r/20230601124613.1446-1-zhanghui31@xiaomi.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: ufs: core: Remove a ufshcd_add_command_trace() callBart Van Assche2023-06-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | ufshcd_add_command_trace() traces SCSI commands. Remove a ufshcd_add_command_trace() call from a code path that is not related to SCSI commands. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230531224050.25554-1-bvanassche@acm.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * Merge patch series "UFS host controller driver patches"Martin K. Petersen2023-05-3112-76/+25
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Bart Van Assche <bvanassche@acm.org> says: Please consider these four UFS host controller driver patches for the next merge window. Link: https://lore.kernel.org/r/20230524203659.1394307-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: ufs: core: Simplify driver shutdownBart Van Assche2023-05-3112-52/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All UFS host drivers call ufshcd_shutdown(). Hence, instead of calling ufshcd_shutdown() from the host driver .shutdown() callback, inline that function into ufshcd_wl_shutdown(). Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230524203659.1394307-5-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: ufs: core: Move ufshcd_wl_shutdown()Bart Van Assche2023-05-311-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the definition of ufshcd_wl_shutdown() to make the next patch in this series easier to review. Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230524203659.1394307-4-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: ufs: core: Fix handling of lrbp->cmdBart Van Assche2023-05-311-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ufshcd_queuecommand() may be called two times in a row for a SCSI command before it is completed. Hence make the following changes: - In the functions that submit a command, do not check the old value of lrbp->cmd nor clear lrbp->cmd in error paths. - In ufshcd_release_scsi_cmd(), do not clear lrbp->cmd. See also scsi_send_eh_cmnd(). This commit prevents that the following appears if a command times out: WARNING: at drivers/ufs/core/ufshcd.c:2965 ufshcd_queuecommand+0x6f8/0x9a8 Call trace: ufshcd_queuecommand+0x6f8/0x9a8 scsi_send_eh_cmnd+0x2c0/0x960 scsi_eh_test_devices+0x100/0x314 scsi_eh_ready_devs+0xd90/0x114c scsi_error_handler+0x2b4/0xb70 kthread+0x16c/0x1e0 Fixes: 5a0b0cb9bee7 ("[SCSI] ufs: Add support for sending NOP OUT UPIU") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230524203659.1394307-3-bvanassche@acm.org Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: ufs: core: Increase the START STOP UNIT timeout from one to ten secondsBart Van Assche2023-05-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One UFS vendor asked to increase the UFS timeout from 1 s to 3 s. Another UFS vendor asked to increase the UFS timeout from 1 s to 10 s. Hence this patch that increases the UFS timeout to 10 s. This patch can cause the total timeout to exceed 20 s, the Android shutdown timeout. This is fine since the loop around ufshcd_execute_start_stop() exists to deal with unit attentions and because unit attentions are reported quickly. Fixes: dcd5b7637c6d ("scsi: ufs: Reduce the START STOP UNIT timeout") Fixes: 8f2c96420c6e ("scsi: ufs: core: Reduce the power mode change timeout") Acked-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230524203659.1394307-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * | Merge patch series "ufs: core: mcq: Add ufshcd_abort() and error handler ↵Martin K. Petersen2023-05-314-57/+478
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | support in MCQ mode" Bao D. Nguyen <quic_nguyenb@quicinc.com> says: This patch series enables support for ufshcd_abort() and error handler in MCQ mode. Link: https://lore.kernel.org/r/cover.1685396241.git.quic_nguyenb@quicinc.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>