commit 0e9693b97a0eee1df7bae33aec207c975fbcbdb8 Author: Keoseong Park Date: Fri Apr 25 10:06:05 2025 +0900 scsi: ufs: core: Remove redundant query_complete trace The query_complete trace was not removed after ufshcd_issue_dev_cmd() was called from the bsg path, resulting in duplicate output. Below is an example of the trace: ufs-utils-773 [000] ..... 218.176933: ufshcd_upiu: query_send: 0000:00:04.0: HDR:16 00 00 1f 00 01 00 00 00 00 00 00, OSF:03 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ufs-utils-773 [000] ..... 218.177145: ufshcd_upiu: query_complete: 0000:00:04.0: HDR:36 00 00 1f 00 01 00 00 00 00 00 00, OSF:03 07 00 00 00 00 00 00 00 00 00 08 00 00 00 00 ufs-utils-773 [000] ..... 218.177146: ufshcd_upiu: query_complete: 0000:00:04.0: HDR:36 00 00 1f 00 01 00 00 00 00 00 00, OSF:03 07 00 00 00 00 00 00 00 00 00 08 00 00 00 00 Remove the redundant trace call in the bsg path, preventing duplication. Signed-off-by: Keoseong Park Link: https://lore.kernel.org/r/20250425010605epcms2p67e89b351398832fe0fd547404d3afc65@epcms2p6 Fixes: 71aabb747d5f ("scsi: ufs: core: Reuse exec_dev_cmd") Reviewed-by: Avri Altman Signed-off-by: Martin K. Petersen commit 9c51f24c1ac7cbde9cc94a54137775dc52aae491 Author: Colin Ian King Date: Tue Apr 22 18:03:47 2025 +0100 scsi: myrb: Fix spelling mistake "statux" -> "status" There is a spelling mistake in a dev_err() message. Fix it. Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20250422170347.66792-1-colin.i.king@gmail.com Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen commit 0d16b70cdbfcdffe7d4bf6ccc6f23372d71bcfeb Author: Dr. David Alan Gilbert Date: Wed Apr 16 01:22:35 2025 +0100 scsi: qedi: Remove unused qedi_get_proto_itt() qedi_get_proto_itt() last use was removed in 2021 by commit ed1b86ba0fba ("scsi: qedi: Wake up if cmd_cleanup_req is set") Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250416002235.299347-3-linux@treblig.org Signed-off-by: Martin K. Petersen commit 918eb068215775d27d8b6e37d9f623eb296f76ee Author: Dr. David Alan Gilbert Date: Wed Apr 16 01:22:34 2025 +0100 scsi: qedi: Remove unused sysfs functions qedi_remove_sysfs_attr() and qedi_create_sysfs_attr() were added in 2016 by commit ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") but have remained unused. Remove them. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250416002235.299347-2-linux@treblig.org Signed-off-by: Martin K. Petersen commit 3a37ab0827fd36a670c5db8a13b3703e4b30c7e1 Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:28:03 2025 +0100 scsi: qla2xxx: Remove unused module parameters ql2xetsenable last use was removed in 2020 by commit 37efd51f75f3 ("scsi: qla2xxx: Use FC generic update firmware options routine for ISP27xx") ql2xiidmaenable last use was removed in 2017 by commit 726b85487067 ("qla2xxx: Add framework for async fabric discovery") Remove them. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-9-linux@treblig.org Signed-off-by: Martin K. Petersen commit 45838d3db7500b1ff8393a195ee6efec56b8d2b8 Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:28:02 2025 +0100 scsi: qla2xxx: Remove unused qla2x00_gpsc() qla2x00_gpsc() was added in 2017 as part of commit 726b85487067 ("qla2xxx: Add framework for async fabric discovery") but has remained unused. Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-8-linux@treblig.org Signed-off-by: Martin K. Petersen commit 33f44a50ca61f03db1d251ddd301b0c11058e59b Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:28:01 2025 +0100 scsi: qla2xxx: Remove unused ql_log_qp ql_log_qp() was added in 2017 as part of commit 22d84726e3b8 ("scsi: qla2xxx: Add debug logging routine for qpair") but has remained unused. Remove it. (That patch also added ql_dbg_qp but that is still used so is left in). Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-7-linux@treblig.org Signed-off-by: Martin K. Petersen commit 2a2f3168c510c7031bbe720452365c00626bacdf Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:28:00 2025 +0100 scsi: qla2xxx: Remove unused qla82xx_wait_for_state_change() qla82xx_wait_for_state_change() was added in 2010 as part of commit 579d12b58abb ("[SCSI] qla2xxx: Added support for quiescence mode for ISP82xx.") but has remained unused. Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-6-linux@treblig.org Signed-off-by: Martin K. Petersen commit 89981b47f6fc942e6ffd73c8811fe73812519fbe Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:27:59 2025 +0100 scsi: qla2xxx: Remove unused qla82xx_pci_region_offset() qla82xx_pci_region_offset() has been unused since the last use was removed by 2010's commit 3711333dfbee ("[SCSI] qla2xxx: Updates for ISP82xx.") Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-5-linux@treblig.org Signed-off-by: Martin K. Petersen commit 91453ebecccce91e6e7604b9c8828bdab499007b Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:27:58 2025 +0100 scsi: qla2xxx: Remove unused qlt_83xx_iospace_config() qlt_83xx_iospace_config() has been unused since the last use was removed by 2017's commit f54f2cb540b5 ("scsi: qla2xxx: Cleaned up queue configuration code.") Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-4-linux@treblig.org Signed-off-by: Martin K. Petersen commit cbb2a2ef58019409e5fc775ccd024ea21d58f17b Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:27:57 2025 +0100 scsi: qla2xxx: Remove unused qlt_fc_port_deleted() qlt_fc_port_deleted() has been unused since the last use was removed by 2017's commit 726b85487067 ("qla2xxx: Add framework for async fabric discovery") Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-3-linux@treblig.org Signed-off-by: Martin K. Petersen commit ae7a08bee82b808081536be373f7d922180518a2 Author: Dr. David Alan Gilbert Date: Tue Apr 15 01:27:56 2025 +0100 scsi: qla2xxx: Remove unused qlt_free_qfull_cmds() qlt_free_qfull_cmds() was added in 2014 as part of commit 33e799775593 ("qla2xxx: Add support for QFull throttling and Term Exchange retry") but has remained unused. Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://lore.kernel.org/r/20250415002803.135909-2-linux@treblig.org Signed-off-by: Martin K. Petersen commit 1ca57644e2e935b39a260ead5e0ec5ac0319148e Author: Yihang Li Date: Mon Apr 14 16:08:45 2025 +0800 scsi: hisi_sas: Wait until error handling is complete SATA devices are lost when FLR is performed while the controller and disks are in suspended state. This is because the libata layer is called to initialize the SATA device during controller resume. If FLR is executed at this time, the IDENTIFY command fails. As a result, the revalidate fails, and the SATA device is disabled by the libata layer. Wait until error handling completes. Signed-off-by: Yihang Li Link: https://lore.kernel.org/r/20250414080845.1220997-5-liyihang9@huawei.com Signed-off-by: Martin K. Petersen commit e4d953ca557e02edd3aed7390043e1b8ad1c9723 Author: Yihang Li Date: Mon Apr 14 16:08:44 2025 +0800 scsi: hisi_sas: Call I_T_nexus after soft reset for SATA disk In commit 21c7e972475e ("scsi: hisi_sas: Disable SATA disk phy for severe I_T nexus reset failure"), if the softreset fails upon certain conditions, the PHY connected to the disk is disabled directly. Manual recovery is required, which is inconvenient for users in actual use. In addition, SATA disks do not support simultaneous connection of multiple hosts. Therefore, when multiple controllers are connected to a SATA disk at the same time, the controller which is connected later failed to issue an ATA softreset to the SATA disk. As a result, the PHY associated with the disk is disabled and cannot be automatically recovered. Now that, we will not focus on the execution result of softreset. No matter whether the execution is successful or not, we will directly carry out I_T_nexus_reset. Fixes: 21c7e972475e ("scsi: hisi_sas: Disable SATA disk phy for severe I_T nexus reset failure") Signed-off-by: Yihang Li Link: https://lore.kernel.org/r/20250414080845.1220997-4-liyihang9@huawei.com Signed-off-by: Martin K. Petersen commit 92c8fe15241587363983d45b63210cc214535146 Author: Yihang Li Date: Mon Apr 14 16:08:43 2025 +0800 scsi: hisi_sas: Coding style cleanup Remove superfluous blank lines and symbols. Add spaces around operators. Signed-off-by: Yihang Li Link: https://lore.kernel.org/r/20250414080845.1220997-3-liyihang9@huawei.com Signed-off-by: Martin K. Petersen commit 4ca7fe99fc8485fcd04b367f37dc7a48f1355419 Author: Yihang Li Date: Mon Apr 14 16:08:42 2025 +0800 scsi: hisi_sas: Use macro instead of magic number The hisi_sas driver has a large number of magic numbers which makes for unfriendly code reading. Use macro definitions instead. Signed-off-by: Yihang Li Link: https://lore.kernel.org/r/20250414080845.1220997-2-liyihang9@huawei.com Signed-off-by: Martin K. Petersen commit 7a497d1649a9d2af1b9d184eeef4c7e63efb022c Author: Chelsy Ratnawat Date: Sat Apr 19 15:59:06 2025 -0700 scsi: mpi3mr: Fix typo and grammar Corrected grammar, spelling, and formatting in the kernel-doc comment for mpi3mr_os_handle_events() to follow kernel-doc style and improve clarity. Signed-off-by: Chelsy Ratnawat Link: https://lore.kernel.org/r/20250419225906.31437-1-chelsyratnawat2001@gmail.com Signed-off-by: Martin K. Petersen commit b0b7ee3b574a72283399b9232f6190be07f220c0 Author: Ranjan Kumar Date: Tue Apr 15 15:45:46 2025 +0530 scsi: mpi3mr: Add level check to control event logging Ensure event logs are only generated when the debug logging level MPI3_DEBUG_EVENT is enabled. This prevents unnecessary logging. Signed-off-by: Ranjan Kumar Link: https://lore.kernel.org/r/20250415101546.204018-1-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen commit c8c70ff3a766a077e5b3a717e91722638d50e2a6 Author: WangYuli Date: Mon Apr 14 12:26:27 2025 +0800 scsi: scsi_transport_fc: Rename del_timer() in comment Commit 8fa7292fee5c ("treewide: Switch/rename to timer_delete[_sync]()") switched del_timer() to timer_delete(), but did not modify the comment for fc_remote_port_rolechg(). Fix it. Cc: James E.J. Bottomley Cc: Martin K. Petersen Cc: SCSI SUBSYSTEM Cc: linux-kernel@vger.kernel.org Signed-off-by: WangYuli Link: https://lore.kernel.org/r/084BD6AB1C4759DA+20250414042629.63019-3-wangyuli@uniontech.com Signed-off-by: Martin K. Petersen commit 08a966a917fe3d92150fa3cc15793ad5e57051eb Author: Chenyuan Yang Date: Sat Apr 12 14:59:09 2025 -0500 scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer() Add a NULL check for the returned hwq pointer by ufshcd_mcq_req_to_hwq(). This is similar to the fix in commit 74736103fb41 ("scsi: ufs: core: Fix ufshcd_abort_one racing issue"). Signed-off-by: Chenyuan Yang Link: https://lore.kernel.org/r/20250412195909.315418-1-chenyuan0y@gmail.com Fixes: ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ mode") Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 54bebe46871d4e56e05fcf55c1a37e7efa24e0a8 Author: Anastasia Kovaleva Date: Mon Mar 24 11:49:33 2025 +0300 scsi: core: Clear flags for scsi_cmnd that did not complete Commands that have not been completed with scsi_done() do not clear the SCMD_INITIALIZED flag and therefore will not be properly reinitialized. Thus, the next time the scsi_cmnd structure is used, the command may fail in scsi_cmd_runtime_exceeded() due to the old jiffies_at_alloc value: kernel: sd 16:0:1:84: [sdts] tag#405 timing out command, waited 720s kernel: sd 16:0:1:84: [sdts] tag#405 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=66636s Clear flags for commands that have not been completed by SCSI. Fixes: 4abafdc4360d ("block: remove the initialize_rq_fn blk_mq_ops method") Signed-off-by: Anastasia Kovaleva Link: https://lore.kernel.org/r/20250324084933.15932-2-a.kovaleva@yadro.com Signed-off-by: Martin K. Petersen commit 569330a34a31a52c904239439984a59972c11d28 Author: Manish Pandey Date: Fri Apr 11 17:46:30 2025 +0530 scsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices Samsung UFS devices require additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the PA_HIBERN8TIME parameter by 100 µs, a value derived from experiments, to ensure a proper hibernation process. Signed-off-by: Manish Pandey Link: https://lore.kernel.org/r/20250411121630.21330-3-quic_mapa@quicinc.com Reviewed-by: Bean Huo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit f8cba9a700cf38b181df7c1d809cd73c6e1b2df9 Author: Manish Pandey Date: Fri Apr 11 17:46:29 2025 +0530 scsi: ufs: qcom: Add quirks for Samsung UFS devices Introduce quirks for Samsung UFS devices to adjust PA TX HSG1 sync length and TX_HS_EQUALIZER settings on the Qualcomm UFS Host controller. This ensures proper functionality of Samsung UFS devices with the Qualcomm UFS Host controller. Signed-off-by: Manish Pandey Link: https://lore.kernel.org/r/20250411121630.21330-2-quic_mapa@quicinc.com Reviewed-by: Bean Huo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen commit 7f533cc5ee4c4436cee51dc58e81dfd9c3384418 Author: Dmitry Bogdanov Date: Tue Dec 24 13:17:57 2024 +0300 scsi: target: iscsi: Fix timeout on deleted connection NOPIN response timer may expire on a deleted connection and crash with such logs: Did not receive response to NOPIN on CID: 0, failing connection for I_T Nexus (null),i,0x00023d000125,iqn.2017-01.com.iscsi.target,t,0x3d BUG: Kernel NULL pointer dereference on read at 0x00000000 NIP strlcpy+0x8/0xb0 LR iscsit_fill_cxn_timeout_err_stats+0x5c/0xc0 [iscsi_target_mod] Call Trace: iscsit_handle_nopin_response_timeout+0xfc/0x120 [iscsi_target_mod] call_timer_fn+0x58/0x1f0 run_timer_softirq+0x740/0x860 __do_softirq+0x16c/0x420 irq_exit+0x188/0x1c0 timer_interrupt+0x184/0x410 That is because nopin response timer may be re-started on nopin timer expiration. Stop nopin timer before stopping the nopin response timer to be sure that no one of them will be re-started. Signed-off-by: Dmitry Bogdanov Link: https://lore.kernel.org/r/20241224101757.32300-1-d.bogdanov@yadro.com Reviewed-by: Maurizio Lombardi Signed-off-by: Martin K. Petersen commit 1f8eb295790001e0f498e62c186130055d3d496f Author: Thorsten Blum Date: Tue Mar 4 19:14:00 2025 +0100 scsi: target: Remove size arguments when calling strscpy() The size parameter of strscpy() is optional because strscpy() uses sizeof() to determine the length of the destination buffer if it is not provided as an argument. Remove it to simplify the code. Remove some unnecessary curly braces. No functional changes intended. Signed-off-by: Thorsten Blum Link: https://lore.kernel.org/r/20250304181400.78325-1-thorsten.blum@linux.dev Signed-off-by: Martin K. Petersen commit fc8a5ee50743516700d10a83c598b6adb3c2dbef Author: Kees Cook Date: Mon Mar 10 15:25:54 2025 -0700 scsi: pm80xx: Add __nonstring annotations for unterminated strings When a character array without a terminating NUL character has a static initializer, GCC 15's -Wunterminated-string-initialization will only warn if the array lacks the "nonstring" attribute[1]. Mark the arrays with __nonstring to and correctly identify the char array as "not a C string" and thereby eliminate the warning. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1] Cc: Jack Wang Cc: James E.J. Bottomley Cc: Martin K. Petersen Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20250310222553.work.437-kees@kernel.org Signed-off-by: Martin K. Petersen commit 3b5091fee49ffcee512901318ca2425bb1e31a5c Author: Ranjan Kumar Date: Fri Apr 11 16:44:19 2025 +0530 scsi: mpi3mr: Reset the pending interrupt flag If an admin interrupt is missed, admin_pend_isr may stay set and trigger admin reply processing even when no admin I/Os are pending. Clearing/Resetting it in the admin completion path prevents this. Fixes: ca41929b2ed5 ("scsi: mpi3mr: Check admin reply queue from Watchdog") Cc: stable@vger.kernel.org Co-developed-by: Sathya Prakash Signed-off-by: Sathya Prakash Signed-off-by: Ranjan Kumar Link: https://lore.kernel.org/r/20250411111419.135485-3-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen commit cdd445258db9919e9dde497a6d5c3477ea7faf4d Author: Ranjan Kumar Date: Fri Apr 11 16:44:18 2025 +0530 scsi: mpi3mr: Fix pending I/O counter Commit 199510e33dea ("scsi: mpi3mr: Update consumer index of reply queues after every 100 replies") introduced a regression with the per-reply queue pending I/O counter which was erroneously decremented, leading to the counter going negative. Drop the incorrect atomic decrement for the pending I/O counter. Fixes: 199510e33dea ("scsi: mpi3mr: Update consumer index of reply queues after every 100 replies") Cc: stable@vger.kernel.org Co-developed-by: Sathya Prakash Signed-off-by: Sathya Prakash Signed-off-by: Ranjan Kumar Link: https://lore.kernel.org/r/20250411111419.135485-2-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen commit 500d4b742e0cc712160054413e129a568467a7de Author: Huan Tang Date: Fri Apr 11 17:29:24 2025 +0800 scsi: ufs: core: Add WB buffer resize support Follow JESD220G, support a WB buffer resize function through sysfs. The host can obtain resize hint and resize status, and enable the resize operation. Add three sysfs nodes: 1. wb_resize_enable 2. wb_resize_hint 3. wb_resize_status The detailed definition of the three nodes can be found in the sysfs documentation. Signed-off-by: Huan Tang Signed-off-by: Lu Hongfei Link: https://lore.kernel.org/r/20250411092924.1116-1-tanghuan@vivo.com Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 4c324085062919d4e21c69e5e78456dcec0052fe Author: Chenyuan Yang Date: Wed Apr 9 19:13:20 2025 -0500 scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort() A race can occur between the MCQ completion path and the abort handler: once a request completes, __blk_mq_free_request() sets rq->mq_hctx to NULL, meaning the subsequent ufshcd_mcq_req_to_hwq() call in ufshcd_mcq_abort() can return a NULL pointer. If this NULL pointer is dereferenced, the kernel will crash. Add a NULL check for the returned hwq pointer. If hwq is NULL, log an error and return FAILED, preventing a potential NULL-pointer dereference. As suggested by Bart, the ufshcd_cmd_inflight() check is removed. This is similar to the fix in commit 74736103fb41 ("scsi: ufs: core: Fix ufshcd_abort_one racing issue"). This is found by our static analysis tool KNighter. Signed-off-by: Chenyuan Yang Link: https://lore.kernel.org/r/20250410001320.2219341-1-chenyuan0y@gmail.com Fixes: f1304d442077 ("scsi: ufs: mcq: Added ufshcd_mcq_abort()") Reviewed-by: Bart Van Assche Reviewed-by: Peter Wang Signed-off-by: Martin K. Petersen commit ae82eaf4aeea060bb736c3e20c0568b67c701d7d Author: Daniel Wagner Date: Wed Apr 9 13:34:22 2025 +0200 scsi: lpfc: Use memcpy() for BIOS version The strlcat() with FORTIFY support is triggering a panic because it thinks the target buffer will overflow although the correct target buffer size is passed in. Anyway, instead of memset() with 0 followed by a strlcat(), just use memcpy() and ensure that the resulting buffer is NULL terminated. BIOSVersion is only used for the lpfc_printf_log() which expects a properly terminated string. Signed-off-by: Daniel Wagner Link: https://lore.kernel.org/r/20250409-fix-lpfc-bios-str-v1-1-05dac9e51e13@kernel.org Reviewed-by: Justin Tee Signed-off-by: Martin K. Petersen commit cdcb08d5710bc9b543551a85ad551f44d6a4bfc0 Author: Thorsten Blum Date: Tue Apr 8 12:28:40 2025 +0200 scsi: elx: sli4: Replace deprecated strncpy() with strscpy() strncpy() is deprecated for NUL-terminated destination buffers; use strscpy() instead. Since sli_config_cmd_init() already zeroes out the destination buffers, the potential NUL-padding by strncpy() is unnecessary. strscpy() copies only the required characters and guarantees NUL-termination. And since all three destination buffers have a fixed length, strscpy() automatically determines their size using sizeof() when the argument is omitted. This makes any explicit sizeof() calls unnecessary. The source strings are also NUL-terminated and meet the __must_be_cstr() requirement of strscpy(). No functional changes intended. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum Link: https://lore.kernel.org/r/20250408102843.804083-2-thorsten.blum@linux.dev Reviewed-by: Kees Cook Signed-off-by: Martin K. Petersen commit 3c7ac40d732232fec0ba31d0a5e3cc9c112fc2e7 Author: Neil Armstrong Date: Mon Apr 7 12:17:05 2025 +0200 scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler On systems with a large number request slots and unavailable MCQ ESI, the current design of the interrupt handler can delay handling of other subsystems interrupts causing display artifacts, GPU stalls or system firmware requests timeouts. Since the interrupt routine can take quite some time, it's preferable to move it to a threaded handler and leave the hard interrupt handler wake up the threaded interrupt routine, the interrupt line would be masked until the processing is finished in the thread thanks to the IRQS_ONESHOT flag. When MCQ & ESI interrupts are enabled the I/O completions are now directly handled in the "hard" interrupt routine to keep IOPs high since queues handling is done in separate per-queue interrupt routines. This fixes all encountered issued when running FIO tests on the Qualcomm SM8650 platform. Example of errors reported on a loaded system: [drm:dpu_encoder_frame_done_timeout:2706] [dpu error]enc32 frame done timeout msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1: hangcheck detected gpu lockup rb 2! msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1: completed fence: 74285 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1: submitted fence: 74286 Error sending AMC RPMH requests (-110) Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-3-08bee980f71e@linaro.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 2d6c7bcc6cca63238fce0a95874b053500a1112e Author: Neil Armstrong Date: Mon Apr 7 12:17:04 2025 +0200 scsi: ufs: core: Track when MCQ ESI is enabled In preparation of adding a threaded interrupt handler, track when the MCQ ESI interrupt handlers were installed so we can optimize the MCQ interrupt handling to avoid walking the threaded handler in the case ESI handlers are enabled. Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-2-08bee980f71e@linaro.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 56f4beffc9a056f70e56f53d01451441106bd4ff Author: Neil Armstrong Date: Mon Apr 7 12:17:03 2025 +0200 scsi: ufs: core: Drop last_intr_status/ts stats In order to prepare introduction of a threaded interrupt handler, drop last_intr_status & last_intr_ts drop the ufs_stats struct, and the associated debug code. Suggested-by: Bart Van Assche Reviewed-by: Bart Van Assche Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-1-08bee980f71e@linaro.org Signed-off-by: Martin K. Petersen commit 50dda49835073433840fdffe8c4d7624daf6d9ba Author: Eric Biggers Date: Fri Apr 4 16:15:32 2025 -0700 scsi: ufs: qcom: Add support for wrapped keys Wire up the wrapped key support for ufs-qcom by implementing the needed methods in struct blk_crypto_ll_ops and setting the appropriate flag in blk_crypto_profile::key_types_supported. For more information about this feature and how to use it, refer to the sections about hardware-wrapped keys in Documentation/block/inline-encryption.rst and Documentation/filesystems/fscrypt.rst. Based on patches by Gaurav Kashyap . Reworked to use the custom crypto profile support. Acked-by: Manivannan Sadhasivam Tested-by: Bartosz Golaszewski # sm8650 Signed-off-by: Eric Biggers Link: https://lore.kernel.org/r/20250404231533.174419-4-ebiggers@kernel.org Acked-by: Ulf Hansson # For MMC Signed-off-by: Martin K. Petersen commit 7cc6e0c34b21b6e981afde695132f38e174c7aa5 Author: Gaurav Kashyap Date: Fri Apr 4 16:15:31 2025 -0700 scsi: soc: qcom: ice: Add HWKM support to the ICE driver Qualcomm's Inline Crypto Engine (ICE) version 3.2 and later includes a key management hardware block called the Hardware Key Manager (HWKM). Add support for HWKM to the ICE driver. HWKM provides hardware-wrapped key support where the ICE (storage) keys are not exposed to software and instead are protected in hardware. Later patches will wire up this feature to ufs-qcom and sdhci-msm using the support added in this patch. HWKM and legacy mode are currently mutually exclusive. The selection of which mode to use has to be made before the storage driver(s) registers any inline encryption capable disk(s) with the block layer (i.e., generally at boot time) so that the appropriate crypto capabilities can be advertised to upper layers. Therefore, make the ICE driver select HWKM mode when the all of the following are true: - The new module parameter qcom_ice.use_wrapped_keys=1 is specified. - HWKM is present and is at least v2, i.e. ICE is v3.2.1 or later. - The SCM calls needed to fully use HWKM are supported by TrustZone. [EB: merged related patches; fixed the module parameter to work correctly; dropped unnecessary support for HWKM v1; fixed error handling; improved log messages, comments, and commit message; fixed naming; merged enable and init functions; and other cleanups] Signed-off-by: Gaurav Kashyap Signed-off-by: Bartosz Golaszewski Co-developed-by: Eric Biggers Signed-off-by: Eric Biggers Link: https://lore.kernel.org/r/20250404231533.174419-3-ebiggers@kernel.org Acked-by: Ulf Hansson # For MMC Signed-off-by: Martin K. Petersen commit 11d4c388a38ab6e95a7be82a44a55ecc32cd6a14 Author: Eric Biggers Date: Fri Apr 4 16:15:30 2025 -0700 scsi: soc: qcom: ice: Make qcom_ice_program_key() take struct blk_crypto_key qcom_ice_program_key() currently accepts the key as an array of bytes, algorithm ID, key size enum, and data unit size. However both callers have a struct blk_crypto_key which contains all that information. Thus they both have similar code that converts the blk_crypto_key into the form that qcom_ice_program_key() wants. Once wrapped key support is added, the key type would need to be added to the arguments too. Therefore, this patch changes qcom_ice_program_key() to take in all this information as a struct blk_crypto_key directly. The calling code is updated accordingly. This ends up being much simpler, and it makes the key type be passed down automatically once wrapped key support is added. Based on a patch by Gaurav Kashyap that replaced the byte array argument only. This patch makes the blk_crypto_key replace other arguments like the algorithm ID too, ensuring that there remains only one source of truth. Acked-by: Manivannan Sadhasivam Tested-by: Bartosz Golaszewski # sm8650 Signed-off-by: Eric Biggers Link: https://lore.kernel.org/r/20250404231533.174419-2-ebiggers@kernel.org Acked-by: Konrad Dybcio Acked-by: Ulf Hansson # For MMC Signed-off-by: Martin K. Petersen commit d19dc8d4dfca33f5957422d4a23963ee8fac12f5 Author: Kai Mäkisara Date: Mon Mar 10 17:55:57 2025 +0200 scsi: scsi_debug: Add ERASE for tapes The command ERASE(6) for tape devices is added. Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20250310155557.2872-6-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen commit 34252036774b19f66eb9241e4b0b5a07f3461dbe Author: Kai Mäkisara Date: Mon Mar 10 17:55:56 2025 +0200 scsi: scsi_debug: Use scsi_device->type instead os sdebug_ptype where possible Devices of several types can be created for a single host. The module device type should be used only when the devices are created. Scsi_scan sets the device type initially to 0xff and sets the correct type based in Inquiry results. This means that Inquiry must report sdebug_ptype as long as scsi_device->type is not set (the limit 32 comes from the 5-bit length of the Peripheral Device Type in Inquiry). Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20250310155557.2872-5-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen commit 5b0cb8c984bf68dc98aa02ab534e7ddb47157693 Author: Kai Mäkisara Date: Mon Mar 10 17:55:55 2025 +0200 scsi: scsi_debug: Move some tape-specific commands to separate definitions New definitions (struct opcode_info_t) are created for READ(6), WRITE(6), READ POSITION(10) for tape devices. Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20250310155557.2872-4-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen commit eaa326f5a8e8996711c0cb6d0aa70fa9b2ea38ea Author: Kai Mäkisara Date: Mon Mar 10 17:55:54 2025 +0200 scsi: scsi_debug: Enable different command definitions for different device types Add mask field devsel to the struct opcode_info_t to enable different definitions for different device types. Add checking of device mask to command queuing and reporting of supported opcodes. Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20250310155557.2872-3-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen commit a040adb78005cc35de61318975768c3d82138232 Author: Kai Mäkisara Date: Mon Mar 10 17:55:53 2025 +0200 scsi: scsi_debug: Fix two typos in command definitions Fix two command definitions: - Flags and service action reversed in SEND DIAGNOSTIC - ATOMIC WRITE missing opcode Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20250310155557.2872-2-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen commit 1b4902f0a4f20aaea14d51a378368fa697467901 Author: Chandrakanth Patil Date: Thu Apr 3 01:07:35 2025 +0530 scsi: megaraid_sas: Driver version update to 07.734.00.00-rc1 Signed-off-by: Chandrakanth Patil Link: https://lore.kernel.org/r/20250402193735.5098-2-chandrakanth.patil@broadcom.com Signed-off-by: Martin K. Petersen commit aad9945623ab4029ae7789609fb6166c97976c62 Author: Chandrakanth Patil Date: Thu Apr 3 01:07:34 2025 +0530 scsi: megaraid_sas: Block zero-length ATA VPD inquiry A firmware bug was observed where ATA VPD inquiry commands with a zero-length data payload were not handled and failed with a non-standard status code of 0xf0. Avoid sending ATA VPD inquiry commands without data payload by setting the device no_vpd_size flag to 1. In addition, if the firmware returns a status code of 0xf0, set scsi_cmnd->result to CHECK_CONDITION to facilitate proper error handling. Suggested-by: Martin K. Petersen Signed-off-by: Chandrakanth Patil Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250402193735.5098-1-chandrakanth.patil@broadcom.com Tested-by: Ryan Lahfa Signed-off-by: Martin K. Petersen commit a63b69f05f999acae91b0b50d7c5fe4fb241dbaf Author: Li Haoran Date: Mon Mar 31 15:55:11 2025 +0800 scsi: scsi_transport_srp: Replace min/max nesting with clamp() This patch replaces min(a, max(b, c)) by clamp(val, lo, hi) in the SRP transport layer. The clamp() macro explicitly expresses the intent of constraining a value within bounds, improving code readability. Signed-off-by: Li Haoran Signed-off-by: Shao Mingyin Link: https://lore.kernel.org/r/202503311555115618U8Md16mKpRYOIy2TOmB6@zte.com.cn Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 1fd2e77b889761d9bde0c580518689d1d8e83117 Author: Bao D. Nguyen Date: Fri Mar 28 14:46:13 2025 -0700 scsi: ufs: core: Add device level exception support The ufs device JEDEC specification version 4.1 adds support for the device level exception events. To support this new device level exception feature, expose two new sysfs nodes below to provide the user space access to the device level exception information. /sys/bus/platform/drivers/ufshcd/*/device_lvl_exception_count /sys/bus/platform/drivers/ufshcd/*/device_lvl_exception_id The device_lvl_exception_count sysfs node reports the number of device level exceptions that have occurred since the last time this variable is reset. Writing a value of 0 will reset it. The device_lvl_exception_id reports the exception ID which is the qDeviceLevelExceptionID attribute of the device JEDEC specifications version 4.1 and later. The user space application can query these sysfs nodes to get more information about the device level exception. Signed-off-by: Bao D. Nguyen Link: https://lore.kernel.org/r/6278d7c125b2f0cf5056f4a647a4b9c1fdd24fc7.1743198325.git.quic_nguyenb@quicinc.com Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Reviewed-by: Arthur Simchaev Signed-off-by: Martin K. Petersen commit bdab40480b146e2f37f4c7164cb47f526e77ee6d Author: Bao D. Nguyen Date: Fri Mar 28 13:17:11 2025 -0700 scsi: ufs: core: Rename ufshcd_wb_presrv_usrspc_keep_vcc_on() The ufshcd_wb_presrv_usrspc_keep_vcc_on() function has deviated from its original implementation. The "_keep_vcc_on" part of the function name is misleading. Rename the function to ufshcd_wb_curr_buff_threshold_check() to improve the readability. Also, updated the comments in the function. There is no change to the functionality. Signed-off-by: Bao D. Nguyen Link: https://lore.kernel.org/r/02ae5e133f6ebf23b54d943e6d1d9de2544eb80e.1743192926.git.quic_nguyenb@quicinc.com Reviewed-by: Avri Altman Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit a2d5a0072235a69749ceb04c1a26dc75df66a31a Author: Martin Wilck Date: Fri Mar 21 23:33:19 2025 +0100 scsi: smartpqi: Use is_kdump_kernel() to check for kdump The smartpqi driver checks the reset_devices variable to determine whether special adjustments need to be made for kdump. This has the effect that after a regular kexec reboot, some driver parameters such as max_transfer_size are much lower than usual. More importantly, kexec reboot tests have revealed memory corruption caused by the driver log being written to system memory after a kexec. Fix this by testing is_kdump_kernel() rather than reset_devices where appropriate. Fixes: 058311b72f54 ("scsi: smartpqi: Add fw log to kdump") Signed-off-by: Martin Wilck Link: https://lore.kernel.org/r/20250321223319.109250-1-mwilck@suse.com Cc: Randy Wright Acked-by: Don Brace Tested-by: Don Brace Reviewed-by: Lee Duncan Signed-off-by: Martin K. Petersen commit f7b705c238d1483f0a766e2b20010f176e5c0fb7 Author: Igor Pylypiv Date: Wed Mar 19 23:03:05 2025 +0000 scsi: pm80xx: Set phy_attached to zero when device is gone When a fatal error occurs, a phy down event may not be received to set phy->phy_attached to zero. Signed-off-by: Igor Pylypiv Signed-off-by: Salomon Dushimirimana Link: https://lore.kernel.org/r/20250319230305.3172920-1-salomondush@google.com Signed-off-by: Martin K. Petersen commit cd4c0025069f16fc666c6ffc56c49c9b1154841f Author: Peter Griffin Date: Wed Mar 19 15:30:24 2025 +0000 scsi: ufs: exynos: gs101: Put UFS device in reset on .suspend() GPIO_OUT[0] is connected to the reset pin of embedded UFS device. Before powering off the phy assert the reset signal. This is added as a gs101 specific suspend hook so as not to have any unintended consequences for other SoCs supported by this driver. Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-7-96722cc2ba1b@linaro.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 67e4085015c33bf2fb552af1f171c58b81ef0616 Author: Peter Griffin Date: Wed Mar 19 15:30:23 2025 +0000 scsi: ufs: exynos: Move phy calls to .exit() callback ufshcd_pltfrm_remove() calls ufshcd_remove(hba) which in turn calls ufshcd_hba_exit(). By moving the phy_power_off() and phy_exit() calls to the newly created .exit callback they get called by ufshcd_variant_hba_exit() before ufshcd_hba_exit() turns off the regulators. This is also similar flow to the ufs-qcom driver. Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-6-96722cc2ba1b@linaro.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit deac9ad496ec17e1ec06848964ecc635bdaca703 Author: Peter Griffin Date: Wed Mar 19 15:30:22 2025 +0000 scsi: ufs: exynos: Enable PRDT pre-fetching with UFSHCD_CAP_CRYPTO PRDT_PREFETCH_ENABLE[31] bit should be set when desctype field of fmpsecurity0 register is type2 (double file encryption) or type3 (support for file and disk encryption). Setting this bit enables PRDT pre-fetching on both TXPRDT and RXPRDT. Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-5-96722cc2ba1b@linaro.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 7f05fd9a3b6fb3a9abc5a748307d11831c03175f Author: Peter Griffin Date: Wed Mar 19 15:30:21 2025 +0000 scsi: ufs: exynos: Ensure consistent phy reference counts ufshcd_link_startup() can call ufshcd_vops_link_startup_notify() multiple times when retrying. This causes the phy reference count to keep increasing and the phy to not properly re-initialize. If the phy has already been previously powered on, first issue a phy_power_off() and phy_exit(), before re-initializing and powering on again. Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-4-96722cc2ba1b@linaro.org Fixes: 3d73b200f989 ("scsi: ufs: ufs-exynos: Change ufs phy control sequence") Cc: stable@vger.kernel.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit f92bb7436802f8eb7ee72dc911a33c8897fde366 Author: Peter Griffin Date: Wed Mar 19 15:30:20 2025 +0000 scsi: ufs: exynos: Disable iocc if dma-coherent property isn't set If dma-coherent property isn't set then descriptors are non-cacheable and the iocc shareability bits should be disabled. Without this UFS can end up in an incompatible configuration and suffer from random cache related stability issues. Suggested-by: Bart Van Assche Fixes: cc52e15397cc ("scsi: ufs: ufs-exynos: Support ExynosAuto v9 UFS") Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-3-96722cc2ba1b@linaro.org Cc: Chanho Park Cc: stable@vger.kernel.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 68f5ef7eebf0f41df4d38ea55a54c2462af1e3d6 Author: Peter Griffin Date: Wed Mar 19 15:30:19 2025 +0000 scsi: ufs: exynos: Move UFS shareability value to drvdata gs101 I/O coherency shareability bits differ from exynosauto SoC. To support both SoCs move this info the SoC drvdata. Currently both the value and mask are the same for both gs101 and exynosauto, thus we use the same value. Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-2-96722cc2ba1b@linaro.org Fixes: d11e0a318df8 ("scsi: ufs: exynos: Add support for Tensor gs101 SoC") Cc: stable@vger.kernel.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 3d101165e72316775947d71321d97194f03dfef3 Author: Peter Griffin Date: Wed Mar 19 15:30:18 2025 +0000 scsi: ufs: exynos: Ensure pre_link() executes before exynos_ufs_phy_init() Ensure clocks are enabled before configuring unipro. Additionally move the pre_link() hook before the exynos_ufs_phy_init() calls. This means the register write sequence more closely resembles the ordering of the downstream driver. Signed-off-by: Peter Griffin Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-1-96722cc2ba1b@linaro.org Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen commit 72eea84a1092b50a10eeecfeba4b28ac9f1312ab Author: Miaoqian Lin Date: Tue Mar 18 17:43:43 2025 +0800 scsi: iscsi: Fix missing scsi_host_put() in error path Add goto to ensure scsi_host_put() is called in all error paths of iscsi_set_host_param() function. This fixes a potential memory leak when strlen() check fails. Fixes: ce51c8170084 ("scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20250318094344.91776-1-linmq006@gmail.com Reviewed-by: Mike Christie Signed-off-by: Martin K. Petersen commit 20b97acc4cafa2be8ac91a777de135110e58a90b Author: Bart Van Assche Date: Fri Mar 14 15:51:50 2025 -0700 scsi: ufs: core: Fix a race condition related to device commands There is a TOCTOU race in ufshcd_compl_one_cqe(): hba->dev_cmd.complete may be cleared from another thread after it has been checked and before it is used. Fix this race by moving the device command completion from the stack of the device command submitter into struct ufs_hba. This patch fixes the following kernel crash: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 Call trace: _raw_spin_lock_irqsave+0x34/0x80 complete+0x24/0xb8 ufshcd_compl_one_cqe+0x13c/0x4f0 ufshcd_mcq_poll_cqe_lock+0xb4/0x108 ufshcd_intr+0x2f4/0x444 __handle_irq_event_percpu+0xbc/0x250 handle_irq_event+0x48/0xb0 Fixes: 5a0b0cb9bee7 ("[SCSI] ufs: Add support for sending NOP OUT UPIU") Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20250314225206.1487838-1-bvanassche@acm.org Reviewed-by: Peter Wang Signed-off-by: Martin K. Petersen commit daff37f00c7506ca322ccfce95d342022f06ec58 Author: Xingui Yang Date: Wed Mar 12 17:51:35 2025 +0800 scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes The hw port ID of phy may change when inserting disks in batches, causing the port ID in hisi_sas_port and itct to be inconsistent with the hardware, resulting in I/O errors. The solution is to set the device state to gone to intercept I/O sent to the device, and then execute linkreset to discard and find the disk to re-update its information. Signed-off-by: Xingui Yang Link: https://lore.kernel.org/r/20250312095135.3048379-3-yangxingui@huawei.com Signed-off-by: Martin K. Petersen commit 8aa580cd92843b60d4d6331f3b0a9e8409bb70eb Author: Xingui Yang Date: Wed Mar 12 17:51:34 2025 +0800 scsi: hisi_sas: Enable force phy when SATA disk directly connected when a SATA disk is directly connected the SAS controller determines the disk to which I/Os are delivered based on the port ID in the DQ entry. When many phys are disconnected and reconnect, the port ID of phys were changed and used by other link, resulting in I/O being sent to incorrect disk. Data inconsistency on the SATA disk may occur during I/O retries using the old port ID. So enable force phy, then force the command to be executed in a certain phy, and if the actual phy ID of the port does not match the phy configured in the command, the chip will stop delivering the I/O to disk. Fixes: ce60689e12dd ("scsi: hisi_sas: add v3 code to send ATA frame") Signed-off-by: Xingui Yang Link: https://lore.kernel.org/r/20250312095135.3048379-2-yangxingui@huawei.com Reviewed-by: Yihang Li Signed-off-by: Martin K. Petersen