Bart Van Assche [Fri, 9 Aug 2019 03:01:24 +0000 (20:01 -0700)]
scsi: qla2xxx: Improve Linux kernel coding style conformance
Insert a space where required, surround complex expressions in macros with
parentheses, use the UL suffix instead of the (unsigned long) cast, do not
use line continuations when not necessary and do not explicitly initialize
static variables to zero.
Cc: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Himanshu Madhani <hmadhani@marvell.com> Reviewed-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:56 +0000 (09:59 -0400)]
scsi: mpt3sas: Run SAS DEVICE STATUS CHANGE EVENT from ISR
In some cases, like while performing extensive expander reset or phy reset,
user may observe that drives are not visible in OS. Driver's
firmware-worker thread is blocked for more than 120 seconds resulting in a
call trace.
1. Received target add event for Device A and hence driver has registered
this device to SML by calling sas_rphy_add(). SML has half added this
device and returned the control to the driver by quitting from
sas_rphy_add() API, and started some background scanning on this device A.
2. While background scanning is going on device A, driver has received SAS
DEVICE STATUS CHANGE EVENT with RC code "Internal device reset" event and
hence driver has set tm_busy flag for this Device A from FW worker thread
context. When tm_busy flag is set then driver return scsi commands with
device busy status asking the kernel to retry the command after some time.
So background scanning for device A will be waiting for this tm_busy to be
cleared.
3. Meanwhile driver has received a target add event for Device B and hence
driver called sas_rphy_add() API to register this device with SML. But
since background scanning for Device A is still pending and SML is not
quitting from sas_rphy_add(), the driver’s firmware worker thread got
blocked.
4. Now driver has received SAS DEVICE STATUS CHANGE EVENT with RC code
"Internal device reset complete" event. But as driver’s firmware worker
thread got blocked in Step3, it can’t process this event and it was not
clearing the tm_busy flag and deadlock occurred (where SML was waiting for
tm_busy flag to be cleared and our FW worker thread is waiting for SML to
quit from sas_device_rphy_add() API).
Same deadlock will be observed even if device B is getting removed in
step3. So to limit these types of deadlocks driver will process the SAS
DEVICE STATUS CHANGE EVENT events from ISR context instead of processing
this event from worker thread context. This improvement avoids above
deadlock.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:55 +0000 (09:59 -0400)]
scsi: mpt3sas: Reduce the performance drop
This patch is to reduce the performance drop depth observed on SATA HDD
when ATA PT command is outstanding.
Driver returns IO commands with status "SAM_STAT_BUSY" whenever ATA PT
command is outstanding. With this, IO commands will be retried until this
outstanding ATA PT to complete and hence we will observe drop in
performance.
As the driver is completing the subsequent IOs commands with SAM_STAT_BUSY
status, these IOs has to go though the block layer. Hence it adds latency
to the IOs and large performance drop is observed.
So to reduce this performance dropp, added improvement in driver to return
the subsequent IOs with SCSI_MLQUEUE_DEVICE_BUSY status instead of
completing the IOs with SAM_STAT_BUSY status when ATA PT command is
outstanding. Sending command back with SCSI_MLQUEUE_DEVICE_BUSY does not go
through complete block layer stack (as scsi_done won't be called) SML will
immediately retry the command and this method will avoid latency of block
layer stack and the performance impact will be reduced.
On Local setup, ran 512k sequential read IO operation on HGST SATA drive
with existing driver & with this improvement drivers and here is the
result,
1. With existing driver: IOs are running at bandwidth of ~230 rMB/s and
whenever any ATA PT command is outstanding (e.g issued from systemd-udevd
daemon) then this bandwidth drops to ~150 rMB/s.
2. With this improvement driver: IOs are running at bandwidth of ~230 rMB/s
and whenever any ATA PT command is outstanding then this bandwidth drops to
just ~190 rMB/s.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:54 +0000 (09:59 -0400)]
scsi: mpt3sas: Handle fault during HBA initialization
During HBA initialization time, if handshake operation fails due to some
firmware fault then currently driver is terminating the HBA
initialization. It is possible that HBA may come up properly if diag reset
is issued.
So improvement is made in driver in such a way that before terminating the
HBA initialization, driver checks the IOC state and if IOC state is in
fault state then issue diag reset for once. If diag reset is successful
then continue with HBA initialization else terminate the HBA
initialization.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:53 +0000 (09:59 -0400)]
scsi: mpt3sas: Add sysfs to know supported features
Currently with sysfs parameter "drv_support_bitmap" driver exposes whether
driver supports toolbox memory move command or not.
And application should issue the toolbox memory move command only if driver
tell that memory move tool box command is supported through this sysfs
parameter.
In future we can utilize this sysfs parameter if any new feature is added
and need to notify the same to applications.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:52 +0000 (09:59 -0400)]
scsi: mpt3sas: Support MEMORY MOVE Tool box command
Host uses the Memory Move Tool to copy data from any source/destination
combination of system memory and IOC memory.
Memory Move Tool box request contains two SGE fields, First SGE field must
contains the source buffer details described by an MPI Simple SGE. The
second SGE field must contains the destination buffer details described by
an MPI Simple SGE.
Source -> Destination
1. IOC -> IOC (Both the SGE's will be filled by application)
2. HOST -> HOST (Both the SGE's will be filled by the host,
application should give sgl_offset to first SGE offset)
3. IOC -> HOST (Application will fill the first SGE and set the
sgl_offset to second SGE and hence driver fills
the second SGE)
4. HOST -> IOC (Application will fill IOC buffer information in the
first SGE and set the sgl_offset to second SGE.
Then driver will fill the second SGE with Host buffer
information and just before posting the command to the
firmware, driver will swap these two SGEs so that first
SGE contains the HOST buffer information and second SGE
contains the IOC information.
Driver has to take care only of the 4th case, other three cases are by
default supported by the current driver design.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:51 +0000 (09:59 -0400)]
scsi: mpt3sas: Allow ioctls to blocked access status NVMe
If driver sees the NVMe drive with "DEVICE_BLOCKED" AccessStatus in its
PCIe Device Page0, then driver removes the drive from its internal list and
does not allow any IOCTL commands to be sent to the drive and will return
the IOCTLs with "-ENODEV" status.
The driver will now allow NVMe Encapsulated IOCTL issued to the NVMe device
with an access status of DEVICE_BLOCKED. This change allows the user to
flash new drive firmware online and revive the drive.
Add NVMe device only the driver's internal list even though the device is
in the blocked state so that the device will be visible to Apps. This way
Apps can send NVMe Encapsulated IOCTLs to this drive and bring the drive
online. This NVMe drive with DEVICE_BLOCKED access status won't added to
the SML, it will be added only in the driver's internal list.
[mkp: clarified desc]
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
During online Firmware upgrade operations it is possible that MaxDevHandles
filled in IOCFacts may change with new FW. With this we may observe kernel
panics when driver try to access the pd_handles or blocking_handles buffers
at offset greater than the old firmware's MaxDevHandle value.
Fix:
_base_check_ioc_facts_changes() looks for increase/decrease in IOCFacts
attributes during online firmware upgrade and increases the pd_handles,
blocking_handles, etc buffer sizes to new firmware's MaxDevHandle value if
this new firmware's MaxDevHandle value is greater than the old firmware's
MaxDevHandle value.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:47 +0000 (09:59 -0400)]
scsi: mpt3sas: memset request frame before reusing
Driver gets a request frame from the free pool of DMA-able request frames
and fill in the required information and pass the address of the frame to
IOC/FW to pull the complete request frame. In certain places the driver
used the request frame allocated from the free pool without completely
clearing the previous data stored in it. The request contents were cleared
only for the size of the new request to be issued and that left out some
stale data in the unused part of the request. Though the IOC/FW is not
expected to access the request beyond the specified size, it is good
practice to clear complete request message frame.
So reinitialize the complete request message frame with 0s before using
it.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu [Sat, 3 Aug 2019 13:59:46 +0000 (09:59 -0400)]
scsi: mpt3sas: Add support for PCIe Lane margin
PCIe Lane margin tool box request requires IEEE sgl's and hence driver
fills the SGL field with IEEE sgl's while issuing the PCIe Lane margin
ioctl request to the HBA firmware.
Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Wed, 31 Jul 2019 22:22:14 +0000 (23:22 +0100)]
scsi: pm80xx: remove redundant assignments to variable rc
There are several occasions where variable rc is being initialized with a
value that is never read and error is being re-assigned a little later on.
Clean up the code by removing rc entirely and just returning the return
value from the call to pm8001_issue_ssp_tmf
Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Luo Jiaxing [Mon, 5 Aug 2019 13:48:12 +0000 (21:48 +0800)]
scsi: hisi_sas: Consolidate internal abort calls in LU reset operation
In hisi_sas_lu_reset(), we call internal abort for SAS and SATA device
codepaths -> consolidate into a single call.
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>
Xiang Chen [Mon, 5 Aug 2019 13:48:11 +0000 (21:48 +0800)]
scsi: hisi_sas: replace "%p" with "%pK"
The format specifier "%p" can leak kernel address, and use "%pK" instead.
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>
Xiang Chen [Mon, 5 Aug 2019 13:48:10 +0000 (21:48 +0800)]
scsi: hisi_sas: Remove some unnecessary code
Remove some unnecessary code, including:
- Explicit zeroing of memory allocated for dmam_alloc_coherent()
- Some duplicated code
- Some redundant masking
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>
Luo Jiaxing [Mon, 5 Aug 2019 13:48:09 +0000 (21:48 +0800)]
scsi: hisi_sas: Modify return type of debugfs functions
For functions which always return 0, which is never checked, make to return
void.
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>
Xiang Chen [Mon, 5 Aug 2019 13:48:08 +0000 (21:48 +0800)]
scsi: hisi_sas: Drop free_irq() when devm_request_irq() failed
It will free irq automatically if devm_request_irq() failed, so drop
free_irq() if devm_request_irq() failed.
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>
John Garry [Mon, 5 Aug 2019 13:48:07 +0000 (21:48 +0800)]
scsi: hisi_sas: Drop SMP resp frame DMA mapping
The SMP frame response is written to the command table and not the SMP
response pointer from libsas, so don't bother DMA mapping (and unmapping)
the SMP response from libsas.
Suggested-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>
John Garry [Mon, 5 Aug 2019 13:48:06 +0000 (21:48 +0800)]
scsi: hisi_sas: Drop kmap_atomic() in SMP command completion
The call to kmap_atomic() in the SMP command completion code is
unnecessary, since kmap() is only really concerned with highmem, which is
not relevant on arm64. The controller only finds itself in arm64 systems.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 5 Aug 2019 13:48:05 +0000 (21:48 +0800)]
scsi: hisi_sas: Make slot buf minimum allocation of PAGE_SIZE
For a system with PAGE_SIZE of 16K or 64K, the size every time we want to
alloc may be small like 4K, but for function dmam_alloc_coherent(), the
least size it allocates is PAGE_SIZE, so it will waste much memory for the
situation.
To solve the issue, limit the minimum allocation size of slot buf to
PAGE_SIZE.
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>
Xiang Chen [Mon, 5 Aug 2019 13:48:04 +0000 (21:48 +0800)]
scsi: hisi_sas: Don't bother clearing status buffer IU in task prep
For struct hisi_sas_status_buffer, it contains struct hisi_sas_err_record
and iu[1024]. The struct iu[1024] will be filled fully by the response of
disks, so it is not need to initialize them to 0, but for the struct
hisi_sas_err_record, SAS controller only fill some fields of
hisi_sas_err_record according to hw designer, so it should be initialised
to 0. After the change, cpu utilization percentage of memset() is changed
from 1.7% to 0.12%.
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>
Luo Jiaxing [Mon, 5 Aug 2019 13:48:03 +0000 (21:48 +0800)]
scsi: hisi_sas: Fix out of bound at debug_I_T_nexus_reset()
Fix a possible out-of-bounds access in hisi_sas_debug_I_T_nexus_reset().
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>
Luo Jiaxing [Mon, 5 Aug 2019 13:48:02 +0000 (21:48 +0800)]
scsi: hisi_sas: Snapshot AXI and RAS register at debugfs
The AXI and RAS register values should also should be snapshot at debugfs.
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>
Luo Jiaxing [Mon, 5 Aug 2019 13:48:01 +0000 (21:48 +0800)]
scsi: hisi_sas: Snapshot HW cache of IOST and ITCT at debugfs
The value of IOST/ITCT is updated to cache first, and then synchronize to
DDR periodically. So the value in IOST/ITCT cache is the latest data and
it's important for debugging.
So, the HW cache of IOST and ITCT should be snapshot at debugfs.
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>
Luo Jiaxing [Mon, 5 Aug 2019 13:48:00 +0000 (21:48 +0800)]
scsi: hisi_sas: Fix pointer usage error in show debugfs IOST/ITCT
Fix how the pointer is set in hisi_sas_debugfs_iost_show() and
hisi_sas_debugfs_itct_show().
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>
John Garry [Mon, 5 Aug 2019 13:47:59 +0000 (21:47 +0800)]
scsi: hisi_sas: Drop hisi_sas_hw.get_free_slot
In commit 1273d65f29045 ("scsi: hisi_sas: change queue depth from 512 to
4096"), the depth of each queue is the same as the max IPTT in the system.
As such, as long as we have an IPTT allocated, we will have enough space on
any delivery queue.
All .get_free_slot functions were checking for space on the queue by
reading the DQ read pointer. Drop this, and also raise the code into common
code, as there is nothing hw specific remaining.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Mon, 5 Aug 2019 13:47:58 +0000 (21:47 +0800)]
scsi: hisi_sas: Make max IPTT count equal for all hw revisions
There is a small optimisation to be had by making the max IPTT the same for
all hw revisions, that being we can drop the check for read and write
pointer being the same in the get free slot function.
Change v1 hw to have max IPTT of 4096 - same as v2 and v3 hw - and
drop hisi_sas_hw.max_command_entries.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Li Zhong [Mon, 5 Aug 2019 00:43:36 +0000 (08:43 +0800)]
scsi: target: tcmu: clean the nl_cmd of the udev when nl send fails
If the userspace process crashes while we send the nl msg, it is possible
that the cmd in curr_nl_cmd of tcmu_dev never gets reset to 0, and and
returns busy for other commands after the userspace process is restartd.
More details below:
/backstores/user:file/file> set attribute dev_size=2048
Cannot set attribute dev_size: [Errno 3] No such process
/backstores/user:file/file> set attribute dev_size=2048
Cannot set attribute dev_size: [Errno 16] Device or resource busy
with following kernel messages:
[173605.747169] Unable to reconfigure device
[173616.686674] tcmu daemon: command reply support 1.
[173623.866978] netlink cmd 3 already executing on file
[173623.866984] Unable to reconfigure device
Also, it is not safe to leave the nl_cmd in the list, and not get deleted.
This patch removes the nl_cmd from the list, and clear its data if it is
not sent successfully.
Signed-off-by: Li Zhong <lizhongfs@gmail.com> Acked-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Anil Varughese [Fri, 2 Aug 2019 11:21:12 +0000 (12:21 +0100)]
scsi: ufs: Configure clock in .hce_enable_notify() in Cadence UFS
Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify() instead of
.setup_clock() because if UFSHCD resets the controller ip because of phy or
device related errors then CDNS_UFS_REG_HCLKDIV is reset to default value
and .setup_clock() is not called later in the sequence whereas
.hce_enable_notify will be called everytime controller is reenabled.
Signed-off-by: Anil Varughese <aniljoy@cadence.com> Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Thu, 1 Aug 2019 22:38:14 +0000 (15:38 -0700)]
scsi: core: Reduce memory required for SCSI logging
The data structure used for log messages is so large that it can cause a
boot failure. Since allocations from that data structure can fail anyway,
use kmalloc() / kfree() instead of that data structure.
See also https://bugzilla.kernel.org/show_bug.cgi?id=204119.
See also commit ded85c193a39 ("scsi: Implement per-cpu logging buffer") # v4.0.
Reported-by: Jan Palus <jpalus@fastmail.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: Ming Lei <ming.lei@redhat.com> Cc: Jan Palus <jpalus@fastmail.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Thu, 1 Aug 2019 22:38:13 +0000 (15:38 -0700)]
scsi: core: Complain if scsi_target_block() fails
If scsi_target_block() fails that can break the code that calls this
function. Hence complain loudly if scsi_target_block() fails.
Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Thu, 1 Aug 2019 22:38:12 +0000 (15:38 -0700)]
scsi: core: Make scsi_internal_device_unblock_nowait() reject invalid new_state
The only 'new_state' values passed by upstream kernel code to
scsi_internal_device_unblock_nowait() are SDEV_RUNNING and
SDEV_TRANSPORT_OFFLINE. These are the only values that should be passed to
this function. Hence check the value of the 'new_state' argument to avoid
that scsi_internal_device_unblock_nowait() would be used to trigger an
illegal SCSI device state transition. In this context 'illegal' means not
allowed by scsi_device_set_state().
Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Tomas Winkler [Tue, 30 Jul 2019 05:55:17 +0000 (08:55 +0300)]
scsi: ufs: revamp string descriptor reading
Define new a type: uc_string_id for easier string handling and less
casting. Reduce number or string copies in price of a dynamic allocation.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Tested-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mark switch cases where we are expecting to fall through.
This patch fixes the following warning (Building: m68k):
drivers/scsi/wd33c93.c: In function round_4 :
drivers/scsi/wd33c93.c:1856:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 2: ++x;
^~~
drivers/scsi/wd33c93.c:1857:3: note: here
case 3: ++x;
^~~~
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: sun3_scsi: Mark expected switch fall-throughs
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
drivers/scsi/sun3_scsi.c: warning: this statement may fall through
[-Wimplicit-fallthrough=]: => 399:9, 403:9
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: qlogicpti: Mark expected switch fall-throughs
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings (Building: sparc defconfig):
drivers/scsi/qlogicpti.c: In function 'qlogicpti_mbox_command':
drivers/scsi/qlogicpti.c:202:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:203:2: note: here
case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
^~~~
drivers/scsi/qlogicpti.c:203:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:204:2: note: here
case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
^~~~
drivers/scsi/qlogicpti.c:204:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:205:2: note: here
case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
^~~~
drivers/scsi/qlogicpti.c:205:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:206:2: note: here
case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
^~~~
drivers/scsi/qlogicpti.c:206:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:207:2: note: here
case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
^~~~
drivers/scsi/qlogicpti.c:256:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:257:2: note: here
case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
^~~~
drivers/scsi/qlogicpti.c:257:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:258:2: note: here
case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
^~~~
drivers/scsi/qlogicpti.c:258:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:259:2: note: here
case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
^~~~
drivers/scsi/qlogicpti.c:259:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:260:2: note: here
case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
^~~~
drivers/scsi/qlogicpti.c:260:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:261:2: note: here
case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
^~~~
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
drivers/scsi/ibmvscsi/ibmvfc.c: In function 'ibmvfc_npiv_login_done':
drivers/scsi/ibmvscsi/ibmvfc.c:4022:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
ibmvfc_retry_host_init(vhost);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/ibmvscsi/ibmvfc.c:4023:2: note: here
case IBMVFC_MAD_DRIVER_FAILED:
^~~~
drivers/scsi/ibmvscsi/ibmvfc.c: In function 'ibmvfc_bsg_request':
drivers/scsi/ibmvscsi/ibmvfc.c:1830:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
port_id = (bsg_request->rqst_data.h_els.port_id[0] << 16) |
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(bsg_request->rqst_data.h_els.port_id[1] << 8) |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bsg_request->rqst_data.h_els.port_id[2];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/ibmvscsi/ibmvfc.c:1833:2: note: here
case FC_BSG_RPT_ELS:
^~~~
drivers/scsi/ibmvscsi/ibmvfc.c:1838:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
port_id = (bsg_request->rqst_data.h_ct.port_id[0] << 16) |
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(bsg_request->rqst_data.h_ct.port_id[1] << 8) |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bsg_request->rqst_data.h_ct.port_id[2];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/ibmvscsi/ibmvfc.c:1841:2: note: here
case FC_BSG_RPT_CT:
^~~~
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Qian Cai [Fri, 26 Jul 2019 14:25:43 +0000 (10:25 -0400)]
scsi: megaraid_sas: Fix a compilation warning
The commit de516379e85f ("scsi: megaraid_sas: changes to function
prototypes") introduced a comilation warning due to it changed the function
prototype of read_fw_status_reg() to take an instance pointer instead, but
forgot to remove an unused variable.
drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
'megasas_fusion_update_can_queue':
drivers/scsi/megaraid/megaraid_sas_fusion.c:326:39: warning: variable
'reg_set' set but not used [-Wunused-but-set-variable]
struct megasas_register_set __iomem *reg_set;
^~~~~~~ Fixes: de516379e85f ("scsi: megaraid_sas: changes to function prototypes") Signed-off-by: Qian Cai <cai@lca.pw> Acked-by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: megaraid_sas: Make a bunch of functions static
Fix sparse warnings:
drivers/scsi/megaraid/megaraid_sas_fusion.c:3369:1: warning: symbol 'complete_cmd_fusion' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3535:6: warning: symbol 'megasas_sync_irqs' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3554:1: warning: symbol 'megasas_complete_cmd_dpc_fusion' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3573:13: warning: symbol 'megasas_isr_fusion' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3604:1: warning: symbol 'build_mpt_mfi_pass_thru' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3661:40: warning: symbol 'build_mpt_cmd' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3688:1: warning: symbol 'megasas_issue_dcmd_fusion' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:3881:5: warning: symbol 'megasas_wait_for_outstanding_fusion' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:4005:6: warning: symbol 'megasas_refire_mgmt_cmd' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:4525:25: warning: symbol 'megasas_get_peer_instance' was not declared. Should it be static?
drivers/scsi/megaraid/megaraid_sas_fusion.c:4825:7: warning: symbol 'megasas_fusion_crash_dump' was not declared. Should it be static?
Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: qla2xxx: Allow NVMe IO to resume with short cable pull
Current driver report dev_loss_tmo to 0 for NVMe devices with short cable
pull. This causes NVMe controller to be freed along with NVMe namespace.
The side affect is IO would stop. By not setting dev_loss_tmo to 0, NVMe
namespace would stay until cable is plugged back in. This allows IO to
resume afterward.
[mkp: commit desc]
Signed-off-by: Arun Easi <aeasi@marvell.com> Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Andrew Vasquez [Fri, 26 Jul 2019 16:07:37 +0000 (09:07 -0700)]
scsi: qla2xxx: Use common update-firmware-options routine for ISP27xx+
Leverage the generic routine, qla24xx_update_fw_options(), for the
configuration of firmware options for ISP27xx/ISP28xx.
Signed-off-by: Andrew Vasquez <andrewv@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: qla2xxx: Fix NVMe port discovery after a short device port loss
The following sequence of event leads to NVME port disappearing:
- device port shut
- nvme_fc_unregister_remoteport
- device port online
- remote port delete completes
- relogin is scheduled
- "post gidpn" message appears due to rscn generation # mismatch
In short, if a device comes back online sooner than an unregister
completion, a mismatch in rscn generation number occurs, which is not
handled correctly during device relogin. Fix this by starting with a redo
of GNL.
When ql2xextended_error_logging is enabled, the re-plugged device's
discovery stops with the following messages printed:
Andrew Vasquez [Fri, 26 Jul 2019 16:07:35 +0000 (09:07 -0700)]
scsi: qla2xxx: Correct error handling during initialization failures
Current code misses or fails to account for proper recovery during early
initialization failures:
- Properly unwind allocations during probe() failures.
- Protect against non-initialization memory allocations during
unwinding.
- Propagate error status during HW initialization.
- Release SCSI host reference when memory allocations fail.
Signed-off-by: Andrew Vasquez <andrewv@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
For any qla2xxx async command, the SRB buffer is used to send it. In
setting up the SRB buffer, the timer for this command is started before all
memory allocation has finished. Under low memory pressure, memory alloc
can go to sleep and not wake up before the timer expires. Once timer has
expired, the timer thread will access uninitialize fields resulting into
NULL pointer crash.
This patch fixes this crash by moving the start of timer after everything
is setup.
scsi: qla2xxx: Fix Relogin to prevent modifying scan_state flag
Relogin fails to move forward due to scan_state flag indicating device is
not there. Before relogin process, Session delete process accidently
modified the scan_state flag.
[mkp: typos plus corrected Fixes: sha as reported by sfr]
Fixes: 2dee5521028c ("scsi: qla2xxx: Fix login state machine freeze") Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: qla2xxx: Skip FW dump on LOOP initialization error
Firmware dump captured during LOOP Init error does not yield any
significant information. This patch removes call to trigger firmware dump
collection during Loop Initialization.
Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
For target mode, the default number of Q-Pairs allowed to use is 2. If the
number of Q-Pairs allocated is lower than the default Q-Pairs, then lower
value should be the set as default.
[mkp: typo]
Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
If an abort times out, the Abort IOCB completion and Abort timer can race
against each other. This patch provides unique error code for timer path to
allow proper cleanup.
[mkp: typo]
Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
With debug kernel we see following wanings indicating memory leak.
[28809.523959] WARNING: CPU: 3 PID: 6790 at lib/dma-debug.c:978
dma_debug_device_change+0x166/0x1d0
[28809.523964] pci 0000:0c:00.6: DMA-API: device driver has pending DMA
allocations while released from device [count=5]
[28809.523964] One of leaked entries details: [device
address=0x00000002aefe4000] [size=8208 bytes] [mapped with DMA_BIDIRECTIONAL]
[mapped as coherent]
Fix this by unmapping DMA memory.
Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Minwoo Im [Sat, 27 Jul 2019 18:53:37 +0000 (03:53 +0900)]
scsi: mpt3sas: support target smid for [abort|query] task
We can request task management IOCTL command(MPI2_FUNCTION_SCSI_TASK_MGMT)
to /dev/mpt3ctl. If the given task_type is either abort task or query
task, it may need a field named "Initiator Port Transfer Tag to Manage" in
the IU.
Current code does not support to check target IPTT tag from the tm_request.
This patch introduces to check TaskMID given from the userspace as a target
tag. We have a rule of relationship between
(struct request *req->tag) and smid in mpt3sas_base.c:
So if we want to abort a request tagged #X, then we can pass (X + 1) to
this IOCTL handler. Otherwise, user space just can pass 0 TaskMID to abort
the first outstanding smid which is legacy behaviour.
Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> Cc: Sathya Prakash <sathya.prakash@broadcom.com> Cc: James E.J. Bottomley <jejb@linux.ibm.com> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: MPT-FusionLinux.pdl@broadcom.com Signed-off-by: Minwoo Im <minwoo.im@samsung.com> Acked-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: ibmvscsi_tgt: Mark expected switch fall-throughs
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings (Building: powerpc allyesconfig):
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_adapter_info':
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1582:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (connection_broken(vscsi))
^
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1584:2: note: here
default:
^~~~~~~
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_ping_response':
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:2494:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
vscsi->flags |= CLIENT_FAILED;
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:2495:2: note: here
case H_DROPPED:
^~~~
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:2496:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
vscsi->flags |= RESPONSE_Q_DOWN;
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:2497:2: note: here
case H_REMOTE_PARM:
^~~~
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Bryant G. Ly <bly@catalogicsoftware.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: cxlflash: Mark expected switch fall-throughs
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
drivers/scsi/cxlflash/main.c: In function 'send_afu_cmd':
drivers/scsi/cxlflash/main.c:2347:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (rc) {
^
drivers/scsi/cxlflash/main.c:2357:2: note: here
case -EAGAIN:
^~~~
drivers/scsi/cxlflash/main.c: In function 'term_intr':
drivers/scsi/cxlflash/main.c:754:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (index == PRIMARY_HWQ)
^
drivers/scsi/cxlflash/main.c:756:2: note: here
case UNMAP_TWO:
^~~~
drivers/scsi/cxlflash/main.c:757:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:758:2: note: here
case UNMAP_ONE:
^~~~
drivers/scsi/cxlflash/main.c:759:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:760:2: note: here
case FREE_IRQ:
^~~~
drivers/scsi/cxlflash/main.c: In function 'cxlflash_remove':
drivers/scsi/cxlflash/main.c:975:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cxlflash_release_chrdev(cfg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:976:2: note: here
case INIT_STATE_SCSI:
^~~~
drivers/scsi/cxlflash/main.c:978:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
scsi_remove_host(cfg->host);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:979:2: note: here
case INIT_STATE_AFU:
^~~~
drivers/scsi/cxlflash/main.c:980:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
term_afu(cfg);
^~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:981:2: note: here
case INIT_STATE_PCI:
^~~~
drivers/scsi/cxlflash/main.c:983:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
pci_disable_device(pdev);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:984:2: note: here
case INIT_STATE_NONE:
^~~~
drivers/scsi/cxlflash/main.c: In function 'num_hwqs_store':
drivers/scsi/cxlflash/main.c:3018:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (cfg->state == STATE_NORMAL)
^
drivers/scsi/cxlflash/main.c:3020:2: note: here
default:
^~~~~~~
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Matthew R. Ochs <mrochs@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Fri, 26 Jul 2019 06:52:05 +0000 (09:52 +0300)]
scsi: mpt3sas: clean up a couple sizeof() uses
There is a copy and paste bug here. It uses EVENT_TRIGGERS size instead of
SCSI_TRIGGERS size but fortunately both size are 84 bytes so it doesn't
affect runtime.
These days the preferred style is to just say sizeof(object) instead of
sizeof(type) so I have updated the function to the latest style as well.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Sergei Shtylyov [Tue, 16 Jul 2019 20:41:54 +0000 (23:41 +0300)]
scsi: fdomain_isa: use CFG1_IRQ_MASK
Commit 1697c6a64c49 ("scsi: fdomain: Add register definitions") somehow
missed the uses of CFG1_IRQ_MASK in the Futire Domain ISA driver, leaving
the magic numbers intact. Fix this issue (with no change in the generated
object file), removing an excess empty line, while at it...
Fixes: 1697c6a64c49 ("scsi: fdomain: Add register definitions") Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Sergei Shtylyov [Tue, 16 Jul 2019 20:40:47 +0000 (23:40 +0300)]
scsi: fdomain: use BSTAT_{MSG|CMD|IO} in fdomain_work()
Commit 1697c6a64c49 ("scsi: fdomain: Add register definitions") somehow
missed the masking of the 'status' variable with the SCSI phase mask in
fdomain_work(), leaving the magic number intact. Fix this issue; while at
it, change the order of BSTAT_{MSG|CMD|IO} bits in the MESSAGE IN
phase *case* (with no change in the generated object file).
Fixes: 1697c6a64c49 ("scsi: fdomain: Add register definitions") Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Sergei Shtylyov [Tue, 16 Jul 2019 20:39:15 +0000 (23:39 +0300)]
scsi: fdomain: use BCTL_RST in fdomain_reset()
Commit 1697c6a64c49 ("scsi: fdomain: Add register definitions") somehow
missed the use of BCTL_RST in fdomain_reset(), leaving the magic number
intact. Fix this issue (with no change in the generated object file).
Fixes: 1697c6a64c49 ("scsi: fdomain: Add register definitions") Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bean Huo [Mon, 15 Jul 2019 11:21:10 +0000 (11:21 +0000)]
scsi: ufs: change msleep to usleep_range
This patch is to change msleep() to usleep_range() based on
Documentation/timers/timers-howto.txt. It suggests using usleep_range()
for small msec(1ms - 20ms) since msleep() will often sleep longer than
desired value.
After changing, booting time will be 5ms-10ms faster than before. I
tested this change on two different platforms, one has 5ms faster, another
one is about 10ms. I think this is different on different platform.
Actually, from UFS host side, 1ms-5ms delay is already sufficient for its
initialization of the local UIC layer.
Fixes: 7a3e97b0dc4b ([SCSI] ufshcd: UFS Host controller driver) Signed-off-by: Bean Huo <beanhuo@micron.com> Acked-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: lpfc: Remove unnecessary null check before kfree
A null check before a kfree is redundant, so remove it. This is detected
by coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Paolo Bonzini [Thu, 30 May 2019 11:28:11 +0000 (13:28 +0200)]
scsi: virtio_scsi: implement request batching
Adding the command and kicking the virtqueue so far was done one after
another. Make the kick optional, so that we can take into account
SCMD_LAST. We also need a commit_rqs callback to kick the device if
blk-mq aborts the submission before the last request is reached.
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Paolo Bonzini [Thu, 30 May 2019 11:28:10 +0000 (13:28 +0200)]
scsi: core: add support for request batching
This allows a list of requests to be issued, with the LLD only writing the
hardware doorbell when necessary, after the last request was prepared.
This is more efficient if we have lists of requests to issue, particularly
on virtualized hardware, where writing the doorbell is more expensive than
on real hardware.
The use case for this is plugged IO, where blk-mq flushes a batch of
requests all at once.
The API is the same as for blk-mq, just with blk-mq concepts tweaked to
fit the SCSI subsystem API: the "last" flag in blk_mq_queue_data becomes a
flag in scsi_cmnd, while the queue_num in the commit_rqs callback is
extracted from the hctx and passed as a parameter.
The only complication is that blk-mq uses different plugging heuristics
depending on whether commit_rqs is present or not. So we have two
different sets of blk_mq_ops and pick one depending on whether the
scsi_host template uses commit_rqs or not.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Avri Altman [Wed, 12 Jun 2019 13:34:37 +0000 (16:34 +0300)]
scsi: ufs: uapi: Fix SPDX license identifier
Added 'WITH Linux-syscall-note' exception which is the officially assigned
exception identifier for the kernel syscall exception. This exception
makes it possible to include GPL headers into non GPL code without
confusing license compliance tools.
Fixes: a851b2bd3632 (scsi: uapi: ufs: Make utp_upiu_req visible to user space) Signed-off-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Pedro Sousa <pedrom.sousa@synopsys.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Wed, 10 Jul 2019 13:38:21 +0000 (21:38 +0800)]
scsi: ufs: Add history of fatal events
Currently only "interrupt-based" errors have their own history, however
there are some "non-interrupt-based" errors or events which need history
to improve debugging or help know the health status of UFS devices.
Example of fatal errors:
- Link startup error
- Suspend error
- Resume error
Example of abnormal events:
- Task or request abort
- Device reset (now equals to Logical Unit Reset)
- Host reset
This patch tries to track above errors and events by existed UFS error
history mechanism.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Wed, 10 Jul 2019 13:38:20 +0000 (21:38 +0800)]
scsi: ufs: Do not reset error history during host reset
Currently UFS error history will be reset and lost during host reset flow
by ufschd_probe_hba().
Avoid resetting it so error history can be kept as complete as possible to
improve debugging.
In addition, fix a minor display error in ufshcd_print_err_hist().
[mkp: commit desc clarification]
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Wed, 10 Jul 2019 13:38:19 +0000 (21:38 +0800)]
scsi: ufs: Add fatal and auto-hibern8 error history
Provide more information about fatal and auto-hibern8 errors to improve
debugging by extending existing UFS error history framework.
[mkp: typos]
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Merge tag 'devicetree-fixes-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull Devicetree fixes from Rob Herring:
"Fix several warnings/errors in validation of binding schemas"
* tag 'devicetree-fixes-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
dt-bindings: pinctrl: stm32: Fix missing 'clocks' property in examples
dt-bindings: iio: ad7124: Fix dtc warnings in example
dt-bindings: iio: avia-hx711: Fix avdd-supply typo in example
dt-bindings: pinctrl: aspeed: Fix AST2500 example errors
dt-bindings: pinctrl: aspeed: Fix 'compatible' schema errors
dt-bindings: riscv: Limit cpus schema to only check RiscV 'cpu' nodes
dt-bindings: Ensure child nodes are of type 'object'
Merge tag '5.3-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French:
"Two fixes for stable, one that had dependency on earlier patch in this
merge window and can now go in, and a perf improvement in SMB3 open"
* tag '5.3-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: update internal module number
cifs: flush before set-info if we have writeable handles
smb3: optimize open to not send query file internal info
cifs: copy_file_range needs to strip setuid bits and update timestamps
CIFS: fix deadlock in cached root handling
Qian Cai [Thu, 11 Jul 2019 16:17:45 +0000 (12:17 -0400)]
iommu/amd: fix a crash in iova_magazine_free_pfns
The commit b3aa14f02254 ("iommu: remove the mapping_error dma_map_ops
method") incorrectly changed the checking from dma_ops_alloc_iova() in
map_sg() causes a crash under memory pressure as dma_ops_alloc_iova()
never return DMA_MAPPING_ERROR on failure but 0, so the error handling
is all wrong.
Mike Rapoport [Tue, 30 Apr 2019 14:27:50 +0000 (17:27 +0300)]
hexagon: switch to generic version of pte allocation
The hexagon implementation pte_alloc_one(), pte_alloc_one_kernel(),
pte_free_kernel() and pte_free() is identical to the generic except of
lack of __GFP_ACCOUNT for the user PTEs allocation.
Switch hexagon to use generic version of these functions.
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge tag 'ntb-5.3' of git://github.com/jonmason/ntb
Pull NTB updates from Jon Mason:
"New feature to add support for NTB virtual MSI interrupts, the ability
to test and use this feature in the NTB transport layer.
Also, bug fixes for the AMD and Switchtec drivers, as well as some
general patches"
* tag 'ntb-5.3' of git://github.com/jonmason/ntb: (22 commits)
NTB: Describe the ntb_msi_test client in the documentation.
NTB: Add MSI interrupt support to ntb_transport
NTB: Add ntb_msi_test support to ntb_test
NTB: Introduce NTB MSI Test Client
NTB: Introduce MSI library
NTB: Rename ntb.c to support multiple source files in the module
NTB: Introduce functions to calculate multi-port resource index
NTB: Introduce helper functions to calculate logical port number
PCI/switchtec: Add module parameter to request more interrupts
PCI/MSI: Support allocating virtual MSI interrupts
ntb_hw_switchtec: Fix setup MW with failure bug
ntb_hw_switchtec: Skip unnecessary re-setup of shared memory window for crosslink case
ntb_hw_switchtec: Remove redundant steps of switchtec_ntb_reinit_peer() function
NTB: correct ntb_dev_ops and ntb_dev comment typos
NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
NTB: ntb_transport: Ensure qp->tx_mw_dma_addr is initaliazed
NTB: ntb_hw_amd: set peer limit register
NTB: ntb_perf: Clear stale values in doorbell and command SPAD register
NTB: ntb_perf: Disable NTB link after clearing peer XLAT registers
...
Rob Herring [Tue, 16 Jul 2019 21:34:40 +0000 (15:34 -0600)]
dt-bindings: pinctrl: stm32: Fix missing 'clocks' property in examples
Now that examples are validated against the DT schema, an error with
required 'clocks' property missing is exposed:
Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.example.dt.yaml: \
pinctrl@40020000: gpio@0: 'clocks' is a required property
Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.example.dt.yaml: \
pinctrl@50020000: gpio@1000: 'clocks' is a required property
Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.example.dt.yaml: \
pinctrl@50020000: gpio@2000: 'clocks' is a required property
Add the missing 'clocks' properties to the examples to fix the errors.
Fixes: 2c9239c125f0 ("dt-bindings: pinctrl: Convert stm32 pinctrl bindings to json-schema") Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: linux-gpio@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Acked-by: Alexandre TORGUE <alexandre.torgue@st.com> Signed-off-by: Rob Herring <robh@kernel.org>
There's a default #size-cells and #address-cells values of 1 for
examples. For examples needing different values such as this one on a
SPI bus, they need to provide a SPI bus parent node.
Fixes: 26ae15e62d3c ("Convert AD7124 bindings documentation to YAML format.") Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-iio@vger.kernel.org Signed-off-by: Rob Herring <robh@kernel.org>