firefly-linux-kernel-4.4.55.git
9 years agosd, mmc, virtio_blk, string_helpers: fix block size units
James Bottomley [Fri, 6 Mar 2015 02:47:01 +0000 (18:47 -0800)]
sd, mmc, virtio_blk, string_helpers: fix block size units

The current string_get_size() overflows when the device size goes over
2^64 bytes because the string helper routine computes the suffix from
the size in bytes.  However, the entirety of Linux thinks in terms of
blocks, not bytes, so this will artificially induce an overflow on very
large devices.  Fix this by making the function string_get_size() take
blocks and the block size instead of bytes.  This should allow us to
keep working until the current SCSI standard overflows.

Also fix virtio_blk and mmc (both of which were also artificially
multiplying by the block size to pass a byte side to string_get_size()).

The mathematics of this is pretty simple:  we're taking a product of
size in blocks (S) and block size (B) and trying to re-express this in
exponential form: S*B = R*N^E (where N, the exponent is either 1000 or
1024) and R < N.  Mathematically, S = RS*N^ES and B=RB*N^EB, so if RS*RB
< N it's easy to see that S*B = RS*RB*N^(ES+EB).  However, if RS*BS > N,
we can see that this can be re-expressed as RS*BS = R*N (where R =
RS*BS/N < N) so the whole exponent becomes R*N^(ES+EB+1)

[jejb: fix incorrect 32 bit do_div spotted by kbuild test robot <fengguang.wu@intel.com>]
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoufs: add support to allow non standard behaviours (quirks)
Yaniv Gardi [Tue, 31 Mar 2015 14:37:14 +0000 (17:37 +0300)]
ufs: add support to allow non standard behaviours (quirks)

Some implementation of UFS host controller HW might have some non-standard
behaviours (quirks) when compared to behaviour specified by UFSHCI
specification. This patch add support to allow specifying all such quirks
to standard UFS host controller driver so standard driver takes them into
account.

In this change a UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS is introduced,
where a minimum delay of 1ms is required before DME commands for
stability purposes.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoufs-qcom: save controller revision info in internal structure
Yaniv Gardi [Tue, 31 Mar 2015 14:37:13 +0000 (17:37 +0300)]
ufs-qcom: save controller revision info in internal structure

Sometimes, specific information about the UFS controller revision is
required in order to determine certain operations or execute
controller dependent quirks.
In order to avoid reading the controller revision multiple times,
we simply read it once and save this information in internal structure.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Reviewed-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Update driver version to 8.07.00.18-k
Himanshu Madhani [Thu, 9 Apr 2015 19:00:08 +0000 (15:00 -0400)]
qla2xxx: Update driver version to 8.07.00.18-k

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Restore physical port WWPN only, when port down detected for FA-WWPN port.
Sawan Chandak [Thu, 9 Apr 2015 19:00:07 +0000 (15:00 -0400)]
qla2xxx: Restore physical port WWPN only, when port down detected for FA-WWPN port.

For FA-WWPN is enabled port, if NPIV created on that port and,
if port link is brought down, then WWPN was restored from flash for both
physical and NPIV port. This will result in NPIV port and physical port
sharing same WWPN. Any application refreshing ports information  will
not be able to scan NPIV port because of this behavior. So while restoring WWPN,
only restore physical port WWPN.

Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Fix virtual port configuration, when switch port is disabled/enabled.
Sawan Chandak [Thu, 9 Apr 2015 19:00:06 +0000 (15:00 -0400)]
qla2xxx: Fix virtual port configuration, when switch port is disabled/enabled.

On some vendor switches, when switch port is toggled (down /up),
then in some condition driver tries to configure virtual port,
before FW is actually in ready state to process any commands on wire.
At this time, configuring virtual port can fail. Add fix in driver
to make driver wait, for FW to be ready state before

Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Prevent multiple firmware dump collection for ISP27XX.
Himanshu Madhani [Thu, 9 Apr 2015 19:00:05 +0000 (15:00 -0400)]
qla2xxx: Prevent multiple firmware dump collection for ISP27XX.

For ISP27XX, driver will capture new firmware dump even if there is
one already collected. Prevent this from happening by checking
fw_dumped flag.

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Disable Interrupt handshake for ISP27XX.
Himanshu Madhani [Thu, 9 Apr 2015 19:00:04 +0000 (15:00 -0400)]
qla2xxx: Disable Interrupt handshake for ISP27XX.

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Add debugging info for MBX timeout.
Himanshu Madhani [Thu, 9 Apr 2015 19:00:03 +0000 (15:00 -0400)]
qla2xxx: Add debugging info for MBX timeout.

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Add serdes read/write support for ISP27XX
Andrew Vasquez [Thu, 9 Apr 2015 19:00:02 +0000 (15:00 -0400)]
qla2xxx: Add serdes read/write support for ISP27XX

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Add udev notification to save fw dump for ISP27XX
Himanshu Madhani [Thu, 9 Apr 2015 19:00:01 +0000 (15:00 -0400)]
qla2xxx: Add udev notification to save fw dump for ISP27XX

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Add message for sucessful FW dump collected for ISP27XX.
Himanshu Madhani [Thu, 9 Apr 2015 19:00:00 +0000 (15:00 -0400)]
qla2xxx: Add message for sucessful FW dump collected for ISP27XX.

o Added message indicating firmware dump was sucessfully collected
  for ISP27XX.
o Improve logging to help debug firmware dump process for ISP27XX.

Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Add support to load firmware from file for ISP 26XX/27XX.
Sawan Chandak [Thu, 9 Apr 2015 18:59:59 +0000 (14:59 -0400)]
qla2xxx: Add support to load firmware from file for ISP 26XX/27XX.

Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Fix beacon blink for ISP27XX.
Nigel Kirkland [Thu, 9 Apr 2015 18:59:58 +0000 (14:59 -0400)]
qla2xxx: Fix beacon blink for ISP27XX.

Signed-off-by: Nigel Kirkland <nigel.kirkland@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Increase the wait time for firmware to be ready for P3P.
Chad Dupuis [Thu, 9 Apr 2015 18:59:57 +0000 (14:59 -0400)]
qla2xxx: Increase the wait time for firmware to be ready for P3P.

Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Fix crash due to wrong casting of reg for ISP27XX.
Himanshu Madhani [Thu, 9 Apr 2015 18:59:56 +0000 (14:59 -0400)]
qla2xxx: Fix crash due to wrong casting of reg for ISP27XX.

[Bart: additional sparse warning caused by this patch]
[jejb: fix sparse warning]
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoqla2xxx: Fix warnings reported by static checker.
Himanshu Madhani [Thu, 9 Apr 2015 18:59:55 +0000 (14:59 -0400)]
qla2xxx: Fix warnings reported by static checker.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Update version to 10.5.0.0 for upstream patch set
James Smart [Tue, 7 Apr 2015 19:07:29 +0000 (15:07 -0400)]
lpfc: Update version to 10.5.0.0 for upstream patch set

Update version  to 10.5.0.0 for upstream patch set

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Update copyright to 2015
James Smart [Tue, 7 Apr 2015 19:07:28 +0000 (15:07 -0400)]
lpfc: Update copyright to 2015

Update copyright to 2015

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix for lun discovery issue with saturn adapter.
James Smart [Tue, 7 Apr 2015 19:07:27 +0000 (15:07 -0400)]
lpfc: Fix for lun discovery issue with saturn adapter.

FCP_CMD payload was not always properly initialized on SLI-3 devices.

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix crash in device reset handler.
James Smart [Tue, 7 Apr 2015 19:07:26 +0000 (15:07 -0400)]
lpfc: Fix crash in device reset handler.

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix OS crash when running loopback test in applications
James Smart [Tue, 7 Apr 2015 19:07:25 +0000 (15:07 -0400)]
lpfc: Fix OS crash when running loopback test in applications

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix internal loopback failure.
James Smart [Tue, 7 Apr 2015 19:07:23 +0000 (15:07 -0400)]
lpfc: Fix internal loopback failure.

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix premature release of rpi bit in bitmask
James Smart [Tue, 7 Apr 2015 19:07:22 +0000 (15:07 -0400)]
lpfc: Fix premature release of rpi bit in bitmask

Currently, the driver plays off the fact that older sli4 adapters have a
different rpi access pattern that allowed for the rpi reference to be
released earlier in the teardown sequence, allowing the driver to recycle
the rpi value sooner. Newer sli4 adapters have a different access pattern that
requires us to wait for a later mailbox completion. This changes the put
call location on the newer sli4 adapters.

Symptoms of the error are "0110 ELS" and the "0372 iotag" errors.

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Initiator sends wrong BBCredit value for either FLOGI or FLOGI_ACC
James Smart [Tue, 7 Apr 2015 19:07:21 +0000 (15:07 -0400)]
lpfc: Initiator sends wrong BBCredit value for either FLOGI or FLOGI_ACC

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix null ndlp dereference in target_reset_handler
James Smart [Tue, 7 Apr 2015 19:07:20 +0000 (15:07 -0400)]
lpfc: Fix null ndlp dereference in target_reset_handler

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix FDMI Fabric support in driver for Brocade
James Smart [Tue, 7 Apr 2015 19:07:19 +0000 (15:07 -0400)]
lpfc: Fix FDMI Fabric support in driver for Brocade

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix provide host name and OS name in RSNN-NN FC-GS command
James Smart [Tue, 7 Apr 2015 19:07:18 +0000 (15:07 -0400)]
lpfc: Fix provide host name and OS name in RSNN-NN FC-GS command

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Parse the new 20G, 25G and 40G link speeds in the lpfc driver
James Smart [Tue, 7 Apr 2015 19:07:17 +0000 (15:07 -0400)]
lpfc: Parse the new 20G, 25G and 40G link speeds in the lpfc driver

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Add support for reporting option_rom_version on newer adapters
James Smart [Tue, 7 Apr 2015 19:07:16 +0000 (15:07 -0400)]
lpfc: Add support for reporting option_rom_version on newer adapters

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix setting of EQ (interrupt) delay Multiplier
James Smart [Tue, 7 Apr 2015 19:07:15 +0000 (15:07 -0400)]
lpfc: Fix setting of EQ (interrupt) delay Multiplier

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix host reset escalation killing all IOs.
James Smart [Tue, 7 Apr 2015 19:07:13 +0000 (15:07 -0400)]
lpfc: Fix host reset escalation killing all IOs.

Fix host reset escalation killing all IOs.

SLI-3 adapters will use a new host template. The template differs
from SLI-4 adapters in that it does not have an eh_host_reset_handler.

Lpfc has traditionally never had a host_reset. The host reset
handler was added when we ran into a stuck hardware condition on a
SLI-4 adapter. The host_reset will reset and reinit the pci function,
clearing the hardware condition.

Unfortunately, the host reset handler uses attach/detach code paths,
which makes scsi_add_host() and scsi_remove_host() calls. Meaning, a
host_reset will completely remove the scsi_host from the system. As a
new call to scsi_add_host() is made, the shost# changes, which results
in completely new scsi_devices and device names. All the older scsi
devices on the old shost# are now orphaned and unrecoverable.

We realize we need to re-implement the host_reset_handler so the scsi_host
stays registered across the host_reset, but that will be a rather
lengthy effort. In the short term, we had an immediate need to restore
the SLI-3 devices to their working behavior, with the easiest path being
to remove their host_reset handler.

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Linux lpfc driver doesn't re-establish the link after a cable pull on LPe12002
James Smart [Tue, 7 Apr 2015 19:07:12 +0000 (15:07 -0400)]
lpfc: Linux lpfc driver doesn't re-establish the link after a cable pull on LPe12002

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix to handle PLOGI when already logged in
James Smart [Tue, 7 Apr 2015 19:07:11 +0000 (15:07 -0400)]
lpfc: Fix to handle PLOGI when already logged in

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Add new mbx cmd recognition
James Smart [Tue, 7 Apr 2015 19:07:10 +0000 (15:07 -0400)]
lpfc: Add new mbx cmd recognition

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Add Lancer Temperature Event support to the lpfc driver
James Smart [Tue, 7 Apr 2015 19:07:09 +0000 (15:07 -0400)]
lpfc: Add Lancer Temperature Event support to the lpfc driver

This will detect and send an async event if overtemp is detected

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agolpfc: Fix the iteration count to match the 30 sec comment in the routine lpfc_pci_fun...
James Smart [Tue, 7 Apr 2015 19:07:08 +0000 (15:07 -0400)]
lpfc: Fix the iteration count to match the 30 sec comment in the routine lpfc_pci_function_reset

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi_transport_fc: Add support for 25Gbit speed
James Smart [Thu, 2 Apr 2015 19:50:52 +0000 (15:50 -0400)]
scsi_transport_fc: Add support for 25Gbit speed

Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: remove loop from aha1542_outb
Ondrej Zary [Fri, 6 Feb 2015 22:11:57 +0000 (23:11 +0100)]
aha1542: remove loop from aha1542_outb

The loop in aha1542_outb with double-check is no longer needed, remove it.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Fix bus reset
Ondrej Zary [Fri, 6 Feb 2015 22:11:56 +0000 (23:11 +0100)]
aha1542: Fix bus reset

Bus reset always fails because aha1542_reset waits for the controller to assert
the INIT bit (Mailbox Initialization Required) which it never does. This bit is
asserted only after host reset.

Remove the requirement for INIT bit (we really need only the IDLE bit).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: rework locking
Ondrej Zary [Fri, 6 Feb 2015 22:11:55 +0000 (23:11 +0100)]
aha1542: rework locking

Remove aha1542_lock and use host_lock instead.
Remove interrupt and queuecommand function wrappers.
Remove locking from lowlevel _out and _in functions, they now can
onle be called (at runtime) with host_lock being held.
Remove ssleep(4) in aha1542_reset as we can't sleep while holding a spinlock.
It's useless anyway as wait_mask will wait until the controller is idle and
kernel waits for 10 seconds (HOST_RESET_SETTLE_TIME) after that.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Don't reduce functionality with DEBUG enabled
Ondrej Zary [Fri, 6 Feb 2015 22:11:54 +0000 (23:11 +0100)]
aha1542: Don't reduce functionality with DEBUG enabled

Enabling DEBUG disables write commands and devices with ID > 1.
Remove this "feature" to allow real debugging.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Use print_hex_dump_bytes in debug code
Ondrej Zary [Fri, 6 Feb 2015 22:11:53 +0000 (23:11 +0100)]
aha1542: Use print_hex_dump_bytes in debug code

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: remove DEB macro and simplify debug code
Ondrej Zary [Fri, 6 Feb 2015 22:11:52 +0000 (23:11 +0100)]
aha1542: remove DEB macro and simplify debug code

Remove DEB macro and join ifdef DEBUG blocks

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Use shost_printk instead of printk
Ondrej Zary [Fri, 6 Feb 2015 22:11:51 +0000 (23:11 +0100)]
aha1542: Use shost_printk instead of printk

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Change aha1542_set_bus_times parameters
Ondrej Zary [Fri, 6 Feb 2015 22:11:50 +0000 (23:11 +0100)]
aha1542: Change aha1542_set_bus_times parameters

Pass struct Scsi_Host *sh and dma parameters instead of index to
aha1542_set_bus_times.
This is required for printk conversion.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Pass struct Scsi_Host * to functions
Ondrej Zary [Fri, 6 Feb 2015 22:11:49 +0000 (23:11 +0100)]
aha1542: Pass struct Scsi_Host * to functions

Pass struct Scsi_Host * to functions instead of base address.
This reduces the number of parameters and is also required for printk
conversion.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: cleanup includes
Ondrej Zary [Fri, 6 Feb 2015 22:11:48 +0000 (23:11 +0100)]
aha1542: cleanup includes

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: remove useless changelog
Ondrej Zary [Fri, 6 Feb 2015 22:11:47 +0000 (23:11 +0100)]
aha1542: remove useless changelog

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: fix include guard and remove useless changelog
Ondrej Zary [Fri, 6 Feb 2015 22:11:46 +0000 (23:11 +0100)]
aha1542: fix include guard and remove useless changelog

Fix include guard in header file and remove useless changelog

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Always name Scsi_Host variables sh
Ondrej Zary [Fri, 6 Feb 2015 22:11:45 +0000 (23:11 +0100)]
aha1542: Always name Scsi_Host variables sh

Make Scsi_Host variable names consistent - use sh everywhere.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1524: Use struct scsi_cmnd
Ondrej Zary [Fri, 6 Feb 2015 22:11:44 +0000 (23:11 +0100)]
aha1524: Use struct scsi_cmnd

Use struct scsi_cmnd instead of Scsi_Cmnd and also rename the variables
to get rid of SC prefix

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: clean up cmd variables
Ondrej Zary [Fri, 6 Feb 2015 22:11:43 +0000 (23:11 +0100)]
aha1542: clean up cmd variables

Make sure that there's no variable named cmd

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Simplify aha1542_biosparam
Ondrej Zary [Fri, 6 Feb 2015 22:11:42 +0000 (23:11 +0100)]
aha1542: Simplify aha1542_biosparam

Simplify aha1542_biosparam, use sector_div, remove unused BIOS_TRANSLATION_1632.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: rework configuration parameters
Ondrej Zary [Fri, 6 Feb 2015 22:11:41 +0000 (23:11 +0100)]
aha1542: rework configuration parameters

Remove __setup and introduce separate io, bus_on, bus_off and dma_speed
module parameters.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: rework hw_init
Ondrej Zary [Fri, 6 Feb 2015 22:11:40 +0000 (23:11 +0100)]
aha1542: rework hw_init

Cleanup hw_init, use goto for error handling.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Call wait_mask from aha1542_out
Ondrej Zary [Fri, 6 Feb 2015 22:11:39 +0000 (23:11 +0100)]
aha1542: Call wait_mask from aha1542_out

aha1542_out call is always followed by wait_mask.
Move the call into aha1542_out to simplify code.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: split out code from aha1542_hw_init
Ondrej Zary [Fri, 6 Feb 2015 22:11:38 +0000 (23:11 +0100)]
aha1542: split out code from aha1542_hw_init

Split out bus times related block of aha1542_hw_init into separate function
aha1542_set_bus_times.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Merge aha1542_host_reset and aha1542_bus_reset
Ondrej Zary [Fri, 6 Feb 2015 22:11:37 +0000 (23:11 +0100)]
aha1542: Merge aha1542_host_reset and aha1542_bus_reset

aha1542_host_reset and aha1542_bus_reset are almost same, merge them
into aha1542_reset

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Remove aha1542_restart
Ondrej Zary [Fri, 6 Feb 2015 22:11:36 +0000 (23:11 +0100)]
aha1542: Remove aha1542_restart

aha1542_restart does nothing (except useless printk), remove it

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: remove useless code from aha1542_test_port
Ondrej Zary [Fri, 6 Feb 2015 22:11:35 +0000 (23:11 +0100)]
aha1542: remove useless code from aha1542_test_port

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Remove unneeded gotos
Ondrej Zary [Fri, 6 Feb 2015 22:11:34 +0000 (23:11 +0100)]
aha1542: Remove unneeded gotos

Remove gotos that are no longer needed.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Split aha1542_out
Ondrej Zary [Fri, 6 Feb 2015 22:11:33 +0000 (23:11 +0100)]
aha1542: Split aha1542_out

aha1542_out are in fact two separate functions.
Split them into aha1542_out and aha1542_outb to simplify the code.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Unify aha1542_in and aha1542_in1
Ondrej Zary [Fri, 6 Feb 2015 22:11:32 +0000 (23:11 +0100)]
aha1542: Unify aha1542_in and aha1542_in1

Unify aha1542_in and aha1542_in1 functions, they differ only in timeout
and printk.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Remove WAIT and WAITd macros
Ondrej Zary [Fri, 6 Feb 2015 22:11:31 +0000 (23:11 +0100)]
aha1542: Remove WAIT and WAITd macros

Convert the ugly WAIT and WAITd macros into wait_mask function.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Use BIT() macro
Ondrej Zary [Fri, 6 Feb 2015 22:11:30 +0000 (23:11 +0100)]
aha1542: Use BIT() macro

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: remove empty aha1542_stat
Ondrej Zary [Fri, 6 Feb 2015 22:11:29 +0000 (23:11 +0100)]
aha1542: remove empty aha1542_stat

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Reorder functions to remove forward declarations
Ondrej Zary [Fri, 6 Feb 2015 22:11:28 +0000 (23:11 +0100)]
aha1542: Reorder functions to remove forward declarations

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Use u8 instead of unchar
Ondrej Zary [Fri, 6 Feb 2015 22:11:27 +0000 (23:11 +0100)]
aha1542: Use u8 instead of unchar

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Convert aha1542_intr_reset to function
Ondrej Zary [Fri, 6 Feb 2015 22:11:26 +0000 (23:11 +0100)]
aha1542: Convert aha1542_intr_reset to function

Convert aha1542_intr_reset macro to inline function

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Remove HOSTDATA macro
Ondrej Zary [Fri, 6 Feb 2015 22:11:25 +0000 (23:11 +0100)]
aha1542: Remove HOSTDATA macro

Remove HOSTDATA macro and use shost_priv instead

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Remove SCSI_BUF_PA, SCSI_SG_PA, AHA1542_SCATTER and AHA1542_CMDLUN
Ondrej Zary [Fri, 6 Feb 2015 22:11:24 +0000 (23:11 +0100)]
aha1542: Remove SCSI_BUF_PA, SCSI_SG_PA, AHA1542_SCATTER and AHA1542_CMDLUN

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: remove dead code
Ondrej Zary [Fri, 6 Feb 2015 22:11:23 +0000 (23:11 +0100)]
aha1542: remove dead code

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaha1542: Stop using scsi_module.c
Ondrej Zary [Fri, 6 Feb 2015 22:11:22 +0000 (23:11 +0100)]
aha1542: Stop using scsi_module.c

Convert aha1542 to use scsi_add_host instead of scsi_module.c
Use pnp_driver and isa_driver to manage cards.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: driver version change
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:32 +0000 (10:41 -0400)]
aacraid: driver version change

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: AIF raw device remove support
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:31 +0000 (10:41 -0400)]
aacraid: AIF raw device remove support

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: performance improvement changes
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:30 +0000 (10:41 -0400)]
aacraid: performance improvement changes

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: IOCTL fix
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:29 +0000 (10:41 -0400)]
aacraid: IOCTL fix

After getting the platform shutdown command "VM_CloseAll" response from the
firmware, driver was getting configuration IOCTL request from the upper layers
and it sends down to firmware. This causes firmware assert issue.

This patch fixes the firmware assert issue. During the shutdown, if driver
gets commands from the upper layer, driver sends error code to the upper
layers.

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: IOP RESET command handling changes
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:28 +0000 (10:41 -0400)]
aacraid: IOP RESET command handling changes

This patch fixes the IOP_RESET issue. Sending IOP_RESET command need to wait
for only 10 sec instead of 5 minutes in case of firmware does not response
IOP_RESET command.  Disable interrupt before setup interrupt routine to
prevent spurious interrupts.

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: 240 simple volume support
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:27 +0000 (10:41 -0400)]
aacraid: 240 simple volume support

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: vpd page code 0x83 support
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:26 +0000 (10:41 -0400)]
aacraid: vpd page code 0x83 support

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: MSI-x support
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:25 +0000 (10:41 -0400)]
aacraid: MSI-x support

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: 4KB sector support
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:24 +0000 (10:41 -0400)]
aacraid: 4KB sector support

Also fix up a name truncation problem

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: IOCTL pass-through command fix
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:23 +0000 (10:41 -0400)]
aacraid: IOCTL pass-through command fix

The Linux aacriad driver fails to detect the case of SG list count=0 on IOCTL
pass-through command and cause intermittent fault.  The result is the Linux
aacriad driver send down IOCTL pass-through command with one not initialized
SG list to firmware when receiving SG list count =0 on pass-through command.

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaacraid: AIF support for SES device add/remove
Mahesh Rajashekhara [Thu, 26 Mar 2015 14:41:22 +0000 (10:41 -0400)]
aacraid: AIF support for SES device add/remove

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: Driver version 2.6.1
Brian King [Thu, 26 Mar 2015 16:24:00 +0000 (11:24 -0500)]
ipr: Driver version 2.6.1

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: AF DASD raw mode implementation in ipr driver
Wen Xiong [Thu, 26 Mar 2015 16:23:58 +0000 (11:23 -0500)]
ipr: AF DASD raw mode implementation in ipr driver

This patch implements raw mode support for AF DASD in ipr driver
which allows for tools to send commands directly to physical
devices which are members of RAID arrays when enabled in the firmware.

[jejb: fix up whitespace]
Signed-off-by: Wen Xiong<wenxiong@linux.vnet.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: Re-enable write same
Brian King [Thu, 26 Mar 2015 16:23:56 +0000 (11:23 -0500)]
ipr: Re-enable write same

Re-enable write same support for ipr RAID adapters.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: Fix possible error path oops during initialization
Brian King [Thu, 26 Mar 2015 16:23:55 +0000 (11:23 -0500)]
ipr: Fix possible error path oops during initialization

Fixes a possible oops during adapter initialization in some
memory allocation failure error paths scenarios.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: Reset in task context
Brian King [Thu, 26 Mar 2015 16:23:52 +0000 (11:23 -0500)]
ipr: Reset in task context

The pci_set_pcie_reset_state has changed semantics to not be callable
from interrupt context, so change ipr's usage of the API to comply with
this change by ensuring this occurs from a workqueue.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoipr: Reboot speed improvements
Brian King [Thu, 26 Mar 2015 16:23:50 +0000 (11:23 -0500)]
ipr: Reboot speed improvements

Currently when performing a reboot with an ipr adapter,
the adapter gets shutdown completely, flushing all write
cache, as well as performing a full hardware reset of the card
during the shutdown phase of the old kernel. This ensures
the adapter is in a fully quiesced state across the reboot.

There are scenarios, however, such as when performing
kexec, where this full adapter shutdown is not required
and not desired, since it can make the reboot process take
noticeably longer.

This patch adds a module parameter to allow for skipping the
full shutdown during reboot. Rather than performing a full
adapter shutdown and reset, we simply cancel any outstanding
error buffers, place the adapter into a state where it has no
memory of any DMA addresses from the old kernel, then disable
the device. This significantly speeds up kexec boot, particularly
in configurations with multiple ipr adapters.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Set the tablesize based on the information given by the host
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:20 +0000 (00:27 -0700)]
scsi: storvsc: Set the tablesize based on the information given by the host

Set the tablesize based on the information given by the host.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Tested-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Don't assume that the scatterlist is not chained
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:19 +0000 (00:27 -0700)]
scsi: storvsc: Don't assume that the scatterlist is not chained

The current code assumes that the scatterlists presented are not chained.
Fix the code to not make this assumption.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Fix a bug in copy_from_bounce_buffer()
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:18 +0000 (00:27 -0700)]
scsi: storvsc: Fix a bug in copy_from_bounce_buffer()

We may exit this function without properly freeing up the maapings
we may have acquired. Fix the bug.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Retrieve information about the capability of the target
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:17 +0000 (00:27 -0700)]
scsi: storvsc: Retrieve information about the capability of the target

The storage protocol informs the guest of the I/O capabilities of the storage
stack. Retrieve this information and use it in the guest.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Always send on the selected outgoing channel
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:16 +0000 (00:27 -0700)]
scsi: storvsc: Always send on the selected outgoing channel

The current code always sent packets without data on the primary channel.
Properly distribute sending of packets with no data amongst all available
channels. I would like to thank Long Li for noticing this problem.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Size the queue depth based on the ringbuffer size
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:15 +0000 (00:27 -0700)]
scsi: storvsc: Size the queue depth based on the ringbuffer size

Size the queue depth based on the ringbuffer size. Also accommodate for the
fact that we could have multiple channels (ringbuffers) per adaptor.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoscsi: storvsc: Increase the ring buffer size
K. Y. Srinivasan [Fri, 27 Mar 2015 07:27:14 +0000 (00:27 -0700)]
scsi: storvsc: Increase the ring buffer size

Increase the default ring buffer size as this can significantly
improve performance especially on high latency storage back-ends.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
9 years agoaic7xxx: replace kmalloc/memset by kzalloc
Michael Opdenacker [Fri, 27 Mar 2015 00:51:46 +0000 (17:51 -0700)]
aic7xxx: replace kmalloc/memset by kzalloc

This replaces kmalloc + memset by a call to kzalloc

This also fixes one checkpatch.pl issue in the process.

This improvement was suggested by "make coccicheck"

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
9 years agoscsi: proper state checking and module refcount handling in scsi_device_get
Christoph Hellwig [Mon, 2 Feb 2015 13:01:26 +0000 (14:01 +0100)]
scsi: proper state checking and module refcount handling in scsi_device_get

This effectively reverts commits 85b6c7 ("[SCSI] sd: fix cache flushing on
module removal (and individual device removal)" and dc4515ea ("scsi: always
increment reference count").

We now never call scsi_device_get from the shutdown path, and the fact
that we started grabbing reference there in commit 85b6c7 turned out
turned out to create more problems than it solves, and required
workarounds for workarounds for workarounds. Move back to properly checking
the device state and carefully handle module refcounting.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>