Anastasia Kovaleva
689d94ec20
scsi: target: core: Change the way target_xcopy_do_work() sets restiction on max I/O
...
To determine how many blocks sends in one command, the minimum value is
selected from the hw_max_sectors of both devices. In target_xcopy_do_work,
hw_max_sectors are used as blocks, not sectors; it also ignores the fact
that sectors can be of different sizes, for example 512 and 4096
bytes. Because of this, a number of blocks can be transmitted that the
device will not be able to accept.
Change the selection of max transmission size into bytes.
Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com >
Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com >
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com >
Link: https://lore.kernel.org/r/20221114102500.88892-4-a.kovaleva@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-24 02:16:19 +00:00
Anastasia Kovaleva
9375031ee4
scsi: target: core: Make hw_max_sectors store the sectors amount in blocks
...
By default, hw_max_sectors stores its value in 512 blocks in iblock,
despite the fact that the block size can be 4096 bytes. Change
hw_max_sectors to store the number of sectors in hw_block_size blocks.
Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com >
Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com >
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com >
Link: https://lore.kernel.org/r/20221114102500.88892-3-a.kovaleva@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-24 02:16:19 +00:00
Anastasia Kovaleva
7870d24817
scsi: target: core: Send max transfer length in blocks
...
A MAXIMUM TRANSFER LENGTH value indicates the maximum transfer length in
logical blocks that the device server accepts for a single command. Fix
function sending the length in sectors instead of blocks.
This patch also removes the special casing for fileio in block_size_store
since this logic in now unified in spc_emulate_evpd_b0() for all backends.
Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com >
Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com >
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com >
Link: https://lore.kernel.org/r/20221114102500.88892-2-a.kovaleva@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-24 02:16:19 +00:00
Thomas Gleixner
cdd9344e00
scsi: lpfc: Remove linux/msi.h include
...
Nothing in this file needs anything from linux/msi.h
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Link: https://lore.kernel.org/r/20221113202428.436270297@linutronix.de
Cc: James Smart <james.smart@broadcom.com >
Cc: Dick Kennedy <dick.kennedy@broadcom.com >
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com >
Cc: "Martin K. Petersen" <martin.petersen@oracle.com >
Cc: linux-scsi@vger.kernel.org
Reviewed-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-24 02:16:19 +00:00
Justin Tee
d57d98fef4
scsi: lpfc: Update lpfc version to 14.2.0.9
...
Update lpfc version to 14.2.0.9.
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Link: https://lore.kernel.org/r/20221116011921.105995-7-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-24 02:16:19 +00:00
Justin Tee
97f256913c
scsi: lpfc: Fix crash involving race between FLOGI timeout and devloss handler
...
When a FLOGI completes with a sequence timeout error, a freed kref ptr
dereference crash can occur due to a timing race involving ndlp referencing
in lpfc_dev_loss_tmo_callbk.
Fix by ensuring the driver accounts for an outstanding FLOGI when dev_loss
is active. Also, don't remove the HBA_FLOGI_OUTSTANDING flag when the
FLOGI is retried to allow the driver to handle the reference counts
correctly in lpfc_dev_loss_tmo_handler.
Reported-by: Dietmar Hahn <dietmar.hahn@fujitsu.com >
Tested-by: Dietmar Hahn <dietmar.hahn@fujitsu.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Link: https://lore.kernel.org/r/20221116011921.105995-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:18:42 +00:00
Justin Tee
d99af587d5
scsi: lpfc: Fix MI capability display in cmf_info sysfs attribute
...
The dynamic mi_ver value holds the currently configured MI setting. mi_ver
was being displayed as part of the cmf_info sysfs attribute, when the
output string meant to display MI capabilities instead.
Add a mi_cap member in the lpfc_pc_sli4_params structure that will store MI
capabilities during initialization so that cmf_info prints out capabilities
instead of current configuration.
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Link: https://lore.kernel.org/r/20221116011921.105995-4-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:18:42 +00:00
Justin Tee
ae696255d6
scsi: lpfc: Correct bandwidth logging during receipt of congestion sync WCQE
...
The lpfc_cmf_timer adjusts phba->cmf_link_byte_count periodically and can
artifically inflate bandwidth percent.
During bandwidth calculation, correct for this by setting a cap of logging
a maximum of 100%.
Bandwidth calculation is only used for display under LOG_CGN_MGMT so there
is no expectation of impacts on performance.
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Link: https://lore.kernel.org/r/20221116011921.105995-3-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:18:42 +00:00
Justin Tee
2c1a0a7584
scsi: lpfc: Fix WQ|CQ|EQ resource check
...
Adapter configurations with limited EQ resources may fail to initialize.
Firmware resources are queried in lpfc_sli4_read_config(). The driver
parameters cfg_irq_chann and cfg_hdw_queue are adjusted from defaults if
constrained by firmware resources.
The minimum resource check includes a special allocation for queues such as
ELS, MBOX, NVME LS. However the additional reservation was also incorrectly
applied to EQ resources.
Reordered WQ|CQ|EQ resource checks to apply the special allocation
adjustment to WQ and CQ resources only.
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Link: https://lore.kernel.org/r/20221116011921.105995-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:18:42 +00:00
Gustavo A. R. Silva
c4c5fa3556
scsi: bfa: Replace one-element array with flexible-array member
...
One-element arrays are deprecated, and we are replacing them with flexible
array members instead. So, replace one-element array with flexible-array
member in struct fdmi_attr_s.
Important to mention is that doing a build before/after this patch results
in no binary output differences.
This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy() and help us make progress towards globally enabling
-fstrict-flex-arrays=3 [1].
Link: https://github.com/KSPP/linux/issues/209
Link: https://github.com/KSPP/linux/issues/79
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Link: https://lore.kernel.org/r/Y3P1rEEBq7HzJygq@work
Reviewed-by: Kees Cook <keescook@chromium.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:15:45 +00:00
Colin Ian King
0824050682
scsi: libfc: Remove redundant variable ev_qual
...
Variable ev_qual is being assigned and modified but the end result is never
used. The variable is redundant and can be removed.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221111170824.558250-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:14:14 +00:00
Xiu Jianfeng
b29e91385c
scsi: lpfc: Use memset_startat() helper
...
Use memset_startat() helper to simplify the code, no functional changes in
this patch.
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com >
Link: https://lore.kernel.org/r/20221111074310.132125-1-xiujianfeng@huawei.com
Reviewed-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:13:14 +00:00
Harshit Mogalapalli
216e179724
scsi: scsi_debug: Fix a warning in resp_write_scat()
...
As 'lbdof_blen' is coming from user, if the size in kzalloc() is >=
MAX_ORDER then we hit a warning.
Call trace:
sg_ioctl
sg_ioctl_common
scsi_ioctl
sg_scsi_ioctl
blk_execute_rq
blk_mq_sched_insert_request
blk_mq_run_hw_queue
__blk_mq_delay_run_hw_queue
__blk_mq_run_hw_queue
blk_mq_sched_dispatch_requests
__blk_mq_sched_dispatch_requests
blk_mq_dispatch_rq_list
scsi_queue_rq
scsi_dispatch_cmd
scsi_debug_queuecommand
schedule_resp
resp_write_scat
If you try to allocate a memory larger than(>=) MAX_ORDER, then kmalloc()
will definitely fail. It creates a stack trace and messes up dmesg. The
user controls the size here so if they specify a too large size it will
fail.
Add __GFP_NOWARN in order to avoid too large allocation warning. This is
detected by static analysis using smatch.
Fixes: 481b5e5c79 ("scsi: scsi_debug: add resp_write_scat function")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com >
Link: https://lore.kernel.org/r/20221111100526.1790533-1-harshit.m.mogalapalli@oracle.com
Acked-by: Douglas Gilbert <dgilbert@interlog.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:12:21 +00:00
Don Brace
2ae45329a9
scsi: smartpqi: Change version to 2.1.20-035
...
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Scott Teel <scott.teel@microchip.com >
Reviewed-by: Gerry Morong <gerry.morong@microchip.com >
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793533417.322537.3074216622272955440.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:59 +00:00
Don Brace
921800a1de
scsi: smartpqi: Initialize feature section info
...
Initialize features to 0 before processing.
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Mike Mcgowan <mike.mcgowan@microchip.com >
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793532902.322537.2436075977808555348.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:59 +00:00
Gilbert Wu
14063fb625
scsi: smartpqi: Add controller cache flush during rmmod
...
Add in a call to flush the controller cache during driver removal.
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Mike Mcgowan <mike.mcgowan@microchip.com >
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Gilbert Wu <Gilbert.Wu@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793532388.322537.878022136408270892.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:59 +00:00
Kumar Meiyappan
cc9befcbbb
scsi: smartpqi: Correct device removal for multi-actuator devices
...
Correct device count for multi-actuator drives which can cause kernel
panics.
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Scott Teel <scott.teel@microchip.com >
Reviewed-by: Mike Mcgowan <mike.mcgowan@microchip.com >
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Kumar Meiyappan <Kumar.Meiyappan@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793531872.322537.9003385780343419275.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:59 +00:00
Kevin Barnett
cbe42ac156
scsi: smartpqi: Change sysfs raid_level attribute to N/A for controllers
...
Change the sysfs raid_level attribute from "RAID-0" to N/A.
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Scott Teel <scott.teel@microchip.com >
Reviewed-by: Mike McGowan <mike.mcgowan@microchip.com >
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793531357.322537.8639138137605612362.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:59 +00:00
Kevin Barnett
7c56850637
scsi: smartpqi: Correct max LUN number
...
Correct maximum LUN number for multi-actuator devices.
When multi-actuator support was added to smartpqi, the maximum number of
LUNs supported for multi-actuator devices was supposed to be changed from
unlimited to 256, but the setting was inadvertently left at unlimited.
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Scott Teel <scott.teel@microchip.com >
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793530842.322537.816949081443241857.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:58 +00:00
Mike McGowen
0b93cf2a90
scsi: smartpqi: Add new controller PCI IDs
...
All PCI ID entries in Hex.
Add PCI IDs for ByteDance controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
ByteHBA JGH43024-8 9005 / 028f / 1e93 / 1000
ByteHBA JGH43034-8 9005 / 028f / 1e93 / 1001
ByteHBA JGH44014-8 9005 / 028f / 1e93 / 1002
Add PCI IDs for new Inspur controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
INSPUR RT0800M7E 9005 / 028f / 1bd4 / 0086
INSPUR RT0800M7H 9005 / 028f / 1bd4 / 0087
INSPUR RT0804M7R 9005 / 028f / 1bd4 / 0088
INSPUR RT0808M7R 9005 / 028f / 1bd4 / 0089
Add PCI IDs for new FAB A controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
Adaptec SmartRAID 3254-16e /e 9005 / 028f / 9005 / 1475
Adaptec HBA 1200-16e 9005 / 028f / 9005 / 14c3
Adaptec HBA 1200-8e 9005 / 028f / 9005 / 14c4
Add H3C controller PCI IDs:
VID / DID / SVID / SDID
---- ---- ---- ----
H3C H4508-Mf-8i 9005 / 028f / 193d / 110b
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Scott Teel <scott.teel@microchip.com >
Signed-off-by: Mike McGowen <mike.mcgowen@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793530327.322537.6056884426657539311.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:58 +00:00
Don Brace
b27ac2faa2
scsi: smartpqi: Convert to host_tagset
...
Add support for host_tagset.
Also move the reserved command slots to the end of the pool to eliminate an
addition operation for every SCSI request.
This patch was originally authored by Hannes Reinecke here:
Link: https://lore.kernel.org/linux-block/20191126131009.71726-8-hare@suse.de/
But we NAKed this patch because we wanted to fully test multipath
failover operations.
Suggested-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Scott Benesh <scott.benesh@microchip.com >
Reviewed-by: Scott Teel <scott.teel@microchip.com >
Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@microchip.com >
Reviewed-by: Mike McGowen <Mike.McGowen@microchip.com >
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com >
Signed-off-by: Don Brace <don.brace@microchip.com >
Link: https://lore.kernel.org/r/166793529811.322537.3294617845448383948.stgit@brunhilda
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:10:58 +00:00
Colin Ian King
729c287e9f
scsi: lpfc: Remove redundant pointer 'lp'
...
Pointer lp is being initialized and incremented but the result is never
read. The pointer is redundant and can be removed.
Once lp is removed, pcmd is not longer used. So remove pcmd as well
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Link: https://lore.kernel.org/r/20221108183620.93978-1-jsmart2021@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-17 18:06:48 +00:00
Christophe JAILLET
e56ca6bcd2
scsi: target: Use kstrtobool() instead of strtobool()
...
strtobool() is the same as kstrtobool(). However, the latter is more used
within the kernel.
In order to remove strtobool() and slightly simplify kstrtox.h, switch to
the other function name.
While at it, include the corresponding header file (<linux/kstrtox.h>)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/fcddc0a53b4fc6e3c2e93592d3f61c5c63121855.1667336095.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:53:37 +00:00
Colin Ian King
bc81131813
scsi: target: core: Remove unused variable 'unit_serial_len'
...
Variable 'unit_serial_len' is just being assigned and it's never used
anywhere else. Remove it.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221101105326.31037-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:49:39 +00:00
Colin Ian King
0aa46eba29
scsi: csiostor: Remove unused variable 'n'
...
Variable 'n' is just being incremented and it's never used anywhere
else. Remove it.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221101123235.52152-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:40:54 +00:00
Colin Ian King
e137b81d30
scsi: qla2xxx: Remove unused variable 'found_devs'
...
Variable 'found_devs' is just being incremented and it's never used
anywhere else. Remove it.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221101104733.30363-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:39:34 +00:00
Bart Van Assche
4fb2169d66
scsi: qla2xxx: Fix set-but-not-used variable warnings
...
Fix the following two compiler warnings:
drivers/scsi/qla2xxx/qla_init.c: In function ‘qla24xx_async_abort_cmd’:
drivers/scsi/qla2xxx/qla_init.c:171:17: warning: variable ‘bail’ set but not used [-Wunused-but-set-variable]
171 | uint8_t bail;
| ^~~~
drivers/scsi/qla2xxx/qla_init.c: In function ‘qla2x00_async_tm_cmd’:
drivers/scsi/qla2xxx/qla_init.c:2023:17: warning: variable ‘bail’ set but not used [-Wunused-but-set-variable]
2023 | uint8_t bail;
| ^~~~
Cc: Arun Easi <arun.easi@qlogic.com >
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com >
Fixes: feafb7b171 ("[SCSI] qla2xxx: Fix vport delete issues")
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20221031224818.2607882-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:38:11 +00:00
Bart Van Assche
2e79cf37b1
scsi: bfa: Rework bfad_reset_sdev_bflags()
...
Since commit f93ed747e2 ("scsi: core: Release SCSI devices
synchronously") it is no longer allowed to call scsi_device_put() from
atomic context.
Rework bfad_reset_sdev_bflags() such that scsi_device_put() is no longer
called. This fixes the following smatch warning:
drivers/scsi/bfa/bfad_bsg.c:2551 bfad_iocmd_lunmask_reset_lunscan_mode() warn: sleeping in atomic context
bfad_iocmd_lunmask() <- disables preempt
-> bfad_iocmd_lunmask_reset_lunscan_mode()
-> scsi_device_put()
Cc: Anil Gurumurthy <anil.gurumurthy@qlogic.com >
Cc: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com >
Cc: Dan Carpenter <dan.carpenter@oracle.com >
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20221031224728.2607760-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:34:39 +00:00
Bart Van Assche
2e5a6c3bac
scsi: bfa: Convert bfad_reset_sdev_bflags() from a macro into a function
...
Before modifying bfad_reset_sdev_bflags(), convert it from a macro into a
function.
Cc: Anil Gurumurthy <anil.gurumurthy@qlogic.com >
Cc: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20221031224728.2607760-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:34:39 +00:00
Bart Van Assche
379e2554e3
scsi: alua: Move a scsi_device_put() call out of alua_rtpg_select_sdev()
...
Move a scsi_device_put() call from alua_rtpg_select_sdev() to its
callers. Fixes the following smatch complaint:
drivers/scsi/device_handler/scsi_dh_alua.c:853 alua_rtpg_select_sdev() warn: sleeping in atomic context
alua_rtpg_work() <- disables preempt
-> alua_rtpg_select_sdev()
-> scsi_device_put()
Cc: Hannes Reinecke <hare@suse.de >
Cc: Dan Carpenter <dan.carpenter@oracle.com >
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20221031224728.2607760-3-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:34:39 +00:00
Bart Van Assche
0b25e17e90
scsi: alua: Move a scsi_device_put() call out of alua_check_vpd()
...
Fix the following smatch warning:
drivers/scsi/device_handler/scsi_dh_alua.c:1013 alua_rtpg_queue() warn: sleeping in atomic context
alua_check_vpd() <- disables preempt
-> alua_rtpg_queue()
-> scsi_device_put()
Cc: Hannes Reinecke <hare@suse.de >
Cc: Dan Carpenter <dan.carpenter@oracle.com >
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20221031224728.2607760-2-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:34:38 +00:00
Keoseong Park
3d6d793092
scsi: ufs: core: Remove check_upiu_size() from ufshcd.h
...
Commit 68078d5cc1 ("[SCSI] ufs: Set fDeviceInit flag to initiate device
initialization") added check_upiu_size(), but no caller.
Cc: Dolev Raviv <draviv@codeaurora.org >
Link: https://lore.kernel.org/r/20221103055349epcms2p338f2550c2dd78d00231a83b24719a3d4@epcms2p3
Signed-off-by: Keoseong Park <keosung.park@samsung.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:06:33 +00:00
Nathan Chancellor
3d75e766b5
scsi: elx: libefc: Fix second parameter type in state callbacks
...
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
indirect call targets are validated against the expected function pointer
prototype to make sure the call target is valid to help mitigate ROP
attacks. If they are not identical, there is a failure at run time, which
manifests as either a kernel panic or thread getting killed. A proposed
warning in clang aims to catch these at compile time, which reveals:
drivers/scsi/elx/libefc/efc_node.c:811:22: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
ctx->current_state = state;
^ ~~~~~
drivers/scsi/elx/libefc/efc_node.c:878:21: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
node->nodedb_state = state;
^ ~~~~~
drivers/scsi/elx/libefc/efc_node.c:905:6: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' from 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') [-Werror,-Wincompatible-function-pointer-types-strict]
pf = node->nodedb_state;
^ ~~~~~~~~~~~~~~~~~~
drivers/scsi/elx/libefc/efc_device.c:455:22: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
node->nodedb_state = __efc_d_init;
^ ~~~~~~~~~~~~
drivers/scsi/elx/libefc/efc_sm.c:41:22: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
ctx->current_state = state;
^ ~~~~~
The type of the second parameter in the prototypes of ->current_state() and
->nodedb_state() ('u32') does not match the implementations, which have a
second parameter type of 'enum efc_sm_event'. Update the prototypes to have
the correct second parameter type, clearing up all the warnings and CFI
failures.
Link: https://github.com/ClangBuiltLinux/linux/issues/1750
Reported-by: Sami Tolvanen <samitolvanen@google.com >
Signed-off-by: Nathan Chancellor <nathan@kernel.org >
Link: https://lore.kernel.org/r/20221102161906.2781508-1-nathan@kernel.org
Reviewed-by: Kees Cook <keescook@chromium.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:05:16 +00:00
Bart Van Assche
b817e6ffba
scsi: ufs: core: Introduce ufshcd_abort_all()
...
Move the code for aborting all SCSI commands and TMFs into a new function.
This patch makes the ufshcd_err_handler() easier to read. Except for adding
more logging, this patch does not change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Link: https://lore.kernel.org/r/20221031183433.2443554-1-bvanassche@acm.org
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:02:32 +00:00
Colin Ian King
81cb3eb68a
scsi: BusLogic: Remove variable 'adapter_count'
...
Variable 'adapter_count' is just being incremented and it's never used
anywhere else. Remove it.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221031160512.872153-1-colin.i.king@gmail.com
Acked-by: Khalid Aziz <khalid@gonehiking.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:01:12 +00:00
Colin Ian King
c7cbaab2d4
scsi: message: fusion: Remove variable 'where'
...
Variable 'where' is just being incremented and it's never used
anywhere else. Remove it.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221031154538.870223-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 03:00:52 +00:00
Jilin Yuan
e47c49219c
scsi: NCR5380: Fix repeated words in comment
...
Delete the redundant word 'the'.
Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com >
Link: https://lore.kernel.org/r/20221028133708.60030-1-yuanjilin@cdjrlc.com
Acked-by: Finn Thain <fthain@linux-m68k.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 02:57:01 +00:00
Keoseong Park
bc77fb9ce4
scsi: ufs: core: Refactor ufshcd_hba_enable()
...
Use "if error return" style in ufshcd_hba_enable(). No functional change.
Cc: Bart Van Assche <bvanassche@acm.org >
Cc: Alim Akhtar <alim.akhtar@samsung.com >
Signed-off-by: Keoseong Park <keosung.park@samsung.com >
Link: https://lore.kernel.org/r/20221028073553epcms2p6dc4f8bdbebdc8f96f43fc4197b3edd0c@epcms2p6
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-11-08 02:55:31 +00:00
John Garry
e6629dcb00
scsi: MAINTAINERS: Make Xiang Chen HiSilicon SAS controller driver maintainer
...
I am soon leaving Huawei, so will no longer maintain this driver. However I
will stay active in upstream Linux storage domain.
Xiang Chen has worked on the driver for as long as I have and has good
knowledge of the driver, so should do a good job.
Signed-off-by: John Garry <john.garry@huawei.com >
Link: https://lore.kernel.org/r/1666784008-125519-1-git-send-email-john.garry@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:24:07 +00:00
John Garry
4481bdc677
scsi: pm8001: Drop !task check in pm8001_abort_task()
...
In commit 0b639decf6 ("scsi: pm8001: Modify task abort handling for SATA
task"), code was introduced to dereference "task" pointer in
pm8001_abort_task(). However there was a pre-existing later check for
"!task", which spooked the kernel test robot.
Function pm8001_abort_task() should never be passed NULL for "task"
pointer, so remove that check. Also remove the "unlikely" hint, as this is
not fastpath code.
Reported-by: kernel test robot <lkp@intel.com >
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: John Garry <john.garry@huawei.com >
Link: https://lore.kernel.org/r/1666781764-123090-1-git-send-email-john.garry@huawei.com
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Acked-by: Jack Wang <jinpu.wang@ionos.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:22:59 +00:00
Bean Huo
9d266e792b
scsi: ufs: core: Use is_visible to control UFS unit descriptor sysfs nodes
...
UFS Boot and Device W-LUs do not have unit descriptors and RPMB does not
support WB. Use is_visible() to control which nodes are visible and which
are not.
Signed-off-by: Bean Huo <beanhuo@micron.com >
Link: https://lore.kernel.org/r/20221025222430.277768-4-beanhuo@iokpp.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Reviewed-by: Arthur Simchaev <arthur.simchaev@wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:20:50 +00:00
Bean Huo
dca899bc02
scsi: ufs: core: Clean up ufshcd_slave_alloc()
...
Combine ufshcd_get_lu_power_on_wp_status() and ufshcd_set_queue_depth()
into one single ufshcd_lu_init(), so that we only need to read the LUN
descriptor once.
Signed-off-by: Bean Huo <beanhuo@micron.com >
Link: https://lore.kernel.org/r/20221025222430.277768-3-beanhuo@iokpp.de
Reviewed-by: Arthur Simchaev <arthur.simchaev@wdc.com >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:20:50 +00:00
Bean Huo
b43678ea5b
scsi: ufs: core: Revert "WB is only available on LUN #0 to #7 "
...
Ccommit d3d9c45702 ("scsi: ufs: Fix memory corruption by
ufshcd_read_desc_param()") has properly fixed stack overflow issue.
As a result, commit a2fca52ee6 ("scsi: ufs: WB is only available on LUN
#0 to #7 ") is no longer required. Revert it.
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Signed-off-by: Bean Huo <beanhuo@micron.com >
Link: https://lore.kernel.org/r/20221025222430.277768-2-beanhuo@iokpp.de
Reviewed-by: Arthur Simchaev <arthur.simchaev@wdc.com >
Reviewed-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:20:50 +00:00
Colin Ian King
25ad6f63e7
scsi: pcmcia: nsp_cs: Remove unused variable i
...
Variable i is just being incremented and it's never used anywhere else. The
variable and the increment are redundant so remove it.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Link: https://lore.kernel.org/r/20221024141101.2161167-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:15:46 +00:00
Peter Wang
a301d487d7
scsi: ufs: core: Print events for WLUN suspend and resume failures
...
WLUN suspend and resume events are currently not handled by
ufshcd_print_evt_hist(). Add the missing events.
Signed-off-by: Peter Wang <peter.wang@mediatek.com >
Link: https://lore.kernel.org/r/20221024120602.30019-1-peter.wang@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com >
Reviewed-by: Asutosh Das <quic_asutoshd@quicinc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 02:13:09 +00:00
Dmitry Bogdanov
415d82b440
scsi: target: core: Dynamically set DPO and FUA in usage_bits
...
libiscsi tests check the support of DPO & FUA bits in usage bits of RSOC
response. This patch adds support for dynamic usage bits for each opcode.
Set support of DPO & FUA bits in usage_bits of RSOC response depending on
support DPOFUA in the backstore device.
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com >
Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com >
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com >
Link: https://lore.kernel.org/r/20220906103421.22348-7-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 01:47:24 +00:00
Dmitry Bogdanov
b8908e5e1d
scsi: target: core: Check emulate_3pc for RECEIVE COPY
...
RECEIVE COPY RESULTS is an opcode from 3rd party copy command set and shall
be rejected if emulate_3pc attribute is off like EXTENDED COPY.
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com >
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com >
Link: https://lore.kernel.org/r/20220906103421.22348-6-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 01:47:13 +00:00
Dmitry Bogdanov
bd217b8c3a
scsi: target: core: Add emulate_rsoc attribute
...
Allow support for RSOC to be turned off via the emulate_rsoc attibute.
This is just for testing purposes.
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com >
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com >
Link: https://lore.kernel.org/r/20220906103421.22348-5-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 01:44:32 +00:00
Dmitry Bogdanov
553b08d9b3
scsi: target: core: Dynamic opcode support in RSOC
...
Report supported opcodes depending on a dynamic device configuration.
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com >
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com >
Link: https://lore.kernel.org/r/20220906103421.22348-4-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 01:44:32 +00:00
Dmitry Bogdanov
0016e82071
scsi: target: core: Add list of opcodes for RSOC
...
Fill the strucures for supported opcodes and usage bits that are reported
in REPORT SUPPORTED OPERATION CODES command response.
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com >
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com >
Link: https://lore.kernel.org/r/20220906103421.22348-3-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-10-27 01:44:32 +00:00