summaryrefslogtreecommitdiff
path: root/drivers/ufs
AgeCommit message (Collapse)AuthorFilesLines
2023-09-05scsi: ufs: core: Poll HCS.UCRDY before issuing a UIC commandKiwoong Kim1-1/+6
With auto hibern8 enabled, UIC could be busy processing a hibern8 operation and the HCI would reports UIC not ready for a short while through HCS.UCRDY. The UFS driver doesn't currently handle this situation. The UFSHCI spec specifies UCRDY like this: whether the host controller is ready to process UIC COMMAND The 'ready' could be seen as many different meanings. If the meaning includes not processing any request from HCI, processing a hibern8 operation can be 'not ready'. In this situation, the driver needs to wait until the operations is completed. Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com> Link: https://lore.kernel.org/r/550484ffb66300bdcec63d3e304dfd55cb432f1f.1693790060.git.kwmad.kim@samsung.com Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Chanwoo Lee <cw9316.lee@samsung.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-05scsi: ufs: core: Move __ufshcd_send_uic_cmd() outside host_lockKiwoong Kim1-5/+1
__ufshcd_send_uic_cmd() is wrapped by uic_cmd_mutex and its related contexts are accessed within the section wrapped by uic_cmd_mutex. Thus, wrapping with host_lock is redundant. Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com> Link: https://lore.kernel.org/r/782ba5f26f0a96e58d85dff50751787d2d2a6b2b.1693790060.git.kwmad.kim@samsung.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Chanwoo Lee <cw9316.lee@samsung.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-31scsi: ufs: core: No need to update UPIU.header.flags and lun in advanced ↵Bean Huo1-3/+1
RPMB handler For advanced RPMB requests, its UPIU package should be fully initialized in its ufs-bsg-based application, except for task tag. in ufshcd.c, we just copy UPIU (with CDB) request as-is. Signed-off-by: Bean Huo <beanhuo@micron.com> Link: https://lore.kernel.org/r/20230809181847.102123-3-beanhuo@iokpp.de Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-31scsi: ufs: core: Add advanced RPMB support where UFSHCI 4.0 does not support ↵Bean Huo2-3/+10
EHS length in UTRD According to UFSHCI 4.0 specification: 5.2 Host Controller Capabilities Registers 5.2.1 Offset 00h: CAP – Controller Capabilities: "EHS Length in UTRD Supported (EHSLUTRDS): Indicates whether the host controller supports EHS Length field in UTRD. 0 – Host controller takes EHS length from CMD UPIU, and SW driver use EHS Length field in CMD UPIU. 1 – HW controller takes EHS length from UTRD, and SW driver use EHS Length field in UTRD. NOTE Recommend Host controllers move to taking EHS length from UTRD, and in UFS-5, it will be mandatory." So, when UFSHCI 4.0 doesn't support EHS Length field in UTRD, we could use EHS Length field in CMD UPIU. Remove the limitation that advanced RPMB only works when EHS length is supported in UTRD. Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg") Co-developed-by: "jonghwi.rha" <jonghwi.rha@samsung.com> Signed-off-by: "jonghwi.rha" <jonghwi.rha@samsung.com> Signed-off-by: Bean Huo <beanhuo@micron.com> Link: https://lore.kernel.org/r/20230809181847.102123-2-beanhuo@iokpp.de Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-31Merge branch '6.5/scsi-fixes' into 6.6/scsi-stagingMartin K. Petersen5-4/+45
Pull in the fixes tree for a commit that missed 6.5. Also resolve a trivial merge conflict in fnic. * 6.5/scsi-fixes: (36 commits) scsi: storvsc: Handle additional SRB status values scsi: snic: Fix double free in snic_tgt_create() scsi: core: raid_class: Remove raid_component_add() scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW major version > 5 scsi: ufs: mcq: Fix the search/wrap around logic scsi: qedf: Fix firmware halt over suspend and resume scsi: qedi: Fix firmware halt over suspend and resume scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock scsi: lpfc: Remove reftag check in DIF paths scsi: ufs: renesas: Fix private allocation scsi: snic: Fix possible memory leak if device_add() fails scsi: core: Fix possible memory leak if device_add() fails scsi: core: Fix legacy /proc parsing buffer overflow scsi: 53c700: Check that command slot is not NULL scsi: fnic: Replace return codes in fnic_clean_pending_aborts() scsi: storvsc: Fix handling of virtual Fibre Channel timeouts scsi: pm80xx: Fix error return code in pm8001_pci_probe() scsi: zfcp: Defer fc_rport blocking until after ADISC response scsi: storvsc: Limit max_sectors for virtual Fibre Channel devices scsi: sg: Fix checking return value of blk_get_queue() ... Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-22scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW major version > 5Neil Armstrong1-1/+1
The qunipro_g4_sel clear is also needed for new platforms with major version > 5. Fix the version check to take this into account. Fixes: 9c02aa24bf40 ("scsi: ufs: ufs-qcom: Clear qunipro_g4_sel for HW version major 5") Acked-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Nitin Rawat <quic_nitirawa@quicinc.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20230821-topic-sm8x50-upstream-ufs-major-5-plus-v2-1-f42a4b712e58@linaro.org Reviewed-by: "Bao D. Nguyen" <quic_nguyenb@quicinc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-22scsi: ufs: mcq: Fix the search/wrap around logicBao D. Nguyen1-2/+4
The search and wrap around logic in the ufshcd_mcq_sqe_search() function does not work correctly when the hwq's queue depth is not a power of two number. Correct it so that any queue depth with a positive integer value within the supported range would work. Signed-off-by: "Bao D. Nguyen" <quic_nguyenb@quicinc.com> Link: https://lore.kernel.org/r/ff49c15be205135ed3ec186f3086694c02867dbd.1692149603.git.quic_nguyenb@quicinc.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Fixes: 8d7290348992 ("scsi: ufs: mcq: Add supporting functions for MCQ abort") Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-21scsi: ufs: host: Convert to dev_err_probe() in ufshcd_pltfrm_init()Brian Masney1-1/+2
Convert ufshcd_pltfrm_init() over to use dev_err_probe() to avoid the following log message on bootup due to an -EPROBE_DEFER return code: ufshcd-qcom 1d84000.ufs: Initialization failed While this line is changed, let's also go ahead and add the error code to the message as well. Signed-off-by: Brian Masney <bmasney@redhat.com> Link: https://lore.kernel.org/r/20230814184352.200531-3-bmasney@redhat.com Reviewed-by: "Bao D. Nguyen" <quic_nguyenb@quicinc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-21scsi: ufs: core: Convert to dev_err_probe() in ufshcd_variant_hba_init()Brian Masney1-2/+3
Convert ufshcd_variant_hba_init() over to use dev_err_probe() to avoid log messages like the following on bootup: ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init failed err -517 Signed-off-by: Brian Masney <bmasney@redhat.com> Link: https://lore.kernel.org/r/20230814184352.200531-2-bmasney@redhat.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-08scsi: ufs: ufs-pci: Add support for QEMUJeuk Kim1-0/+1
To ensure that the PCI based QEMU UFS device properly works with Linux, register the device ID (0x0013) and vendor ID (0x1b36) of QEMU UFS device. QEMU UFS will enable testing of the UFS driver inside a virtual machine on systems without UFS host controller. It can also be used to preemptively implement and test new features before the real device is created. The new QEMU UFS device can be found at: https://lore.kernel.org/qemu-devel/20230727155239.GA979354@fedora Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com> Link: https://lore.kernel.org/r/20230807013726epcms2p1c604cb8e98680aebebb7cc5ab2d580f5@epcms2p1 Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-08scsi: ufs: renesas: Fix private allocationYoshihiro Shimoda1-1/+1
Should use devm_kzalloc() for struct ufs_renesas_priv because the .initialized should be false as default. Fixes: d69520288efd ("scsi: ufs: ufs-renesas: Add support for Renesas R-Car UFS controller") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Link: https://lore.kernel.org/r/20230803081812.1446282-1-yoshihiro.shimoda.uh@renesas.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-08scsi: ufs: qcom: Make struct ufs_qcom_bw_table static constManivannan Sadhasivam1-1/+1
ufs_qcom_bw_table is not modified anywhere. So make it static const so that it can be placed in read-only memory. Reported-by: Bart Van Assche <bvanassche@acm.org> Closes: https://lore.kernel.org/linux-scsi/43cd0057-c6d8-bc92-08f4-d767336d2cfe@acm.org/ Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20230802040154.10652-1-manivannan.sadhasivam@linaro.org Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-08scsi: ufs: core: Fix the build for gcc 9 and beforeBart Van Assche1-0/+8
gcc compilers before version 10 cannot do constant-folding for sub-byte bitfields. This makes the compiler layout tests fail. Hence skip the layout checks for gcc 9 and before. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Naresh Kamboju <naresh.kamboju@linaro.org> Cc: Nathan Chancellor <nathan@kernel.org> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Closes: https://lore.kernel.org/linux-scsi/CA+G9fYur8UJoUyTLJFVEJPh-15TJ7kbdD2q8xVz8a3fLjkxxVw@mail.gmail.com/ Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230801232204.1481902-1-bvanassche@acm.org Tested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-08-08scsi: ufs: ufs-qcom: Check host controller stateNitin Rawat1-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>
2023-08-08scsi: ufs: core: Export ufshcd_is_hba_active()Nitin Rawat1-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>
2023-07-31Merge patch series "Multiple cleanup patches for the UFS driver"Martin K. Petersen14-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>
2023-07-31scsi: ufs: Simplify response header parsingBart Van Assche1-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>
2023-07-31scsi: ufs: Simplify transfer request header initializationBart Van Assche3-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>
2023-07-31scsi: ufs: Remove a member variableBart Van Assche1-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>
2023-07-31scsi: ufs: Simplify ufshcd_abort_all()Bart Van Assche1-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>
2023-07-31scsi: ufs: Remove a local variable from ufshcd_abort_all()Bart Van Assche1-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>
2023-07-31scsi: ufs: Improve type safetyBart Van Assche2-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>
2023-07-31scsi: ufs: Simplify zero-initializationBart Van Assche1-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>
2023-07-31scsi: ufs: Rename a function argumentBart Van Assche1-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>
2023-07-31scsi: ufs: Fix kernel-doc headersBart Van Assche3-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>
2023-07-31scsi: ufs: Document all return valuesBart Van Assche4-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>
2023-07-31scsi: ufs: Follow the kernel-doc syntax for documenting return valuesBart Van Assche11-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>
2023-07-31scsi: ufs: qcom: Add support for scaling interconnectsManivannan Sadhasivam2-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>
2023-07-31scsi: ufs: core: Add enums for UFS lanesManivannan Sadhasivam2-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>
2023-07-26scsi: ufs: Fix residual handlingBart Van Assche1-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>
2023-07-26scsi: RDMA/srp: Fix residual handlingBart Van Assche0-0/+0
Although the code for residual handling in the SRP initiator follows the SCSI documentation, that documentation has never been correct. Because scsi_finish_command() starts from the data buffer length and subtracts the residual, scsi_set_resid() must not be called if a residual overflow occurs. Hence remove the scsi_set_resid() calls from the SRP initiator if a residual overflow occurrs. Cc: Leon Romanovsky <leon@kernel.org> Cc: Jason Gunthorpe <jgg@nvidia.com> Fixes: 9237f04e12cc ("scsi: core: Fix scsi_get/set_resid() interface") Fixes: e714531a349f ("IB/srp: Fix residual handling") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230724200843.3376570-3-bvanassche@acm.org Acked-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-07-26scsi: ufs: qcom: Remove unused variableArnd Bergmann1-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>
2023-07-23scsi: ufs: core: Remove HPB supportBart Van Assche6-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>
2023-07-23scsi: ufs: ufs-qcom: Change UFS devfreq timer to delayedNitin Rawat1-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>
2023-07-23scsi: ufs: Explicitly include correct DT includesRob Herring2-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>
2023-07-23scsi: ufs: core: Fix some kernel-doc commentsYang Li1-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>
2023-07-23scsi: ufs: ufs-mediatek: Remove redundant dev_err()Yang Li1-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>
2023-07-23scsi: ufs: qcom: Hold the mutex lock when configuring ESIZiqi Chen1-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>
2023-07-23scsi: ufs: qcom: Get queue ID from MSI index in ESI handlerZiqi Chen2-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>
2023-07-23scsi: ufs: ti-j721e: Expose device tree aliasesUdit Kumar1-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>
2023-07-11scsi: ufs: ufs-mediatek: Add MCQ support for MTK platformPo-Wen Kao2-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>
2023-07-11scsi: ufs: core: Export symbols for MTK driver modulePo-Wen Kao1-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>
2023-07-11scsi: ufs: core: Convert UPIU_HEADER_DWORD() into a functionBart Van Assche2-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>
2023-07-11Merge branch '6.5/scsi-staging' into 6.5/scsi-fixesMartin K. Petersen2-0/+39
Pull in the currently staged SCSI fixes for 6.5. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-07-08Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds1-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
2023-07-06scsi: ufs: core: Add support for qTimestamp attributeArthur Simchaev1-0/+38
The new qTimestamp attribute was added to UFS 4.0 spec, in order to synchronize timestamp between device logs and the host. The spec recommends to send this attribute upon device power-on Reset/HW reset or when switching to Active state (using SSU command). Due to this attribute, the attribute's max value was extended to 8 bytes. As a result, the new definition of struct utp_upiu_query_v4_0 was added. Signed-off-by: Arthur Simchaev <Arthur.Simchaev@wdc.com> ----------------- Changes to v2: - Adressed Bart's comments - Add missed response variable to ufshcd_set_timestamp_attr Link: https://lore.kernel.org/r/20230626103320.8737-1-arthur.simchaev@wdc.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-07-06scsi: ufs: ufs-mediatek: Add dependency for RESET_CONTROLLERRandy Dunlap1-0/+1
When RESET_CONTROLLER is not set, kconfig complains about missing dependencies for RESET_TI_SYSCON, so add the missing dependency just as is done above for SCSI_UFS_QCOM. Silences this kconfig warning: WARNING: unmet direct dependencies detected for RESET_TI_SYSCON Depends on [n]: RESET_CONTROLLER [=n] && HAS_IOMEM [=y] Selected by [m]: - SCSI_UFS_MEDIATEK [=m] && SCSI_UFSHCD [=y] && SCSI_UFSHCD_PLATFORM [=y] && ARCH_MEDIATEK [=y] Fixes: de48898d0cb6 ("scsi: ufs-mediatek: Create reset control device_link") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Link: lore.kernel.org/r/202306020859.1wHg9AaT-lkp@intel.com Link: https://lore.kernel.org/r/20230701052348.28046-1-rdunlap@infradead.org Cc: Stanley Chu <stanley.chu@mediatek.com> Cc: Peter Wang <peter.wang@mediatek.com> Cc: Paul Gazzillo <paul@pgazz.com> Cc: Necip Fazil Yildiran <fazilyildiran@gmail.com> Cc: linux-scsi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-06-30Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds24-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 ...
2023-06-29scsi: ufs: core: Remove unused function declarationKeoseong Park1-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>
2023-06-16scsi: ufs: ufs-pci: Add support for Intel Arrow LakeAdrian Hunter1-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>