Peter Oberparleiter [Tue, 3 Jun 2025 18:21:56 +0000 (20:21 +0200)]
scsi: s390: zfcp: Ensure synchronous unit_add
Improve the usability of the unit_add sysfs attribute by ensuring that
the associated FCP LUN scan processing is completed synchronously. This
enables configuration tooling to consistently determine the end of the
scan process to allow for serialization of follow-on actions.
While the scan process associated with unit_add typically completes
synchronously, it is deferred to an asynchronous background process if
unit_add is used before initial remote port scanning has completed. This
occurs when unit_add is used immediately after setting the associated FCP
device online.
To ensure synchronous unit_add processing, wait for remote port scanning
to complete before initiating the FCP LUN scan.
Cc: stable@vger.kernel.org
Reviewed-by: M Nikhil <nikh1092@linux.ibm.com>
Reviewed-by: Nihar Panda <niharp@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
Link: https://lore.kernel.org/r/20250603182252.2287285-2-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Alok Tiwari [Fri, 30 May 2025 19:29:35 +0000 (12:29 -0700)]
scsi: iscsi: Fix incorrect error path labels for flashnode operations
Correct the error handling goto labels used when host lookup fails in
various flashnode-related event handlers:
- iscsi_new_flashnode()
- iscsi_del_flashnode()
- iscsi_login_flashnode()
- iscsi_logout_flashnode()
- iscsi_logout_flashnode_sid()
scsi_host_put() is not required when shost is NULL, so jumping to the
correct label avoids unnecessary operations. These functions previously
jumped to the wrong goto label (put_host), which did not match the
intended cleanup logic.
Use the correct exit labels (exit_new_fnode, exit_del_fnode, etc.) to
ensure proper error handling. Also remove the unused put_host label
under iscsi_new_flashnode() as it is no longer needed.
No functional changes beyond accurate error path correction.
Fixes:
c6a4bb2ef596 ("[SCSI] scsi_transport_iscsi: Add flash node mgmt support")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://lore.kernel.org/r/20250530193012.3312911-1-alok.a.tiwari@oracle.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ankit Chauhan [Wed, 28 May 2025 11:06:04 +0000 (16:36 +0530)]
scsi: mvsas: Fix typos in per-phy comments and SAS cmd port registers
Spelling fixes:
Deocder --> Decoder
Memroy --> Memory
This is a non-functional change aimed at improving code clarity.
Signed-off-by: Ankit Chauhan <ankitchauhan2065@gmail.com>
Link: https://lore.kernel.org/r/20250528110604.59528-1-ankitchauhan2065@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Sanjeev Yadav [Fri, 23 May 2025 20:14:01 +0000 (13:14 -0700)]
scsi: core: ufs: Fix a hang in the error handler
ufshcd_err_handling_prepare() calls ufshcd_rpm_get_sync(). The latter
function can only succeed if UFSHCD_EH_IN_PROGRESS is not set because
resuming involves submitting a SCSI command and ufshcd_queuecommand()
returns SCSI_MLQUEUE_HOST_BUSY if UFSHCD_EH_IN_PROGRESS is set. Fix this
hang by setting UFSHCD_EH_IN_PROGRESS after ufshcd_rpm_get_sync() has
been called instead of before.
Backtrace:
__switch_to+0x174/0x338
__schedule+0x600/0x9e4
schedule+0x7c/0xe8
schedule_timeout+0xa4/0x1c8
io_schedule_timeout+0x48/0x70
wait_for_common_io+0xa8/0x160 //waiting on START_STOP
wait_for_completion_io_timeout+0x10/0x20
blk_execute_rq+0xe4/0x1e4
scsi_execute_cmd+0x108/0x244
ufshcd_set_dev_pwr_mode+0xe8/0x250
__ufshcd_wl_resume+0x94/0x354
ufshcd_wl_runtime_resume+0x3c/0x174
scsi_runtime_resume+0x64/0xa4
rpm_resume+0x15c/0xa1c
__pm_runtime_resume+0x4c/0x90 // Runtime resume ongoing
ufshcd_err_handler+0x1a0/0xd08
process_one_work+0x174/0x808
worker_thread+0x15c/0x490
kthread+0xf4/0x1ec
ret_from_fork+0x10/0x20
Signed-off-by: Sanjeev Yadav <sanjeev.y@mediatek.com>
[ bvanassche: rewrote patch description ]
Fixes:
62694735ca95 ("[SCSI] ufs: Add runtime PM support for UFS host controller driver")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250523201409.1676055-1-bvanassche@acm.org
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Nitin Rawat [Mon, 26 May 2025 15:38:12 +0000 (21:08 +0530)]
scsi: ufs: qcom: Prevent calling phy_exit() before phy_init()
Prevent calling phy_exit() before phy_init() to avoid abnormal power
count and the following warning during boot up.
[5.146763] phy phy-
1d80000.phy.0: phy_power_on was called before phy_init
Fixes:
7bac65687510 ("scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()")
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Link: https://lore.kernel.org/r/20250526153821.7918-2-quic_nitirawa@quicinc.com
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 22 May 2025 02:15:37 +0000 (10:15 +0800)]
scsi: ufs: qcom: Call ufs_qcom_cfg_timers() in clock scaling path
ufs_qcom_cfg_timers() is clock freq dependent like
ufs_qcom_set_core_clk_ctrl(), hence move ufs_qcom_cfg_timers() call to
clock scaling path. In addition, do not assume the devfreq OPP freq is
always the 'core_clock' freq although 'core_clock' is the first clock
phandle in device tree, use ufs_qcom_opp_freq_to_clk_freq() to find the
core clk freq.
Signed-off-by: Can Guo <quic_cang@quicinc.com>
Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Link: https://lore.kernel.org/r/20250522021537.999107-4-quic_ziqichen@quicinc.com
Reported-by: Luca Weiss <luca.weiss@fairphone.com>
Closes: https://lore.kernel.org/linux-arm-msm/D9FZ9U3AEXW4.1I12FX3YQ3JPW@fairphone.com/
Tested-by: Luca Weiss <luca.weiss@fairphone.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Tested-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 22 May 2025 02:15:36 +0000 (10:15 +0800)]
scsi: ufs: qcom: Map devfreq OPP freq to UniPro Core Clock freq
On some platforms, the devfreq OPP freq may be different than the unipro
core clock freq. Implement ufs_qcom_opp_freq_to_clk_freq() and use it to
find the unipro core clk freq.
Fixes:
c02fe9e222d1 ("scsi: ufs: qcom: Implement the freq_to_gear_speed() vop")
Signed-off-by: Can Guo <quic_cang@quicinc.com>
Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Link: https://lore.kernel.org/r/20250522021537.999107-3-quic_ziqichen@quicinc.com
Reported-by: Luca Weiss <luca.weiss@fairphone.com>
Closes: https://lore.kernel.org/linux-arm-msm/D9FZ9U3AEXW4.1I12FX3YQ3JPW@fairphone.com/
Tested-by: Luca Weiss <luca.weiss@fairphone.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Tested-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ziqi Chen [Thu, 22 May 2025 02:15:35 +0000 (10:15 +0800)]
scsi: ufs: qcom: Check gear against max gear in vop freq_to_gear()
The vop freq_to_gear() may return a gear greater than the negotiated max
gear. Return the negotiated max gear if the mapped gear is greater.
Fixes:
c02fe9e222d1 ("scsi: ufs: qcom: Implement the freq_to_gear_speed() vop")
Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
Link: https://lore.kernel.org/r/20250522021537.999107-2-quic_ziqichen@quicinc.com
Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
Closes: https://lore.kernel.org/all/
c7f2476a-943a-4d73-ad80-
802c91e5f880@linaro.org/
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Tested-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Tomas Henzl [Wed, 21 May 2025 16:51:48 +0000 (18:51 +0200)]
scsi: aacraid: Remove useless code
There isn't a AAC_MIN_NATIVE_SIZE defined so remove eight useless lines.
When at it remove also an unused #define
No functional change.
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20250521165148.8856-1-thenzl@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
mrigendrachaubey [Sat, 24 May 2025 03:55:16 +0000 (09:25 +0530)]
scsi: core: devinfo: Fix typo in comment
Correct a minor typo in a comment within scsi_devinfo.c, replacing
"compatibile" with the correct spelling "compatible".
Signed-off-by: mrigendrachaubey <mrigendra.chaubey@gmail.com>
Link: https://lore.kernel.org/r/20250524035516.27341-1-mrigendra.chaubey@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ziqi Chen [Thu, 22 May 2025 08:12:28 +0000 (16:12 +0800)]
scsi: ufs: core: Don't perform UFS clkscaling during host async scan
When preparing for UFS clock scaling, the UFS driver will quiesce all
sdevs queues in the UFS SCSI host tagset list and then unquiesce them in
ufshcd_clock_scaling_unprepare(). If the UFS SCSI host async scan is in
progress at this time, some LUs may be added to the tagset list between
UFS clkscale prepare and unprepare. This can cause two issues:
1. During clock scaling, there may be I/O requests issued through new
added queues that have not been quiesced, leading to task abort issue.
2. These new added queues that have not been quiesced will be unquiesced
as well when UFS clkscale is unprepared, resulting in warning prints.
Therefore, use the mutex lock scan_mutex in
ufshcd_clock_scaling_prepare() and ufshcd_clock_scaling_unprepare() to
protect it.
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/20250522081233.2358565-1-quic_ziqichen@quicinc.com
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christophe JAILLET [Sun, 18 May 2025 18:26:43 +0000 (20:26 +0200)]
scsi: target: core: Constify struct target_opcode_descriptor
Instances of 'struct target_opcode_descriptor' are not modified in this
driver.
Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.
On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
53602 19750 0 73352 11e88 drivers/target/target_core_spc.o
After:
=====
text data bss dec hex filename
58594 14758 0 73352 11e88 drivers/target/target_core_spc.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/889ee46e75db33e8ab997a627a1d3d651ad648db.1747592774.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christophe JAILLET [Sun, 18 May 2025 18:26:42 +0000 (20:26 +0200)]
scsi: target: core: Constify enabled() in struct target_opcode_descriptor
Constify the first argument of the enabled() function in struct
target_opcode_descriptor.
This is the first step in order to constify struct
target_opcode_descriptor.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/4290cf1dbe100c1b1edf2ede5e5aef19b04ee7f2.1747592774.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yihang Li [Thu, 15 May 2025 01:35:04 +0000 (09:35 +0800)]
scsi: hisi_sas: Fix warning detected by sparse
LKP reports below warning when building for RISC-V with randconfig
configuration.
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:4554:25: sparse:
sparse: incorrect type in argument 4 (different base types)
@@ expected restricted __le32 [usertype] *[assigned] ptr
@@ got unsigned int * @@
Type cast to fix this warning.
Fixes:
4ca7fe99fc84 ("scsi: hisi_sas: Use macro instead of magic number")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202505150705.k9ZzMxf1-lkp@intel.com/
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250515013504.3234016-1-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Shivasharan S [Wed, 14 May 2025 09:09:41 +0000 (02:09 -0700)]
scsi: mpt3sas: Fix _ctl_get_mpt_mctp_passthru_adapter() to return IOC pointer
Fix _ctl_get_mpt_mctp_passthru_adapter() to return the correct IOC
pointer to caller based on dev_index.
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Link: https://lore.kernel.org/r/1747213781-31545-1-git-send-email-shivasharan.srikanteshwara@broadcom.com
Fixes:
c72be4b5bb7c ("scsi: mpt3sas: Add support for MCTP Passthrough commands")
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chen Ni [Wed, 14 May 2025 03:28:45 +0000 (11:28 +0800)]
scsi: sg: Remove unnecessary NULL check before unregister_sysctl_table()
unregister_sysctl_table() checks for NULL pointers internally. Remove
unneeded NULL check here.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://lore.kernel.org/r/20250514032845.2317700-1-nichen@iscas.ac.cn
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
ping.gao [Fri, 16 May 2025 08:38:12 +0000 (16:38 +0800)]
scsi: ufs: mcq: Delete ufshcd_release_scsi_cmd() in ufshcd_mcq_abort()
After UFS_ABORT_TASK has been processed successfully, the host will
generate MCQ IRQ for ABORT TAG with response OCS_ABORTED. This results in
ufshcd_compl_one_cqe() calling ufshcd_release_scsi_cmd().
But ufshcd_mcq_abort() already calls ufshcd_release_scsi_cmd(), resulting
in __ufshcd_release() being called twice. This means
hba->clk_gating.active_reqs will be decreased twice, making it go
negative.
Delete ufshcd_release_scsi_cmd() in ufshcd_mcq_abort().
Fixes:
f1304d442077 ("scsi: ufs: mcq: Added ufshcd_mcq_abort()")
Signed-off-by: ping.gao <ping.gao@samsung.com>
Link: https://lore.kernel.org/r/20250516083812.3894396-1-ping.gao@samsung.com
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Nitin Rawat [Thu, 27 Mar 2025 20:54:28 +0000 (13:54 -0700)]
scsi: ufs: qcom: dt-bindings: Document the SM8750 UFS Controller
Document the UFS Controller on the SM8750 Platform.
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Signed-off-by: Melody Olvera <melody.olvera@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250327-sm8750_ufs_master-v3-1-bad1f5398d0a@oss.qualcomm.com
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Alok Tiwari [Sat, 17 May 2025 19:24:10 +0000 (12:24 -0700)]
scsi: mvsas: Fix typos in SAS/SATA VSP register comments
Correct spelling mistakes of the SAS/SATA Vendor Specific Port Registers.
Fixed "Vednor" to "Vendor" in VSR_PHY_VS0 and VSR_PHY_VS1 comments. This
is a non-functional change aimed at improving code clarity.
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://lore.kernel.org/r/20250517192422.310489-1-alok.a.tiwari@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chen Ni [Mon, 19 May 2025 08:54:57 +0000 (16:54 +0800)]
scsi: fnic: Replace memset() with eth_zero_addr()
Use eth_zero_addr() to assign the zero address to the given address array
instead of memset() when second argument is address of zero.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://lore.kernel.org/r/20250519085457.918720-1-nichen@iscas.ac.cn
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Peter Wang [Sat, 10 May 2025 08:01:01 +0000 (16:01 +0800)]
scsi: ufs: core: Support updating device command timeout
The default device command timeout remains 1.5 seconds, but platform
drivers can override it if needed.
Some UFS device commands may timeout due to being blocked by regular SCSI
write commands. Therefore, the maximum timeout needs to be extended to 30
seconds, matching the SCSI write command timeout. And for error injection
purposes, set the minimum value to 1 ms.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250510080345.595798-1-peter.wang@mediatek.com
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Peter Wang [Fri, 9 May 2025 02:16:12 +0000 (10:16 +0800)]
scsi: ufs: core: Change hwq_id type and value
Change the type of hwq_id to u32 because the member id of struct
ufs_hw_queue is u32 (hwq->id) and the trace entry hwq_id is also u32.
Set hwq_id to 0 if MCQ is not supported, as SDB mode only supports one
hardware queue.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250509021648.412098-1-peter.wang@mediatek.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Thu, 8 May 2025 16:54:03 +0000 (09:54 -0700)]
scsi: ufs: core: Increase the UIC command timeout further
On my development board I observed that it can take a little longer than
two seconds before UIC completions are processed if the UART is enabled.
Hence this patch that increases the UIC command timeout upper limit
further.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250508165411.3755300-1-bvanassche@acm.org
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Benjamin Block [Wed, 7 May 2025 04:28:07 +0000 (06:28 +0200)]
scsi: zfcp: Simplify workqueue allocation
alloc_ordered_workqueue() accepts a format string and format arguments as
part of the call, so there is no need for the indirection of first using
snprintf() to print the name into an local array, and then passing that
array to the allocation call.
Also make the error-/non-error-case handling more canonical in that the
error case is tested in the 'if' that follows the allocation call, and
the default return value of the function is '0'.
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: M Nikhil <nikh1092@linux.ibm.com>
Reviewed-by: Nihar Panda <niharp@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
Link: https://lore.kernel.org/r/20250507042854.3607038-3-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Wonkon Kim [Mon, 12 May 2025 02:52:10 +0000 (11:52 +0900)]
scsi: ufs: core: Print error value as hex format in ufshcd_err_handler()
It is better to print saved_err and saved_uic_err in hex format. Integer
format is hard to decode.
[ 1024.485428] [2: kworker/u20:13:28211] exynos-ufs
17100000.ufs: ufshcd_err_handler started; HBA state eh_fatal; powered 1; shutting down 0; saved_err = 131072; saved_uic_err = 0; force_reset = 0; link is broken
Signed-off-by: Wonkon Kim <wkon.kim@samsung.com>
Link: https://lore.kernel.org/r/20250512025210.5802-1-wkon.kim@samsung.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig [Mon, 5 May 2025 06:06:37 +0000 (08:06 +0200)]
scsi: sd: Remove the stream_status member from scsi_stream_status_header
Having a variable length array at the end of scsi_stream_status_header
only causes problems. Remove it and switch sd_is_perm_stream(), which is
the only place that currently uses it, to use the scsi_stream_status
directly following it in the local buf structure.
Besides being a much better data structure design, this also avoids a
-Wflex-array-member-not-at-end warning.
Reported-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250505060640.3398500-1-hch@lst.de
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Randy Dunlap [Fri, 2 May 2025 01:51:36 +0000 (18:51 -0700)]
scsi: docs: Clean up some style in scsi_mid_low_api
Capitalize Linux but not "kernel."
Spell out Linux instead of using "lk".
Hyphenate "system-wide."
Hyphenate "32-bit".
End a sentence with a period (full stop).
Change "double linked" to "doubly linked" list.
Use SCSI or scsi but not Scsi.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20250502015136.683691-1-rdunlap@infradead.org
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Sat, 3 May 2025 23:07:42 +0000 (00:07 +0100)]
scsi: core: Remove unused scsi_dev_info_list_del_keyed()
The last use of scsi_dev_info_list_del_keyed() was removed by 2011's
commit
2b132577a05e ("[SCSI] scsi_dh: code cleanup and remove the
references to scsi_dev_info")
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250503230743.124978-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Sat, 3 May 2025 23:06:01 +0000 (00:06 +0100)]
scsi: isci: Remove unused sci_remote_device_reset()
sci_remote_device_reset() last use was removed in 2012 by commit
14aaa9f0a318 ("isci: Redesign device suspension, abort, cleanup.")
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250503230601.124794-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Thu, 1 May 2025 10:02:41 +0000 (10:02 +0000)]
scsi: scsi_debug: Reduce DEF_ATOMIC_WR_MAX_LENGTH
The default atomic write max length in DEF_ATOMIC_WR_MAX_LENGTH is
excessively large.
For 512B LBS, we would get a 4MB max, but due to block layer atomic write
restrictions this is limited to 512KB.
Reduce DEF_ATOMIC_WR_MAX_LENGTH to a value which would be more realistic
(for a real device supporting atomic writes), 64KB.
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20250501100241.930071-1-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Wed, 30 Apr 2025 08:09:16 +0000 (11:09 +0300)]
scsi: smartpqi: Delete a stray tab in pqi_is_parity_write_stream()
We accidentally indented this line an extra tab. Delete the tab.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Don Brace <Don.Brace@microchip.com>
Link: https://lore.kernel.org/r/aBHarJ601XTGsyOX@stanley.mountain
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Nathan Chancellor [Wed, 30 Apr 2025 00:46:49 +0000 (17:46 -0700)]
scsi: dc395x: Remove leftover if statement in reselect()
Clang warns (or errors with CONFIG_WERROR=y):
drivers/scsi/dc395x.c:2553:6: error: variable 'id' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
2553 | if (!(rsel_tar_lun_id & (IDENTIFY_BASE << 8)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/dc395x.c:2556:22: note: uninitialized use occurs here
2556 | dcb = find_dcb(acb, id, lun);
| ^~
drivers/scsi/dc395x.c:2553:2: note: remove the 'if' if its condition is always true
2553 | if (!(rsel_tar_lun_id & (IDENTIFY_BASE << 8)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2554 | id = rsel_tar_lun_id & 0xff;
This if statement only existed for a debugging print but it was not
removed with the debugging print in a recent cleanup, leading to id only
being initialized when the if condition is true. Remove the if statement
to ensure id is always initialized, clearing up the warning.
Fixes:
62b434b0db2c ("scsi: dc395x: Remove DEBUG conditional compilation")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250429-scsi-dc395x-fix-uninit-var-v1-1-25215d481020@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 29 Apr 2025 02:01:20 +0000 (22:01 -0400)]
Merge patch series "scsi: ufs-qcom: Enable Hibern8, MCQ, and Testbus registers Dump"
Manish Pandey <quic_mapa@quicinc.com> says:
Adding support to enhance the debugging capabilities of the Qualcomm
UFS Host Controller, including HW and SW Hibern8 counts, MCQ
registers, and testbus registers dump.
Link: https://lore.kernel.org/r/20250411121345.16859-1-quic_mapa@quicinc.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manish Pandey [Fri, 11 Apr 2025 12:13:45 +0000 (17:43 +0530)]
scsi: ufs: ufs-qcom: Add support to dump testbus registers
Add support to dump testbus registers to enhance debugging capabilities
for the Qualcomm UFS Host Controller.
Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121345.16859-4-quic_mapa@quicinc.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manish Pandey [Fri, 11 Apr 2025 12:13:44 +0000 (17:43 +0530)]
scsi: ufs: ufs-qcom: Add support to dump MCQ registers
Add support to dump UFS MCQ registers to enhance debugging capabilities
for the Qualcomm UFS Host Controller.
Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121345.16859-3-quic_mapa@quicinc.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manish Pandey [Fri, 11 Apr 2025 12:13:43 +0000 (17:43 +0530)]
scsi: ufs: ufs-qcom: Add support to dump HW and SW hibern8 count
Add support to dump HW and SW hibern8 enter and exit counts to enhance
the debugging of hibern8 state transitions.
Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121345.16859-2-quic_mapa@quicinc.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ranjan Kumar [Wed, 23 Apr 2025 09:21:39 +0000 (14:51 +0530)]
scsi: mpi3mr: Event processing debug improvement
Improve event process debugging. Implement more verbose event logging
throughout the driver.
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250423092139.110206-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 29 Apr 2025 01:48:37 +0000 (21:48 -0400)]
Merge patch series "target: Remove atomics from main IO path"
Mike Christie <michael.christie@oracle.com> says:
The following patches made over Linus's tree remove the atomic use from
the main IO path. There was a handful of atomic_longs used just used
for stats and a couple atomics used for handling ordered commands. These
patches move the stats to per cpu, and moves the ordered tracking to a
per cpu counter.
With the patches 8K IOPS increases by up to 33% when running fio
with numjobs >= 4 and using the vhost-scsi target with virtio-scsi
and virtio num_queues >= 4 (jobs and queues match, and virtqueue_size
and cmd_per_lun are increased to match the total iodepth of all
jobs).
Link: https://lore.kernel.org/r/20250424032741.16216-1-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 24 Apr 2025 03:26:33 +0000 (22:26 -0500)]
scsi: target: Move delayed/ordered tracking to per CPU
The atomic use from the delayed/ordered tracking is causing perf issues
when using higher perf backend devices and multiple queues. This moves
the values to a per CPU counter. Combined with the per CPU stats patch,
this improves IOPS by up to 33% for 8K IOS when using 4 or more queues
from the initiator.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20250424032741.16216-3-michael.christie@oracle.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 24 Apr 2025 03:26:32 +0000 (22:26 -0500)]
scsi: target: Move I/O path stats to per CPU
The atomic use in the main I/O path is causing perf issues when using
higher performance backend devices and multiple queues. This moves the
stats to per CPU. Combined with the next patch that moves the
non_ordered/delayed_cmd_count to per CPU, IOPS by up to 33% for 8K IOS
when using 4 or more queues.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20250424032741.16216-2-michael.christie@oracle.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 29 Apr 2025 01:44:03 +0000 (21:44 -0400)]
Merge patch series "smartpqi updates"
Don Brace <don.brace@microchip.com> says:
These patches are based on Martin Petersen's 6.16/scsi-queue tree
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
6.16/scsi-queue
There are two main functional changes in this patch series:
smartpqi-take-drives-offline-when-controller-is-offline
smartpqi-fix-smp_processor_id-call-trace-for-preemptible-kernels
The other two patches add PCI-IDs for new controllers and change the
driver version.
This set of changes consists of:
* smartpqi-take-drives-offline-when-controller-is-offline
On rare occasions, the controller can lock up and the driver was
removing the controller instance from OS but leaving the
drives exposed and their state was still 'running'.
This patch sets the drive state as 'offline' to avoid confusion.
* smartpqi-add-new-pci_ids
Add support for more PCI devices.
* smartpqi-enhance_wwid-logging-logic
Cosmetic change for logging WWIDs for NVMe devices and for drives
that support the extended format.
* smartpqi-fix-smp_processor_id-call-trace-for-preemptible-kernels
When preemption is enabled, there are call traces in the console
logs which are annoying. The call trace mentions using
smp_processor_id(). Since the driver is only using this function call
when accessing a per_cpu variable, we changed the call to
raw_smp_processor_id(). This patch was written by
Yi Zhang <yi.zhang@redhat.com> and I am posting it on his behalf.
* smartpqi-update-driver-version-to-2.1.34-035
No functional changes.
Link: https://lore.kernel.org/r/20250423183229.538572-1-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Wed, 23 Apr 2025 18:32:29 +0000 (13:32 -0500)]
scsi: smartpqi: Update driver version to 2.1.34-035
Update driver version to 2.1.34-035.
Reviewed-by: Gerry Morong <gerry.morong@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20250423183229.538572-6-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yi Zhang [Wed, 23 Apr 2025 18:32:28 +0000 (13:32 -0500)]
scsi: smartpqi: Fix smp_processor_id() call trace for preemptible kernels
Correct kernel call trace when calling smp_processor_id() when called in
preemptible kernels by using raw_smp_processor_id().
smp_processor_id() checks to see if preemption is disabled and if not,
issue an error message followed by a call to dump_stack().
Brief example of call trace:
kernel: check_preemption_disabled: 436 callbacks suppressed
kernel: BUG: using smp_processor_id() in preemptible [
00000000]
code: kworker/u1025:0/2354
kernel: caller is pqi_scsi_queue_command+0x183/0x310 [smartpqi]
kernel: CPU: 129 PID: 2354 Comm: kworker/u1025:0
kernel: ...
kernel: Workqueue: writeback wb_workfn (flush-253:0)
kernel: Call Trace:
kernel: <TASK>
kernel: dump_stack_lvl+0x34/0x48
kernel: check_preemption_disabled+0xdd/0xe0
kernel: pqi_scsi_queue_command+0x183/0x310 [smartpqi]
kernel: ...
Fixes:
283dcc1b142e ("scsi: smartpqi: add counter for parity write stream requests")
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Tested-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20250423183229.538572-5-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Venkatesh Emparala [Wed, 23 Apr 2025 18:32:27 +0000 (13:32 -0500)]
scsi: smartpqi: Enhance WWID logging logic
Log the extended WWID for NVMe devices and for devices that have the
firmware feature bit "PQI_FIRMWARE_FEATURE_RPL_EXTENDED_FORMAT_4_5"
enabled.
Log 8-bytes otherwise.
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Venkatesh Emparala <Venkatesh.Emparala@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20250423183229.538572-4-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
David Strahan [Wed, 23 Apr 2025 18:32:26 +0000 (13:32 -0500)]
scsi: smartpqi: Add new PCI IDs
Add in support for more PCI devices.
All PCI ID entries in Hex.
Add PCI IDs for Ramaxel controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
Ramaxel SmartHBA RX8238-16i 9005 028f 1018 8238
Ramaxel SSSRAID card 9005 028f 1f3f 0610
Add PCI ID for Alibaba controller:
VID / DID / SVID / SDID
---- ---- ---- ----
HBA AS1340 9005 028f 1ded 3301
Add PCI IDs for Inspur controller:
VID / DID / SVID / SDID
---- ---- ---- ----
RT0800M6E2i 9005 028f 1bd4 00a3
Add PCI IDs for Delta controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
ThinkSystem 4450-8i SAS/SATA/NVMe PCIe Gen4 9005 028f 1d49 0222
24Gb HBA
ThinkSystem 4450-16i SAS/SATA/NVMe PCIe Gen4 9005 028f 1d49 0223
24Gb HBA
ThinkSystem 4450-8e SAS/SATA PCIe Gen4 9005 028f 1d49 0224
24Gb HBA
ThinkSystem RAID 4450-16e PCIe Gen4 24Gb 9005 028f 1d49 0225
Adapter HBA
ThinkSystem RAID 5450-16i PCIe Gen4 24Gb Adapter 9005 028f 1d49 0521
ThinkSystem RAID 9450-8i 4GB Flash PCIe Gen4 9005 028f 1d49 0624
24Gb Adapter
ThinkSystem RAID 9450-16i 4GB Flash PCIe Gen4 9005 028f 1d49 0625
24Gb Adapter
ThinkSystem RAID 9450-16i 4GB Flash PCIe Gen4 9005 028f 1d49 0626
24Gb Adapter
ThinkSystem RAID 9450-32i 8GB Flash PCIe Gen4 9005 028f 1d49 0627
24Gb Adapter
ThinkSystem RAID 9450-16e 4GB Flash PCIe Gen4 9005 028f 1d49 0628
24Gb Adapter
Add PCI ID for Cloudnine Controller:
VID / DID / SVID / SDID
---- ---- ---- ----
SmartHBA P6600-24i 9005 028f 1f51 100b
Add PCI IDs for Hurraydata Controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
HRDT TrustHBA H4100-8i 9005 028f 207d 4044
HRDT TrustHBA H4100-8e 9005 028f 207d 4054
HRDT TrustHBA H4100-16i 9005 028f 207d 4084
HRDT TrustHBA H4100-16e 9005 028f 207d 4094
HRDT TrustRAID D3152s-8i 9005 028f 207d 4140
HRDT TrustRAID D3154s-8i 9005 028f 207d 4240
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: David Strahan <david.strahan@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20250423183229.538572-3-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
David Strahan [Wed, 23 Apr 2025 18:32:25 +0000 (13:32 -0500)]
scsi: smartpqi: Take drives offline when controller is offline
During a controller lockup, the physical and logical drives under the
locked up controller are still listed at the OS level. I.e. the
controller is offline but the status of each drive is 'running'.
When the controller is unexpectedly taken offline, show its drives as
offline.
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: David Strahan <david.strahan@microchip.com>
Co-developed-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20250423183229.538572-2-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 29 Apr 2025 01:38:51 +0000 (21:38 -0400)]
Merge patch series "Update lpfc to revision 14.4.0.9"
Justin Tee <justintee8345@gmail.com> says:
Update lpfc to revision 14.4.0.9
This patch set contains fixes related to handling of WQE commands, PCI
function resets, firmware eratta events, ELS retries, a smatch
use-after-free warning, and the creation of a new VMID information entry.
The patches were cut against Martin's 6.16/scsi-queue tree.
Link: https://lore.kernel.org/r/20250425194806.3585-1-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:06 +0000 (12:48 -0700)]
scsi: lpfc: Copyright updates for 14.4.0.9 patches
Update copyrights to 2025 for files modified in the 14.4.0.9 patch set.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-9-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:05 +0000 (12:48 -0700)]
scsi: lpfc: Update lpfc version to 14.4.0.9
Update lpfc version to 14.4.0.9
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-8-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:04 +0000 (12:48 -0700)]
scsi: lpfc: Create lpfc_vmid_info sysfs entry
A vmid_info sysfs entry is created as a convenience designed for users to
obtain VMID information without having to log into fabrics for similar
info.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-7-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:03 +0000 (12:48 -0700)]
scsi: lpfc: Avoid potential ndlp use-after-free in dev_loss_tmo_callbk
Smatch detected a potential use-after-free of an ndlp oject in
dev_loss_tmo_callbk during driver unload or fatal error handling.
Fix by reordering code to avoid potential use-after-free if initial
nodelist reference has been previously removed.
Fixes:
4281f44ea8bf ("scsi: lpfc: Prevent NDLP reference count underflow in dev_loss_tmo callback")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-scsi/
41c1d855-9eb5-416f-ac12-
8b61929201a3@stanley.mountain/
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-6-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:02 +0000 (12:48 -0700)]
scsi: lpfc: Prevent failure to reregister with NVMe transport after PRLI retry
A failure to unregister with the NVMe transport may occur when a PRLI is
retried.
Remove duplicate testing of NLP_NVME_TARGET flag. Add a secondary check
of the registered state based on the nrport information. Further qualify
the ndlp reference count modification when nvme_fc_register_remoteport()
returns an error.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:01 +0000 (12:48 -0700)]
scsi: lpfc: Restart eratt_poll timer if HBA_SETUP flag still unset
Reschedule the eratt_poll timer if the HBA_SETUP flag isn’t set yet. The
eratt_poll timer should only be cancelled if FC_UNLOADING flag is set or
if lpfc_stop_hba_timers() is called as part of error, reset, or offline
handling.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-4-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:48:00 +0000 (12:48 -0700)]
scsi: lpfc: Notify FC transport of rport disappearance during PCI fcn reset
A PCI function reset implies a temporary disappearance of a fc_rport.
So, call lpfc_scsi_dev_block(), which sets all mapped fc_rports into the
temporary FC_PORTSTATE_BLOCKED state. Once PCI function reset completes
and link reinitialized, the fc_rport is rediscovered and
FC_PORTSTATE_BLOCKED state is removed.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-3-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Justin Tee [Fri, 25 Apr 2025 19:47:59 +0000 (12:47 -0700)]
scsi: lpfc: Fix lpfc_check_sli_ndlp() handling for GEN_REQUEST64 commands
In lpfc_check_sli_ndlp(), the get_job_els_rsp64_did remote_id assignment
does not apply for GEN_REQUEST64 commands as it only has meaning for a
ELS_REQUEST64 command. So, if (iocb->ndlp == ndlp) is false, we could
erroneously return the wrong value. Fix by replacing the fallthrough
statement with a break statement before the remote_id check.
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kees Cook [Sat, 26 Apr 2025 06:20:11 +0000 (23:20 -0700)]
scsi: qla4xxx: Remove duplicate struct crb_addr_pair
In preparation for making the kmalloc family of allocators type aware, we
need to make sure that the returned type from the allocation matches the
type of the variable being assigned. (Before, the allocator would always
return "void *", which can be implicitly cast to any pointer type.)
The assigned type is "struct crb_addr_pair *" and the returned type will
be a _different_ "struct crb_addr_pair *", causing a warning. This really
stumped me for a bit. :) Drop the redundant declaration.
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250426062010.work.878-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kees Cook [Sat, 26 Apr 2025 06:19:52 +0000 (23:19 -0700)]
scsi: qla2xxx: Remove duplicate struct crb_addr_pair
In preparation for making the kmalloc family of allocators type aware, we
need to make sure that the returned type from the allocation matches the
type of the variable being assigned. (Before, the allocator would always
return "void *", which can be implicitly cast to any pointer type.)
The assigned type is "struct crb_addr_pair *" and the returned type will
be a _different_ "struct crb_addr_pair *", causing a warning. This really
stumped me for a bit. :) Drop the redundant declaration.
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250426061951.work.272-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Thorsten Blum [Mon, 28 Apr 2025 17:16:26 +0000 (19:16 +0200)]
scsi: lpfc: Use secs_to_jiffies() instead of msecs_to_jiffies()
Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling the
timeouts to milliseconds.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250428171625.2499-2-thorsten.blum@linux.dev
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Oliver Neukum [Mon, 28 Apr 2025 12:43:45 +0000 (14:43 +0200)]
scsi: dc395x: Remove DEBUG conditional compilation
Building dc395x with debugging enabled has been broken for ages. This
driver needs to be converted to dynamic debugging. Remove the crud.
Fixes:
a862ea31655a ("[SCSI] dc395x: convert to use the data buffer accessors")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20250428124345.520137-1-oneukum@suse.com
Reviewed-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Huan Tang [Wed, 23 Apr 2025 09:29:17 +0000 (17:29 +0800)]
scsi: ufs: core: Fix WB resize using wrong offset
Commit
500d4b742e0c ("scsi: ufs: core: Add WB buffer resize support")
incorrectly reads the value of offset
DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP to determine whether WB resize is
supported.
Fix the issue by reading the value of DEVICE_DESC_PARAM_EXT_WB_SUP to
determine whether the device supports WB resize.
Fixes:
500d4b742e0c ("scsi: ufs: core: Add WB buffer resize support")
Reported-by: Peter Wang <peter.wang@mediatek.com>
Closes: https://lore.kernel.org/all/
7ce05b28f5d4b4b4973244310010c1487
Signed-off-by: Huan Tang <tanghuan@vivo.com>
Link: https://lore.kernel.org/r/20250423092917.1031-1-tanghuan@vivo.com
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 29 Apr 2025 00:56:57 +0000 (20:56 -0400)]
Merge branch '6.15/scsi-fixes' into 6.16/scsi-staging
Pull in fixes from 6.15 and resolve a few conflicts so we can have a
clean base for UFS patches.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 22 Apr 2025 01:52:45 +0000 (21:52 -0400)]
Merge patch series "scsi: qedi deadcoding"
linux@treblig.org says:
Hi,
A couple of deadcode patches for the qdi driver.
Build tested only.
Dave
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250416002235.299347-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 22 Apr 2025 01:52:15 +0000 (21:52 -0400)]
Merge patch series "scsi: qla2xxx deadcoding"
linux@treblig.org says:
Hi,
This is a batch of deadcoding on the qla2xxx driver.
Note the last patch removes two unused module
parameters, so I guess if anyone has that in some configs
somewhere that might surprise them.
Other than that, it's all simple function deletion.
Build tested only.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 22 Apr 2025 01:51:51 +0000 (21:51 -0400)]
Merge patch series "hisi_sas: Misc patches and cleanups"
Yihang Li <liyihang9@huawei.com> says:
This series contains some minor bugfix and general tidying:
- Ignore the soft reset result by calling I_T_nexus after the SATA disk
is soft reset
- General minor tidying
Link: https://lore.kernel.org/r/20250331123349.99591-1-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Wed, 16 Apr 2025 00:22:35 +0000 (01:22 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250416002235.299347-3-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Wed, 16 Apr 2025 00:22:34 +0000 (01:22 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250416002235.299347-2-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:03 +0000 (01:28 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-9-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:02 +0000 (01:28 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-8-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:01 +0000 (01:28 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-7-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:00 +0000 (01:28 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-6-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:59 +0000 (01:27 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-5-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:58 +0000 (01:27 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-4-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:57 +0000 (01:27 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-3-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:56 +0000 (01:27 +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 <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-2-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yihang Li [Mon, 14 Apr 2025 08:08:45 +0000 (16:08 +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 <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-5-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yihang Li [Mon, 14 Apr 2025 08:08:44 +0000 (16:08 +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 <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-4-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yihang Li [Mon, 14 Apr 2025 08:08:43 +0000 (16:08 +0800)]
scsi: hisi_sas: Coding style cleanup
Remove superfluous blank lines and symbols. Add spaces around operators.
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-3-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yihang Li [Mon, 14 Apr 2025 08:08:42 +0000 (16:08 +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 <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-2-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chelsy Ratnawat [Sat, 19 Apr 2025 22:59:06 +0000 (15:59 -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 <chelsyratnawat2001@gmail.com>
Link: https://lore.kernel.org/r/20250419225906.31437-1-chelsyratnawat2001@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ranjan Kumar [Tue, 15 Apr 2025 10:15:46 +0000 (15:45 +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 <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250415101546.204018-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
WangYuli [Mon, 14 Apr 2025 04:26:27 +0000 (12:26 +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 <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: SCSI SUBSYSTEM <linux-scsi@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: WangYuli <wangyuli@uniontech.com>
Link: https://lore.kernel.org/r/084BD6AB1C4759DA+20250414042629.63019-3-wangyuli@uniontech.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chenyuan Yang [Sat, 12 Apr 2025 19:59:09 +0000 (14:59 -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 <chenyuan0y@gmail.com>
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 <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Anastasia Kovaleva [Mon, 24 Mar 2025 08:49:33 +0000 (11:49 +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 <a.kovaleva@yadro.com>
Link: https://lore.kernel.org/r/20250324084933.15932-2-a.kovaleva@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manish Pandey [Fri, 11 Apr 2025 12:16:30 +0000 (17:46 +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 <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121630.21330-3-quic_mapa@quicinc.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Manish Pandey [Fri, 11 Apr 2025 12:16:29 +0000 (17:46 +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 <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121630.21330-2-quic_mapa@quicinc.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dmitry Bogdanov [Tue, 24 Dec 2024 10:17:57 +0000 (13:17 +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 <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20241224101757.32300-1-d.bogdanov@yadro.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Thorsten Blum [Tue, 4 Mar 2025 18:14:00 +0000 (19:14 +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 <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250304181400.78325-1-thorsten.blum@linux.dev
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kees Cook [Mon, 10 Mar 2025 22:25:54 +0000 (15:25 -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
Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250310222553.work.437-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ranjan Kumar [Fri, 11 Apr 2025 11:14:19 +0000 (16:44 +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 <sathya.prakash@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250411111419.135485-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ranjan Kumar [Fri, 11 Apr 2025 11:14:18 +0000 (16:44 +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 <sathya.prakash@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250411111419.135485-2-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Huan Tang [Fri, 11 Apr 2025 09:29:24 +0000 (17:29 +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 <tanghuan@vivo.com>
Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
Link: https://lore.kernel.org/r/20250411092924.1116-1-tanghuan@vivo.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chenyuan Yang [Thu, 10 Apr 2025 00:13:20 +0000 (19:13 -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 <chenyuan0y@gmail.com>
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 <bvanassche@acm.org>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner [Wed, 9 Apr 2025 11:34:22 +0000 (13:34 +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 <wagi@kernel.org>
Link: https://lore.kernel.org/r/20250409-fix-lpfc-bios-str-v1-1-05dac9e51e13@kernel.org
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Thorsten Blum [Tue, 8 Apr 2025 10:28:40 +0000 (12:28 +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 <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250408102843.804083-2-thorsten.blum@linux.dev
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Sat, 12 Apr 2025 01:24:34 +0000 (21:24 -0400)]
Merge patch series "ufs: core: cleanup and threaded irq handler"
Neil Armstrong <neil.armstrong@linaro.org> says:
On systems with a large number request slots and unavailable MCQ,
the current design of the interrupt handler can delay handling of
other subsystems interrupts causing display artifacts, GPU stalls
or system firmware requests timeouts.
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 <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-0-08bee980f71e@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Neil Armstrong [Mon, 7 Apr 2025 10:17:05 +0000 (12:17 +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 <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-3-08bee980f71e@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Neil Armstrong [Mon, 7 Apr 2025 10:17:04 +0000 (12:17 +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 <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-2-08bee980f71e@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Neil Armstrong [Mon, 7 Apr 2025 10:17:03 +0000 (12:17 +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 <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-1-08bee980f71e@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Sat, 12 Apr 2025 01:16:58 +0000 (21:16 -0400)]
Merge patch series "Support for wrapped inline encryption keys on Qualcomm SoCs"
Eric Biggers <ebiggers@kernel.org> says:
Add support for hardware-wrapped inline encryption keys to the Qualcomm
ICE (Inline Crypto Engine) and UFS (Universal Flash Storage) drivers.
I'd like these patches to be taken through the scsi tree for 6.16.
But the Qualcomm / msm tree would be okay too if that is preferred.
The block layer framework for this feature was merged in 6.15; refer to
the "Hardware-wrapped keys" section of
Documentation/block/inline-encryption.rst. This patchset wires it up
for the newer Qualcomm SoCs, such as SM8650, which have a HWKM (Hardware
Key Manager) and support the SCM calls needed to easily use it.
Tested on the SM8650 HDK with xfstests, specifically generic/368 and
generic/369, in combination with the required fscrypt patch
https://lore.kernel.org/r/
20250404225859.172344-1-ebiggers@kernel.org
which I plan to apply separately.
Link: https://lore.kernel.org/r/20250404231533.174419-1-ebiggers@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Eric Biggers [Fri, 4 Apr 2025 23:15:32 +0000 (16:15 -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 <quic_gaurkash@quicinc.com>.
Reworked to use the custom crypto profile support.
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sm8650
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20250404231533.174419-4-ebiggers@kernel.org
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>