Commit Graph

1121526 Commits

Author SHA1 Message Date
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
Gustavo A. R. Silva ac23b92b27 scsi: megaraid_sas: Replace one-element array with flexible-array member in MR_FW_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 the rest of 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/4495ce170c8ef088a10f1abe0e7c227368f43242.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_FW_RAID_MAP_ALL
2022-08-31 23:39:59 -04:00
Tetsuo Handa 3cb0643a9a scsi: qla2xxx: Avoid flush_scheduled_work() usage
Although qla2xxx driver is calling schedule_{,delayed}_work() from 10
locations, I assume that flush_scheduled_work() from qlt_stop_phase1()
needs to flush only works scheduled by qlt_sched_sess_work(), for this loop
continues while "struct qla_tgt"->sess_works_list is not empty.

Link: https://lore.kernel.org/r/133c6723-90b6-5c8b-72b4-cc01eeb3a8c0@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:59 -04:00
Tetsuo Handa a434555752 scsi: qla2xxx: Always wait for qlt_sess_work_fn() from qlt_stop_phase1()
Currently qlt_stop_phase1() may fail to call flush_scheduled_work(), for
list_empty() may return true as soon as qlt_sess_work_fn() called
list_del(). In order to close this race window, check list_empty() after
calling flush_scheduled_work().

If this patch causes problems, please check commit c4f135d643
("workqueue: Wrap flush_workqueue() using a macro"). We are on the way to
remove all flush_scheduled_work() calls from the kernel.

Link: https://lore.kernel.org/r/7f24469d-9e39-3398-d851-329b54c0b923@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
Tetsuo Handa 1b2b8d45cc scsi: qla2xxx: Remove unused qlt_tmr_work()
qlt_tmr_work() is no longer used since commit fb35265b12 ("scsi:
qla2xxx: Remove session creation redundant code").

Link: https://lore.kernel.org/r/a0e53c70-b801-adf5-0549-b2b1e421a819@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
Tetsuo Handa e6852b41b5 scsi: qla2xxx: Remove unused del_sess_list field
"struct qla_tgt"->del_sess_list is no longer used since commit
726b854870 ("qla2xxx: Add framework for async fabric discovery").

Link: https://lore.kernel.org/r/0c335e86-5624-b599-5137-f1377419fb0c@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart 1775c2080e scsi: lpfc: Copyright updates for 14.2.0.6 patches
Update copyrights to 2022 for files modified in the 14.2.0.6 patch set.

Link: https://lore.kernel.org/r/20220819011736.14141-8-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart b5c6c88e58 scsi: lpfc: Update lpfc version to 14.2.0.6
Update lpfc version to 14.2.0.6.

Link: https://lore.kernel.org/r/20220819011736.14141-7-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart 2af33e5a03 scsi: lpfc: Remove SANDiags related code
The SANDiags feature is unused, and related code is removed.

Link: https://lore.kernel.org/r/20220819011736.14141-6-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart 71ddeeaf5b scsi: lpfc: Add warning notification period to CMF_SYNC_WQE
Add capability to specify warning notification period to help firmware
adjust to congestion accordingly.

Link: https://lore.kernel.org/r/20220819011736.14141-5-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart bd269188ea scsi: lpfc: Rework MIB Rx Monitor debug info logic
The kernel test robot reported the following sparse warning:

arch/arm64/include/asm/cmpxchg.h:88:1: sparse: sparse: cast truncates
   bits from constant value (369 becomes 69)

On arm64, atomic_xchg only works on 8-bit byte fields.  Thus, the macro
usage of LPFC_RXMONITOR_TABLE_IN_USE can be unintentionally truncated
leading to all logic involving the LPFC_RXMONITOR_TABLE_IN_USE macro to not
work properly.

Replace the Rx Table atomic_t indexing logic with a new
lpfc_rx_info_monitor structure that holds a circular ring buffer.  For
locking semantics, a spinlock_t is used.

Link: https://lore.kernel.org/r/20220819011736.14141-4-jsmart2021@gmail.com
Fixes: 17b27ac592 ("scsi: lpfc: Add rx monitoring statistics")
Cc: <stable@vger.kernel.org> # v5.15+
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart 59b7e210a5 scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID
An error case exit from lpfc_cmpl_ct_cmd_gft_id() results in a call to
lpfc_nlp_put() with a null pointer to a nodelist structure.

Changed lpfc_cmpl_ct_cmd_gft_id() to initialize nodelist pointer upon
entry.

Link: https://lore.kernel.org/r/20220819011736.14141-3-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
James Smart 439b93293f scsi: lpfc: Fix unsolicited FLOGI receive handling during PT2PT discovery
During a stress offline/online test in PT2PT topology, target rediscovery
can fail with a specific target vendor array.

When the HBA transitions to online mode it is possible to receive an
unsolicited FLOGI before processing the Link Up event. The received FLOGI
will set the defer_flogi_acc_flag, which instructs the driver to wait until
it transmits its own FLOGI before ACKing the received FLOGI.  In this
failure scenario, the link up processing clears the set
defer_flogi_acc_flag before we have sent out the FLOGI.  As the target has
the higher WWPN and is responsible for sending the PLOGI, the target is
stuck waiting for its FLOGI_ACC that the driver will never send.

Remove the clear of defer_flogi_acc_flag from Link Up event processing.  In
this stress test case, the defer_flogi_acc_flag is cleared during the Link
Down event processing anyways.

Link: https://lore.kernel.org/r/20220819011736.14141-2-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:58 -04:00
Colin Ian King f0ee639adb scsi: st: Remove redundant variable pointer stp
Variable stp is assigned a value that is never read, the assignment and the
variable stp are redundant and can be removed.

Cleans up clang scan build warning:

drivers/scsi/st.c:4253:7: warning: Although the value stored to 'stp'
is used in the enclosing expression, the value is never actually
read from 'stp' [deadcode.DeadStores]

Link: https://lore.kernel.org/r/20220805115652.2340991-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-08-31 23:39:57 -04:00
Colin Ian King 4e62671a9a scsi: megaraid: Remove redundant assignment to variable mfiStatus
The variable mfiStatus is assigned a value but it is never read. The
assignment is redundant and can be removed. Also remove { } as the return
statement does not need to be in its own code block.

Cleans up clang scan build warning:

drivers/scsi/megaraid/megaraid_sas_base.c:4026:7: warning: Although the
value stored to 'mfiStatus' is used in the enclosing expression, the
value is never actually read from 'mfiStatus' [deadcode.DeadStores]

Link: https://lore.kernel.org/r/20220805115042.2340400-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-08-31 23:39:57 -04:00
Colin Ian King 3fa5975b07 scsi: initio: Remove redundant assignment to pointer scb
The variable scb is assigned a value but it is never read. The assignment
is redundant and can be removed. Also replace the != NULL check with the
more usual non-null check idiom.

Cleans up clang scan build warning:

drivers/scsi/initio.c:1169:9: warning: Although the value stored to 'scb'
is used in the enclosing expression, the value is never actually read
from 'scb' [deadcode.DeadStores]

Link: https://lore.kernel.org/r/20220805114100.2339637-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-08-31 23:39:57 -04:00
Colin Ian King 231159f334 scsi: message: fusion: Remove redundant variable iocnum
Variable iocnum is assigned a value that is never read, the assignment and
hence the variable are redundant can be removed. Also update the comment to
reflect the correct name of the variable being updated.

Cleans up clang-scan warning:

drivers/message/fusion/mptctl.c:641:8: warning: Although the value stored
to 'iocnum' is used in the enclosing expression, the value is never
actually read from 'iocnum' [deadcode.DeadStores]

Link: https://lore.kernel.org/r/20220805113214.2339022-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-08-31 23:39:57 -04:00
Bradley Grove f45fadde91 scsi: mpt3sas: Disable MPI2_FUNCTION_FW_DOWNLOAD for ATTO devices
Disable firmware download for ATTO devices where it is not supported.

Link: https://lore.kernel.org/r/20220805174609.14830-2-bgrove@attotech.com
Co-developed-by: Rob Crispo <rcrispo@attotech.com>
Signed-off-by: Rob Crispo <rcrispo@attotech.com>
Signed-off-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:57 -04:00
Bradley Grove 91cf186aa1 scsi: mpt3sas: Add support for ATTO ExpressSAS H12xx GT devices
Add ATTO's PCI IDs and modify the driver to handle the unique NVRAM
structure used by ATTO's devices.

Link: https://lore.kernel.org/r/20220805174609.14830-1-bgrove@attotech.com
Co-developed-by: Rob Crispo <rcrispo@attotech.com>
Signed-off-by: Rob Crispo <rcrispo@attotech.com>
Signed-off-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:57 -04:00
Sreekanth Reddy 7f90bc70d1 scsi: mpi3mr: Block I/Os while refreshing target dev objects
Block the I/Os on the target devices until corresponding target device's
target dev objects are refreshed as part of post controller reset
operation.

Link: https://lore.kernel.org/r/20220804131226.16653-16-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:57 -04:00
Sreekanth Reddy 2745ce0e6d scsi: mpi3mr: Refresh SAS ports during soft reset
Update the host's SAS ports if there is change in port id or phys. If the
port id is changed, then the driver updates it. If some phys are
enabled/disabled during reset, then driver updates them in STL.

Check for the responding expander devices and update the device handle if
it got changed. Register the expander with STL if it got added during reset
and unregister the expander device if it got removed during reset.

[mkp: include fix for zeroday warning]

Link: https://lore.kernel.org/r/20220804131226.16653-15-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-31 23:39:39 -04:00
Sreekanth Reddy 176d4aa69c scsi: mpi3mr: Support SAS transport class callbacks
Add support for the following SAS transport class callbacks:

 - get_linkerrors
 - get_enclosure_identifier
 - get_bay_identifier
 - phy_reset
 - phy_enable
 - set_phy_speed
 - smp_handler

Link: https://lore.kernel.org/r/20220804131226.16653-14-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:06 -04:00
Sreekanth Reddy 2bd37e2849 scsi: mpi3mr: Add framework to issue MPT transport cmds
Add framework to issue MPT transport commands to controllers.  Also issue
the MPT transport commands to get the manufacturing info of SAS expander
device.

Link: https://lore.kernel.org/r/20220804131226.16653-13-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:06 -04:00
Sreekanth Reddy 7f56c79196 scsi: mpi3mr: Add SAS SATA end devices to STL
Register/unregister the SAS, SATA devices to SCSI Transport Layer(STL)
whenever the corresponding device is added/removed from topology.

Link: https://lore.kernel.org/r/20220804131226.16653-12-sreekanth.reddy@broadcom.com
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:06 -04:00
Sreekanth Reddy 626665e9c3 scsi: mpi3mr: Get target object based on rphy
When device is registered with the STL then get the corresponding device's
target object using the rphy in below callback functions:

 - mpi3mr_target_alloc()

 - mpi3mr_slave_alloc()

 - mpi3mr_slave_configure()

 - mpi3mr_slave_destroy()

Link: https://lore.kernel.org/r/20220804131226.16653-11-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:06 -04:00
Sreekanth Reddy e22bae3066 scsi: mpi3mr: Add expander devices to STL
Register/unregister the expander devices to SCSI Transport Layer(STL)
whenever the corresponding expander is added/removed from topology.

Link: https://lore.kernel.org/r/20220804131226.16653-10-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy c4723e68a0 scsi: mpi3mr: Enable STL on HBAs where multipath is disabled
Register the SAS, SATA devices to SCSI Transport Layer (STL) only if
multipath capability is disabled in the controller's firmware.

Link: https://lore.kernel.org/r/20220804131226.16653-9-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy 42fc9fee11 scsi: mpi3mr: Add helper functions to manage device's port
Add the following helper functions:

 - Update the host phys with STL

 - Remove the device's SAS port with STL

Link: https://lore.kernel.org/r/20220804131226.16653-8-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy 125ad1e6b4 scsi: mpi3mr: Add helper functions to retrieve device objects
Add the following helper functions:

 - Get the device's sas address by reading corresponding device's Device
   page0

 - Get the expander object from expander list based on expander's handle

 - Get the target device object from target device list based on device's
   sas address

 - Get the expander device object from expander list based on expanders's
   sas address

 - Get hba port object from hba port table list based on port's port id

Link: https://lore.kernel.org/r/20220804131226.16653-7-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy fc7212fd31 scsi: mpi3mr: Add framework to add phys to STL
Add framework to register and unregister the host and expander phys with
SCSI Transport Layer (STL).

Link: https://lore.kernel.org/r/20220804131226.16653-6-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy 7188c03ff8 scsi: mpi3mr: Enable Enclosure device add event
Enable and process the Enclosure device add event.

Link: https://lore.kernel.org/r/20220804131226.16653-5-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy 64a8d9315b scsi: mpi3mr: Add helper functions to retrieve config pages
Add helper functions to retrieve below controller's config pages:

 - SAS IOUnit Page0

 - SAS IOUnit Page1

 - Driver Page1

 - Device Page0

 - SAS Phy Page0

 - SAS Phy Page1

 - SAS Expander Page0

 - SAS Expander Page1

 - Enclosure Page0

Also add the helper function to set SAS IOUnit Page1.

Link: https://lore.kernel.org/r/20220804131226.16653-4-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:05 -04:00
Sreekanth Reddy 32d457d5a2 scsi: mpi3mr: Add framework to issue config requests
Add framework to issue config requests commands to controller firmware.

Link: https://lore.kernel.org/r/20220804131226.16653-3-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:04 -04:00
Sreekanth Reddy 3b73c45e6f scsi: mpi3mr: Add config and transport related debug flags
Add config and transport request related error & info debug flags and
functions.

Link: https://lore.kernel.org/r/20220804131226.16653-2-sreekanth.reddy@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:34:04 -04:00
Jinyoung Choi 4f6b69f364 scsi: ufs: wb: Modify messages
Modify messages to fit the format of others.

Link: https://lore.kernel.org/r/20220804075519epcms2p148b6ae956b172925b26304b50d6a0da9@epcms2p1
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:16:50 -04:00
Jinyoung Choi 42f8c5cdb0 scsi: ufs: wb: Introduce ufshcd_is_wb_buf_flush_allowed()
The explicit flushing should check the following:

 - UFSHCD_CAP_WB_EN

 - UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Add helper to improve readability.

Link: https://lore.kernel.org/r/20220804075444epcms2p4a0520880262281f02be65ce0fe50602d@epcms2p4
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:15:11 -04:00
Jinyoung Choi 6c4148ce7c scsi: ufs: wb: Add explicit flush sysfs attribute
There is the following quirk to bypass "WB Flush" in Write Booster.

	- UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

If this quirk is not set, there is no knob that can control "WB Flush".

There are three flags that control Write Booster Feature:

	1. WB ON/OFF
	2. WB Hibern Flush ON/OFF (implicitly)
	3. WB Flush ON/OFF (explicit)

The sysfs attribute that controls the WB was implemented. (1)

In the case of "Hibern Flush", it is always good to turn on.  Control may
not be required. (2)

Finally, "Flush" may be necessary because the Auto-Hibern8 is not supported
in a specific environment.  So the sysfs attribute that controls this is
necessary. (3)

Link: https://lore.kernel.org/r/20220804075354epcms2p8c21c894b4e28840c5fc651875b7f435f@epcms2p8
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:15:11 -04:00
Jinyoung Choi 4450a1653a scsi: ufs: wb: Change function name and parameter names
Change the parameter names of ufshcd_wb_toggle_flush_during_h8() to match
the other toggle functions.

Link: https://lore.kernel.org/r/20220804075058epcms2p550c578d743fe0a94888b3d71cc9076d4@epcms2p5
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:15:10 -04:00
Jinyoung Choi f8dc7a31a3 scsi: ufs: wb: Change wb_enabled condition test
Change to improve readability.

Link: https://lore.kernel.org/r/20220804074928epcms2p86582693a39597501b491400a28543a92@epcms2p8
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:15:10 -04:00
Peter Wang 87bd05016a scsi: ufs: core: Allow host driver to disable wb toggling during clock scaling
Mediatek UFS does not want to toggle write booster during clock scaling.
Permit host driver to disable wb toggling during clock scaling.

Introduce a flag UFSHCD_CAP_WB_WITH_CLK_SCALING to decouple WB and clock
scaling.  UFSHCD_CAP_WB_WITH_CLK_SCALING is only valid when
UFSHCD_CAP_CLK_SCALING is set. Just like UFSHCD_CAP_HIBERN8_WITH_CLK_GATING
is valid only when UFSHCD_CAP_CLK_GATING set.

Set UFSHCD_CAP_WB_WITH_CLK_SCALING for qcom to compatible legacy design at
the same time.

Link: https://lore.kernel.org/r/20220804025422.18803-1-peter.wang@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:07:50 -04:00
Daniil Lunev 0f85e74756 scsi: ufs: core: Use local_clock() for debugging timestamps
CLOCK_MONOTONIC is not advanced when the system is in suspend. This becomes
problematic when debugging issues related to suspend-resume: the timestamps
printed by ufshcd_print_trs can not be correlated with dmesg entries, which
are timestamped with local_clock().

Change the used clock to local_clock() for the informational timestamp
variables and adds mirroring *_local_clock instances for variables used in
subsequent derevations (to not change the semantics of those derevations).

Link: https://lore.kernel.org/r/20220804065019.v5.1.I699244ea7efbd326a34a6dfd9b5a31e78400cf68@changeid
Acked-by: Stanley Chu <stanley.chu@mediatek.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Daniil Lunev <dlunev@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 23:03:30 -04:00
Po-Wen Kao b7dbc686f6 scsi: ufs: ufs-mediatek: Support clk-scaling to optimize power consumption
Provide clk-scaling feature in MediaTek UFS platforms.

MediaTek platform supports clk-scaling by switching parent clock mux of
UFSHCI main clocks: ufs_sel.

The driver needs to prevent changing the rate of ufs_sel because its parent
PLL clock may be shared between multiple IPs. In order to achieve this
goal, the maximum and minimum clock rates of ufs_sel defined in dts should
match the rate of "ufs_sel_max_src" and "ufs_sel_min_src" respectively.

Link: https://lore.kernel.org/r/20220802235437.4547-6-stanley.chu@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 22:58:30 -04:00
Peter Wang 2873e0453b scsi: ufs: ufs-mediatek: Fix performance scaling
If clk-scaling is enabled, performance scaling can be bound to the decision
of clk-scaling to avoid unnecessary boosting.

In addition, fix missing initialization of pm-qos request.

Link: https://lore.kernel.org/r/20220802235437.4547-5-stanley.chu@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 22:58:30 -04:00
Peter Wang 364893575d scsi: ufs: ufs-mediatek: Dump more registers
Dump more proprietary UFSHCI status registers for easier issue breakdown.

Link: https://lore.kernel.org/r/20220802235437.4547-4-stanley.chu@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 22:58:29 -04:00
Stanley Chu 4d869fe67a scsi: ufs: ufs-mediatek: Provide detailed description for UIC errors
Provide detailed description in logs for UIC errors for easier issue
breakdown.

Link: https://lore.kernel.org/r/20220802235437.4547-3-stanley.chu@mediatek.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 22:58:29 -04:00
Stanley Chu de9f43f0d2 scsi: ufs: ufs-mediatek: Remove redundant header files
Remove redundant #include of header file <linux/sched/clock.h>.

Link: https://lore.kernel.org/r/20220802235437.4547-2-stanley.chu@mediatek.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-08-22 22:58:29 -04:00
Linus Torvalds 568035b01c Linux 6.0-rc1 2022-08-14 15:50:18 -07:00
Yury Norov 9f162193d6 radix-tree: replace gfp.h inclusion with gfp_types.h
Radix tree header includes gfp.h for __GFP_BITS_SHIFT only. Now we
have gfp_types.h for this.

Fixes powerpc allmodconfig build:

   In file included from include/linux/nodemask.h:97,
                    from include/linux/mmzone.h:17,
                    from include/linux/gfp.h:7,
                    from include/linux/radix-tree.h:12,
                    from include/linux/idr.h:15,
                    from include/linux/kernfs.h:12,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/pci.h:35,
                    from arch/powerpc/kernel/prom_init.c:24:
   include/linux/random.h: In function 'add_latent_entropy':
>> include/linux/random.h:25:46: error: 'latent_entropy' undeclared (first use in this function); did you mean 'add_latent_entropy'?
      25 |         add_device_randomness((const void *)&latent_entropy, sizeof(latent_entropy));
         |                                              ^~~~~~~~~~~~~~
         |                                              add_latent_entropy
   include/linux/random.h:25:46: note: each undeclared identifier is reported only once for each function it appears in

Reported-by: kernel test robot <lkp@intel.com>
CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-08-14 13:31:03 -07:00
Linus Torvalds 74cbb480d0 Fix proc_reg_llseek() breakage. Always had been possible if
somebody left NULL ->proc_lseek, became a practical issue now.
 
 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQqUNBr3gm4hGXdBJlZ7Krx/gZQ6wUCYvlK4QAKCRBZ7Krx/gZQ
 68EUAQDFUFhyvVLnhh1tAkPt3mxHT2OHASN8z6gRBjxGmqj53QD8D4EZAMy3XHnB
 /6ajdD7hl5pxZQnECPqbBjzPYHa22QE=
 =BNbv
 -----END PGP SIGNATURE-----

Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs lseek fix from Al Viro:
 "Fix proc_reg_llseek() breakage. Always had been possible if somebody
  left NULL ->proc_lseek, became a practical issue now"

* tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  take care to handle NULL ->proc_lseek()
2022-08-14 13:03:53 -07:00