GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
10 years agoufs: add UFS power management support
Subhash Jadavani [Thu, 25 Sep 2014 12:32:30 +0000 (15:32 +0300)]
ufs: add UFS power management support

This patch adds support for UFS device and UniPro link power management
during runtime/system PM.

Main idea is to define multiple UFS low power levels based on UFS device
and UFS link power states. This would allow any specific platform or pci
driver to choose the best suited low power level during runtime and
system suspend based on their power goals.

bkops handlig:
To put the UFS device in sleep state when bkops is disabled, first query
the bkops status from the device and enable bkops on device only if
device needs time to perform the bkops.

START_STOP handling:
Before sending START_STOP_UNIT to the device well-known logical unit
(w-lun) to make sure that the device w-lun unit attention condition is
cleared.

Write protection:
UFS device specification allows LUs to be write protected, either
permanently or power on write protected. If any LU is power on write
protected and if the card is power cycled (by powering off VCCQ and/or
VCC rails), LU's write protect status would be lost. So this means those
LUs can be written now. To ensures that UFS device is power cycled only
if the power on protect is not set for any of the LUs, check if power on
write protect is set and if device is in sleep/power-off state & link in
inactive state (Hibern8 or OFF state).
If none of the Logical Units on UFS device is power on write protected
then all UFS device power rails (VCC, VCCQ & VCCQ2) can be turned off if
UFS device is in power-off state and UFS link is in OFF state. But current
implementation would disable all device power rails even if UFS link is
not in OFF state.

Low power mode:
If UFS link is in OFF state then UFS host controller can be power collapsed
to avoid leakage current from it. Note that if UFS host controller is power
collapsed, full UFS reinitialization will be required on resume to
re-establish the link between host and device.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: introduce well known logical unit in ufs
Subhash Jadavani [Thu, 25 Sep 2014 12:32:29 +0000 (15:32 +0300)]
ufs: introduce well known logical unit in ufs

UFS device may have standard LUs and LUN id could be from 0x00 to 0x7F.
UFS device specification use "Peripheral Device Addressing Format"
(SCSI SAM-5) for standard LUs.

UFS device may also have the Well Known LUs (also referred as W-LU) which
again could be from 0x00 to 0x7F. For W-LUs, UFS device specification only
allows the "Extended Addressing Format" (SCSI SAM-5) which means the W-LUNs
would start from 0xC100 onwards.

This means max. LUN number reported from UFS device could be 0xC17F hence
this patch advertise the "max_lun" as 0xC17F which will allow SCSI mid
layer to detect the W-LUs as well.

But once the W-LUs are detected, UFSHCD driver may get the commands with
SCSI LUN id upto 0xC17F but UPIU LUN id field is only 8-bit wide so it
requires the mapping of SCSI LUN id to UPIU LUN id. This patch also add
support for this mapping.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: manually add well known logical units
Subhash Jadavani [Thu, 25 Sep 2014 12:32:28 +0000 (15:32 +0300)]
ufs: manually add well known logical units

UFS device specification requires the UFS devices to support 4 well known
logical units:
"REPORT_LUNS" (address: 01h)
"UFS Device" (address: 50h)
"RPMB" (address: 44h)
"BOOT" (address: 30h)

UFS device's power management needs to be controlled by "POWER CONDITION"
field of SSU (START STOP UNIT) command. But this "power condition" field
will take effect only when its sent to "UFS device" well known logical unit
hence we require the scsi_device instance to represent this logical unit in
order for the UFS host driver to send the SSU command for power management.

We also require the scsi_device instance for "RPMB" (Replay Protected
Memory Block) LU so user space process can control this LU. User space may
also want to have access to BOOT LU.

This patch adds the scsi device instances for each of all well known LUs
(except "REPORT LUNS" LU).

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: Active Power Mode - configuring bActiveICCLevel
Yaniv Gardi [Thu, 25 Sep 2014 12:32:27 +0000 (15:32 +0300)]
ufs: Active Power Mode - configuring bActiveICCLevel

The maximum power consumption in active is determined by bActiveICCLevel.
The configuration is done by reading max current supported by the
regulators connected to VCC, VCCQ and VCCQ2 rails on the boards, and
reading the current consumption levels from the device for each rails
(vcc/vccq/vccq2) using power descriptor.
We configure the bActiveICCLevel attribute, with the max value that
correspond to the minimum-of(VCC-current-level,VCCQ-current-level,
VCCQ2-current-level).
In order to minimize resume latency, pre-fetch icc levels and reference
clock during initialization and avoid reading them each link startup
during resume.

Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: improve init sequence
Sujit Reddy Thumma [Thu, 25 Sep 2014 12:32:26 +0000 (15:32 +0300)]
ufs: improve init sequence

In ->hce_enable_notify() callback the vendor specific initialization
may carry out additional DME configuration using UIC commands and
hence the UIC command completion interrupt enable bit should be set
before the post reset notification.
Add retries if the link-startup fails. This is required since due to
hardware timing issues, the Uni-Pro link-startup might fail. The UFS
HCI recovery procedure contradicts the Uni-Pro sequence. The UFS HCI
specifies to resend DME_LINKSTARTUP command after IS.ULLS (link-lost
interrupt) is received. The Uni-Pro specifies that if link-startup
fails the link is in "down" state. The link-lost is indicated to the
DME user only when the link is up. Hence, the UFS HCI recovery procedure
of waiting for IS.ULLS and retrying link-startup may not work properly.

At the end, if detection fails, power off (disable clocks, regulators,
phy) if the UFS device detection fails. This saves power while UFS device
is not embedded into the system.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: refactor query descriptor API support
Subhash Jadavani [Thu, 25 Sep 2014 12:32:25 +0000 (15:32 +0300)]
ufs: refactor query descriptor API support

Currently reading query descriptor is more tightened to each
descriptor type. This patch generalize the approach and allows
reading any parameter from any query descriptor.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: add voting support for host controller power
Raviv Shvili [Thu, 25 Sep 2014 12:32:24 +0000 (15:32 +0300)]
ufs: add voting support for host controller power

Add the support for voting of the regulator powering the
host controller logic.

Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: Add clock initialization support
Sujit Reddy Thumma [Thu, 25 Sep 2014 12:32:23 +0000 (15:32 +0300)]
ufs: Add clock initialization support

Add generic clock initialization support for UFSHCD platform
driver. The clock info is read from device tree using standard
clock bindings. A generic max-clock-frequency-hz property is
defined to save information on maximum operating clock frequency
the h/w supports.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: Add regulator enable support
Sujit Reddy Thumma [Thu, 25 Sep 2014 12:32:22 +0000 (15:32 +0300)]
ufs: Add regulator enable support

UFS devices are powered by at most three external power supplies -
- VCC - The flash memory core power supply, 2.7V to 3.6V or 1.70V to 1.95V
- VCCQ - The controller and I/O power supply, 1.1V to 1.3V
- VCCQ2 - Secondary controller and/or I/O power supply, 1.65V to 1.95V

For some devices VCCQ or VCCQ2 are optional as they can be
generated using internal LDO inside the UFS device.

Add DT bindings for voltage regulators that can be controlled
from host driver.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoufs: Allow vendor specific initialization
Sujit Reddy Thumma [Thu, 25 Sep 2014 12:32:21 +0000 (15:32 +0300)]
ufs: Allow vendor specific initialization

Some vendor specific controller versions might need to configure
vendor specific - registers, clocks, voltage regulators etc. to
initialize the host controller UTP layer and Uni-Pro stack.
Provide some common initialization operations that can be used
to configure vendor specifics. The methods can be extended in
future, for example, for power mode transitions.

The operations are vendor/board specific and hence determined with
the help of compatible property in device tree.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoscsi: don't add scsi_device if its already visible
Subhash Jadavani [Thu, 25 Sep 2014 12:32:20 +0000 (15:32 +0300)]
scsi: don't add scsi_device if its already visible

If LLD has added scsi device (by calling scsi_add_device) before scheduling
async scsi_scan_host then scsi_finish_async_scan() will end up calling
scsi_sysfs_add_sdev for scsi device which was already added by LLD.
This patch fixes this issue by skipping the call to scsi_sysfs_add_sdev()
if it's already visible to rest of the kernel.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoscsi: fix the type for well known LUs
Subhash Jadavani [Thu, 25 Sep 2014 12:32:19 +0000 (15:32 +0300)]
scsi: fix the type for well known LUs

Some devices may respond with wrong type for well-known logical units.
This patch forces well-known type for devices which doesn't report it
correct.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoscsi_debug: deadlock between completions and surprise module removal
Douglas Gilbert [Sun, 31 Aug 2014 23:09:59 +0000 (19:09 -0400)]
scsi_debug: deadlock between completions and surprise module removal

A deadlock has been reported when the completion
of SCSI commands (simulated by a timer) was surprised
by a module removal. This patch removes one half of
the offending locks around timer deletions. This fix
is applied both to stop_all_queued() which is were
the deadlock was discovered and stop_queued_cmnd()
which has very similar logic.

This patch should be applied both to the lk 3.17 tree
and Christoph's drivers-for-3.18 tree.

Tested-and-reported-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agobe2iscsi: check ip buffer before copying
Mike Christie [Mon, 29 Sep 2014 18:55:41 +0000 (13:55 -0500)]
be2iscsi: check ip buffer before copying

Dan Carpenter found a issue where be2iscsi would copy the ip
from userspace to the driver buffer before checking the len
of the data being copied:
http://marc.info/?l=linux-scsi&m=140982651504251&w=2

This patch just has us only copy what we the driver buffer
can support.

Cc: <stable@vger.kernel.org>
Tested-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoiscsi_tcp: export port being used
Mike Christie [Mon, 29 Sep 2014 18:55:42 +0000 (13:55 -0500)]
iscsi_tcp: export port being used

This just has iscsi_tcp support ISCSI_PARAM_LOCAL_PORT which
exports the local port being used by the iscsi connection.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agobe2iscsi : Bump the driver version
John Soni Jose [Fri, 26 Sep 2014 19:14:16 +0000 (15:14 -0400)]
be2iscsi : Bump the driver version

 Bump the driver version

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agobe2iscsi : Fix kernel panic during reboot/shutdown
John Soni Jose [Fri, 26 Sep 2014 19:13:55 +0000 (15:13 -0400)]
be2iscsi : Fix kernel panic during reboot/shutdown

 In the reboot/shutdown path, workqueue was destroyed after the
 adapter resource were freed. The task associated with workqueue
 was getting executed after resources were freed. This lead to
 kernel panic.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agolibfc: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Andreea-Cristina Bernat [Mon, 18 Aug 2014 14:56:22 +0000 (17:56 +0300)]
libfc: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

The uses of "rcu_assign_pointer()" are NULLing out the pointers.
According to RCU_INIT_POINTER()'s block comment:
"1.   This use of RCU_INIT_POINTER() is NULLing out the pointer"
it is better to use it instead of rcu_assign_pointer() because it has a
smaller overhead.

The following Coccinelle semantic patch was used:
@@
@@

- rcu_assign_pointer
+ RCU_INIT_POINTER
  (..., NULL)

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Acked-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agofcoe: extend ethtool to FC port speed mapping
Chris Leech [Thu, 25 Sep 2014 18:55:42 +0000 (11:55 -0700)]
fcoe: extend ethtool to FC port speed mapping

add support for 20 Gbit and 40 Gbit links

Signed-off-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoipr: fix compile failure
Christoph Hellwig [Fri, 26 Sep 2014 07:49:02 +0000 (09:49 +0200)]
ipr: fix compile failure

Fix a typo in the IPR_IOASC_HW_CMD_FAILED declaration.  Based on a patch
from Wen Xiong <wenxiong@linux.vnet.ibm.com>.

Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add memory barrier before ringing doorbell.
Himanshu Madhani [Thu, 25 Sep 2014 10:14:59 +0000 (06:14 -0400)]
qla2xxx: Add memory barrier before ringing doorbell.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add flags for tracing the target commands.
Saurav Kashyap [Thu, 25 Sep 2014 10:14:58 +0000 (06:14 -0400)]
qla2xxx: Add flags for tracing the target commands.

Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Fix hang due to cmd_kref not decrementing
Quinn Tran [Thu, 25 Sep 2014 10:14:57 +0000 (06:14 -0400)]
qla2xxx: Fix hang due to cmd_kref not decrementing

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Do not send SS_RESIDUAL_UNDER with SAM_STAT_BUSY
Himanshu Madhani [Thu, 25 Sep 2014 10:14:56 +0000 (06:14 -0400)]
qla2xxx: Do not send SS_RESIDUAL_UNDER with SAM_STAT_BUSY

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add support for QFull throttling and Term Exchange retry
Quinn Tran [Thu, 25 Sep 2014 10:14:55 +0000 (06:14 -0400)]
qla2xxx: Add support for QFull throttling and Term Exchange retry

Through the qla target code, the qlt_send_term_exchange() routine
is used in various different places to cleanup an exchange. For the
case of IOCB request queue is full, the exchange is left unhandled/
dangling. Existing code does not have re-try logic to cleanup the
exchange. This patch add retry logic to cleanup the exchange before
letting new commands through.

For the case of FW running out of exchanges, driver need to reply
SAM_STAT_BUSY to the initiators. This patch add a pending queue
for the busy reply in case IOCB queue is unable to handle the cmd.

Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Increase the request queue size to 8K for ISP2031
Saurav Kashyap [Thu, 25 Sep 2014 10:14:54 +0000 (06:14 -0400)]
qla2xxx: Increase the request queue size to 8K for ISP2031

Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Host reset handling in ABTS path.
Arun Easi [Thu, 25 Sep 2014 10:14:53 +0000 (06:14 -0400)]
qla2xxx: Host reset handling in ABTS path.

ABTS path takes path similar to regular task management, but
reset_count was not initialized when allocating mcmd causing
the response to get dropped in qlt_xmit_tm_rsp. Fix this by
initializing reset_count correctly.

Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Handle chip reset in target mode.
Arun Easi [Thu, 25 Sep 2014 10:14:52 +0000 (06:14 -0400)]
qla2xxx: Handle chip reset in target mode.

A chip reset can occur after driver submits command to the stack. Abort
command processing if a chip reset has occurred or in progress when you
get a follow up for a command.

Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add Host reset handling in target mode.
Arun Easi [Thu, 25 Sep 2014 10:14:51 +0000 (06:14 -0400)]
qla2xxx: Add Host reset handling in target mode.

Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: fix crash due to task mgmt cmd type
Himanshu Madhani [Thu, 25 Sep 2014 10:14:50 +0000 (06:14 -0400)]
qla2xxx: fix crash due to task mgmt cmd type

tcm_qla2xxx_get_task_tag incorrectly assume command is
qla_tgt_cmd.  Add check to see if it's a scsi cmd or
task mgmt command.

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add counter for message
Saurav Kashyap [Thu, 25 Sep 2014 10:14:49 +0000 (06:14 -0400)]
qla2xxx: Add counter for message

Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Enable SLER conditionally in target mode.
Arun Easi [Thu, 25 Sep 2014 10:14:48 +0000 (06:14 -0400)]
qla2xxx: Enable SLER conditionally in target mode.

Sequence level error recovery (aka FC Tape) is not really required
for disk devices. On heavily loaded system, with slow turn around,
a bunch of status enquiries using REC puts additional burden to the
target, so just turn off SLER by default.

Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Remove verbose messages in target mode.
Arun Easi [Thu, 25 Sep 2014 10:14:47 +0000 (06:14 -0400)]
qla2xxx: Remove verbose messages in target mode.

Turning logging bits for target mode ON dumps quite a lot verbose
messages, remove those and change some of the IO path logging to
use IO bits.

Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Increase room in request queue for sending priority packets
Himanshu Madhani [Thu, 25 Sep 2014 10:14:46 +0000 (06:14 -0400)]
qla2xxx: Increase room in request queue for sending priority packets

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Use correct offset to req-q-out for reserve calculation
Arun Easi [Thu, 25 Sep 2014 10:14:45 +0000 (06:14 -0400)]
qla2xxx: Use correct offset to req-q-out for reserve calculation

Cc: <stable@vger.kernel.org>
Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: fix kernel NULL pointer access
Himanshu Madhani [Thu, 25 Sep 2014 10:14:44 +0000 (06:14 -0400)]
qla2xxx: fix kernel NULL pointer access

This patch is to fix regression added by commit id
51a07f84649d2be206c4c2ad9a612956db0c2f8c.

When allocating memory for new session original patch does
not assign vha to op->vha resulting into NULL pointer
access during qlt_create_sess_from_atio().

Cc: <stable@vger.kernel.org>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Fix sparse warnings in tcm_qla2xxx.c
Himanshu Madhani [Thu, 25 Sep 2014 10:14:43 +0000 (06:14 -0400)]
qla2xxx: Fix sparse warnings in tcm_qla2xxx.c

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Update the driver version to 8.07.00.16-k.
Saurav Kashyap [Thu, 25 Sep 2014 09:17:06 +0000 (05:17 -0400)]
qla2xxx: Update the driver version to 8.07.00.16-k.

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Fix sparse warning in qla_iocb.c file.
Joe Carnuccio [Thu, 25 Sep 2014 09:17:05 +0000 (05:17 -0400)]
qla2xxx: Fix sparse warning in qla_iocb.c file.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Move warning message to debug level.
Sawan Chandak [Thu, 25 Sep 2014 09:17:04 +0000 (05:17 -0400)]
qla2xxx: Move warning message to debug level.

Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Fail adapter initialization on load ram failure.
Chad Dupuis [Thu, 25 Sep 2014 09:17:03 +0000 (05:17 -0400)]
qla2xxx: Fail adapter initialization on load ram failure.

If we fail to load one of the segments of firmware fail the operation
instead of trying to continue which will lead to a system crash since
the pointers to the next segment will not be updated correctly.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Disable PCI device in shutdown handler.
Chad Dupuis [Thu, 25 Sep 2014 09:17:02 +0000 (05:17 -0400)]
qla2xxx: Disable PCI device in shutdown handler.

Disable the PCI device during shutdown to prevent any races with
other PCI code such as the AER handling code.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Mark port lost when we receive an RSCN for it.
Chad Dupuis [Thu, 25 Sep 2014 09:17:01 +0000 (05:17 -0400)]
qla2xxx: Mark port lost when we receive an RSCN for it.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Restore WWPN in case of Loop Dead.
Himanshu Madhani [Thu, 25 Sep 2014 09:17:00 +0000 (05:17 -0400)]
qla2xxx: Restore WWPN in case of Loop Dead.

For FA-WWPN capable device, ISP2031 and ISP27XX, when loop
dead is detected by a driver, restore WWPN from NVRAM.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Honor FCP_RSP retry delay timer field.
Chad Dupuis [Thu, 25 Sep 2014 09:16:59 +0000 (05:16 -0400)]
qla2xxx: Honor FCP_RSP retry delay timer field.

Parse the retry delay timer field from the FCP response data and if:

- It is not zero
- The SCSI status is busy or queue full

return SCSI_MLQUEUE_TARGET_BUSY for the number of milliseconds specified
in the retry delay timer field.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add missing ISP27xx checks to optrom code.
Alex Vechersky [Thu, 25 Sep 2014 09:16:58 +0000 (05:16 -0400)]
qla2xxx: Add missing ISP27xx checks to optrom code.

Signed-off-by: Alex Vechersky <alex.vechersky@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Force use of mailbox interface for flash access commands for ISP27xx.
Chad Dupuis [Thu, 25 Sep 2014 09:16:57 +0000 (05:16 -0400)]
qla2xxx: Force use of mailbox interface for flash access commands for ISP27xx.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Free sysfs attributes for ISP27xx.
Nigel Kirkland [Thu, 25 Sep 2014 09:16:56 +0000 (05:16 -0400)]
qla2xxx: Free sysfs attributes for ISP27xx.

Signed-off-by: Nigel Kirkland <nigel.kirkland@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Disable laser for ISP2031 while unloading driver.
Himanshu Madhani [Thu, 25 Sep 2014 09:16:55 +0000 (05:16 -0400)]
qla2xxx: Disable laser for ISP2031 while unloading driver.

Nameserver data on FC switch is not refreshed when
qla2xxx driver is unloaded. Disabling laser for
ISP2031 will force FC switch to rescan ports and
clear fdmi entries from Nameserver.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Enable diagnostic port using NVRAM parameters.
Himanshu Madhani [Thu, 25 Sep 2014 09:16:54 +0000 (05:16 -0400)]
qla2xxx: Enable diagnostic port using NVRAM parameters.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Declaration error cause stack corruption.
Quinn Tran [Thu, 25 Sep 2014 09:16:53 +0000 (05:16 -0400)]
qla2xxx: Declaration error cause stack corruption.

Declaration error of mb array in qla2x00_iidma_fcport cause data
to be written beyond the array. This ends up causing stack corruption.

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add fix in driver unload for pending activity.
Sawan Chandak [Thu, 25 Sep 2014 09:16:52 +0000 (05:16 -0400)]
qla2xxx: Add fix in driver unload for pending activity.

Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Unload of qla2xxx driver crashes the machine.
Arun Easi [Thu, 25 Sep 2014 09:16:51 +0000 (05:16 -0400)]
qla2xxx: Unload of qla2xxx driver crashes the machine.

Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Allow user to change ql2xfdmienable value.
Himanshu Madhani [Thu, 25 Sep 2014 09:16:50 +0000 (05:16 -0400)]
qla2xxx: Allow user to change ql2xfdmienable value.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Fix driver version string message.
Himanshu Madhani [Thu, 25 Sep 2014 09:16:49 +0000 (05:16 -0400)]
qla2xxx: Fix driver version string message.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add diagnostic port functionality.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:48 +0000 (05:16 -0400)]
qla2xxx: Add diagnostic port functionality.

Add support for the D-port (diagnostic port) fabric switch feature.

(Fabric Switch initiates loopback style port testing)

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add FA-WWN functionality.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:47 +0000 (05:16 -0400)]
qla2xxx: Add FA-WWN functionality.

Add support for the FA-WWN (fabric assigned wwn) fabric switch feature.

(Fabric Assigned World Wide Port Name)

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add FDMI-2 functionality.
Himanshu Madhani [Thu, 25 Sep 2014 09:16:46 +0000 (05:16 -0400)]
qla2xxx: Add FDMI-2 functionality.

Add support for the FDMI-2 fabric switch feature.

Since FDMI-2 uses code from FDMI-1, some of the existing code
needed to be repaired to prevent fields from being overflowed.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISPFx00 unexpected resets during adapter boot sequence.
Jan Kulich [Thu, 25 Sep 2014 09:16:45 +0000 (05:16 -0400)]
qla2xxx: ISPFx00 unexpected resets during adapter boot sequence.

Signed-off-by: Jan Kulich <jan.kulich@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Incorrect linked list semantic in qlafx00_get_fcport().
Joe Carnuccio [Thu, 25 Sep 2014 09:16:44 +0000 (05:16 -0400)]
qla2xxx: Incorrect linked list semantic in qlafx00_get_fcport().

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Incorrect debug level on mailbox command print 0x1111.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:43 +0000 (05:16 -0400)]
qla2xxx: Incorrect debug level on mailbox command print 0x1111.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISPFX00 avoid writing semaphore register in request_irqs().
Joe Carnuccio [Thu, 25 Sep 2014 09:16:42 +0000 (05:16 -0400)]
qla2xxx: ISPFX00 avoid writing semaphore register in request_irqs().

Semaphore register does not exist for ISPFx00.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Fix potential return count bug in qla2xxx_get_vpd_field().
Joe Carnuccio [Thu, 25 Sep 2014 09:16:41 +0000 (05:16 -0400)]
qla2xxx: Fix potential return count bug in qla2xxx_get_vpd_field().

Call scnprintf() instead of snprintf() since the latter may return
an incorrect count in cases where the write is truncated to fit.

scnprintf() returns the count of what was actually written;
snprintf() returns the count of what would have been written.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISP27xx fwdump template error print simplification.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:40 +0000 (05:16 -0400)]
qla2xxx: ISP27xx fwdump template error print simplification.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISP25xx multiqueue shadow register crash fix.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:39 +0000 (05:16 -0400)]
qla2xxx: ISP25xx multiqueue shadow register crash fix.

When creating request/response queues from qla25xx_setup_mode(),
the shadow index register pointers were not being initialized
to point at the registers.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add endianizer to max_payload_size modifier.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:38 +0000 (05:16 -0400)]
qla2xxx: Add endianizer to max_payload_size modifier.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Enable fast flash access for ISP83xx.
Chad Dupuis [Thu, 25 Sep 2014 09:16:37 +0000 (05:16 -0400)]
qla2xxx: Enable fast flash access for ISP83xx.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: Add ISP27xx fwdump template entry T275 (insert buffer).
Joe Carnuccio [Thu, 25 Sep 2014 09:16:36 +0000 (05:16 -0400)]
qla2xxx: Add ISP27xx fwdump template entry T275 (insert buffer).

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISP27xx fwdump template fix insertbuf() routine.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:35 +0000 (05:16 -0400)]
qla2xxx: ISP27xx fwdump template fix insertbuf() routine.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISP27xx fwdump template remove high frequency debug logs.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:34 +0000 (05:16 -0400)]
qla2xxx: ISP27xx fwdump template remove high frequency debug logs.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISP27xx optimize fwdump entry table lookup.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:33 +0000 (05:16 -0400)]
qla2xxx: ISP27xx optimize fwdump entry table lookup.

Since the entry call array is sorted in order of entry type opcode,
the search can be terminated as soon as the search key is exceeded.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoqla2xxx: ISP27xx add tests for incomplete template.
Joe Carnuccio [Thu, 25 Sep 2014 09:16:32 +0000 (05:16 -0400)]
qla2xxx: ISP27xx add tests for incomplete template.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agomptfusion: enable no_write_same for vmware scsi disks
Chris J Arges [Tue, 23 Sep 2014 14:22:25 +0000 (09:22 -0500)]
mptfusion: enable no_write_same for vmware scsi disks

When using a virtual SCSI disk in a VMWare VM if blkdev_issue_zeroout is used
data can be improperly zeroed out using the mptfusion driver. This patch
disables write_same for this driver and the vmware subsystem_vendor which
ensures that manual zeroing out is used instead.

Cc: stable@vger.kernel.org
BugLink: http://bugs.launchpad.net/bugs/1371591
Reported-by: Bruce Lucas <bruce.lucas@mongodb.com>
Tested-by: Chris J Arges <chris.j.arges@canonical.com>
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agohpsa: add missing pci_set_master in kdump path
Tomas Henzl [Fri, 12 Sep 2014 12:44:15 +0000 (14:44 +0200)]
hpsa: add missing pci_set_master in kdump path

Add a call to pci_set_master(...)  missing in the previous
patch "hpsa: refine the pci enable/disable handling".
Found thanks to Rob Elliot.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Robert Elliott <elliott@hp.com>
Tested-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: simplify ioctl data read/write
Ching Huang [Wed, 24 Sep 2014 09:33:34 +0000 (17:33 +0800)]
arcmsr: simplify ioctl data read/write

Signed-off-by: Ching Huang <ching 2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoipr: don't log error messages when applications issues illegal requests
wenxiong@linux.vnet.ibm.com [Wed, 24 Sep 2014 21:25:47 +0000 (16:25 -0500)]
ipr: don't log error messages when applications issues illegal requests

Failing Device information are logged when IOA firmware detected these
illegal request such as IOA firmware doesn't support inquiry with page
code 2. The patch fixes the issue.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Tested-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agocxgb4i: avoid holding mutex in interrupt context
Anish Bhatt [Tue, 16 Sep 2014 00:44:18 +0000 (17:44 -0700)]
cxgb4i: avoid holding mutex in interrupt context

cxgbi_inet6addr_handler() can be called in interrupt context, so use rcu
protected list while finding netdev

Applies on top of core-for-3.18

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Karen Xie <kxie@chelsio.com>
Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
Fixes: 759a0cc5a3e1 ("cxgb4i: Add ipv6 code to driver, call into libcxgbi ipv6
api")
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agostorvsc: get rid of overly verbose warning messages
K. Y. Srinivasan [Tue, 2 Sep 2014 23:43:16 +0000 (16:43 -0700)]
storvsc: get rid of overly verbose warning messages

Get rid of the warning messages since they will clutter up various system logs
and are of questionable value to the end user. For debugging purposes, this
information can be gotten by setting the scsi log level appropriately.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agompt2sas: fix undefined reference to `__udivdi3' compilation errors
Sreekanth Reddy [Fri, 19 Sep 2014 06:47:27 +0000 (12:17 +0530)]
mpt2sas: fix undefined reference to `__udivdi3' compilation errors

This patch will fix the below compilation errors on i386 ARCH

drivers/built-in.o: In function `_scsih_qcmd':
mpt2sas_scsih.c:(.text+0x1e7b56): undefined reference to `__udivdi3'
mpt2sas_scsih.c:(.text+0x1e7b8a): undefined reference to `__umoddi3'

Used sector_div() API to fix above compilation errors.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: simplify of updating doneq_index and postq_index
Ching Huang [Mon, 15 Sep 2014 11:05:33 +0000 (19:05 +0800)]
arcmsr: simplify of updating doneq_index and postq_index

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: call scsi_scan_host at the end of host initialization
Ching Huang [Tue, 19 Aug 2014 07:28:36 +0000 (15:28 +0800)]
arcmsr: call scsi_scan_host at the end of host initialization

Call scsi_scan_host at the end of host initialization and fix and error path
to free allocated resource.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: add support new adapter ARC12x4 series
Ching Huang [Tue, 19 Aug 2014 07:25:22 +0000 (15:25 +0800)]
arcmsr: add support new adapter ARC12x4 series

Add code to support the new Areca Raid ARC12x4 series adapters.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: modify some character strings
Ching Huang [Tue, 19 Aug 2014 07:22:45 +0000 (15:22 +0800)]
arcmsr: modify some character strings

Revise comment and some character strings.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: fix sparse warnings and errors
Ching Huang [Tue, 19 Aug 2014 07:20:31 +0000 (15:20 +0800)]
arcmsr: fix sparse warnings and errors

Fix sparse utility checking errors and warnings.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: fix ioctl data read/write error for adapter type C
Ching Huang [Tue, 19 Aug 2014 07:17:45 +0000 (15:17 +0800)]
arcmsr: fix ioctl data read/write error for adapter type C

Rewrite ioctl entry and its relate function.  This patch fix ioctl data
read/write error and change data I/O access from byte to Dword.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: revise allocation of second dma_coherent_handle for type B
Ching Huang [Tue, 19 Aug 2014 07:14:14 +0000 (15:14 +0800)]
arcmsr: revise allocation of second dma_coherent_handle for type B

This modification is for consistency with upcoming adapter type D.
Both adapter type B and D have similar H/W and S/W structure.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: rename functions and variables
Ching Huang [Tue, 19 Aug 2014 07:10:12 +0000 (15:10 +0800)]
arcmsr: rename functions and variables

Rename some variable and function names for readability and consistency.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: clear outbound doorbell buffer completely
Ching Huang [Tue, 19 Aug 2014 07:07:35 +0000 (15:07 +0800)]
arcmsr: clear outbound doorbell buffer completely

Clear outbound doorbell buffer completely for adapter type C.  This is to
prevent getting bad data input from IOP before ioctl command processing
starts.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: modify printing adapter model number and F/W messages
Ching Huang [Tue, 19 Aug 2014 07:03:55 +0000 (15:03 +0800)]
arcmsr: modify printing adapter model number and F/W messages

Adjust printing order of adapter model name and firmware version.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: remove calling arcmsr_hbb_enable_driver_mode
Ching Huang [Tue, 19 Aug 2014 07:01:28 +0000 (15:01 +0800)]
arcmsr: remove calling arcmsr_hbb_enable_driver_mode

Remove calling arcmsr_hbb_enable_driver_mode by in-lining the code into
the caller.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: revise message_isr_bh_fn to remove duplicate code
Ching Huang [Tue, 19 Aug 2014 06:59:00 +0000 (14:59 +0800)]
arcmsr: revise message_isr_bh_fn to remove duplicate code

Revise message_isr_bh_fn to remove the duplicate code for each adapter type.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: store adapter type in PCI id table
Ching Huang [Tue, 19 Aug 2014 06:55:57 +0000 (14:55 +0800)]
arcmsr: store adapter type in PCI id table

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: return status of abort command
Ching Huang [Tue, 19 Aug 2014 06:47:16 +0000 (14:47 +0800)]
arcmsr: return status of abort command

This patch fixes the wrong return status of abort command.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: limit max. number of SCSI command request
Ching Huang [Tue, 19 Aug 2014 06:29:41 +0000 (14:29 +0800)]
arcmsr: limit max. number of SCSI command request

This patch limits the max. number of SCSI commmand request to avoid command
overflow.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: add code to support hibernation
Ching Huang [Tue, 19 Aug 2014 06:26:09 +0000 (14:26 +0800)]
arcmsr: add code to support hibernation

This patch adds code to support system hibernation.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: add code to support MSI-X and MSI interrupt
Ching Huang [Tue, 19 Aug 2014 06:23:31 +0000 (14:23 +0800)]
arcmsr: add code to support MSI-X and MSI interrupt

This patch adds code to support MSI and MSI-X interrupt.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agoarcmsr: fix command timeout under heavy load
Ching Huang [Tue, 19 Aug 2014 06:18:24 +0000 (14:18 +0800)]
arcmsr: fix command timeout under heavy load

This patch rewrites the interrupt service routine relate function to fix
a command timeout under heavy controller load.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agomegaraid_sas : Driver version update
Sumit.Saxena@avagotech.com [Fri, 12 Sep 2014 13:28:03 +0000 (18:58 +0530)]
megaraid_sas : Driver version update

Resending the patch. Addressed the review comments by Tomas Henzl.

Driver version upgrade patch.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agomegaraid_sas : MFI MPT linked list corruption fix
Sumit.Saxena@avagotech.com [Fri, 12 Sep 2014 13:27:58 +0000 (18:57 +0530)]
megaraid_sas : MFI MPT linked list corruption fix

Resending the patch. Addressed the review comments from Tomas Henzl.
Added comment for to-do work.

Problem statement:
MFI link list in megaraid_sas driver is used from mfi-mpt pass-through commands.
This list can be corrupted due to many possible race conditions in driver and
eventually we may see kernel panic.

One example -
MFI frame is freed from calling process as driver send command via polling method and interrupt
for that command comes after driver free mfi frame (actually even after some other context reuse
the mfi frame). When driver receive MPT frame in ISR, driver will be using the index of MFI and
access that MFI frame and finally in-used MFI frame’s list will be corrupted.

High level description of new solution -
Free MFI and MPT command from same context.
Free both the command either from process (from where mfi-mpt pass-through was called) or from
ISR context. Do not split freeing of MFI and MPT, because it creates the race condition which
will do MFI/MPT list corruption.

Renamed the cmd_pool_lock which is used in instance as well as fusion with below name.
mfi_pool_lock and mpt_pool_lock to add more code readability.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
10 years agomegaraid_sas : N-drive primary raid level 1 load balancing
Sumit.Saxena@avagotech.com [Fri, 12 Sep 2014 13:27:53 +0000 (18:57 +0530)]
megaraid_sas : N-drive primary raid level 1 load balancing

Resending the patch. Addressed the review comments from Tomas Henzl.

Current driver does fast path read load balancing between arm and mirror disk
for two Drive Raid-1 configuration only.

Now, Driver support fast path read load balancing for all (any number of disk) Raid-1 configuration.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>