Brian King [Fri, 16 Sep 2016 21:51:37 +0000 (16:51 -0500)]
scsi: ipr: Remove redundant messages at adapter init time
Whenever multiple HRRQs are enabled, which is the default setting now,
we end up seeing the following message logged prior to initialization of
each HRRQ:
Starting IOA initialization sequence
This results in 16 of these messages on most adapters, which serves
little purpose. Change to just log this once.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
A 9084 error gets logged by the ipr adapter when adapter raw mode gets
enabled. A bunch of unformatted hex data also gets logged for this
error, which is of little use, so let's avoid logging it by default in
order to avoid the log getting polluted with useless data.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
kevin Barnett [Fri, 16 Sep 2016 20:01:51 +0000 (15:01 -0500)]
scsi: smartpqi: raid bypass lba calculation fix
In the ioaccel path, the calculation of the starting LBA for
READ(6)/WRITE(6) SCSI commands does not take into account the most
significant 5 bits of the LBA: it only uses the least significant 16
bits of the starting LBA.
Reported-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Missing 5 bits of byte 1 in the LBA issued by SML.
Reported-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Thu, 15 Sep 2016 13:44:56 +0000 (16:44 +0300)]
scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer()
We need to put an upper bound on "user_len" so the memcpy() doesn't
overflow.
Cc: <stable@vger.kernel.org> Reported-by: Marco Grassi <marco.gra@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: ibmvscsis: Fix error return code in ibmvscsis_probe()
Fix to return error code -ENOMEM from the dma mapping error handling
case instead of 0, as done elsewhere in this function.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
These should go together with the rest of the T10 protection information
defintions.
[mkp: s/T10_DIF/T10_PI/]
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
scsi: scsi_debug: Use struct t10_pi_tuple instead of struct sd_dif_tuple
And remove the declaration of the latter in sd.h as scsi_debug was the
only user.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Fri, 9 Sep 2016 21:30:42 +0000 (16:30 -0500)]
scsi: hpsa: Check for null devices in ioaccel submission patch
Reviewed-by: Scott Benesh <scott.benest@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Scott Teel [Fri, 9 Sep 2016 21:30:36 +0000 (16:30 -0500)]
scsi: hpsa: Prevent sending bmic commands to externals
Reviewed-by: Scott Benesh <scott.benest@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Scott Teel [Fri, 9 Sep 2016 21:30:29 +0000 (16:30 -0500)]
scsi: hpsa: Check for vpd support before sending
Before using vendor-specific VPD pages for getting raid_level and
device_id, check for page support. If page isn't supported, don't try
to use it. Also, pay attention to return status on hpsa_get_device_id.
[mkp: fix boolean return warnings reported by kbuild test robot]
Reviewed-by: Scott Benesh <scott.benest@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Fri, 9 Sep 2016 21:30:23 +0000 (16:30 -0500)]
scsi: hpsa: Check for null device pointers
A device can be deleted causing NULL pointer issues.
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Fri, 9 Sep 2016 21:30:17 +0000 (16:30 -0500)]
scsi: hpsa: Determine device external status earlier
Currently we are checking for external status before we are determining
if a device is an external device.
Reviewed-by: Scott Benesh <scott.benest@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Finn Thain [Wed, 31 Aug 2016 04:44:56 +0000 (14:44 +1000)]
scsi: ncr5380: Improve interrupt latency during PIO tranfers
Large PIO transfers are broken up into chunks to try to avoid disabling
local IRQs for long periods. But IRQs are still disabled for too long
and this causes SCC FIFO overruns during serial port transfers.
This patch reduces the PIO chunk size to reduce interrupt latency to
something on the order of milliseconds, at the expense of additional CPU
overhead from extra iterations of the NCR5380_main() loop.
That CPU overhead is a problem for slow machines (e.g. mac_scsi on 25
MHz 68030) but these machines generally use PDMA not PIO. This patch
doesn't make the overhead any worse on my Mac LC III (because it only
gets about 510 accesses per ms).
This patch decreases disk performance by a fraction of one percent for
dmx3191d on my 333 MHz PowerPC 750. Other affected hardware (such as
g_NCR5380 on x86) was not tested but 5380 ISA cards generally use PDMA
and not PIO.
[mkp: fix whitespace]
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Laurence Oberman <loberman@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner [Tue, 13 Sep 2016 08:58:50 +0000 (10:58 +0200)]
scsi: virtio_scsi: Use complete() instead complete_all()
There is only one waiter for the completion, therefore there is no need
to use complete_all(). Let's make that clear by using complete() instead
of complete_all().
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner [Tue, 13 Sep 2016 08:58:49 +0000 (10:58 +0200)]
scsi: sym53c8xx_2: Use complete() instead complete_all()
There is only one waiter for the completion, therefore there is no need
to use complete_all(). Let's make that clear by using complete() instead
of complete_all().
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner [Tue, 13 Sep 2016 08:58:48 +0000 (10:58 +0200)]
scsi: csiostor: Fix completion usage
The (re)initializing of the completion object should be done before we
trigger the transfer. Doing this after triggering the hardware opens up
a race window. Without the timeout we would problaly even deadlock. Use
also reinit_completion because we initalize the whole data structure in
csio_scscim_init().
There is only one waiter for the completion, therefore there is no need
to use complete_all(). Let's make that clear by using complete() instead
of complete_all().
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Mon, 12 Sep 2016 12:42:12 +0000 (13:42 +0100)]
scsi: megaraid_sas: add in missing white space in error message text
A dev_printk message spans two lines and the literal string is missing a
white space between words. Add the white space.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Sumit Saxena <sumit.saxena@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:25 +0000 (23:36 +0800)]
scsi: hisi_sas: send three identify before phy up
When the v2 hw is attached with many disks through an expander, there
may be OOB reset resulting in a PHY going down after the speed is
negotiated (very low probability).
This issue is resolved by modifying the link control registers to send
three identify frames before the PHY is ready (according to 6.10.3.3.2
in SAS 3.0 spec) and close ready when the PHY is down.
Signed-off-by: NengLong Zhao <zhaonenglong@hisilicon.com> Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:24 +0000 (23:36 +0800)]
scsi: hisi_sas: add missing SATA pending device type to v2 hw
In setup_itct_v2_hw(), SATA device type SAS_SATA_PENDING is missing, so
add it.
Note: The HiSi SAS controller does not support SATA PM, so do not handle
SAS_SATA_PM_PORT or SAS_SATA_PM.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:23 +0000 (23:36 +0800)]
scsi: hisi_sas: remove init_id_frame_v1_hw()
Function config_id_frame_v1_hw() is called twice for each PHY during
initialisation, which is unneeded.
So remove init_id_frame_v1_hw(), which only calls
config_id_frame_v1_hw().
We will keep the call to config_id_frame_v1_hw() in start_phy_v1_hw()
since it will be used for PHY reset functions.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:22 +0000 (23:36 +0800)]
scsi: hisi_sas: remove init_id_frame_v2_hw()
Function config_id_frame_v2_hw() is called twice for each PHY during
initialisation, which is unneeded.
So remove init_id_frame_v2_hw(), which only calls
config_id_frame_v2_hw().
We will keep the call to config_id_frame_v2_hw() in start_phy_v2_hw()
since it will be used for PHY reset functions.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:21 +0000 (23:36 +0800)]
scsi: hisi_sas: fix HBA SAS addr endianness for v1 hw
The endianness for the SAS address in the TX_ID_DWORD registers is set
incorrectly. We see errors like this in the boot log for v2 hw (which
would have the same issue as v1 hw):
[ 7.583284] sas: target proto 0x0 at 50000d1108e7923f:0x1f not handled
This is due to the host SAS addr not matching the PHY SAS addr in the
expander host-attached phy discovery responses.
To fix, we byte swap the SAS addr from BE to LE (which is the endianness
of the SAS controller).
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:20 +0000 (23:36 +0800)]
scsi: hisi_sas: fix HBA SAS addr endianness for v2 hw
The endianness for the SAS address in the TX_ID_DWORD registers is set
incorrectly. We see errors like this in the boot log:
[ 7.583284] sas: target proto 0x0 at 50000d1108e7923f:0x1f not handled
This is due to the host SAS addr not matching the PHY SAS addr in the
expander host-attached phy discovery responses.
To fix, we byte swap the SAS addr from BE to LE (which is the endianness
of the SAS controller).
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:19 +0000 (23:36 +0800)]
scsi: hisi_sas: set dma mask before allocate DMA memory
The device DMA mask was being set after the bulk of the DMA allocations
in the driver init, so potentially DMA allocates fail. To resolve,
relocate before allocating the DMA memory when initialising the driver.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:18 +0000 (23:36 +0800)]
scsi: hisi_sas: fix a potential warning for sata disk ejection
If hisi_sas_task_prep() fails for a SATA device due to PHY down, we
return a failure to libata and also call task_done(), which will cause
ata_qc_complete() to be called twice: - first call from
hisi_sas_task_prep(), which will clear flag ATA_QCFLAG_ACTIVE -
ata_qc_complete() called from libata The warning call trace is as
follows:
The issue is resolved by simply returning a failure status code to the
upper layer.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:17 +0000 (23:36 +0800)]
scsi: hisi_sas: fix phy8 linkrate calculation in phy_up_v2_hw()
In function phy_up_v2_hw(), we needlessly recalculate the phy linkrate
for all phys, and the calculation is incorrect for phy8, so remove this
code.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:16 +0000 (23:36 +0800)]
scsi: hisi_sas: disable dlvry queues once at reset for v2 hw
The Delivery queue enable register should only be written to once at
reset for v2 hw.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:15 +0000 (23:36 +0800)]
scsi: hisi_sas: use safe BITS_PER_BYTE for slot tag size calculation
The memory calculation for the tags bitmap should use BITS_PER_BYTE
macro instead of coincidental same value of sizeof(unsigned long).
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:14 +0000 (23:36 +0800)]
scsi: hisi_sas: only zero slot memory when reused
Currently the slot memory is zeroed when it is freed and also when it is
reused, like in hisi_sas_task_prep(). Optimise by avoiding the redundant
zeroing in the free.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:13 +0000 (23:36 +0800)]
scsi: hisi_sas: keep CHL_INT2 masked for v2 HW
None of the CHL_INT2 interrupts are serviced in the channel irq ISR, so
leave the interrupt source masked. The interrupt mask is initially set
in init_reg_v2_hw().
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:12 +0000 (23:36 +0800)]
scsi: hisi_sas: save delivery queue write pointer
Optimise by saving an avoidable read in the get_free_slot function. The
delivery queue write pointer will only be updated by software, so don't
bother re-reading what was already written in the previous call to
start_delivery function.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 6 Sep 2016 15:36:11 +0000 (23:36 +0800)]
scsi: hisi_sas: save completion queue read pointer
Optimise by saving an avoidable read in the cq interrupt. The queue
read pointer will only be updated by software, so don't bother
re-reading what was already written in the previous interrupt.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Matthew R. Ochs [Fri, 2 Sep 2016 20:40:41 +0000 (15:40 -0500)]
scsi: cxlflash: Fix context reference tracking on detach
Commit 888baf069f49 ("scsi: cxlflash: Add kref to context") introduced a
kref to the context. In particular, the detach routine was updated to
use the kref services for managing the removal and destruction of a
context.
As part of this change, the tracking mechanism internal to the detach
handler was refactored. This introduced a bug that can cause the
tracking state to be lost. This can lead to a situation where exclusive
access to a context is prematurely [and unknowingly] relinquished for
the executing thread.
To remedy, only update the tracking state when the kref operation
indicates the context was removed.
Fixes: 888baf069f49 ("scsi: cxlflash: Add kref to context") Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Matthew R. Ochs [Fri, 2 Sep 2016 20:40:20 +0000 (15:40 -0500)]
scsi: cxlflash: Refactor WWPN setup
Commit 964497b3bf3f ("cxlflash: Remove dual port online dependency")
logically removed the ability for the WWPN setup routine afu_set_wwpn()
to return a non-success value. This routine can safely be made a void to
simplify the code as there is no longer a need to report a failure.
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Matthew R. Ochs [Fri, 2 Sep 2016 20:40:03 +0000 (15:40 -0500)]
scsi: cxlflash: Improve EEH recovery time
When an EEH occurs during device initialization, the port timeout logic
can cause excessive delays as MMIO reads will fail. Depending on where
they are experienced, these delays can lead to a prolonged reset,
causing an unnecessary triggering of other timeout logic in the SCSI
stack or user applications.
To expedite recovery, the port timeout logic is updated to decay the
timeout at a much faster rate when in the presence of a likely EEH
frozen event.
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Matthew R. Ochs [Fri, 2 Sep 2016 20:39:30 +0000 (15:39 -0500)]
scsi: cxlflash: Fix to avoid EEH and host reset collisions
The EEH reset handler is ignorant to the current state of the driver
when processing a frozen event and initiating a device reset. This can
be an issue if an EEH event occurs while a user or stack initiated reset
is executing. More specifically, if an EEH occurs while the SCSI host
reset handler is active, the reset initiated by the EEH thread will
likely collide with the host reset thread. This can leave the device in
an inconsistent state, or worse, cause a system crash.
As a remedy, the EEH handler is updated to evaluate the device state and
take appropriate action (proceed, wait, or disconnect host). The host
reset handler is also updated to handle situations where an EEH occurred
during a host reset. In such situations, the host reset handler will
delay reporting back a success to give the EEH reset an opportunity to
complete.
Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Acked-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Uma Krishnan [Fri, 2 Sep 2016 20:39:16 +0000 (15:39 -0500)]
scsi: cxlflash: Remove the device cleanly in the system shutdown path
Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash
cards") was recently introduced to notify the AFU when a system is going
down. Due to the position of the cxlflash driver in the device stack,
cxlflash devices are _always_ removed during a reboot/shutdown. This can
lead to a crash if the cxlflash shutdown hook is invoked _after_ the
shutdown hook for the owning virtual PHB. Furthermore, the current
implementation of shutdown/remove hooks for cxlflash are not tolerant to
being invoked when the device is not enabled. This can also lead to a
crash in situations where the remove hook is invoked after the device
has been removed via the vPHBs shutdown hook. An example of this
scenario would be an EEH reset failure while a reboot/shutdown is in
progress.
To solve both problems, the shutdown hook for cxlflash is updated to
simply remove the device. This path already includes the AFU
notification and thus this solution will continue to perform the
original intent. At the same time, the remove hook is updated to protect
against being called when the device is not enabled.
Fixes: 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash
cards") Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Uma Krishnan [Fri, 2 Sep 2016 20:38:48 +0000 (15:38 -0500)]
scsi: cxlflash: Scan host only after the port is ready for I/O
When a port link is established, the AFU sends a 'link up' interrupt.
After the link is up, corresponding initialization steps are performed
on the card. Following that, when the card is ready for I/O, the AFU
sends 'login succeeded' interrupt. Today, cxlflash invokes
scsi_scan_host() upon receipt of both interrupts.
SCSI commands sent to the port prior to the 'login succeeded' interrupt
will fail with 'port not available' error. This is not desirable.
Moreover, when async_scan is active for the host, subsequent scan calls
are terminated with error. Due to this, the scsi_scan_host() call
performed after 'login succeeded' interrupt could portentially return
error and the devices may not be scanned properly.
To avoid this problem, scsi_scan_host() should be called only after the
'login succeeded' interrupt.
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
We get a few warnings when building kernel with W=1:
drivers/scsi/bnx2fc/bnx2fc_els.c:257:6: warning: no previous prototype for 'bnx2fc_srr_compl' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_els.c:367:6: warning: no previous prototype for 'bnx2fc_rec_compl' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:628:5: warning: no previous prototype for 'bnx2fc_percpu_io_thread' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:1413:26: warning: no previous prototype for 'bnx2fc_interface_create' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_hwi.c:997:21: warning: no previous prototype for 'bnx2fc_alloc_work' [-Wmissing-prototypes]
drivers/scsi/bnx2fc/bnx2fc_io.c:1082:5: warning: no previous prototype for 'bnx2fc_abts_cleanup' [-Wmissing-prototypes]
....
In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static. so this
patch marks these functions with 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
We get 1 warning when building kernel with W=1:
drivers/scsi/aacraid/src.c:616:5: warning: no previous prototype for 'aac_src_select_comm' [-Wmissing-prototypes]
In fact, this function is only used in the file in which it is declared
and don't need a declaration, but can be made static. so this patch
marks this function with 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Dave Carroll <david.carroll@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Baoyou Xie [Mon, 29 Aug 2016 10:19:00 +0000 (18:19 +0800)]
scsi: ufs: Add missing header dependencies for tc-dwc-g210
We get 2 warnings when build kernel with W=1:
drivers/scsi/ufs/tc-dwc-g210.c:261:5: warning: no previous prototype for 'tc_dwc_g210_config_40_bit' [-Wmissing-prototypes]
drivers/scsi/ufs/tc-dwc-g210.c:293:5: warning: no previous prototype for 'tc_dwc_g210_config_20_bit' [-Wmissing-prototypes]
In fact, these functions are declared in ufs/tc-dwc-g210.h, so this
patch add missing header dependencies
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Baoyou Xie [Sat, 27 Aug 2016 15:49:24 +0000 (23:49 +0800)]
scsi: pmcraid: mark symbols static where possible
We get 4 warnings about global functions without a declaration
in the scsi pmcraid driver when building with W=1:
drivers/scsi/pmcraid.c:309:6: warning: no previous prototype for 'pmcraid_init_cmdblk' [-Wmissing-prototypes]
drivers/scsi/pmcraid.c:404:6: warning: no previous prototype for 'pmcraid_return_cmd' [-Wmissing-prototypes]
drivers/scsi/pmcraid.c:1713:6: warning: no previous prototype for 'pmcraid_ioasc_logger' [-Wmissing-prototypes]
drivers/scsi/pmcraid.c:3141:1: warning: no previous prototype for 'pmcraid_init_ioadls' [-Wmissing-prototypes]
In fact, these functions are only used in the file in which it is
declared and don't need a declaration, but can be made static. so this
patch marks it 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bryant G. Ly [Wed, 31 Aug 2016 16:29:01 +0000 (11:29 -0500)]
scsi: ibmvscsis: Fixed a bug reported by Dan Carpenter
SUPPORTED_FORMATS is 1 << 1 so it's never zero.
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bryant G. Ly [Wed, 31 Aug 2016 16:29:00 +0000 (11:29 -0500)]
scsi: ibmvscsis: Code cleanup of print statements
[mkp: applied by hand]
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
The driver currently doesn't properly deregisters target sessions
completely, so this will address that.
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Michael Cyr <mikecyr@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:55:36 +0000 (14:55 -0500)]
scsi: smartpqi: bump driver version
[mkp: fixed typo]
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Wed, 31 Aug 2016 19:55:30 +0000 (14:55 -0500)]
scsi: smartpqi: add smartpqi.txt
added Documentation/scsi/smartpqi.txt
[mkp: applied by hand]
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Don Brace <don.brace@microsemi.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:55:24 +0000 (14:55 -0500)]
scsi: smartpqi: update Kconfig
The aacraid driver will not managage Microsemi smartpqi controllers, but
will still manage older aacraid devices.
Updated help section.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:55:17 +0000 (14:55 -0500)]
scsi: smartpqi: remove timeout for cache flush operations
Some cache flush operations can take longer than the timeout value. Best
to not impose a time limit to handle all cases.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:55:11 +0000 (14:55 -0500)]
scsi: smartpqi: scsi queuecommand cleanup
minor cleanup of scsi queue command function
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:55:05 +0000 (14:55 -0500)]
scsi: smartpqi: minor tweaks to update time support
minor tweaks to update time support
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:59 +0000 (14:54 -0500)]
scsi: smartpqi: minor function reformating
reformatted pqi_num_elements_free() to match the rest of the driver
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
the driver no longer waits for the firmware to consume
the event ack IU.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:47 +0000 (14:54 -0500)]
scsi: smartpqi: correct controller offline issue
Fixes: 6c223761e 'smartpqi: initial commit of Microsemi smartpqi driver'
Fixed a bug where the driver would not free all of the
controller resources if the controller ever went offline.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:41 +0000 (14:54 -0500)]
scsi: smartpqi: add kdump support
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:35 +0000 (14:54 -0500)]
scsi: smartpqi: enhance reset logic
Eliminated timeout from LUN reset logic.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:23 +0000 (14:54 -0500)]
scsi: smartpqi: simplify spanning
Removed the workaround for the transition to spanning.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:17 +0000 (14:54 -0500)]
scsi: smartpqi: change tmf macro names
small change to make code look cleaner
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kevin Barnett [Wed, 31 Aug 2016 19:54:11 +0000 (14:54 -0500)]
scsi: smartpqi: change aio sg processing
Take advantage of controller improvements.
Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
The workqueues "ioc->reset_work_q" and "ioc->fw_event_q" queue a single
work item &ioc->fault_reset_work and &fw_event->work, respectively and
hence don't require ordering. Hence, they have been converted to use
alloc_workqueue().
The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure since the workqueue belongs to a storage driver which is
being used on a memory reclaim path.
Since there are fixed number of work items, explicit concurrency limit
is unnecessary here.
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
The workqueue "fc_rescan_work_q" queues multiple work items viz
&ioc->fc_rescan_work, &ioc->fc_lsc_work, &ioc->fc_setup_reset_work,
which require strict execution ordering. Hence, an ordered dedicated
workqueue has been used.
WQ_MEM_RECLAIM has been set since the workqueue is belongs to a storage
driver which is being used on a memory reclaim path and hence, requires
forward progress under memory pressure.
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Tue, 30 Aug 2016 16:36:16 +0000 (17:36 +0100)]
scsi: bfa: Do not dereference port before it is null checked
Port is deferenced before it is null sanity checked, hence we
potentially have a null pointer dereference bug. Instead, initialise
trl_enabled from port->fcs->bfa after we are sure port is not null.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Baoyou Xie [Mon, 29 Aug 2016 10:46:51 +0000 (18:46 +0800)]
scsi: qla4xxx: Mark symbols static where possible
We get 1 warning when build kernel with W=1:
drivers/scsi/qla4xxx/ql4_nx.c:1846:10: warning: no previous prototype for 'ql4_84xx_ipmdio_rd_reg' [-Wmissing-prototypes]
In fact, this function is only used in the file in which it is declared
and don't need a declaration, but can be made static. This patch marks
this function with 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Acked-by: Nilesh Javali <nilesh.javali@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Baoyou Xie [Tue, 30 Aug 2016 11:26:00 +0000 (19:26 +0800)]
scsi: move function declarations to scsi_priv.h
We get 2 warnings about global functions without a declaration in the
scsi driver when building with W=1:
drivers/scsi/scsi_lib.c:467:6: warning: no previous prototype for 'scsi_requeue_run_queue' [-Wmissing-prototypes]
drivers/scsi/scsi_lib.c:2609:6: warning: no previous prototype for 'scsi_evt_thread' [-Wmissing-prototypes]
In fact, both functions are declared in drivers/scsi/scsi_scan.c but
need to move them into scsi_priv.h.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Trivial fix to spelling mistakes in ql_dbg messages.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Finn Thain [Sat, 27 Aug 2016 02:30:00 +0000 (12:30 +1000)]
scsi: ncr5380: Avoid a compiler warning
With commit 3a0f64bfa907 ("mac_scsi: Fix pseudo DMA implementation")
some versions of gcc now warn:
In file included from drivers/scsi/mac_scsi.c:335:
drivers/scsi/NCR5380.h:295: warning: `NCR5380_poll_politely' declared inline after being called
drivers/scsi/NCR5380.h:295: warning: previous declaration of `NCR5380_poll_politely' was here
Avoid this by defining NCR5380_poll_politely() in NCR5380.h.
[mkp: checkpatch warnings]
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
The driver that used the 'nodisconnect' parameter was removed in commit 565bae6a4a8f ("[SCSI] 53c7xx: kill driver"). Related documentation was
cleaned up in commit f37a7238d379 ("[SCSI] 53c7xx: fix removal
fallout"), except for the remaining two mentions that are removed here.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Jitendra Bhivare [Fri, 26 Aug 2016 09:39:08 +0000 (15:09 +0530)]
scsi: be2iscsi: Add missing unlock for mbox_lock
Julia pointed out beiscsi_boot_get_sinfo does not unlock mbox_lock on
nonemb_cmd memory allocation failure.
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
alloc_wrb_handle already does memset zero of iscsi_wrb descriptor so
remove redundant memset in WRB submission paths.
Add pwrb_handle NULL check before memsett'ing pwrb.
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
We know that 'ret' is not an error code because it has been tested a few
lines above. So, if one of these function fails, 0 will be returned
instead of an error code. Return -ENOMEM instead.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
'ret' needs to be set with error code if hba_setup_cid_tbls fails.
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Paul Burton [Fri, 19 Aug 2016 16:43:57 +0000 (17:43 +0100)]
scsi: sg: Use mult_frac, drop MULDIV macro
The MULDIV macro is essentially a duplicate of the more standard
mult_frac macro. Replace use of MULDIV with mult_frac & drop the
duplication.
Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Paul Burton [Fri, 19 Aug 2016 16:43:56 +0000 (17:43 +0100)]
scsi: sg: Avoid overflow when USER_HZ > HZ
Calculating the maximum timeout that a user can set via the
SG_SET_TIMEOUT ioctl involves multiplying INT_MAX by USER_HZ/HZ. If
USER_HZ is larger than HZ then this results in an overflow when
performed as a 32 bit integer calculation, resulting in compiler
warnings such as the following:
drivers/scsi/sg.c: In function 'sg_ioctl':
drivers/scsi/sg.c:91:67: warning: integer overflow in expression [-Woverflow]
#define MULDIV(X,MUL,DIV) ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))
^
drivers/scsi/sg.c:887:14: note: in expansion of macro 'MULDIV'
if (val >= MULDIV (INT_MAX, USER_HZ, HZ))
^
drivers/scsi/sg.c:91:67: warning: integer overflow in expression [-Woverflow]
#define MULDIV(X,MUL,DIV) ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL))
^
drivers/scsi/sg.c:888:13: note: in expansion of macro 'MULDIV'
val = MULDIV (INT_MAX, USER_HZ, HZ);
^
Avoid this overflow by performing the (constant) arithmetic on 64 bit
integers, which ensures that overflow from multiplying the 32 bit values
cannot occur. When converting the result back to a 32 bit integer use
min_t to ensure that we don't simply truncate a value beyond INT_MAX to
a 32 bit integer, but instead use INT_MAX where the result was larger
than it. As the values are all compile time constant the 64 bit
arithmetic should have no runtime cost.
Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Tyrel Datwyler [Wed, 3 Aug 2016 21:36:53 +0000 (16:36 -0500)]
scsi: ibmvfc: add FC Class 3 Error Recovery support
The ibmvfc driver currently doesn't support FC Class 3 Error Recovery.
However, it is simply a matter of informing the VIOS that the payload
expects to use sequence level error recovery via a bit flag in the
ibmvfc_cmd structure.
This patch adds a module parameter to enable error recovery support at
boot time. When enabled the RETRY service parameter bit is set during
PRLI, and ibmvfc_cmd->flags includes the IBMVFC_CLASS_3_ERR bit.
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Heiner Kallweit [Wed, 3 Aug 2016 19:49:03 +0000 (21:49 +0200)]
scsi: configure runtime pm before calling device_add in scsi_add_host_with_dma
Runtime PM should be configured already once we call device_add. See
also the description in this mail thread
https://lists.linuxfoundation.org/pipermail/linux-pm/2009-November/023198.html
or the order of calls e.g. in usb_new_device.
The changed order also helps to avoid scenarios where runtime pm for
&shost->shost_gendev is activated whilst the parent is suspended,
resulting in error message "runtime PM trying to activate child device
hostx but parent yyy is not active".
In addition properly reverse the runtime pm calls in the error path.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Brian King [Wed, 24 Aug 2016 17:56:51 +0000 (12:56 -0500)]
scsi: ipr: Add asynchronous error notification
This patch implements functions for pushing HCAM (host controlled
asynchronous messages) error buffers to userspace through sysfs
attributes. Reads to the "async_err_log" attribute will result in a
single HCAM buffer being copied to userspace; one can process the next
HCAM buffer by writing any string to the same attribute.
A new list was added to the ioa_cfg structure to store the HCAM buffers
for later reporting. We also send a KOBJ_CHANGE event whenever a new
HCAM buffer is made available to userspace.
Signed-off-by: Heitor Ricardo Alves de Siqueira <halves@linux.vnet.ibm.com> Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:54 +0000 (19:05 +0800)]
scsi: hisi_sas: update version to 1.6
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:53 +0000 (19:05 +0800)]
scsi: hisi_sas: add TMF success check
When a tmf is issued, various response codes can be returned from the
target. For a query tmf the response may be TMF_RESP_FUNC_COMPLETE or
TMF_RESP_FUNC_SUCC. Add a condition for TMF_RESP_FUNC_SUCC to
hisi_sas_exec_internal_tmf_task(). This affects query tmf, as the
result is success the returned value was for failure.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:52 +0000 (19:05 +0800)]
scsi: hisi_sas: fail tmf task prep when port detached
When the port is detached we cannot execute a TMF, as there can be no
device attached to the port.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:51 +0000 (19:05 +0800)]
scsi: hisi_sas: add v2 hw slot complete internal abort support
Add code in slot_complete_v2_hw() to deal with the slots which have
completed due to internal abort.
The status codes have the following meaning:
- STAT_IO_ABORTED: the IO has been aborted due to internal abort,
whether by device or individual abort command
- STAT_IO_COMPLETE: internal abort command has completed successfully
for device or individual abort command
- STAT_IO_NO_DEVICE: internal abort command has completed for device but
cannot find any IO
- STAT_IO_NOT_VALID: internal abort command has completed for single
command but could not find the command
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:50 +0000 (19:05 +0800)]
scsi: hisi_sas: add prep_abort_v2_hw()
Add function to prepare the an internal abort for v2 hw.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:49 +0000 (19:05 +0800)]
scsi: hisi_sas: add internal abort to hisi_sas_abort_task()
Execute an internal abort for executing a task abort.
This is for case of the command still being present
in host when abort is executed.
For a SATA internal abort, we set abort for all tasks
associated with the device.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:48 +0000 (19:05 +0800)]
scsi: hisi_sas: add internal abort in hisi_sas_dev_gone()
Execute an internal abort for that device when it is removed, so that
commands for that device are not processed.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Wed, 24 Aug 2016 11:05:47 +0000 (19:05 +0800)]
scsi: hisi_sas: add internal abort main code
Add main code for internal abort functionality.
The internal abort features allows the host controller to abort commands
which are still active in the controller but have not yet been sent to
the slave device.
Typically a command only spends a relatively short time in the
controller when compared to the amount of the time after it is sent to
the slave device.
Two modes of internal abort are supported:
- device
- individual command
For device, when the internal abort is issued all commands in the host
for that device are aborted. For a single command, only that command is
aborted if it is still in the host.
In HW the internal abort command is executed similar to any other sort
of command, like SSP.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
req_table is allocate by kzalloc, so we don't need to zero it again.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Bradley Grove <bgrove@attotech.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Shawn Lin [Sun, 21 Aug 2016 02:33:29 +0000 (10:33 +0800)]
scsi: esas2r: not need to alloc zero buffer for local_atto_ioctl
We don't need to use kzalloc as we will always memset the
local_atto_ioctl later.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Bradley Grove <bgrove@attotech.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Markus Elfring [Sun, 21 Aug 2016 08:39:04 +0000 (10:39 +0200)]
scsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation
Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Jitendra Bhivare [Fri, 19 Aug 2016 09:50:26 +0000 (15:20 +0530)]
MAINTAINERS: Update be2iscsi contact info
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>