]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
9 years agoqla2xxx: Fix indentation
Bart Van Assche [Thu, 4 Jun 2015 22:58:09 +0000 (15:58 -0700)]
qla2xxx: Fix indentation

Detected by smatch.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Comment out unreachable code
Bart Van Assche [Thu, 4 Jun 2015 22:57:20 +0000 (15:57 -0700)]
qla2xxx: Comment out unreachable code

Comment out the code that is never reached in qla83xx_idc_unlock()
and also in qlt_set_data_offset() to avoid that static source code
analysis tools report warnings for this code.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Acked-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agofusion: remove dead MTRR code
Luis R. Rodriguez [Tue, 21 Apr 2015 20:46:06 +0000 (13:46 -0700)]
fusion: remove dead MTRR code

If and when this gets enabled the driver could should split
up IO memory space properly and that is quite a bit of work.
Just remove the uncommented dead MTRR code then.

There are a few motivations for this:

a) Take advantage of PAT when available

b) Help bury MTRR code away, MTRR is architecture specific and on
   x86 its replaced by PAT

c) Help with the goal of eventually using _PAGE_CACHE_UC over
   _PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (see commit
   de33c442e titled "x86 PAT: fix performance drop for glx,
   use UC minus for ioremap(), ioremap_nocache() and
   pci_mmap_page_range()")

Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Sreekanth Reddy <ureekanth.reddy@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoadvansys: fix compilation errors and warnings when CONFIG_PCI is not set
Johannes Thumshirn [Wed, 3 Jun 2015 07:56:42 +0000 (09:56 +0200)]
advansys: fix compilation errors and warnings when CONFIG_PCI is not set

Fix compilation errors on forgotten #include <linux/dmapool.h> and warnings when
CONFIG_PCI is not set.

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agomptsas: fix depth param in scsi_track_queue_full
Tomas Henzl [Wed, 3 Jun 2015 15:37:02 +0000 (17:37 +0200)]
mptsas: fix depth param in scsi_track_queue_full

A user of scsi_track_queue_full should pass to the function a constant value
untill the queue-depth changes, otherwise the internal logic in
scsi_track_queue_full rejects the change.  Other users of this function use a
'sdev->queue_depth - 1' as depth parameter, let's do the same.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: "Sreekanth Reddy" <Sreekanth.reddy@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agomegaraid: fix irq setup process regression
Tomas Henzl [Tue, 2 Jun 2015 10:39:46 +0000 (16:09 +0530)]
megaraid: fix irq setup process regression

This fixes a regression caused by commit
d3557fc8be11d25f316884581f487684f8e7dad3 megaraid_sas : Add separate function
for setting up IRQs This makes boot end with 'root does not exist' message on
certain adapters.

The bug is that the driver does not setup ints for cards without msi-x
support.  This patch fixes it, in addition to that it moves tasklet
initialisation before enable_intr, otherwise a kernel panic may occur, when an
interrupt arrives before the tasklet is ready.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Update version to 10.7.0.0 for upstream patch set.
James Smart [Fri, 22 May 2015 14:42:44 +0000 (10:42 -0400)]
lpfc: Update version to 10.7.0.0 for upstream patch set.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix to drop PLOGIs from fabric node till LOGO processing completes
James Smart [Fri, 22 May 2015 14:42:43 +0000 (10:42 -0400)]
lpfc: Fix to drop PLOGIs from fabric node till LOGO processing completes

The domain controller PLOGI's concurrent with prior LOGO's/unreg_rpi's
completing created a race condition where driver rpi ref count can
inadvertantly hit 0 and the rpi attempted to be freed. This error
sometimes resulted in Warning messages indicating kref.h via
lfpc_nlp_get+0x128.

Correct by dropping any new PLOGI until the prior nport state has settled.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix scsi task management error message.
James Smart [Fri, 22 May 2015 14:42:41 +0000 (10:42 -0400)]
lpfc: Fix scsi task management error message.

TMF's were getting error messages on FCP_RSP errors (underrun). Underruns
aren't meaningful in the scenario. Change the error message to filter out
these response check errors, and don't unconditionally mark the cmd as
in error.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix cq_id masking problem.
James Smart [Fri, 22 May 2015 14:42:40 +0000 (10:42 -0400)]
lpfc: Fix cq_id masking problem.

The driver inadvertainly constrained the id space to 8 bits, when its
a full 16 bits from hw. This resulted in bad id's being written to the
hardware. Resulted in symptoms such as incomplete initialization, no
detection of link events, etc.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix scsi prep dma buf error.
James Smart [Fri, 22 May 2015 14:42:39 +0000 (10:42 -0400)]
lpfc: Fix scsi prep dma buf error.

Didn't check for less-than-or-equal zero. Means we may later call
scsi_dma_unmap() even though we don't have valid mappings.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Add support for using block multi-queue
James Smart [Fri, 22 May 2015 14:42:38 +0000 (10:42 -0400)]
lpfc: Add support for using block multi-queue

With blk-mq support in the mid-layer, lpfc can do IO steering based
on the information in the request tag.  This patch allows lpfc to use
blk-mq if enabled. If not enabled, we fall back into the emulex-internal
affinity mappings.

This feature can be turned on via CONFIG_SCSI_MQ_DEFAULT or passing
scsi_mod.use_blk_mq=Y as a parameter to the kernel.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Devices are not discovered during takeaway/giveback testing
James Smart [Fri, 22 May 2015 14:42:37 +0000 (10:42 -0400)]
lpfc: Devices are not discovered during takeaway/giveback testing

When a remote nport changes it's DID, a new ndlp is used.
However, we left the old ndlp state unchanged and still in
a discovery state. The may stall discovery resulting in some
devices not being discovered.  Correct by swapping the state
of the 2 ndlp's when a DID swap is detected.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix vport deletion failure.
James Smart [Fri, 22 May 2015 14:42:36 +0000 (10:42 -0400)]
lpfc: Fix vport deletion failure.

If a vport was deleted while in the middle of discovery, we weren't
clearing the nport discovery flag. Correct by clearing the flag and
cancelling our discovery timeout timer.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Check for active portpeerbeacon.
James Smart [Fri, 22 May 2015 14:42:35 +0000 (10:42 -0400)]
lpfc: Check for active portpeerbeacon.

LCB requests to set Beacon would fail if the beacon was already enabled
internally as the mailbox command used to query the state failes with
an already-set status.

Correct by enhancing the check so we don't fail if if the already set
status comes back.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Update driver version for upstream patch set 10.6.0.1.
James Smart [Thu, 21 May 2015 17:55:31 +0000 (13:55 -0400)]
lpfc: Update driver version for upstream patch set 10.6.0.1.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Change buffer pool empty message to miscellaneous category
James Smart [Thu, 21 May 2015 17:55:30 +0000 (13:55 -0400)]
lpfc: Change buffer pool empty message to miscellaneous category

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix incorrect log message reported for empty FCF record.
James Smart [Thu, 21 May 2015 17:55:29 +0000 (13:55 -0400)]
lpfc: Fix incorrect log message reported for empty FCF record.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix rport leak.
James Smart [Thu, 21 May 2015 17:55:28 +0000 (13:55 -0400)]
lpfc: Fix rport leak.

Correct locking and refcounting in tracking our rports

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Correct loss of RSCNs during array takeaway/giveback testing.
James Smart [Thu, 21 May 2015 17:55:27 +0000 (13:55 -0400)]
lpfc: Correct loss of RSCNs during array takeaway/giveback testing.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix crash in vport_delete.
James Smart [Thu, 21 May 2015 17:55:26 +0000 (13:55 -0400)]
lpfc: Fix crash in vport_delete.

We inadvertantly took the path to recreate the vport while in a
driver teardown path

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix to remove IRQF_SHARED flag for MSI/MSI-X vectors.
James Smart [Thu, 21 May 2015 17:55:25 +0000 (13:55 -0400)]
lpfc: Fix to remove IRQF_SHARED flag for MSI/MSI-X vectors.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix discovery issue when changing from Pt2Pt to Fabric.
James Smart [Thu, 21 May 2015 17:55:23 +0000 (13:55 -0400)]
lpfc: Fix discovery issue when changing from Pt2Pt to Fabric.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Correct reporting of vport state on fdisc command failure.
James Smart [Thu, 21 May 2015 17:55:22 +0000 (13:55 -0400)]
lpfc: Correct reporting of vport state on fdisc command failure.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Add support for RDP ELS command.
James Smart [Thu, 21 May 2015 17:55:21 +0000 (13:55 -0400)]
lpfc: Add support for RDP ELS command.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix ABORTs WQ selection in terminate_rport_io
James Smart [Thu, 21 May 2015 17:55:20 +0000 (13:55 -0400)]
lpfc: Fix ABORTs WQ selection in terminate_rport_io

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Correct reference counting of rport
James Smart [Thu, 21 May 2015 17:55:19 +0000 (13:55 -0400)]
lpfc: Correct reference counting of rport

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Add support for ELS LCB.
James Smart [Thu, 21 May 2015 17:55:18 +0000 (13:55 -0400)]
lpfc: Add support for ELS LCB.

Also has a little whitespace fixing.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Correct loss of target discovery after cable swap.
James Smart [Thu, 21 May 2015 17:55:17 +0000 (13:55 -0400)]
lpfc: Correct loss of target discovery after cable swap.

Fix incorrect reference counting

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: The lpfc driver does not issue RFF_ID and RFT_ID in the correct sequence
James Smart [Thu, 21 May 2015 17:55:16 +0000 (13:55 -0400)]
lpfc: The lpfc driver does not issue RFF_ID and RFT_ID in the correct sequence

The order (it's a shall, but hard to dictate after the fact) is given in
FC-SCM - kind of.  SCM indicates what shall be implemented, lists it as (a),
(b), (c), but actually doesn't say it has to be in that order.  The only hard
requirement, called out in FCP-4, is that you must register your FC-4 Type
(via RFT_ID) before registering FC-4 Type Features (via RFF_ID), which makes
sense. We obviously violated this and there were some switches (or newer fw in
them) that enforced it.  The other rule of thumbs are: register your data with
the switch first, then register for SCRs, then do queries about the fabric,
with the SCRs telling you of changes post the queries.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agotarget: explicitly include scsi_proto.h in target_core_fabric_lib.c
Stephen Rothwell [Wed, 3 Jun 2015 08:16:07 +0000 (18:16 +1000)]
target: explicitly include scsi_proto.h in target_core_fabric_lib.c

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoiscsi: Fix iscsi endpoints leak
Sagi Grimberg [Wed, 20 May 2015 09:38:58 +0000 (12:38 +0300)]
iscsi: Fix iscsi endpoints leak

When creating a new endpoint, we look for a free id
for the new endpoint. We baisically loop on possible ids
and use the first id that class_find_device() returns NULL.
However, we are missing a reference put when class_find_device()
does find an existing device for a given id.

Reported-by: Alex Lyakas <alex@zadarastorage.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoips: remove pointless #warning
James Bottomley [Tue, 19 May 2015 18:38:17 +0000 (11:38 -0700)]
ips: remove pointless #warning

non-x86 builds want the #warning in the IPS code about compiling on the wrong
architecture removed because it keeps triggering on their platforms build
farms.  Transform from a compile time warning into a runtime one with taint to
preserve the original intent of the authors.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agobnx2i: Fix call trace while device reset
Nilesh Javali [Tue, 19 May 2015 09:51:58 +0000 (05:51 -0400)]
bnx2i: Fix call trace while device reset

The driver waits for command completion event while cleanup of task
within the frwd lock and back locks. The frwd lock was still held
which caused the call trace while issuing a device reset.
Release the frwd lock along with the back lock
to avoid waiting in the lock context.

Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agobnx2i: Fixed firmware assert, during target logout.
Tej Parkash [Tue, 19 May 2015 09:51:57 +0000 (05:51 -0400)]
bnx2i: Fixed firmware assert, during target logout.

Fix the firmware assert, during target logout in
case driver received FIN from target before waiting for
asyncronous response.

Signed-off-by: Tej Parkash <tej.parkash@qlogic.com>
Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs-qcom: enable UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION
Yaniv Gardi [Sun, 17 May 2015 15:55:06 +0000 (18:55 +0300)]
scsi: ufs-qcom: enable UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION

Newer revisions of QUALCOMM Technologies UFS host controller may not
advertise the correct version information in UFS HCI VER register.
To handle this, enable UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION to let
UFS standard host controller driver call into vendor specific
operation to get right UFS HCI VER register value.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs: add quirk to handle broken UFS HCI version
Yaniv Gardi [Sun, 17 May 2015 15:55:05 +0000 (18:55 +0300)]
scsi: ufs: add quirk to handle broken UFS HCI version

Some host controller hardware controllers may not advertise correct
version in UFS HCI VER register. To workaround this, add new quirk
and call the host controller hardware vendor specific callback to
get the correct UFS HCI version register value.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs-qcom: enable UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk
Yaniv Gardi [Sun, 17 May 2015 15:55:04 +0000 (18:55 +0300)]
scsi: ufs-qcom: enable UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk

Current version of host controller on QUALCOMM Technologies requires
this quirk to be enabled, as DME commands to device must be sent
only in AUTO mode (SLOW AUTO or FAST AUTO).

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs: introduce UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk
Yaniv Gardi [Sun, 17 May 2015 15:55:03 +0000 (18:55 +0300)]
scsi: ufs: introduce UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk

Some UFS host controllers may only allow accessing the peer DME attribute
in AUTO mode (FAST AUTO or SLOW AUTO) hence we had added a quirk for
switching to AUTO power mode before accessing the peer DME attribute.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs-qcom: enable quirk to fix gear change to HS
Yaniv Gardi [Sun, 17 May 2015 15:55:02 +0000 (18:55 +0300)]
scsi: ufs-qcom: enable quirk to fix gear change to HS

With the G3 UFS devices, changing gear into HS is failing in UFS host
controllers of version 0x2.
The quirk solves the problem of changing gear into HS by enabling
the attribute that specifies whether or not the inbound Link supports
unterminated line in HS mode.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs: introduce a broken PA_RXHSUNTERMCAP quirk
Yaniv Gardi [Sun, 17 May 2015 15:55:01 +0000 (18:55 +0300)]
scsi: ufs: introduce a broken PA_RXHSUNTERMCAP quirk

The attribute PA_RXHSUNTERMCAP specifies whether or not the
inbound Link supports unterminated line in HS mode. enabling this
attribute to 1 fixes moving to HS gear.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs-qcom: enable UFSHCD_QUIRK_BROKEN_LCC
Yaniv Gardi [Sun, 17 May 2015 15:55:00 +0000 (18:55 +0300)]
scsi: ufs-qcom: enable UFSHCD_QUIRK_BROKEN_LCC

LCC (Line Control Command) are being used for communication between
UFS host and UFS device. But UFS host controller on QUALCOMM
Technologies have an issue with issuing the LCC commands to
UFS device and hence this quirk is enabled in order to to disable
LCC from the host side.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs: provide a quirk to disable the LCC
Yaniv Gardi [Sun, 17 May 2015 15:54:59 +0000 (18:54 +0300)]
scsi: ufs: provide a quirk to disable the LCC

LCC (Line Control Command) are being used for communication between
UFS host and UFS device.
New commercial UFS devices don't have the issues with LCC processing
but UFS host controller might still have the issue with LCC processing,
hence, added a routine to disable TX LCC on the device.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs-qcom: don't enable interrupt aggregation
Yaniv Gardi [Sun, 17 May 2015 15:54:58 +0000 (18:54 +0300)]
scsi: ufs-qcom: don't enable interrupt aggregation

Current versions of UFS host controllers on QUALCOMM Technologies
have interrupt aggregation logic broken.
Interrupt aggregation may not work if both threshold count and timeout
is enabled. Hence disable interrupt aggregation by enabling
UFSHCD_QUIRK_BROKEN_INTR_AGGR quirk until its fixed in the newer
UFS host controller revisions.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: ufs: introduce the capability and quirk for interrupt aggregation
Yaniv Gardi [Sun, 17 May 2015 15:54:57 +0000 (18:54 +0300)]
scsi: ufs: introduce the capability and quirk for interrupt aggregation

UFS HCI (Host Controller Interface) allows the transfer requests
interrupts to be aggregated to generate the single interrupt but
this can impact the performance. Hence introduce the capability which
gives choice to use the interrupt aggregation capability or not.
By default interrupt aggregation capability is kept disabled.

This change also introduces a quirk for broken interrupt aggregation
feature, as in some UFS controllers, this feature may not work.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: Increase default adapter init stage change timeout
Brian King [Wed, 13 May 2015 13:50:27 +0000 (08:50 -0500)]
ipr: Increase default adapter init stage change timeout

Increase the default init stage change timeout from 15 seconds to 30 seconds.
This resolves issues we have seen with some adapters not transitioning
to the first init stage within 15 seconds, which results in adapter
initialization failures.

Cc: <stable@vger.kernel.org>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agost: implement tape statistics
Seymour, Shane M [Wed, 6 May 2015 01:37:20 +0000 (01:37 +0000)]
st: implement tape statistics

This patch implements tape statistics in the st module via
sysfs. Current no statistics are available for tape I/O and there
is no easy way to reuse the block layer statistics for tape
as tape is a character device and does not have perform I/O in
sector sized chunks (the size of the data written to tape
can change). For tapes we also need extra stats related to
things like tape movement (via other I/O).

There have been multiple end users requesting statistics
including AT&T (and some HP customers who have not given
permission to be named). It is impossible for them
to investigate any issues related to tape performance
in a non-invasive way.

[jejb: eliminate PRId64]
Signed-off-by: Shane Seymour <shane.seymour@hp.com>
Tested-by: Shane Seymour <shane.seymour@hp.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agotarget: Minimize SCSI header #include directives
Bart Van Assche [Fri, 8 May 2015 08:11:12 +0000 (10:11 +0200)]
target: Minimize SCSI header #include directives

Only include SCSI initiator header files in target code that needs
these header files, namely the SCSI pass-through code and the tcm_loop
driver. Change SCSI_SENSE_BUFFERSIZE into TRANSPORT_SENSE_BUFFER in
target code because the former is intended for initiator code and the
latter for target code. With this patch the only initiator include
directives in target code that remain are as follows:

$ git grep -nHE 'include .scsi/(scsi.h|scsi_host.h|scsi_device.h|scsi_cmnd.h)' drivers/target drivers/infiniband/ulp/{isert,srpt} drivers/usb/gadget/legacy/tcm_*.[ch] drivers/{vhost,xen} include/{target,trace/events/target.h}
drivers/target/loopback/tcm_loop.c:29:#include <scsi/scsi.h>
drivers/target/loopback/tcm_loop.c:31:#include <scsi/scsi_host.h>
drivers/target/loopback/tcm_loop.c:32:#include <scsi/scsi_device.h>
drivers/target/loopback/tcm_loop.c:33:#include <scsi/scsi_cmnd.h>
drivers/target/target_core_pscsi.c:39:#include <scsi/scsi_device.h>
drivers/target/target_core_pscsi.c:40:#include <scsi/scsi_host.h>
drivers/xen/xen-scsiback.c:52:#include <scsi/scsi_host.h> /* SG_ALL */

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agotarget: Correct a comment
Bart Van Assche [Fri, 8 May 2015 08:08:55 +0000 (10:08 +0200)]
target: Correct a comment

Correct the comment above the definition of TCM_MAX_COMMAND_SIZE.
A quote from Christoph:

    There aren't any legacy issues, we just decided to handle >
    16 byte CDBs in the slow path.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoMove code that is used both by initiator and target drivers
Bart Van Assche [Fri, 8 May 2015 08:07:48 +0000 (10:07 +0200)]
Move code that is used both by initiator and target drivers

Move the functions that are used by both the initiator and target
subsystems into scsi_common.c/.h. This change will allow to remove
the initiator SCSI header include directives from most SCSI target
source files in a later patch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoSplit SCSI header files
Bart Van Assche [Fri, 8 May 2015 08:07:18 +0000 (10:07 +0200)]
Split SCSI header files

Move the constants that are used by both initiator and target
drivers into the new header file <scsi/scsi_proto.h>. This change
will allow to remove the initiator SCSI header include directives
from most SCSI target source files in a later patch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agomegaraid_sas : Modify return value of megasas_issue_blocked_cmd() and wait_and_poll...
Sumit.Saxena@avagotech.com [Wed, 6 May 2015 13:31:02 +0000 (19:01 +0530)]
megaraid_sas : Modify return value of megasas_issue_blocked_cmd() and wait_and_poll() to consider command status returned by firmware

This patch is rebased on top of recently sent 18 patches(submitted by me) for
megaraid_sas driver.

Change the return value of wait_and_poll() and megsas_issue_blocked_cmd()
based on MFI_STAT returned by firmware for that command. Earlier driver always
send return type based on command completion (but never check MFI_STAT_OK for
that command), so even if command is failed by firmware still driver will
return SUCCESS status from these functions wait_and_poll() and
megsas_issue_blocked_cmd() and if caller of these functions does not check
command status (MFI_STAT), then it may endup using invalid data returned in
DMA buffers(one of the example is megasas_ld_list_query DCMD). Best thing to
avoid this type of issue is do error handling and set proper return type from
caller function wait_and_poll() and megsas_issue_blocked_cmd().

The change proposed in this patch will fix the regression introduced in patch-
"90dc9d9 megaraid_sas : MFI MPT linked list corruption fix" inside function
megasas_ld_list_query().  Prior to this MFI MPT linked list corruption fix
patch, megasas_ld_list_query() function used to check DCMD status(returned by
firmware) but with this linked list corruption fix patch, DCMD status will not
be checked inside function megasas_ld_list_query() and introduced this issue
of wrong data being used by function megasas_ld_list_query().

Cc: <stable@vger.kernel.org>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: Do not set cmd_per_lun to 1 in the host template
Hannes Reinecke [Wed, 29 Apr 2015 06:57:34 +0000 (08:57 +0200)]
scsi: Do not set cmd_per_lun to 1 in the host template

'0' is now used as the default cmd_per_lun value,
so there's no need to explicitly set it to '1' in the
host template.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: change driver version
Don Brace [Thu, 23 Apr 2015 14:35:33 +0000 (09:35 -0500)]
hpsa: change driver version

update driver version

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: add in new controller id
Don Brace [Thu, 23 Apr 2015 14:35:27 +0000 (09:35 -0500)]
hpsa: add in new controller id

add in support for latest PMC controller

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: cleanup reset
Webb Scales [Thu, 23 Apr 2015 14:35:22 +0000 (09:35 -0500)]
hpsa: cleanup reset

Synchronize completion the reset with completion of outstanding commands

Extending the newly-added synchronous abort functionality,
now also synchronize resets with the completion of outstanding commands.
Rename the wait queue to reflect the fact that it's being used for both
types of waits.  Also, don't complete commands which are terminated
due to a reset operation.

fix for controller lockup during reset

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: propagate the error code in hpsa_kdump_soft_reset
Robert Elliott [Thu, 23 Apr 2015 14:35:14 +0000 (09:35 -0500)]
hpsa: propagate the error code in hpsa_kdump_soft_reset

If hpsa_wait_for_board_state fails, hpsa_kdump_soft_reset
should propagate its return value (e.g., -ENODEV) rather
than just returning -1.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: use scsi host_no as hpsa controller number
Robert Elliott [Thu, 23 Apr 2015 14:35:09 +0000 (09:35 -0500)]
hpsa: use scsi host_no as hpsa controller number

Rather than numbering the hpsa controllers with an
incrementing 0..n value (e.g., that shows up in
/proc/interrupts), use the scsi midlayer
host_no (e.g. matching /sys/class/scsi_host/hostNN).

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: use block layer tag for command allocation
Webb Scales [Thu, 23 Apr 2015 14:35:04 +0000 (09:35 -0500)]
hpsa: use block layer tag for command allocation

Rework slave allocation:
  - separate the tagging support setup from the hostdata setup
  - make the hostdata setup act consistently when the lookup fails
  - make the hostdata setup act consistently when the device is not added
  - set up the queue depth consistently across these scenarios
  - if the block layer mq support is not available, explicitly enable and
    activate the SCSI layer tcq support (and do this at allocation-time so
    that the tags will be available for INQUIRY commands)

Tweak slave configuration so that devices which are masked are also
not attached.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: add interrupt number to /proc/interrupts interrupt name
Robert Elliott [Thu, 23 Apr 2015 14:34:58 +0000 (09:34 -0500)]
hpsa: add interrupt number to /proc/interrupts interrupt name

Add the interrupt number to the interrupt names that
appear in /proc/interrupts, so they are unique

Also, delete the IRQ and DAC prints.  Other parts of the kernel
already print the IRQ assignments, and dual-address-cycle support
has not been interesting since the parallel PCI bus went from
32 to 64 bits wide.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: create workqueue after the driver is ready for use
Robert Elliott [Thu, 23 Apr 2015 14:34:53 +0000 (09:34 -0500)]
hpsa: create workqueue after the driver is ready for use

Don't create the resubmit workqueue in hpsa_init_one until everything else
is ready to use, so everything can be freed in reverse order of when they
were allocated without risking freeing things while workqueue items are
still active.

Destroy the workqueue in the right order in
hpsa_undo_allocations_after_kdump_soft_reset too.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: fix try_soft_reset error handling
Robert Elliott [Thu, 23 Apr 2015 14:34:48 +0000 (09:34 -0500)]
hpsa: fix try_soft_reset error handling

If registering the special interrupt handlers in hpsa_init_one
before a soft reset fails, the error exit needs to deallocate
everything that was allocated before.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: cleanup for init_one step 2 in kdump
Robert Elliott [Thu, 23 Apr 2015 14:34:43 +0000 (09:34 -0500)]
hpsa: cleanup for init_one step 2 in kdump

In hpsa_undo_allocations_after_kdump_soft_reset,
the things allocated in hpsa_init_one step 2 -
h->resubmit_wq and h->lockup_detected  need to
be freed, in the right order.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: skip free_irq calls if irqs are not allocated
Robert Elliott [Thu, 23 Apr 2015 14:34:37 +0000 (09:34 -0500)]
hpsa: skip free_irq calls if irqs are not allocated

If try_soft_reset fails to re-allocate irqs, the error exit
starts with free_irq calls, which generate kernel WARN
messages since they were already freed a few lines earlier.

Jump to the next exit label to skip the free_irq calls.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: call pci_release_regions after pci_disable_device
Robert Elliott [Thu, 23 Apr 2015 14:34:32 +0000 (09:34 -0500)]
hpsa: call pci_release_regions after pci_disable_device

Despite the fact that PCI devices are enabled in this order:
    1. pci_enable_device
    2. pci_request_regions

    Documentation/PCI/pci.txt specifies that they be undone
    in this order
    1. pci_disable_device
    2. pci_release_regions

    Tested by injecting error in the call to pci_enable_device
    in hpsa_init_one -> hpsa_pci_init:
    [    9.095001] hpsa 0000:04:00.0: failed to enable PCI device
    [    9.095005] hpsa: probe of 0000:04:00.0 failed with error -22
    (-22 is -EINVAL)
    and then in the call pci_request_regions:
    [    9.178623] hpsa 0000:04:00.0: failed to obtain PCI resources
    [    9.178671] hpsa: probe of 0000:04:00.0 failed with error -16
    (-16 is -EBUSY)

    and then by adding
        reset_devices
    to the kernel command line and inject errors into the two
    calls to pci_enable_device and the call to pci_request_regions
    in hpsa_init_one -> hpsa_init_reset_devices.

    (inject on 6th call, 1st to hpsa2)
    [   62.413750] hpsa 0000:04:00.0: Failed to enable PCI device

    (inject on 7th call, 2nd to hpsa2)
    [   62.807571] hpsa 0000:04:00.0: failed to enable device.

    (inject on 8th call, 3rd to hpsa2)
    [   62.697198] hpsa 0000:04:00.0: failed to obtain PCI resources
    [   62.697234] hpsa: probe of 0000:04:00.0 failed with error -16

    The reset_devices path calls return -ENODEV on failure
    rather than passing the result, which apparently doesn't
    cause the pci driver to print anything.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: performance tweak for hpsa_scatter_gather()
Webb Scales [Thu, 23 Apr 2015 14:34:27 +0000 (09:34 -0500)]
hpsa: performance tweak for hpsa_scatter_gather()

Divide the loop in hpsa_scatter_gather() into two, one for the initial SG list
and a second one for the chained list, if any.  This allows the conditional
check which resets the indicies for the chained list to be performed outside
the loop instead of being done on every iteration inside the loop.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: refactor and rework support for sending TEST_UNIT_READY
Webb Scales [Thu, 23 Apr 2015 14:34:22 +0000 (09:34 -0500)]
hpsa: refactor and rework support for sending TEST_UNIT_READY

Factor out the code which sends the TEST_UNIT_READY from
wait_for_device_to_become_ready() into its own function.

Move the code which waits for the TEST_UNIT_READY from
wait_for_device_to_become_ready() into its own function.

If a logical drive has failed, resetting it will ensure
outstanding commands are completed, but polling it with
TURs after the reset will not work because the TURs will
never report good status.  So successful TUR should not
be a condition of success for the device reset error
handler.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: don't return abort request until target is complete
Webb Scales [Thu, 23 Apr 2015 14:34:16 +0000 (09:34 -0500)]
hpsa: don't return abort request until target is complete

Don't return from the abort request until the target command is complete.
Mark outstanding commands which have a pending abort, and do not send them
to the host if we can avoid it.

If the current command has been aborted, do not call the SCSI command
completion routine from the I/O path: when the abort returns successfully,
the SCSI mid-layer will handle the completion implicitly.

The following race was possible in theory.

1. LLD is requested to abort a scsi command
2. scsi command completes
3. The struct CommandList associated with 2 is made available.
4. new io request to LLD to another LUN re-uses struct CommandList
5. abort handler follows scsi_cmnd->host_scribble and
   finds struct CommandList and tries to aborts it.

Now we have aborted the wrong command.

Fix by resetting the scsi_cmd field of struct CommandList
upon completion and making the abort handler check that
the scsi_cmd pointer in the CommadList struct matches the
scsi_cmnd that it has been asked to abort.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: use helper routines for finishing commands
Webb Scales [Thu, 23 Apr 2015 14:34:11 +0000 (09:34 -0500)]
hpsa: use helper routines for finishing commands

cleanup command completions

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: add support sending aborts to physical devices via the ioaccel2 path
Stephen Cameron [Thu, 23 Apr 2015 14:34:06 +0000 (09:34 -0500)]
hpsa: add support sending aborts to physical devices via the ioaccel2 path

add support for tmf when in ioaccel2 mode

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: do not print ioaccel2 warning messages about unusual completions.
Robert Elliott [Thu, 23 Apr 2015 14:34:00 +0000 (09:34 -0500)]
hpsa: do not print ioaccel2 warning messages about unusual completions.

The SCSI midlayer already prints more detail about completions,
and has logging level options to filter them if not wanted.
These just slow down the system if a lot of errors occur,
stressing error handling even more.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: clean up some error reporting output in abort handler
Robert Elliott [Thu, 23 Apr 2015 14:33:54 +0000 (09:33 -0500)]
hpsa: clean up some error reporting output in abort handler

report more useful information on aborts

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: clean up driver init
Robert Elliott [Thu, 23 Apr 2015 14:33:48 +0000 (09:33 -0500)]
hpsa: clean up driver init

Improve initialization error handling in hpsa_init_one
Clean up style and indent issues
Rename functions for consistency
Improve error messaging on allocations
Fix return status from hpsa_put_ctlr_into_performant_mode
Correct free order in hpsa_init_one using new function
   hpsa_free_performant_mode
Prevent inadvertent use of null pointers by nulling out the parent structures
   and zeroing out associated size variables.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: correct return values from driver functions.
Robert Elliott [Thu, 23 Apr 2015 14:33:43 +0000 (09:33 -0500)]
hpsa: correct return values from driver functions.

correct return codes for error conditions

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: do not check cmd_alloc return value - it cannnot return NULL
Robert Elliott [Thu, 23 Apr 2015 14:33:38 +0000 (09:33 -0500)]
hpsa: do not check cmd_alloc return value - it cannnot return NULL

cmd_alloc can no longer return NULL, so don't check for NULL any more
(which is unreachable code).

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: add more ioaccel2 error handling, including underrun statuses.
Joe Handzik [Thu, 23 Apr 2015 14:33:32 +0000 (09:33 -0500)]
hpsa: add more ioaccel2 error handling, including underrun statuses.

improve ioaccel2 error handling, including better handling of
underrun statuses

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: add ioaccel sg chaining for the ioaccel2 path
Webb Scales [Thu, 23 Apr 2015 14:33:27 +0000 (09:33 -0500)]
hpsa: add ioaccel sg chaining for the ioaccel2 path

Increase the request size for ioaccel2 path.

The error, if any, returned by hpsa_allocate_ioaccel2_sg_chain_blocks
to hpsa_alloc_ioaccel2_cmd_and_bft should be returned upstream rather
than assumed to be -ENOMEM.

This differs slightly from hpsa_alloc_ioaccel1_cmd_and_bft,
which does not call another hpsa_allocate function and only
has -ENOMEM to return from some kmalloc calls.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: refactor freeing of resources into more logical functions
Robert Elliott [Thu, 23 Apr 2015 14:33:22 +0000 (09:33 -0500)]
hpsa: refactor freeing of resources into more logical functions

refactor freeing of resources into more logical functions

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: clean up error handling
Robert Elliott [Thu, 23 Apr 2015 14:33:17 +0000 (09:33 -0500)]
hpsa: clean up error handling

refactor error cleanup and shutdown
disable interrupts and pci_disable_device on critical failures
add hpsa_free_cfgtables function

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: break hpsa_free_irqs_and_disable_msix into two functions
Robert Elliott [Thu, 23 Apr 2015 14:33:12 +0000 (09:33 -0500)]
hpsa: break hpsa_free_irqs_and_disable_msix into two functions

replace calls to hpsa_free_irqs_and_disable_msix with
hpsa_free_irqs and hpsa_disable_interrupt_mode

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: Get queue depth from identify physical bmic for physical disks.
Joe Handzik [Thu, 23 Apr 2015 14:33:04 +0000 (09:33 -0500)]
hpsa: Get queue depth from identify physical bmic for physical disks.

get drive queue depth to help avoid task set full conditions.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: use ioaccel2 path to submit IOs to physical drives in HBA mode.
Joe Handzik [Thu, 23 Apr 2015 14:32:59 +0000 (09:32 -0500)]
hpsa: use ioaccel2 path to submit IOs to physical drives in HBA mode.

use ioaccel2 path to submit I/O to physical drives in HBA mode

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: print accurate SSD Smart Path Enabled status
Robert Elliott [Thu, 23 Apr 2015 14:32:54 +0000 (09:32 -0500)]
hpsa: print accurate SSD Smart Path Enabled status

offload_enabled changes are deferred until after the
added/updated prints occur, so the values are incorrect.

defer printing SSD Smart Path Enabled status information until the
information is correct

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: factor out hpsa_ioaccel_submit function
Webb Scales [Thu, 23 Apr 2015 14:32:48 +0000 (09:32 -0500)]
hpsa: factor out hpsa_ioaccel_submit function

clean up command submission

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: try resubmitting down raid path on task set full
Stephen Cameron [Thu, 23 Apr 2015 14:32:43 +0000 (09:32 -0500)]
hpsa: try resubmitting down raid path on task set full

allow the controller firmware to queue up commands when the ioaccel device
queue is full.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: do not ignore return value of hpsa_register_scsi
Stephen Cameron [Thu, 23 Apr 2015 14:32:37 +0000 (09:32 -0500)]
hpsa: do not ignore return value of hpsa_register_scsi

add error handling for failure when registering with SCSI subsystem.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: factor out hpsa_init_cmd function
Stephen Cameron [Thu, 23 Apr 2015 14:32:32 +0000 (09:32 -0500)]
hpsa: factor out hpsa_init_cmd function

Factor out hpsa_cmd_init from cmd_alloc().  We also need
this for resubmitting commands down the default RAID path
when they have returned from the ioaccel paths with errors.

In particular, reinitialize the cmd_type and busaddr fields as these
will not be correct for submitting down the RAID stack path
after ioaccel command completion.

This saves time when submitting commands.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: make function names consistent
Robert Elliott [Thu, 23 Apr 2015 14:32:27 +0000 (09:32 -0500)]
hpsa: make function names consistent

make function names more consistent and meaningful

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: allow lockup detected to be viewed via sysfs
Stephen Cameron [Thu, 23 Apr 2015 14:32:22 +0000 (09:32 -0500)]
hpsa: allow lockup detected to be viewed via sysfs

expose a detected lockup via sysfs

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: hpsa decode sense data for io and tmf
Stephen Cameron [Thu, 23 Apr 2015 14:32:16 +0000 (09:32 -0500)]
hpsa: hpsa decode sense data for io and tmf

In hba mode, we could get sense data in descriptor format so
we need to handle that.

It's possible for CommandStatus to have value 0x0D
"TMF Function Status", which we should handle.  We will get
this from a P1224 when aborting a non-existent tag, for
example.  The "ScsiStatus" field of the errinfo field
will contain the TMF function status value.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: decrement h->commands_outstanding in fail_all_outstanding_cmds
Stephen Cameron [Thu, 23 Apr 2015 14:32:11 +0000 (09:32 -0500)]
hpsa: decrement h->commands_outstanding in fail_all_outstanding_cmds

make tracking of outstanding commands more robust

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: clean up aborts
Stephen Cameron [Thu, 23 Apr 2015 14:32:06 +0000 (09:32 -0500)]
hpsa: clean up aborts

Do not send aborts to logical devices that do not support aborts

Instead of relying on what the Smart Array claims for supporting logical
drives, simply try an abort and see how it responds at device discovery
time.  This way devices that do support aborts (e.g. MSA2000) can work
and we do not waste time trying to send aborts to logical drives that do
not support them (important for high IOPS devices.)

While rescanning devices only test whether devices support aborts
the first time we encounter a device rather than every time.

Some Smart Arrays required aborts to be sent with tags in
the wrong endian byte order.  To avoid having to know about
this, we would send two aborts with tags with each endian order.
On high IOPS devices, this turns out to be not such a hot idea.
So we now have a list of the devices that got the tag backwards,
and we only send it one way.

If all available commands are outstanding and the abort handler
is invoked, the abort handler may not be able to allocate a command
and may busy-wait excessivly.  Reserve a small number of commands
for the abort handler and limit the number of concurrent abort
requests to the number of reserved commands.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: rework controller command submission
Webb Scales [Thu, 23 Apr 2015 14:32:00 +0000 (09:32 -0500)]
hpsa: rework controller command submission

Allow driver initiated commands to have a timeout.  It does not
yet try to do anything with timeouts on such commands.

We are sending a reset in order to get rid of a command we want to abort.
If we make it return on the same reply queue as the command we want to abort,
the completion of the aborted command will not race with the completion of
the reset command.

Rename hpsa_scsi_do_simple_cmd_core() to hpsa_scsi_do_simple_cmd(), since
this function is the interface for issuing commands to the controller and
not the "core" of that implementation.  Add a parameter to it which allows
the caller to specify the reply queue to be used.  Modify existing callers
to specify the default reply queue.

Rename __hpsa_scsi_do_simple_cmd_core() to hpsa_scsi_do_simple_cmd_core(),
since this routine is the "core" implementation of the "do simple command"
function and there is no longer any other function with a similar name.
Modify the existing callers of this routine (other than
hpsa_scsi_do_simple_cmd()) to instead call hpsa_scsi_do_simple_cmd(), since
it will now accept the reply_queue paramenter, and it provides a controller
lock-up check.  (Also, tweak two related message strings to make them
distinct from each other.)

Submitting a command to a locked up controller always results in a timeout,
so check for controller lock-up before submitting.

This is to enable fixing a race between command completions and
abort completions on different reply queues in a subsequent patch.
We want to be able to specify which reply queue an abort completion
should occur on so that it cannot race the completion of the command
it is trying to abort.

The following race was possible in theory:

  1. Abort command is sent to hardware.
  2. Command to be aborted simultaneously completes on another
     reply queue.
  3. Hardware receives abort command, decides command has already
     completed and indicates this to the driver via another different
     reply queue.
  4. driver processes abort completion finds that the hardware does not know
     about the command, concludes that therefore the command cannot complete,
     returns SUCCESS indicating to the mid-layer that the scsi_cmnd may be
     re-used.
  5. Command from step 2 is processed and completed back to scsi mid
     layer (after we already promised that would never happen.)

Fix by forcing aborts to complete on the same reply queue as the command
they are aborting.

Piggybacking device rescanning functionality onto the lockup
detection thread is not a good idea because if the controller
locks up during device rescanning, then the thread could get
stuck, then the lockup isn't detected.  Use separate work
queues for device rescanning and lockup detection.

Detect controller lockup in abort handler.

After a lockup is detected, return DO_NO_CONNECT which results in immediate
termination of commands rather than DID_ERR which results in retries.

Modify detect_controller_lockup() to return the result, to remove the need for
a separate check.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Signed-off-by: Webb Scales <webbnh@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: clean up host, channel, target, lun prints
Webb Scales [Thu, 23 Apr 2015 14:31:55 +0000 (09:31 -0500)]
hpsa: clean up host, channel, target, lun prints

We had a mix of formats used for specifying controller, bus, target,
and lun address of devices.

change to the format used by the scsi midlayer and upper layer (2:3:0:0)
so you can easily follow the information from hpsa to scsi midlayer
to sd upper layer.

Also add this information:
- product ID
- vendor ID
- RAID level
- SSD Smath Path capable and enabled
- exposure level (sg-only)

Example:
hpsa 0000:04:00.0: added scsi 2:0:0:0: Direct-Access     HP LOGICAL VOLUME   RAID-0 SSDSmartPathCap+ En+ Exp=4
scsi 2:0:0:0: Direct-Access     HP       LOGICAL VOLUME   10.0 PQ: 0 ANSI: 5
sd 2:0:0:0: [sdr] 12501713072 512-byte logical blocks: (6.40 TB/5.82 TiB)
sd 2:0:0:0: [sdr] 4096-byte physical blocks
sd 2:0:0:0: [sdr] Attached SCSI disk
sd 2:0:0:0: Attached scsi generic sg20 type 0

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: add masked physical devices into h->dev[] array
Stephen Cameron [Thu, 23 Apr 2015 14:31:47 +0000 (09:31 -0500)]
hpsa: add masked physical devices into h->dev[] array

Cache the ioaccel handle so that when we need to abort commands sent
down the ioaccel2 path, we can look up the LUN ID in h->dev[] instead of
having to do I/O to the controller.

Add a field to elements in h->dev[] to keep track of how the device is exposed
to the SCSI mid layer: Not at all, without an upper level driver
(no_uld_attach) or normally exposed.

Since masked physical devices are now present in h->dev[] array
it would be perfectly possible to do

echo scsi add-single-device 2 2 0 0 > /proc/scsi/scsi

and bring them online.  This was previously not allowed for masked
physical devices.

Ensure that the mapping of physical disks to logical drives gets updated in a
consistent way when a RAID migration occurs and is not touched until updates
to it are complete.

now instead of doing CISS_REPORT_PHYSICAL to get the LUNID for
the physical disk in hpsa_get_pdisk_of_ioaccel2(), just get
it out of h->dev[] where we already have it cached.

do not touch phys_disk[] for ioaccel enabled logical drives during rescan

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@Suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agohpsa: dont meddle with hw which isn't ours (cciss)
Tomas Henzl [Thu, 2 Apr 2015 13:25:54 +0000 (15:25 +0200)]
hpsa: dont meddle with hw which isn't ours (cciss)

The hpsa driver touches the hardware before checking the pci-id table.
This way, especially in kdump, it may confuse the proper driver (cciss).

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Don Brace <Don.Brace@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agocciss: correct the non-resettable board list
Tomas Henzl [Tue, 17 Feb 2015 16:40:22 +0000 (17:40 +0100)]
cciss: correct the non-resettable board list

The hpsa driver carries a more recent version,
copy the table from there.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Don Brace <Don.Brace@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agocciss: remove duplicate entries from board_type struct
Tomas Henzl [Tue, 17 Feb 2015 16:40:21 +0000 (17:40 +0100)]
cciss: remove duplicate entries from board_type struct

and devices not supported by this driver from unresettable list

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Don Brace <Don.Brace@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoadvansys: Update to version 3.5 and remove compilation warning
Hannes Reinecke [Fri, 24 Apr 2015 11:18:42 +0000 (13:18 +0200)]
advansys: Update to version 3.5 and remove compilation warning

The driver has now been converted to DMA-API, so we should
increase the version number and remove the compilation
warning.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoadvansys: Remove call to dma_cache_sync()
Hannes Reinecke [Fri, 24 Apr 2015 11:18:41 +0000 (13:18 +0200)]
advansys: Remove call to dma_cache_sync()

Only required if the dma buffer has been allocated via
dma_alloc_noncoherent(), which this one is not.
With that call removed we can now also compile on ARM.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>