Commit graph

1121574 commits

Author SHA1 Message Date
Dan Carpenter
a113c02f57 scsi: mpi3mr: Fix error codes in mpi3mr_report_manufacture()
There are three error paths which return success:

1) Propagate the error code from mpi3mr_post_transport_req() if it fails.

2) Return -EINVAL if "ioc_status != MPI3_IOCSTATUS_SUCCESS".

3) Return -EINVAL if "le16_to_cpu(mpi_reply.response_data_length) !=
   sizeof(struct rep_manu_reply)"

Link: https://lore.kernel.org/r/YyMIJh1HU2Qz9+Rs@kili
Fixes: 2bd37e2849 ("scsi: mpi3mr: Add framework to issue MPT transport cmds")
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-15 22:04:02 -04:00
Kees Cook
32e7e06f60 scsi: aic79xx: Use __ro_after_init explicitly
ahd_linux_setup_iocell_info() intentionally writes to the const-marked
aic79xx_iocell_info array, but is called during __init, so the location is
actually writable at this point on most architectures. Annotate this
explicitly with __ro_after_init to avoid static analysis confusion.

Link: https://lpc.events/event/16/contributions/1175/attachments/1109/2128/2022-LPC-analyzer-talk.pdf
Link: https://lore.kernel.org/r/20220914115953.3854029-1-keescook@chromium.org
Cc: Hannes Reinecke <hare@suse.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Reported-by: David Malcolm <dmalcolm@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-15 22:01:24 -04:00
Gaosheng Cui
4663509304 scsi: target: Remove unused se_tmr_req_cache declaration
se_tmr_req_cache has been removed since commit c8e31f26fe ("target: Add
SCF_SCSI_TMR_CDB usage and drop se_tmr_req_cache").

Remove extern.

Link: https://lore.kernel.org/r/20220913023722.547249-3-cuigaosheng1@huawei.com
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-15 21:46:46 -04:00
Gaosheng Cui
1b80addaae scsi: qla2xxx: Remove unused declarations for qla2xxx
qla2x00_get_fw_version_str() has been removed since commit abbd8870b9
("[SCSI] qla2xxx: Factor-out ISP specific functions to method-based call
tables.").

qla2x00_release_nvram_protection() has been removed since commit
459c537807 ("[SCSI] qla2xxx: Add ISP24xx flash-manipulation routines.").

qla82xx_rdmem() and qla82xx_wrmem() have been removed since commit
3711333dfb ("[SCSI] qla2xxx: Updates for ISP82xx.").

qla25xx_rd_req_reg(), qla24xx_rd_req_reg(), qla25xx_wrt_rsp_reg(),
qla24xx_wrt_rsp_reg(), qla25xx_wrt_req_reg() and qla24xx_wrt_req_reg() have
been removed since commit 08029990b2 ("[SCSI] qla2xxx: Refactor
request/response-queue register handling.").

qla2x00_async_login_done() has been removed since commit 726b854870
("qla2xxx: Add framework for async fabric discovery").

qlt_24xx_process_response_error() has been removed since commit
c5419e2618 ("scsi: qla2xxx: Combine Active command arrays.").

Remove the declarations for them from header file.

Link: https://lore.kernel.org/r/20220913023722.547249-2-cuigaosheng1@huawei.com
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-15 21:46:46 -04:00
Dmitry Bogdanov
f04e47e770 scsi: target: alua: Do not report emtpy port group
The default target port group is always returned in the list of port
groups, even if the behaviour is unwanted, i.e. it has no members and
non-default port groups are primary port groups.

That violates SPC-4 "6.37 REPORT TARGET PORT GROUPS command":

  Every target port group shall contain at least one target port. The
  target port group descriptor shall include one target port descriptor for
  each target port in the target port group.

This patch hides port groups with no ports in REPORT TARGET PORT GROUPS
response.

Link: https://lore.kernel.org/r/20220912214549.27882-1-d.bogdanov@yadro.com
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-15 21:42:44 -04:00
Dmitry Bogdanov
5bdd4a8e5c scsi: target: core: Set MULTIP bit for se_device with multiple ports
SAM-5 4.8.3 (SCSI target device with multiple SCSI ports structure)
obligates to set MULTIP bit when there's multiple SCSI target ports:

  Each device server shall indicate the presence of multiple SCSI
  target ports by setting the MULTIP bit to one in its standard
  INQUIRY data (see SPC-4).

Set MULTIP bit automatically to indicate the presence of multiple SCSI
target ports within standard inquiry response data if there are
multiple target ports in all target port groups of the se_device.

Link: https://lore.kernel.org/r/20220912125457.22573-2-d.bogdanov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Co-developed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-15 21:40:58 -04:00
Colin Ian King
efca527495 scsi: qla2xxx: Fix spelling mistake "definiton" -> "definition"
There is a spelling mistake in a MODULE_PARM_DESC description. Fix it.

Link: https://lore.kernel.org/r/20220906140010.194273-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:32:18 -04:00
John Garry
f5f2a27160 scsi: hisi_sas: Don't send bcast events from HW during nexus HA reset
Remote devices may go missing from the per-device nexus reset part of the
HA nexus, i.e after the controller reset. This is because libsas may find
the devices to be gone as the phy may be temporarily down when processing
the bcast event generated from the nexus reset. Filter out bcast events
during this time to stop the devices being lost.

Link: https://lore.kernel.org/r/1662378529-101489-6-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:28:11 -04:00
John Garry
e9b6bada98 scsi: hisi_sas: Add helper to process bcast events
Add a helper for bcast processing to reduce duplication.

Link: https://lore.kernel.org/r/1662378529-101489-5-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:28:11 -04:00
John Garry
11ff0c98fc scsi: hisi_sas: Drain bcast events in hisi_sas_rescan_topology()
In resetting the controller, SATA devices may be lost.

The issue is that when we insert the bcast events to rescan the topology in
hisi_sas_rescan_topology(), when we subsequently nexus reset the SATA
devices in hisi_sas_async_I_T_nexus_reset(), there is a small timing window
in which the remote phy is down and we process the bcast event (meaning
that libsas judges that the disk is lost).

Ensure that all bcast events are processed prior to the nexus reset to
close this window.

Link: https://lore.kernel.org/r/1662378529-101489-4-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:28:11 -04:00
John Garry
bc5551157a scsi: hisi_sas: Clear HISI_SAS_HW_FAULT_BIT earlier
Once the controller HW has been reset then we can unset flag
HISI_SAS_HW_FAULT_BIT. In clearing this flag earlier we can now
successfully execute commands in hisi_sas_controller_reset_done(), like
bcast processing.

Link: https://lore.kernel.org/r/1662378529-101489-3-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:28:10 -04:00
John Garry
245050af5d scsi: hisi_sas: Revert change to limit max hw sectors for v3 HW
Now that libsas and the SCSI core code limits the default sectors from
commit 4cbfca5f77 ("scsi: scsi_transport_sas: cap shost opt_sectors
according to DMA optimal limit") and commit 608128d391 ("scsi: sd: allow
max_sectors be capped at DMA optimal size limit"), there is no need for
the hack to limit the max HW sectors.

Link: https://lore.kernel.org/r/1662378529-101489-2-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:28:10 -04:00
Kees Cook
1ce871de4f scsi: esas2r: Use flex array destination for memcpy()
In preparation for FORTIFY_SOURCE performing run-time destination buffer
bounds checking for memcpy(), specify the destination output buffer
explicitly, instead of asking memcpy() to write past the end of what looked
like a fixed-size object. Silences future run-time warning:

  memcpy: detected field-spanning write (size 80) of single field "trc + 1" (size 64)

There is no binary code output differences from this change.

Link: https://lore.kernel.org/r/20220901205729.2260982-1-keescook@chromium.org
Cc: Bradley Grove <linuxdrivers@attotech.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: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:24:37 -04:00
Letu Ren
7eff437b5e scsi: 3w-9xxx: Avoid disabling device if failing to enable it
The original code will "goto out_disable_device" and call
pci_disable_device() if pci_enable_device() fails. The kernel will generate
a warning message like "3w-9xxx 0000:00:05.0: disabling already-disabled
device".

We shouldn't disable a device that failed to be enabled. A simple return is
fine.

Link: https://lore.kernel.org/r/20220829110115.38789-1-fantasquex@gmail.com
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Letu Ren <fantasquex@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:22:24 -04:00
Daniil Lunev
2286ade07d scsi: ufs: core: Print UFSHCD capabilities in controller's sysfs node
Userspace may want to manually control when the data should go into
WriteBooster buffer. The control happens via "wb_on" node, but presently,
there is no simple way to check if WriteBooster is supported and
enabled.

Expose the Write Booster and Clock Scaling capabilities to be able to
determine if the Write Booster is available and if its manual control is
blocked by Clock Scaling mechanism.

Link: https://lore.kernel.org/r/20220829081845.v8.1.Ibf9efc9be50783eeee55befa2270b7d38552354c@changeid
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Daniil Lunev <dlunev@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:18:06 -04:00
Jack Wang
9806d1b895 scsi: qlogicpti: Fix dma_map_sg() check
Add missing error check for dma_map_sg().

Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Link: https://lore.kernel.org/r/20220826101435.79170-1-jinpu.wang@ionos.com
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:14:14 -04:00
Mike Christie
68a3a9102a scsi: core: Remove useless host error codes
The host codes that were supposed to only be used for internal use are now
not used, so remove them.

Link: https://lore.kernel.org/r/20220812010027.8251-11-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:59 -04:00
Mike Christie
7dfaae6ac1 scsi: core: Convert scsi_decide_disposition() to use SCSIML_STAT
Don't use:

 - DID_TARGET_FAILURE

 - DID_NEXUS_FAILURE

 - DID_ALLOC_FAILURE

 - DID_MEDIUM_ERROR

Instead use the SCSI midlayer internal values.

Link: https://lore.kernel.org/r/20220812010027.8251-10-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:59 -04:00
Mike Christie
36ebf1e2aa scsi: core: Add error codes for internal SCSI midlayer use
If a driver returns:

 - DID_TARGET_FAILURE

 - DID_NEXUS_FAILURE

 - DID_ALLOC_FAILURE

 - DID_MEDIUM_ERROR

we hit a couple bugs:

1. The SCSI error handler runs because scsi_decide_disposition() has no
case statements for them and we return FAILED.

2. For SG IO the userspace app gets a success status instead of failed,
because scsi_result_to_blk_status() clears those errors.

This patch adds a new internal error code byte for use by the SCSI
midlayer.  This will be used instead of the above error codes, so we don't
have to play that clearing the host code game in
scsi_result_to_blk_status() and drivers cannot accidentally use them.

A subsequent commit will then remove the internal users of the above codes
and convert us to use the new ones.

Link: https://lore.kernel.org/r/20220812010027.8251-9-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:59 -04:00
Mike Christie
ebb54b201c scsi: cxlflash: Drop DID_ALLOC_FAILURE use
DID_ALLOC_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it results
    in entering SCSI error handling.

By the code comment, it looks like the driver wanted a retryable error
code, so this has it use DID_ERROR.

Link: https://lore.kernel.org/r/20220812010027.8251-8-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:59 -04:00
Mike Christie
a965d35c87 scsi: qla2xxx: Drop DID_TARGET_FAILURE use
DID_TARGET_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it
    results in entering SCSI error handling.

This has qla2xxx use DID_NO_CONNECT because it looks like we hit this error
when we can't find a port. It will give us the same hard error behavior and
it seems to match the error where we can't find the endpoint.

Link: https://lore.kernel.org/r/20220812010027.8251-7-michael.christie@oracle.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:58 -04:00
Mike Christie
377a7b0b1e scsi: virtio_scsi: Drop DID_NEXUS_FAILURE use
DID_NEXUS_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it results
    in entering SCSI error handling.

virtio_scsi gets this when something like qemu returns
VIRTIO_SCSI_S_NEXUS_FAILURE. It looks like qemu returns that error code if
host OS returns DID_NEXUS_FAILURE (qemu's internal
SCSI_HOST_RESERVATION_ERROR maps to DID_NEXUS_FAILURE). This shouldn't
happen for Linux since we don't propagate that error code to userspace.

This has us convert VIRTIO_SCSI_S_NEXUS_FAILURE to a
SAM_STAT_RESERVATION_CONFLICT in case some other virt layer is returning
it. In that case we will still get the reservation confict failure we
expect.

Link: https://lore.kernel.org/r/20220812010027.8251-6-michael.christie@oracle.com
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:58 -04:00
Mike Christie
beb4dac8d2 scsi: virtio_scsi: Drop DID_TARGET_FAILURE use
DID_TARGET_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it results
    in entering SCSI error handling.

virtio_scsi gets this when something like qemu returns
VIRTIO_SCSI_S_TARGET_FAILURE.  It looks like qemu returns that error code
if a host OS returns it, but this shouldn't happen for Linux since we never
propagate that error to userspace.

This has us use DID_BAD_TARGET in case some other virt layer is returning
it. In that case we will still get a hard error like before and it conveys
something unexpected happened.

Link: https://lore.kernel.org/r/20220812010027.8251-5-michael.christie@oracle.com
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:58 -04:00
Mike Christie
f1d0d5c9fe scsi: uas: Drop DID_TARGET_FAILURE use
DID_TARGET_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it results
    in entering SCSI error handling.

It looks like the driver wanted a hard failure so this swaps it with
DID_BAD_TARGET which gives us that behavior. The error looks like it's for
a case where the target did not support a TMF we wanted to use (maybe not a
bad target but disappointing so close enough).

Link: https://lore.kernel.org/r/20220812010027.8251-4-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:58 -04:00
Mike Christie
a6cb546250 scsi: storvsc: Drop DID_TARGET_FAILURE use
DID_TARGET_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it results
    in the SCSI error handling running.

It looks like the driver wanted a hard failure so swap it with
DID_BAD_TARGET.

Link: https://lore.kernel.org/r/20220812010027.8251-3-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:58 -04:00
Mike Christie
00903af94d scsi: xen: Drop use of internal host codes
The error codes:

 - DID_TARGET_FAILURE

 - DID_NEXUS_FAILURE

 - DID_ALLOC_FAILURE

 - DID_MEDIUM_ERROR

are internal to the SCSI layer. Drivers must not use them because:

 1. They are not propagated upwards, so SG IO/passthrough users will not
    see an error and think a command was successful.

    xen-scsiback will never see this error and should not try to send it.

 2. There is no handling for them in scsi_decide_disposition() so if
    xen-scsifront were to return the error to the SCSI midlayer then it
    kicks off the error handler which is definitely not what we want.

Remove the use from xen-scsifront/back.

Link: https://lore.kernel.org/r/20220812010027.8251-2-michael.christie@oracle.com
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-06 22:05:58 -04:00
Shaomin Deng
e699bb9765 scsi: target: pscsi: Remove repeated word "calling"
There is repeated word, remove it.

Link: https://lore.kernel.org/r/20220811153923.17278-1-dengshaomin@cdjrlc.com
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shaomin Deng <dengshaomin@cdjrlc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:47:52 -04:00
Christophe JAILLET
e95b305add scsi: hpsa: Simplify {clear|set}_bit() parameters
{clear|set}_bit() can take an almost arbitrarily large bit number, so there
is no need to manually compute addresses. This is just redundant.

Link: https://lore.kernel.org/r/c3429a22023f58e5e5cc65d6cd7e83fb2bd9b870.1658340442.git.christophe.jaillet@wanadoo.fr
Tested-by: Don Brace <don.brace@microchip.com>
Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:45:12 -04:00
Christophe JAILLET
5afdd990ce scsi: hpsa: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less
verbose and it improves the semantic.

Link: https://lore.kernel.org/r/5f975ef43f8b7306e4ac4e2e8ce4bcd53f6092bb.1658340441.git.christophe.jaillet@wanadoo.fr
Tested-by: Don Brace <don.brace@microchip.com>
Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:45:12 -04:00
ye xingchen
de05e4843c scsi: lpfc: Remove unneeded result variable
Return the value from lpfc_issue_reg_vfi() directly instead of storing it
in another redundant variable.

Link: https://lore.kernel.org/r/20220824075123.221316-1-ye.xingchen@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Reviewed-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:39:05 -04:00
ye xingchen
7fd080e19c scsi: lpfc: Remove the unneeded result variable
Return the value from lpfc_sli4_issue_wqe() directly instead of storing it
in another redundant variable.

Link: https://lore.kernel.org/r/20220824075017.221244-1-ye.xingchen@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Reviewed-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:37:42 -04:00
Randy Dunlap
0414441259 scsi: docs: Fix a typo
Correct a typo in SCSI documentation.

Link: https://lore.kernel.org/r/20220827221719.11006-1-rdunlap@infradead.org
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:33:34 -04:00
Nilesh Javali
fed842d04d scsi: qla2xxx: Update version to 10.02.07.900-k
Link: https://lore.kernel.org/r/20220826102559.17474-8-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:56 -04:00
Nilesh Javali
2c57d0defa scsi: qla2xxx: Define static symbols
drivers/scsi/qla2xxx/qla_os.c:40:20: warning: symbol 'qla_trc_array'
was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_os.c:345:5: warning: symbol
'ql2xdelay_before_pci_error_handling' was not declared.
Should it be static?

Define qla_trc_array and ql2xdelay_before_pci_error_handling as static to
fix sparse warnings.

Link: https://lore.kernel.org/r/20220826102559.17474-7-njavali@marvell.com
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:56 -04:00
Arun Easi
8bfc149ba2 scsi: qla2xxx: Enhance driver tracing with separate tunable and more
Older tracing of driver messages was to:

    - log only debug messages to kernel main trace buffer; and

    - log only if extended logging bits corresponding to this message is
      off

This has been modified and extended as follows:

    - Tracing is now controlled via ql2xextended_error_logging_ktrace
      module parameter. Bit usages same as ql2xextended_error_logging.

    - Tracing uses "qla2xxx" trace instance, unless instance creation have
      issues.

    - Tracing is enabled (compile time tunable).

    - All driver messages, include debug and log messages are now traced in
      kernel trace buffer.

Trace messages can be viewed by looking at the qla2xxx instance at:

    /sys/kernel/tracing/instances/qla2xxx/trace

Trace tunable that takes the same bit mask as ql2xextended_error_logging
is:

    ql2xextended_error_logging_ktrace (default=1)

Link: https://lore.kernel.org/r/20220826102559.17474-6-njavali@marvell.com
Suggested-by: Daniel Wagner <dwagner@suse.de>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:55 -04:00
Anil Gurumurthy
d9ba85efc3 scsi: qla2xxx: Add NVMe parameters support in Auxiliary Image Status
Add new API to obtain the NVMe Parameters region status from the Auxiliary
Image Status bitmap.

Link: https://lore.kernel.org/r/20220826102559.17474-5-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Anil Gurumurthy <agurumurthy@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:55 -04:00
Arun Easi
389f179b86 scsi: qla2xxx: Add debugfs create/delete helpers
Define a few helpful macros for creating debugfs files.

Link: https://lore.kernel.org/r/20220826102559.17474-4-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:55 -04:00
Arun Easi
e4f8a29deb scsi: qla2xxx: Fix response queue handler reading stale packets
On some platforms, the current logic of relying on finding new packet
solely based on signature pattern can lead to driver reading stale
packets. Though this is a bug in those platforms, reduce such exposures by
limiting reading packets until the IN pointer.

Link: https://lore.kernel.org/r/20220826102559.17474-3-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:55 -04:00
Arun Easi
6dc45a7322 scsi: qla2xxx: Revert "scsi: qla2xxx: Fix response queue handler reading stale packets"
Reverting this commit so that a fixed up patch, without adding new module
parameters, can be submitted.

    Link: https://lore.kernel.org/stable/166039743723771@kroah.com/

This reverts commit b1f7071469.

Link: https://lore.kernel.org/r/20220826102559.17474-2-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:30:55 -04:00
Mauricio Faria de Oliveira
eee8bb4a2b scsi: qla2xxx: Log message "skipping scsi_scan_host()" as informational
This message is helpful to troubleshoot missing LUNs/SAN boot errors.  It'd
be nice to log it by default instead of only being enabled with debug.

This user had an accidental/forgotten file modprobe.d/qla2xxx.conf w/
option qlini_mode=disabled from experiments with FC target mode, and their
boot LUN didn't come up, as it skips SCSI scan, of course.

However, their boot log didn't provide any clues to help understand that.

The issue/message could be figured out w/ ql2xextended_error_logging, but
it would have been simpler (or even deflected/addressed by user) if it had
been there by default. And it also would help support/triage/deflection
tooling.

Expected change:

 scsi host15: qla2xxx
+qla2xxx [0000:3b:00.0]-00fb:15: skipping scsi_scan_host() for non-initiator port
 qla2xxx [0000:3b:00.0]-00fb:15: QLogic QLE2692 - QLE2692 Dual Port 16Gb FC to PCIe Gen3 x8 Adapter.

According to:

  qla2x00_probe_one()
  ...
          ret = scsi_add_host(...);
  ...
                  ql_log(ql_log_info, ...
                          "skipping scsi_scan_host() for non-initiator port\n");
  ...
          ql_log(ql_log_info, ...
              "QLogic %s - %s.\n", ha->model_number, ha->model_desc);

Link: https://lore.kernel.org/r/20220825120159.275051-1-mfo@canonical.com
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:24:45 -04:00
Sreekanth Reddy
c0958d2335 scsi: mpt3sas: Update driver version to 43.100.00.00
Update driver version to 43.100.00.00.

Link: https://lore.kernel.org/r/20220825075457.16422-5-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:15:47 -04:00
Sreekanth Reddy
669b2b667e scsi: mpt3sas: Increase cmd_per_lun to 128
With cmd_per_lun value 7, a higher number of cache lines (map_nr) are
needed while allocating sdev->budget_map which is not reasonable and hence
increase the cmd_per_lun value to 128.

Link: https://lore.kernel.org/r/20220825075457.16422-4-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:15:46 -04:00
Sreekanth Reddy
463e683bfd scsi: mpt3sas: Fix trace buffer registration failed
The ExtendedType field was set to 1 in the diag buffer register command and
hence MPT Endpoint firmware is failing the request with Invalid Field
IOCStatus.

memset the request frame to zero before framing the diag buffer register
command.

Link: https://lore.kernel.org/r/20220825075457.16422-3-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:15:46 -04:00
Sreekanth Reddy
9df650963b scsi: mpt3sas: Don't change DMA mask while reallocating pools
When a pool crosses the 4GB boundary region then before reallocating pools
change the coherent DMA mask to 32 bits and keep the normal DMA mask set to
63/64 bits.

Link: https://lore.kernel.org/r/20220825075457.16422-2-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:15:46 -04:00
Sreekanth Reddy
e75c8ea0d7 scsi: mpt3sas: Prevent error handler escalation when device removed
If SCSI error handling is taking place for timed out I/Os on a drive and
the corresponding drive is removed, then stop escalating to higher level of
reset by returning the TUR with "I_T NEXUS LOSS OCCURRED" sense key.

Link: https://lore.kernel.org/r/20220816080801.13929-1-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-09-01 00:08:35 -04:00
Gustavo A. R. Silva
4865821320 scsi: megaraid_sas: Use struct_size() in code related to struct MR_PD_CFG_SEQ_NUM_SYNC
Prefer struct_size() over open-coded versions of idiom:

        sizeof(struct-with-flex-array) + sizeof(type-of-flex-array) * count

where count is the max number of items the flexible array is supposed to
have.

Link: https://github.com/KSPP/linux/issues/160
Link: https://lore.kernel.org/r/b215f4760f0e8fbe5fc35be20f2487e89924424d.1660592640.git.gustavoars@kernel.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:59 -04:00
Gustavo A. R. Silva
41e830269d scsi: megaraid_sas: Use struct_size() in code related to struct MR_FW_RAID_MAP
Prefer struct_size() over open-coded versions of idiom:

	sizeof(struct-with-flex-array) + sizeof(type-of-flex-array) * count

where count is the max number of items the flexible array is supposed to
have.

Link: https://github.com/KSPP/linux/issues/160
Link: https://lore.kernel.org/r/1211398fb8f7ab332a93f4f8f1a63e8168dbd002.1660592640.git.gustavoars@kernel.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:59 -04:00
Gustavo A. R. Silva
ee92366a84 scsi: megaraid_sas: Replace one-element array with flexible-array member in MR_PD_CFG_SEQ_NUM_SYNC
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 MR_PD_CFG_SEQ_NUM_SYNC and refactor the rest of the code
accordingly.

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 [0].

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Link: Link: https://reviews.llvm.org/D126864 [0]
Link: https://lore.kernel.org/r/78e9261591db072b67fcf49f0216d7046a67ca6d.1660592640.git.gustavoars@kernel.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:59 -04:00
Gustavo A. R. Silva
eeb3bab772 scsi: megaraid_sas: Replace one-element array with flexible-array member in MR_DRV_RAID_MAP
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 MR_DRV_RAID_MAP and refactor the code accordingly.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy().

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Link: https://lore.kernel.org/r/1448f387821833726b99f0ce13069ada89164eb5.1660592640.git.gustavoars@kernel.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Enhanced-by: Kees Cook <keescook@chromium.org> # Change in struct MR_DRV_RAID_MAP_ALL
2022-08-31 23:39:59 -04:00
Gustavo A. R. Silva
204a29a169 scsi: megaraid_sas: Replace one-element array with flexible-array member in MR_FW_RAID_MAP_DYNAMIC
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 MR_FW_RAID_MAP_DYNAMIC.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy().

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Link: https://lore.kernel.org/r/896476f8fe43cf83b491c6c13f59c9ace780d82c.1660592640.git.gustavoars@kernel.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:59 -04:00