platform/kernel/linux-rpi.git
3 years agoscsi: qedi: Fix missing destroy_workqueue() on error in __qedi_probe
Qinglang Miao [Mon, 9 Nov 2020 09:15:18 +0000 (17:15 +0800)]
scsi: qedi: Fix missing destroy_workqueue() on error in __qedi_probe

Add the missing destroy_workqueue() before return from __qedi_probe in the
error handling case when fails to create workqueue qedi->offload_thread.

Link: https://lore.kernel.org/r/20201109091518.55941-1-miaoqinglang@huawei.com
Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: target: core: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:32:32 +0000 (12:32 -0600)]
scsi: target: core: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple of
warnings by explicitly adding a break statement and a fallthrough
pseudo-keyword instead of letting the code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/761d6f755e8a6f8a6daebd1e5c1394167e5c780a.1605896059.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: stex: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:39:36 +0000 (12:39 -0600)]
scsi: stex: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by
explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/20a7bcc10af2b762325c7078a4f472121a4fabc7.1605896060.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:39:31 +0000 (12:39 -0600)]
scsi: lpfc: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by
explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/fff8d6f1d33b9e2c94dbe024a4f8df22866d3bf8.1605896060.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: csiostor: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:39:26 +0000 (12:39 -0600)]
scsi: csiostor: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by
explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/b77ee091548f16b52056c3b9ee8c76dc6691f868.1605896060.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aha1740: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:39:21 +0000 (12:39 -0600)]
scsi: aha1740: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by
explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/e9fc10eb7d843e6f31e50400d428bd7a217684ac.1605896060.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aacraid: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:39:15 +0000 (12:39 -0600)]
scsi: aacraid: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by
explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/e4e25e57964a69f7173f868ff93df9d6d08f360f.1605896060.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: bfa: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:27:30 +0000 (12:27 -0600)]
scsi: bfa: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding a couple break statements and replacing /*
fall through */ comments with the new pseudo-keyword macro fallthrough;
instead of just letting the code fall through to the next case.

Notice that Clang doesn't recognize /* fall through */ comments as implicit
fall-through markings.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/2ae1cafd858238b85fc5e7fe5cc183843e21ec9f.1605896059.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aic94xx: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:27:24 +0000 (12:27 -0600)]
scsi: aic94xx: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding a couple of break and fallthrough statements
instead of just letting the code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/9b58459045d303bbea0160f2e349f5799402a2bf.1605896059.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aic7xxx: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:27:16 +0000 (12:27 -0600)]
scsi: aic7xxx: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break statements instead of just
letting the code fall through to the next case, and by adding fallthrough
statements in places where the code is intended to fall through, and
finally by replacing /* FALLTHROUGH */ comments with the new pseudo-keyword
macro fallthrough.

Link: https://github.com/KSPP/linux/issues/115
Link: https://lore.kernel.org/r/1a7cd2f77623e6ab46bbec0b6103b18491419206.1605896059.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Correct null ndlp reference on routine exit
James Smart [Mon, 30 Nov 2020 18:12:26 +0000 (10:12 -0800)]
scsi: lpfc: Correct null ndlp reference on routine exit

smatch correctly called out a logic error with accessing a pointer after
checking it for null:

 drivers/scsi/lpfc/lpfc_els.c:2043 lpfc_cmpl_els_plogi()
 error: we previously assumed 'ndlp' could be null (see line 1942)

Adjust the exit point to avoid the trace printf ndlp reference. A trace
entry was already generated when the ndlp was checked for null.

Link: https://lore.kernel.org/r/20201130181226.16675-1-james.smart@broadcom.com
Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Stop hardcoding the scale down gear
Can Guo [Fri, 27 Nov 2020 01:58:48 +0000 (17:58 -0800)]
scsi: ufs: Stop hardcoding the scale down gear

Instead of hardcoding the scale down gear, make it a member of
the ufs_clk_scaling struct.

Link: https://lore.kernel.org/r/1606442334-22641-1-git-send-email-cang@codeaurora.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs-qcom: Keep core_clk_unipro on while link is active
Can Guo [Thu, 26 Nov 2020 02:01:01 +0000 (18:01 -0800)]
scsi: ufs-qcom: Keep core_clk_unipro on while link is active

If we want to disable clocks to save power but still keep the link active,
core_clk_unipro, like ref_clk, should not be the one being disabled.

Link: https://lore.kernel.org/r/1606356063-38380-3-git-send-email-cang@codeaurora.org
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Refactor ufshcd_setup_clocks() to remove skip_ref_clk
Can Guo [Thu, 26 Nov 2020 02:01:00 +0000 (18:01 -0800)]
scsi: ufs: Refactor ufshcd_setup_clocks() to remove skip_ref_clk

Remove the param skip_ref_clk from __ufshcd_setup_clocks(), but keep a flag
in struct ufs_clk_info to tell whether a clock can be disabled or not while
the link is active.

Link: https://lore.kernel.org/r/1606356063-38380-2-git-send-email-cang@codeaurora.org
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: message: fusion: Remove in_interrupt() usage in mptsas_cleanup_fw_event_q()
Sebastian Andrzej Siewior [Thu, 26 Nov 2020 13:29:52 +0000 (14:29 +0100)]
scsi: message: fusion: Remove in_interrupt() usage in mptsas_cleanup_fw_event_q()

mptsas_cleanup_fw_event_q() uses in_interrupt() to determine if it is safe
to cancel a worker item.

Aside of that in_interrupt() is deprecated as it does not provide what the
name suggests. It covers more than hard/soft interrupt servicing context
and is semantically ill defined.

Looking closer there are a few problems with the current construct:

 - It could be invoked from an interrupt handler / non-blocking context
   because cancel_delayed_work() has no such restriction. Also,
   mptsas_free_fw_event() has no such restriction.

 - The list is accessed unlocked. It may dequeue a valid work-item but at
   the time of invoking cancel_delayed_work() the memory may be released or
   reused because the worker has already run.

mptsas_cleanup_fw_event_q() is invoked via mptsas_shutdown() which is
always invoked from preemtible context on device shutdown.  It is also
invoked via mptsas_ioc_reset(, MPT_IOC_POST_RESET) which is a
MptResetHandlers callback. The only caller here are mpt_SoftResetHandler(),
mpt_HardResetHandler() and mpt_Soft_Hard_ResetHandler(). All these
functions have a `sleepFlag' argument and each caller uses caller uses
`CAN_SLEEP' here and according to current documentation: | @sleepFlag:
Indicates if sleep or schedule must be called

So it is safe to sleep.

Add mptsas_hotplug_event::users member. Initialize it to one by default so
mptsas_free_fw_event() will free the memory.  mptsas_cleanup_fw_event_q()
will increment its value for items it dequeues and then it may keep a
pointer after dropping the lock.  Invoke cancel_delayed_work_sync() to
cancel the work item and wait if the worker is currently busy. Free the
memory afterwards since it owns the last reference to it.

Link: https://lore.kernel.org/r/20201126132952.2287996-15-bigeasy@linutronix.de
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: MPT-FusionLinux.pdl@broadcom.com
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: message: fusion: Remove in_interrupt() usage in mpt_config()
Thomas Gleixner [Thu, 26 Nov 2020 13:29:51 +0000 (14:29 +0100)]
scsi: message: fusion: Remove in_interrupt() usage in mpt_config()

in_interrupt() is referenced all over the place in these drivers. Most of
these references are comments which are outdated and wrong.

Aside of that in_interrupt() is deprecated as it does not provide what the
name suggests. It covers more than hard/soft interrupt servicing context
and is semantically ill defined.

>From reading the mpt_config() code and the history this is clearly a debug
mechanism and should probably be replaced by might_sleep() or completely
removed because such checks are already in the subsequent functions.

Remove the in_interrupt() references and replace the usage in mpt_config()
with might_sleep().

Link: https://lore.kernel.org/r/20201126132952.2287996-14-bigeasy@linutronix.de
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: MPT-FusionLinux.pdl@broadcom.com
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: myrs: Remove WARN_ON(in_interrupt())
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:49 +0000 (14:29 +0100)]
scsi: myrs: Remove WARN_ON(in_interrupt())

The in_interrupt() macro is ill-defined and does not provide what the name
suggests. The usage especially in driver code is deprecated and a tree-wide
effort to clean up and consolidate the (ab)usage of in_interrupt() and
related checks is happening.

In this case the check covers only parts of the contexts in which these
functions cannot be called. It fails to detect preemption or interrupt
disabled invocations.

As wait_for_completion() already contains a broad variety of checks (always
enabled or debug option dependent) which cover all invalid conditions
already, there is no point in having extra inconsistent warnings in
drivers.

Just remove it.

Link: https://lore.kernel.org/r/20201126132952.2287996-12-bigeasy@linutronix.de
Cc: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: myrb: Remove WARN_ON(in_interrupt())
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:48 +0000 (14:29 +0100)]
scsi: myrb: Remove WARN_ON(in_interrupt())

The in_interrupt() macro is ill-defined and does not provide what the name
suggests. The usage especially in driver code is deprecated and a tree-wide
effort to clean up and consolidate the (ab)usage of in_interrupt() and
related checks is happening.

In this case the check covers only parts of the contexts in which these
functions cannot be called. It fails to detect preemption or interrupt
disabled invocations.

As wait_for_completion() already contains a broad variety of checks (always
enabled or debug option dependent) which cover all invalid conditions
already, there is no point in having extra inconsistent warnings in
drivers.

Just remove it.

Link: https://lore.kernel.org/r/20201126132952.2287996-11-bigeasy@linutronix.de
Cc: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mpt3sas: Remove in_interrupt()
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:47 +0000 (14:29 +0100)]
scsi: mpt3sas: Remove in_interrupt()

_scsih_fw_event_cleanup_queue() waits for all outstanding firmware events
wokrqueue handlers to finish. If in_interrupt() is true, it cancels itself
and return early.

That in_interrupt() check is ill-defined and does not provide what the name
suggests: it does not cover all states in which it is safe to block and
call functions like cancel_work_sync().

That check is also not needed: _scsih_fw_event_cleanup_queue() is always
invoked from process context. Below is an analysis of its callers:

  - scsih_remove(), bound to PCI ->remove(), process context

  - scsih_shutdown(), bound to PCI ->shutdown(), process context

  - mpt3sas_scsih_clear_outstanding_scsi_tm_commands(), called by
      => _base_clear_outstanding_commands(), called by
        =>_base_fault_reset_work(), workqueue
        => mpt3sas_base_hard_reset_handler(), locks mutex

Remove the in_interrupt() check. Change _scsih_fw_event_cleanup_queue()
specification to a purely process-context function and mark it with
"Context: task, can sleep".

Link: https://lore.kernel.org/r/20201126132952.2287996-10-bigeasy@linutronix.de
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: <MPT-FusionLinux.pdl@broadcom.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla4xxx: Remove in_interrupt() from qla4_82xx_rom_lock()
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:46 +0000 (14:29 +0100)]
scsi: qla4xxx: Remove in_interrupt() from qla4_82xx_rom_lock()

qla4_82xx_rom_lock() spins on a certain hardware state until it is
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(). Otherwise, it yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: qla4_82xx_rom_lock() is always called
from process context. Below is an analysis of its callers:

  - ql4_nx.c: qla4_82xx_rom_fast_read(), all process context callers:
    => ql4_nx.c: qla4_82xx_pinit_from_rom(), GFP_KERNEL allocation
    => ql4_nx.c: qla4_82xx_load_from_flash(), msleep() in a loop

  - ql4_nx.c: qla4_82xx_pinit_from_rom(), earlier discussed

  - ql4_nx.c: qla4_82xx_rom_lock_recovery(), bound to "isp_operations"
    ->rom_lock_recovery() hook, which has one process context caller,
    qla4_8xxx_device_bootstrap(), with callers:
      => ql4_83xx.c: qla4_83xx_need_reset_handler(), process, msleep()
      => ql4_nx.c: qla4_8xxx_device_state_handler(), multiple msleep()s

  - ql4_nx.c: qla4_82xx_read_flash_data(), has cond_resched()

Remove the in_interrupt() check. Mark, qla4_82xx_rom_lock(), and the
->rom_lock_recovery() hook, with "Context: task, can sleep".

Change qla4_82xx_rom_lock() implementation to sleep 20ms, instead of a
schedule(), for each spin. This is more deterministic, and it matches
the other implementations bound to ->rom_lock_recovery().

Link: https://lore.kernel.org/r/20201126132952.2287996-9-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla4xxx: Remove in_interrupt() from qla4_82xx_idc_lock()
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:45 +0000 (14:29 +0100)]
scsi: qla4xxx: Remove in_interrupt() from qla4_82xx_idc_lock()

qla4_82xx_idc_lock() spins on a certain hardware state until it is
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(). Otherwise, it yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: qla4_82xx_idc_lock() is always called from
process context. Below is an analysis of its callers:

  - ql4_nx.c: qla4_82xx_need_reset_handler(), 1-second msleep() in a
    loop.

  - ql4_nx.c: qla4_82xx_isp_reset(), calls
    qla4_8xxx_device_state_handler(), which has multiple msleep()s.

Beside direct calls, qla4_82xx_idc_lock() is also bound to isp_operations
->idc_lock() hook. Other functions which are bound to the same hook,
e.g. qla4_83xx_drv_lock(), also have an msleep(). For completeness, below
is an analysis of all callers of that hook:

  - ql4_83xx.c: qla4_83xx_need_reset_handler(), has an msleep()

  - ql4_83xx.c: qla4_83xx_isp_reset(), calls
    qla4_8xxx_device_state_handler(), which has multiple msleep()s.

  - ql4_83xx.c: qla4_83xx_disable_pause(), all process context callers:
    => ql4_mbx.c: qla4xxx_mailbox_command(), msleep(), mutex_lock()
    => ql4_os.c: qla4xxx_recover_adapter(), schedule_timeout() in loop
    => ql4_os.c: qla4xxx_do_dpc(), workqueue context

  - ql4_attr.c: qla4_8xxx_sysfs_write_fw_dump(), sysfs bin_attribute
    ->write() hook, process context

  - ql4_mbx.c: qla4xxx_mailbox_command(), earlier discussed

  - ql4_nx.c: qla4_8xxx_device_bootstrap(), callers:
    => ql4_83xx.c: qla4_83xx_need_reset_handler(), process, msleep()
    => ql4_nx.c: qla4_8xxx_device_state_handler(), earlier discussed

  - ql4_nx.c: qla4_8xxx_need_qsnt_handler(), callers:
    => ql4_nx.c: qla4_8xxx_device_state_handler(), multiple msleep()s
    => ql4_os.c: qla4xxx_do_dpc(), workqueue context

  - ql4_nx.c: qla4_8xxx_update_idc_reg(), callers:
    => ql4_nx.c: qla4_8xxx_device_state_handler(), earlier discussed
    => ql4_os.c: qla4_8xxx_error_recovery(), only called by
    qla4xxx_pci_slot_reset(), which is bound to PCI ->slot_reset()
    process-context hook

  - ql4_nx.c: qla4_8xxx_device_state_handler(), earlier discussed

  - ql4_os.c: qla4xxx_recover_adapter(), earlier discussed

  - ql4_os.c: qla4xxx_do_dpc(), earlier discussed

Remove the in_interrupt() check. Mark, qla4_82xx_idc_lock(), and the
->idc_lock() hook itself, with "Context: task, can sleep".

Change qla4_82xx_idc_lock() implementation to sleep 100ms, instead of a
schedule(), for each spin. This is more deterministic, and it matches other
PCI HW locking functions in the driver.

Link: https://lore.kernel.org/r/20201126132952.2287996-8-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Remove in_interrupt() from qla83xx-specific code
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:44 +0000 (14:29 +0100)]
scsi: qla2xxx: Remove in_interrupt() from qla83xx-specific code

qla83xx_wait_logic() is used to control the frequency of device IDC lock
retries. If in_interrupt() is true, it does 20 loops of cpu_relax().
Otherwise, it sleeps for 100ms and yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: that qla83xx_wait_logic() is exclusively
called by qla83xx_idc_lock() / unlock(), and they always run from process
context. Below is an analysis of all the idc lock/unlock callers, in order
of appearance:

  - qla_os.c:
      qla83xx_nic_core_unrecoverable_work(),
      qla83xx_idc_state_handler_work(),
      qla83xx_nic_core_reset_work(),
      qla83xx_service_idc_aen(), all workqueue context

  - qla_os.c: qla83xx_check_nic_core_fw_alive(), has msleep()

  - qla_os.c: qla83xx_set_drv_presence(), called once from
    qla2x00_abort_isp(), which is bound to process-context ->abort_isp()
    hook. It also invokes wait_for_completion_timeout() through the chain
    qla2x00_configure_hba() => qla24xx_link_initialize() =>
    qla2x00_mailbox_command().

  - qla_os.c: qla83xx_clear_drv_presence(), which is called from
    qla2x00_abort_isp() discussed above, and from qla2x00_remove_one()
    which is PCI process-context ->remove() hook.

  - qla_os.c: qla83xx_need_reset_handler(), has a one second msleep() in
    a loop.

  - qla_os.c: qla83xx_device_bootstrap(), called only by
    qla83xx_idc_state_handler(), which has multiple msleep()
    invocations.

  - qla_os.c: qla83xx_idc_state_handler(), multiple msleep()
    invocations.

  - qla_attr.c: qla2x00_sysfs_write_reset(), sysfs bin_attribute
    ->write() hook, process context

  - qla_init.c: qla83xx_nic_core_fw_load()
      => qla_init.c: qla2x00_initialize_adapter()
        => bound to isp_operations ->initialize_adapter() hook
        ** => qla_os.c: qla2x00_probe_one(), PCI ->probe() process ctx

  - qla_init.c: qla83xx_initiating_reset(), msleep() in a loop.

  - qla_init.c: qla83xx_nic_core_reset(), called by
    qla83xx_nic_core_reset_work(), workqueue context.

Remove the in_interrupt() check, and thus replace the entirety of
qla83xx_wait_logic() with an msleep(QLA83XX_WAIT_LOGIC_MS).

Mark qla83xx_idc_lock() / unlock() with "Context: task, can sleep".

Link: https://lore.kernel.org/r/20201126132952.2287996-7-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: target: tcm_qla2xxx: Remove BUG_ON(in_interrupt())
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:43 +0000 (14:29 +0100)]
scsi: target: tcm_qla2xxx: Remove BUG_ON(in_interrupt())

tcm_qla2xxx_free_session() has a BUG_ON(in_interrupt()).

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: the function is always invoked from
workqueue context through "struct qla_tgt_func_tmpl" ->free_session() hook
it is bound to.

The function also calls wait_event_timeout() down the chain, which already
has a might_sleep().

Remove the in_interrupt() check.

Link: https://lore.kernel.org/r/20201126132952.2287996-6-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla2xxx: Remove in_interrupt() from qla82xx-specific code
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:42 +0000 (14:29 +0100)]
scsi: qla2xxx: Remove in_interrupt() from qla82xx-specific code

qla82xx_idc_lock() spins on a certain hardware state until it's updated. At
the end of each spin, if in_interrupt() is true, it does 20 loops of
cpu_relax(). Otherwise, it yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: qla82xx_idc_lock() is always called from
process context. Below is an analysis of its callers, in order of
appearance:

  - qla_nx.c: qla82xx_device_bootstrap(), only called by
    qla82xx_device_state_handler(), has multiple msleep()s.

  - qla_nx.c: qla82xx_need_qsnt_handler(), has one second msleep()

  - qla_nx.c: qla82xx_wait_for_state_change(), one second msleep()

  - qla_nx.c: qla82xx_need_reset_handler(), can sleep up to 10 seconds

  - qla_nx.c: qla82xx_device_state_handler(), has multiple msleep()s

  - qla_nx.c: qla82xx_abort_isp(), if it's a qla82xx controller, calls
    qla82xx_device_state_handler(), which sleeps. It's also bound to
    isp_operations ->abort_isp() hook, where all the callers are in process
    context.

  - qla_nx.c: qla82xx_beacon_on(), bound to isp_operations ->beacon_on()
    hook.  That hook is only called once, in a mutex locked context, from
    qla2x00_beacon_store().

  - qla_nx.c: qla82xx_beacon_off(), bound to isp_operations ->beacon_off()
    hook.  Like ->beacon_on(), it's only called once, in a mutex locked
    context, from qla2x00_beacon_store().

  - qla_nx.c: qla82xx_fw_dump(), calls qla2x00_wait_for_chip_reset(), which
    has msleep() in a loop. It is bound to isp_operations ->fw_dump()
    hook. That hook *is* called from atomic context at qla_isr.c by
    multiple interrupt handlers. Nonetheless, it's other controllers
    interrupt handlers, and not the qla82xx.

  - qla82xx_msix_default() and qla82xx_msix_rsp_q() call
    qla24xx_process_response_queue() which doesn't implement the firmware
    dumping.

  - qla_attr.c: qla2x00_sysfs_write_fw_dump(), and
    qla2x00_sysfs_write_reset(), process-context sysfs ->write() hooks.

  - qla_os.c: qla2x00_probe_one(). PCI ->probe(), process context.

  - qla_os.c: qla2x00_clear_drv_active(), called solely from
    qla2x00_remove_one(), which is PCI ->remove() hook, process context.

  - qla_os.c: qla2x00_do_dpc(), kthread function, process context.

Remove the in_interrupt() check. Change qla82xx_idc_lock() specification to
a purely process-context function. Mark it with "Context: task, might
sleep".

Change qla82xx_idc_lock() implementation to sleep 100ms, instead of a
schedule(), for each spin. This is more deterministic, and it matches the
other qla models idc_lock() functions.

Link: https://lore.kernel.org/r/20201126132952.2287996-5-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla4xxx: Remove in_interrupt()
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:41 +0000 (14:29 +0100)]
scsi: qla4xxx: Remove in_interrupt()

qla4_82xx_crb_win_lock() spins on a certain hardware state until it's
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(). Otherwise, it yields the CPU.

The in_interrupt() macro is ill-defined as it does not provide what the
name suggests, and it does not catch the intended use-case here.

qla4_82xx_crb_win_lock() is always invoked with scsi_qla_host::hw_lock
acquired, with disabled interrupts. If the caller is in process context, as
in qla4_82xx_need_reset_handler(), then in_interrupt() will return false
even though it is not allowed to call schedule().

Remove the in_interrupt() check.

Change qla4_82xx_crb_win_lock() specification to a purely atomic
function. Mark it as static, remove its forward declaration, and move it
above its callers. To avoid hammering the PCI bus while spinning, use a 10
micro-second delay instead of cpu_relax().

Link: https://lore.kernel.org/r/20201126132952.2287996-4-bigeasy@linutronix.de
Fixes: f4f5df23bf72 ("[SCSI] qla4xxx: Added support for ISP82XX")
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Remove preemptible()
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:40 +0000 (14:29 +0100)]
scsi: hisi_sas: Remove preemptible()

hisi_sas_task_exec() uses preemptible() to see if it's safe to block.  This
does not work for CONFIG_PREEMPT_COUNT=n kernels in which preemptible()
always returns 0.

The problem is masked when enabling some of the common Kconfig.debug
options (like CONFIG_DEBUG_ATOMIC_SLEEP), as they implicitly enable the
preemption counter.

In general, driver leaf functions should not make logic decisions based on
the context they're called from. The caller should be the entity
responsible for explicitly indicating context.

Since hisi_sas_task_exec() already has a gfp_t flags parameter, use it as
the explicit context marker.

Link: https://lore.kernel.org/r/20201126132952.2287996-3-bigeasy@linutronix.de
Fixes: 214e702d4b70 ("scsi: hisi_sas: Adjust task reject period during host reset")
Fixes: 550c0d89d52d ("scsi: hisi_sas: Replace in_softirq() check in hisi_sas_task_exec()")
Cc: Xiaofei Tan <tanxiaofei@huawei.com>
Cc: Xiang Chen <chenxiang66@hisilicon.com>
Cc: John Garry <john.garry@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm80xx: Do not sleep in atomic context
Ahmed S. Darwish [Thu, 26 Nov 2020 13:29:39 +0000 (14:29 +0100)]
scsi: pm80xx: Do not sleep in atomic context

hw_event_sas_phy_up() is used in hardirq/softirq context:

 pm8001_interrupt_handler_msix() || pm8001_interrupt_handler_intx() || pm8001_tasklet
   => PM8001_CHIP_DISP->isr() = pm80xx_chip_isr()
     => process_oq() [spin_lock_irqsave(&pm8001_ha->lock,)]
       => process_one_iomb()
         => mpi_hw_event()
           => hw_event_sas_phy_up()
             => msleep(200)

Revert the msleep() back to an mdelay() to avoid sleeping in atomic
context.

Link: https://lore.kernel.org/r/20201126132952.2287996-2-bigeasy@linutronix.de
Fixes: 4daf1ef3c681 ("scsi: pm80xx: Convert 'long' mdelay to msleep")
Cc: Vikram Auradkar <auradkar@google.com>
Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Remove unnecessary if condition in ufshcd_suspend()
Bean Huo [Wed, 25 Nov 2020 18:53:00 +0000 (19:53 +0100)]
scsi: ufs: Remove unnecessary if condition in ufshcd_suspend()

In the case that auto_bkops_enable is false, which means auto bkops has
been disabled, there is no need to call ufshcd_disable_auto_bkops().

Link: https://lore.kernel.org/r/20201125185300.3394-1-huobean@gmail.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Move debugfs code to v3 hw driver
Luo Jiaxing [Tue, 24 Nov 2020 08:46:34 +0000 (16:46 +0800)]
scsi: hisi_sas: Move debugfs code to v3 hw driver

Relocate all the debugfs code for DFX to v3 hw since no other versions
support it.

Link: https://lore.kernel.org/r/1606207594-196362-4-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Fix up probe error handling for v3 hw
Xiang Chen [Tue, 24 Nov 2020 08:46:33 +0000 (16:46 +0800)]
scsi: hisi_sas: Fix up probe error handling for v3 hw

Fix some rollbacks in function hisi_sas_v3_probe() and
interrupt_init_v3_hw().

Link: https://lore.kernel.org/r/1606207594-196362-3-git-send-email-john.garry@huawei.com
Fixes: 8d98416a55eb ("scsi: hisi_sas: Switch v3 hw to MQ")
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas: Reduce some indirection in v3 hw driver
John Garry [Tue, 24 Nov 2020 08:46:32 +0000 (16:46 +0800)]
scsi: hisi_sas: Reduce some indirection in v3 hw driver

Sometimes local functions are called indirectly from the hw driver, which
only makes the code harder to follow. Remove these.

Method .hw_init is only called from platform driver probe, which is not
relevant, so don't set this either.

Link: https://lore.kernel.org/r/1606207594-196362-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>
3 years agoscsi: pm8001: Remove space in a debug message
Colin Ian King [Tue, 24 Nov 2020 09:38:28 +0000 (09:38 +0000)]
scsi: pm8001: Remove space in a debug message

There are two words that need separating with a space in a pm8001_dbg()
message. Fix it.

Link: https://lore.kernel.org/r/20201124093828.307709-1-colin.king@canonical.com
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm8001: Fix misindentation
Joe Perches [Tue, 24 Nov 2020 04:36:04 +0000 (20:36 -0800)]
scsi: pm8001: Fix misindentation

kernel robot reported a misindentation of a goto.

Fix it.

At the same time, use a temporary for a repeated entry in the same block to
reduce visual noise.

Link: https://lore.kernel.org/r/9542a8be9954c1dca744f93f53bb1af6dd1436e8.1606192458.git.joe@perches.com
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm8001: Convert pm8001_printk() to pm8001_info()
Joe Perches [Tue, 24 Nov 2020 04:36:03 +0000 (20:36 -0800)]
scsi: pm8001: Convert pm8001_printk() to pm8001_info()

Use the more common logging style.

[mkp: fixed a few conflicts]

Link: https://lore.kernel.org/r/69dc34ff63adfa60b3f203ed2d58143b5692af57.1606192458.git.joe@perches.com
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pmcraid: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:30 +0000 (22:17 +0530)]
scsi: pmcraid: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-30-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pmcraid: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:29 +0000 (22:17 +0530)]
scsi: pmcraid: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in pmcraid_resume(), and
there is no corresponding pci_enable_wake(...., true) in pmcraid_suspend().
Either it should do enable-wake the device in .suspend() or should not
invoke pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
pmcraid_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-29-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mvumi: Update function description
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:28 +0000 (22:17 +0530)]
scsi: mvumi: Update function description

There is no "device" parameter in mvumi_shutdown(). Instead there is "pdev"
which is not described.

Link: https://lore.kernel.org/r/20201102164730.324035-28-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mvumi: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:27 +0000 (22:17 +0530)]
scsi: mvumi: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-27-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mvumi: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:26 +0000 (22:17 +0530)]
scsi: mvumi: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in mvumi_resume(), and there
is no corresponding pci_enable_wake(...., true) in mvumi_suspend().  Either
it should do enable-wake the device in .suspend() or should not invoke
pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
mvumi_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-26-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: 3w-sas: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:25 +0000 (22:17 +0530)]
scsi: 3w-sas: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-25-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: 3w-sas: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:24 +0000 (22:17 +0530)]
scsi: 3w-sas: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in twl_resume(), and there is
no corresponding pci_enable_wake(...., true) in twl_suspend().  Either it
should do enable-wake the device in .suspend() or should not invoke
pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
twl_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-24-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: 3w-9xxx: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:23 +0000 (22:17 +0530)]
scsi: 3w-9xxx: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-23-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: 3w-9xxx: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:22 +0000 (22:17 +0530)]
scsi: 3w-9xxx: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in twa_resume(), and there is
no corresponding pci_enable_wake(...., true) in twa_suspend().  Either it
should do enable-wake the device in .suspend() or should not invoke
pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
twa_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-22-vaibhavgupta40@gmail.com
Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hpsa: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:21 +0000 (22:17 +0530)]
scsi: hpsa: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-21-vaibhavgupta40@gmail.com
Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm_8001: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:20 +0000 (22:17 +0530)]
scsi: pm_8001: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-20-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm_8001: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:19 +0000 (22:17 +0530)]
scsi: pm_8001: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in pm8001_pci_resume(), and
there is no corresponding pci_enable_wake(...., true) in
pm8001_pci_suspend(). Either it should do enable-wake the device in
.suspend() or should not invoke pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
pm8001_pci__resume().

Link: https://lore.kernel.org/r/20201102164730.324035-19-vaibhavgupta40@gmail.com
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:18 +0000 (22:17 +0530)]
scsi: lpfc: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-18-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mpt3sas_scsih: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:17 +0000 (22:17 +0530)]
scsi: mpt3sas_scsih: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-17-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: mpt3sas_scsih: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:16 +0000 (22:17 +0530)]
scsi: mpt3sas_scsih: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in scsih_resume(), and there
is no corresponding pci_enable_wake(...., true) in scsih_suspend().  Either
it should do enable-wake the device in .suspend() or should not invoke
pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
scsih_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-16-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas_v3_hw: Remove extra function calls for runtime pm
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:15 +0000 (22:17 +0530)]
scsi: hisi_sas_v3_hw: Remove extra function calls for runtime pm

Both runtime_suspend_v3_hw() and runtime_resume_v3_hw() do nothing else but
invoke suspend_v3_hw() and resume_v3_hw() respectively. This is the case of
unnecessary function calls. To use those functions for runtime pm as well,
simply use UNIVERSAL_DEV_PM_OPS.

make -j$(nproc) W=1, with CONFIG_PM disabled, throws '-Wunused-function'
warning for runtime_suspend_v3_hw() and runtime_resume_v3_hw(). After
dropping those function definitions, the warning was thrown for
suspend_v3_hw() and resume_v3_hw(). Hence, mark them as '__maybe_unused'.

Link: https://lore.kernel.org/r/20201102164730.324035-15-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas_v3_hw: Don't use PCI helper functions
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:14 +0000 (22:17 +0530)]
scsi: hisi_sas_v3_hw: Don't use PCI helper functions

Drivers using new-framework/generic-framework should not handle standard
power management operations. These operations were performed by legacy
framework through PCI helper functions like pci_save/restore_state(),
pci_set_power_state(), etc.

Drivers should not use them now.

Link: https://lore.kernel.org/r/20201102164730.324035-14-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: hisi_sas_v3_hw: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:13 +0000 (22:17 +0530)]
scsi: hisi_sas_v3_hw: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in hisi_sas_v3_resume(), and
there is no corresponding pci_enable_wake(...., true) in
hisi_sas_v3_suspend(). Either it should do enable-wake the device in
.suspend() or should not invoke pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
hisi_sas_v3_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-13-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: esas2r: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:12 +0000 (22:17 +0530)]
scsi: esas2r: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-12-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: esas2r: Drop PCI Wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:11 +0000 (22:17 +0530)]
scsi: esas2r: Drop PCI Wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in esas2r_resume(), and there
is no corresponding pci_enable_wake(...., true) in esas2r_suspend().
Either it should do enable-wake the device in .suspend() or should not
invoke pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
esas2r_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-11-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: arcmsr: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:10 +0000 (22:17 +0530)]
scsi: arcmsr: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-10-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: arcmsr: Drop PCI wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:09 +0000 (22:17 +0530)]
scsi: arcmsr: Drop PCI wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in arcmsr_resume(), and there
is no corresponding pci_enable_wake(...., true) in arcmsr_suspend().
Either it should do enable-wake the device in .suspend() or should not
invoke pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
arcmsr_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-9-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aic79xx: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:08 +0000 (22:17 +0530)]
scsi: aic79xx: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-8-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aic7xxx: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:07 +0000 (22:17 +0530)]
scsi: aic7xxx: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-7-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aacraid: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:06 +0000 (22:17 +0530)]
scsi: aacraid: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-6-vaibhavgupta40@gmail.com
Acked-by: Balsundar P <balsundar.p@microchip.com>
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: aacraid: Drop pci_enable_wake() from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:05 +0000 (22:17 +0530)]
scsi: aacraid: Drop pci_enable_wake() from .resume

The driver calls pci_enable_wake(...., false) in aac_resume(), and there is
no corresponding pci_enable_wake(...., true) in aac_suspend(). Either it
should do enable-wake the device in .suspend() or should not invoke
pci_enable_wake() at all.

Concluding that this is a bug and PCI core calls pci_enable_wake(pci_dev,
PCI_D0, false) during resume, drop it from aac_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-5-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: megaraid_sas: Update function description
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:04 +0000 (22:17 +0530)]
scsi: megaraid_sas: Update function description

Function parameter 'pdev 'is described as Generic Device Structure. It is a
PCI device structure.

Link: https://lore.kernel.org/r/20201102164730.324035-4-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: megaraid_sas: Use generic power management
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:03 +0000 (22:17 +0530)]
scsi: megaraid_sas: Use generic power management

Drivers should do only device-specific jobs. But in general, drivers using
legacy PCI PM framework for .suspend()/.resume() have to manage many PCI
PM-related tasks themselves which can be done by PCI Core itself. This
brings extra load on the driver and it directly calls PCI helper functions
to handle them.

Switch to the new generic framework by updating function signatures and
define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove
unnecessary calls to the PCI Helper functions along with the legacy
.suspend & .resume bindings.

Link: https://lore.kernel.org/r/20201102164730.324035-3-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: megaraid_sas: Drop PCI wakeup calls from .resume
Vaibhav Gupta [Mon, 2 Nov 2020 16:47:02 +0000 (22:17 +0530)]
scsi: megaraid_sas: Drop PCI wakeup calls from .resume

The driver calls pci_enable_wake(...., false) in megasas_resume(), and
there is no corresponding pci_enable_wake(...., true) in megasas_suspend().
Either it should do enable-wake the device in .suspend() or should not
invoke pci_enable_wake() at all.

Concluding that this driver doesn't support enable-wake and PCI core calls
pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from
megasas_resume().

Link: https://lore.kernel.org/r/20201102164730.324035-2-vaibhavgupta40@gmail.com
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Validate io_req before others
Karan Tilak Kumar [Sat, 21 Nov 2020 02:33:37 +0000 (18:33 -0800)]
scsi: fnic: Validate io_req before others

We need to check for a valid io_req before we check other data. Also,
remove redundant checks.

Link: https://lore.kernel.org/r/20201121023337.19295-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Set scsi_set_resid() only for underflow
Karan Tilak Kumar [Sat, 21 Nov 2020 01:51:34 +0000 (17:51 -0800)]
scsi: fnic: Set scsi_set_resid() only for underflow

Set scsi_set_resid() only if FCPIO_ICMND_CMPL_RESID_UNDER is set.

Link: https://lore.kernel.org/r/20201121015134.18872-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Change shost_printk() to FNIC_MAIN_DBG()
Karan Tilak Kumar [Sat, 21 Nov 2020 01:37:39 +0000 (17:37 -0800)]
scsi: fnic: Change shost_printk() to FNIC_MAIN_DBG()

Replace shost_printk() with FNIC_MAIN_DBG() so that these log messages are
controlled by fnic_log_level flag in fnic_handle_link.

Link: https://lore.kernel.org/r/20201121013739.18701-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Avoid looping in TRANS ETH on unload
Karan Tilak Kumar [Sat, 21 Nov 2020 01:21:45 +0000 (17:21 -0800)]
scsi: fnic: Avoid looping in TRANS ETH on unload

Avoid looping in fnic_scsi_abort_io() before sending fw reset when fnic is
in TRANS ETH state and when we have not received any link events.

Link: https://lore.kernel.org/r/20201121012145.18522-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: fnic: Change shost_printk() to FNIC_FCS_DBG()
Karan Tilak Kumar [Fri, 20 Nov 2020 22:07:12 +0000 (14:07 -0800)]
scsi: fnic: Change shost_printk() to FNIC_FCS_DBG()

Replacing shost_printk with FNIC_FCS_DBG() so that these log messages are
controlled by fnic_log_level flag in fnic_fip_handler_timer.

Bumping up version number from 47 to 49 to maintain same level as internal
version.

Link: https://lore.kernel.org/r/20201120220712.16708-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm8001: Make implicit use of pm8001_ha in pm8001_printk() explicit
Joe Perches [Fri, 20 Nov 2020 23:16:10 +0000 (15:16 -0800)]
scsi: pm8001: Make implicit use of pm8001_ha in pm8001_printk() explicit

Make the pm8001_printk() macro take an explicit HBA instead of assuming the
existence of an unspecified pm8001_ha argument.

Miscellanea:

 - Add pm8001_ha to the few uses of pm8001_printk()

 - Add HBA to the pm8001_dbg macro call to pm8001_printk()

Link: https://lore.kernel.org/r/0e17a4c845f15e18f98b346ffb9b039584d21cdd.1605914030.git.joe@perches.com
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm8001: Neaten debug logging macros and uses
Joe Perches [Fri, 20 Nov 2020 23:16:09 +0000 (15:16 -0800)]
scsi: pm8001: Neaten debug logging macros and uses

Every PM8001_<FOO>_DBG macro uses an internal call to pm8001_printk.

Convert all uses of:

PM8001_<FOO>_DBG(hba, pm8001_printk(fmt, ...))
to
pm8001_dbg(hba, <FOO>, fmt, ...)

so the visual complexity of each macro is reduced.

The repetitive macro definitions are converted to a single pm8001_dbg and
the level is concatenated using PM8001_##level##_LOGGING for the specific
level test.

Done with coccinelle, checkpatch and a little typing of the new macro
definition.

Miscellanea:

 - Coalesce formats

 - Realign arguments

 - Add missing terminating newlines to formats

 - Remove trailing spaces from formats

 - Change defective loop with printk(KERN_INFO... to emit a 16 byte hex
   block to %p16h

Link: https://lore.kernel.org/r/49f36a93af7752b613d03c89a87078243567fd9a.1605914030.git.joe@perches.com
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: pm8001: Remove typecast for pointer returned by kcalloc()
Xu Wang [Fri, 20 Nov 2020 08:36:48 +0000 (08:36 +0000)]
scsi: pm8001: Remove typecast for pointer returned by kcalloc()

Stop typecasting the value returned by kcalloc().

Link: https://lore.kernel.org/r/20201120083648.9319-1-vulab@iscas.ac.cn
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: NCR5380: Reduce NCR5380_maybe_release_dma_irq() call sites
Finn Thain [Fri, 20 Nov 2020 04:39:56 +0000 (15:39 +1100)]
scsi: NCR5380: Reduce NCR5380_maybe_release_dma_irq() call sites

Refactor to avoid needless calls to NCR5380_maybe_release_dma_irq().
This makes the machine code smaller and the source more readable.

Link: https://lore.kernel.org/r/c1317ae8fdcb498460de5d7ea0bd62a42f5eeca8.1605847196.git.fthain@telegraphics.com.au
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Reviewed-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: atari_scsi: Fix race condition between .queuecommand and EH
Finn Thain [Fri, 20 Nov 2020 04:39:56 +0000 (15:39 +1100)]
scsi: atari_scsi: Fix race condition between .queuecommand and EH

It is possible that bus_reset_cleanup() or .eh_abort_handler could be
invoked during NCR5380_queuecommand(). If that takes place before the new
command is enqueued and after the ST-DMA "lock" has been acquired, the
ST-DMA "lock" will be released again. This will result in a lost DMA
interrupt and a command timeout. Fix this by excluding EH and interrupt
handlers while the new command is enqueued.

Link: https://lore.kernel.org/r/af25163257796b50bb99d4ede4025cea55787b8f.1605847196.git.fthain@telegraphics.com.au
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Reviewed-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Adjust logic in common ADAPT helper
Bjorn Andersson [Sat, 21 Nov 2020 04:48:10 +0000 (20:48 -0800)]
scsi: ufs: Adjust logic in common ADAPT helper

The introduction of ufshcd_dme_configure_adapt() refactored out duplication
from the Mediatek and Qualcomm drivers.

Both these implementations had the logic of:

    gear_tx == UFS_HS_G4 => PA_INITIAL_ADAPT
    gear_tx != UFS_HS_G4 => PA_NO_ADAPT

but now both implementations pass PA_INITIAL_ADAPT as "adapt_val" and if
gear_tx is not UFS_HS_G4 that is replaced with PA_INITIAL_ADAPT. In other
words, it's PA_INITIAL_ADAPT in both above cases.

The result is that e.g. Qualcomm SM8150 has no longer functional UFS, so
adjust the logic to match the previous implementation.

Link: https://lore.kernel.org/r/20201121044810.507288-1-bjorn.andersson@linaro.org
Fixes: fc85a74e28fe ("scsi: ufs: Refactor ADAPT configuration function")
Reviewed-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix variable 'vport' set but not used in lpfc_sli4_abts_err_handler()
James Smart [Thu, 19 Nov 2020 20:34:07 +0000 (12:34 -0800)]
scsi: lpfc: Fix variable 'vport' set but not used in lpfc_sli4_abts_err_handler()

Remove vport variable that is assigned but not used in
lpfc_sli4_abts_err_handler().

Link: https://lore.kernel.org/r/20201119203407.121913-1-james.smart@broadcom.com
Fixes: e7dab164a9aa ("scsi: lpfc: Fix scheduling call while in softirq context in lpfc_unreg_rpi")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix missing prototype for lpfc_nvmet_prep_abort_wqe()
James Smart [Thu, 19 Nov 2020 20:33:16 +0000 (12:33 -0800)]
scsi: lpfc: Fix missing prototype for lpfc_nvmet_prep_abort_wqe()

lpfc_nvmet_prep_abort_wqe() needs to be declared static.

Link: https://lore.kernel.org/r/20201119203316.121725-1-james.smart@broadcom.com
Fixes: db7531d2b377 ("scsi: lpfc: Convert abort handling to SLI-3 and SLI-4 handlers")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix set but unused variables in lpfc_dev_loss_tmo_handler()
James Smart [Thu, 19 Nov 2020 20:33:53 +0000 (12:33 -0800)]
scsi: lpfc: Fix set but unused variables in lpfc_dev_loss_tmo_handler()

Remove set but not used variable shost in lpfc_dev_loss_tmo_handler().

Link: https://lore.kernel.org/r/20201119203353.121866-1-james.smart@broadcom.com
Fixes: 52edb2caf675 ("scsi: lpfc: Remove ndlp when a PLOGI/ADISC/PRLI/REG_RPI ultimately fails")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix set but not used warnings from Rework remote port lock handling
James Smart [Thu, 19 Nov 2020 20:33:40 +0000 (12:33 -0800)]
scsi: lpfc: Fix set but not used warnings from Rework remote port lock handling

Remove local variables that are set but not used.

Link: https://lore.kernel.org/r/20201119203340.121819-1-james.smart@broadcom.com
Fixes: c6adba150191 ("scsi: lpfc: Rework remote port lock handling")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix missing prototype warning for lpfc_fdmi_vendor_attr_mi()
James Smart [Thu, 19 Nov 2020 20:33:28 +0000 (12:33 -0800)]
scsi: lpfc: Fix missing prototype warning for lpfc_fdmi_vendor_attr_mi()

Function needs to be declared as static.

Link: https://lore.kernel.org/r/20201119203328.121772-1-james.smart@broadcom.com
Fixes: 8aaa7bcf07a2 ("scsi: lpfc: Add FDMI Vendor MIB support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: lpfc: Fix memory leak on lcb_context
Colin Ian King [Wed, 18 Nov 2020 14:13:14 +0000 (14:13 +0000)]
scsi: lpfc: Fix memory leak on lcb_context

Currently there is an error return path that neglects to free the
allocation for lcb_context.  Fix this by adding a new error free exit path
that kfree's lcb_context before returning.  Use this new kfree exit path in
another exit error path that also kfree's the same object, allowing a line
of code to be removed.

Link: https://lore.kernel.org/r/20201118141314.462471-1-colin.king@canonical.com
Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking")
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Resource leak")

3 years agoscsi: lpfc: Remove dead code on second !ndlp check
Colin Ian King [Wed, 18 Nov 2020 13:37:44 +0000 (13:37 +0000)]
scsi: lpfc: Remove dead code on second !ndlp check

Currently there is a null check on the pointer ndlp that exits via error
path issue_ct_rsp_exit followed by another null check on the same pointer
that is almost identical to the previous null check stanza and yet can
never can be reached because the previous check exited via
issue_ct_rsp_exit. This is deadcode and can be removed.

Link: https://lore.kernel.org/r/20201118133744.461385-1-colin.king@canonical.com
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Logically dead code")

3 years agoscsi: lpfc: Fix pointer defereference before it is null checked issue
Colin Ian King [Wed, 18 Nov 2020 13:13:45 +0000 (13:13 +0000)]
scsi: lpfc: Fix pointer defereference before it is null checked issue

There is a null check on pointer lpfc_cmd after the pointer has been
dereferenced when pointers rdata and ndlp are initialized at the start of
the function. Fix this by only assigning rdata and ndlp after the pointer
lpfc_cmd has been null checked.

Link: https://lore.kernel.org/r/20201118131345.460631-1-colin.king@canonical.com
Fixes: 96e209be6ecb ("scsi: lpfc: Convert SCSI I/O completions to SLI-3 and SLI-4 handlers")
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Dereference before null check")

3 years agoscsi: ibmvfc: Advertise client support for targetWWPN using v2 commands
Tyrel Datwyler [Wed, 18 Nov 2020 01:11:04 +0000 (19:11 -0600)]
scsi: ibmvfc: Advertise client support for targetWWPN using v2 commands

The previous patch added support for the targetWWPN field in version 2 MADs
and vfcFrame structures.

Set the IBMVFC_CAN_SEND_VF_WWPN bit in our capabailites flag during NPIV
Login to inform the VIOS that this client supports the feature.

Link: https://lore.kernel.org/r/20201118011104.296999-7-tyreld@linux.ibm.com
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Add support for target_wwpn field in v2 MADs and vfcFrame
Tyrel Datwyler [Wed, 18 Nov 2020 01:11:03 +0000 (19:11 -0600)]
scsi: ibmvfc: Add support for target_wwpn field in v2 MADs and vfcFrame

Several version 2 MADs and the version 2 vfcFrame structures introduced a
new targetWWPN field for better identification of a target over the
scsi_id.

Set this field and MAD versioning fields when the VIOS advertises the
IBMVFC_HANDLE_VF_WWPN capability.

Link: https://lore.kernel.org/r/20201118011104.296999-6-tyreld@linux.ibm.com
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Add FC payload retrieval routines for versioned vfcFrames
Tyrel Datwyler [Wed, 18 Nov 2020 01:11:02 +0000 (19:11 -0600)]
scsi: ibmvfc: Add FC payload retrieval routines for versioned vfcFrames

The FC iu and response payloads are located at different offsets depending
on the ibmvfc_cmd version. This is a result of the version 2 vfcFrame
definition adding an extra 64bytes of reserved space to the structure prior
to the payloads.

Add helper routines to determine the current vfcFrame version and return a
pointer to the proper iu or response structure within that ibmvfc_cmd.

Link: https://lore.kernel.org/r/20201118011104.296999-5-tyreld@linux.ibm.com
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Add helper for testing capability flags
Tyrel Datwyler [Wed, 18 Nov 2020 01:11:01 +0000 (19:11 -0600)]
scsi: ibmvfc: Add helper for testing capability flags

Testing the NPIV Login response capabilities is a long winded process of
dereferencing the vhost->login_buf->resp.capabilities field, then byte
swapping that value to host endian, and performing the bitwise test.
Currently we only ever check this in ibmvfc_cancel_all(), but follow-up
patches will need to regularly check for targetWWPN and channelization
support.

Add a helper to simplify checking various VIOS capabilities, namely
ibmvfc_check_caps().

Link: https://lore.kernel.org/r/20201118011104.296999-4-tyreld@linux.ibm.com
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Add new fields for version 2 of several MADs
Tyrel Datwyler [Wed, 18 Nov 2020 01:11:00 +0000 (19:11 -0600)]
scsi: ibmvfc: Add new fields for version 2 of several MADs

Introduce a target_wwpn field to several MADs. Its possible that a SCSI ID
of a target can change due to some fabric changes. The WWPN of the SCSI
target provides a better way to identify the target. Also, add flags for
receiving MAD versioning information and advertising client support for
targetWWPN with the VIOS. This latter capability flag will be required for
future clients capable of requesting multiple hardware queues from the host
adapter.

Link: https://lore.kernel.org/r/20201118011104.296999-3-tyreld@linux.ibm.com
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Deduplicate common ibmvfc_cmd init code
Tyrel Datwyler [Wed, 18 Nov 2020 01:10:59 +0000 (19:10 -0600)]
scsi: ibmvfc: Deduplicate common ibmvfc_cmd init code

The virtual FC frame command exchanged with the VIOS is used for device
reset and command abort TMF as well as normally queued commands. When
initializing the ibmvfc_cmd there are several elements of the command that
are set the same way regardless of the command type.

Deduplicate code by moving these commonally set fields into a
initialization helper routine, namely ibmvfc_init_vfc_cmd().

Link: https://lore.kernel.org/r/20201118011104.296999-2-tyreld@linux.ibm.com
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Use correlation token to tag commands
Tyrel Datwyler [Tue, 17 Nov 2020 18:50:31 +0000 (12:50 -0600)]
scsi: ibmvfc: Use correlation token to tag commands

The vfcFrame correlation field is a 64bit handle that is intended to trace
I/O operations through both the client stack and VIOS stack when the
underlying physical FC adapter supports tagging.

Tag vfcFrames with the associated ibmvfc_event pointer handle.

Link: https://lore.kernel.org/r/20201117185031.129939-3-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Remove trailing semicolon
Tyrel Datwyler [Tue, 17 Nov 2020 18:50:30 +0000 (12:50 -0600)]
scsi: ibmvfc: Remove trailing semicolon

Remove a superfluous semicolon following a closing function block bracket.

Link: https://lore.kernel.org/r/20201117185031.129939-2-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ibmvfc: Byte swap login_buf.resp values in attribute show functions
Tyrel Datwyler [Tue, 17 Nov 2020 18:50:29 +0000 (12:50 -0600)]
scsi: ibmvfc: Byte swap login_buf.resp values in attribute show functions

Both ibmvfc_show_host_(capabilities|npiv_version) functions retrieve values
from vhost->login_buf.resp buffer. This is the MAD response buffer from the
VIOS and as such any multi-byte non-string values are in big endian format.

Byte swap these values to host CPU endian format for better human
readability.

Link: https://lore.kernel.org/r/20201117185031.129939-1-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Show LBA and length for UNMAP commands
Leo Liou [Tue, 17 Nov 2020 16:58:39 +0000 (08:58 -0800)]
scsi: ufs: Show LBA and length for UNMAP commands

We have LBA and length for unmap commands.

Link: https://lore.kernel.org/r/20201117165839.1643377-8-jaegeuk@kernel.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Leo Liou <leoliou@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Fix clkgating on/off
Jaegeuk Kim [Tue, 17 Nov 2020 16:58:38 +0000 (08:58 -0800)]
scsi: ufs: Fix clkgating on/off

The following call stack prevents clk_gating at every I/O completion.  We
can remove the condition, ufshcd_any_tag_in_use(), since clkgating_work
will check it again.

ufshcd_complete_requests(struct ufs_hba *hba)
  ufshcd_transfer_req_compl()
    __ufshcd_transfer_req_compl()
      __ufshcd_release(hba)
        if (ufshcd_any_tag_in_use() == 1)
           return;
  ufshcd_tmc_handler(hba);
    blk_mq_tagset_busy_iter();

Note that this still requires work to deal with a potential race condition
when user sets clkgating.delay_ms to very small value. That can cause
preventing clkgating by the check of ufshcd_any_tag_in_use() in gate_work.

Link: https://lore.kernel.org/r/20201117165839.1643377-7-jaegeuk@kernel.org
Fixes: 7252a3603015 ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts")
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Add more contexts in the ufs tracepoints
Jaegeuk Kim [Tue, 17 Nov 2020 16:58:37 +0000 (08:58 -0800)]
scsi: ufs: Add more contexts in the ufs tracepoints

This adds user-friendly tracepoints with group id.

Link: https://lore.kernel.org/r/20201117165839.1643377-6-jaegeuk@kernel.org
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Use WQ_HIGHPRI for gating work
Jaegeuk Kim [Tue, 17 Nov 2020 16:58:36 +0000 (08:58 -0800)]
scsi: ufs: Use WQ_HIGHPRI for gating work

Must have WQ_MEM_RECLAIM

``WQ_MEM_RECLAIM``

  All workqueues which might be used in the memory reclaim paths **MUST**
  have this flag set.  The wq is guaranteed to have at least one execution
  context regardless of memory pressure.

Link: https://lore.kernel.org/r/20201117165839.1643377-5-jaegeuk@kernel.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Clear UAC for FFU and RPMB LUNs
Jaegeuk Kim [Tue, 17 Nov 2020 16:58:35 +0000 (08:58 -0800)]
scsi: ufs: Clear UAC for FFU and RPMB LUNs

In order to conduct FFU or RPMB operations, UFS needs to clear UNIT
ATTENTION condition. Clear it explicitly so that we get no failures during
initialization.

Link: https://lore.kernel.org/r/20201117165839.1643377-4-jaegeuk@kernel.org
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Atomic update for clkgating_enable
Jaegeuk Kim [Tue, 17 Nov 2020 16:58:34 +0000 (08:58 -0800)]
scsi: ufs: Atomic update for clkgating_enable

While running a stress test which enables/disables clkgating, we
occasionally hit device timeout. This patch avoids a subtle race condition
to address it.

Link: https://lore.kernel.org/r/20201117165839.1643377-3-jaegeuk@kernel.org
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: Avoid to call REQ_CLKS_OFF to CLKS_OFF
Jaegeuk Kim [Tue, 17 Nov 2020 16:58:33 +0000 (08:58 -0800)]
scsi: ufs: Avoid to call REQ_CLKS_OFF to CLKS_OFF

Once UFS is gated with CLKS_OFF, it should not call REQ_CLKS_OFF
again. This can lead to hibern8_enter failure.

Link: https://lore.kernel.org/r/20201117165839.1643377-2-jaegeuk@kernel.org
Reviewed-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: qla4xxx: Remove redundant assignment to variable rval
Jing Xiangfeng [Tue, 3 Nov 2020 12:01:37 +0000 (20:01 +0800)]
scsi: qla4xxx: Remove redundant assignment to variable rval

The variable rval has been initialized with 'QLA_ERROR'. The assignment is
redundant in an error path. Remove it.

Link: https://lore.kernel.org/r/20201103120137.109717-1-jingxiangfeng@huawei.com
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 years agoscsi: ufs: ufs-qcom: Use common ADAPT configuration function
Stanley Chu [Mon, 16 Nov 2020 06:50:54 +0000 (14:50 +0800)]
scsi: ufs: ufs-qcom: Use common ADAPT configuration function

Use common ADAPT configuration function to reduce duplicated code in UFS
drivers.

Link: https://lore.kernel.org/r/20201116065054.7658-10-stanley.chu@mediatek.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>