Commit graph

287 commits

Author SHA1 Message Date
Sasikumar Chandrasekaran ede7c3ce82 scsi: megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid Controllers
Update Linux driver to use new pdTargetId field for JBOD target ID

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:46 -05:00
Sasikumar Chandrasekaran 3e5eadb1a8 scsi: megaraid_sas: Enable or Disable Fast path based on the PCI Threshold Bandwidth
Large SEQ IO workload should sent as non fast path commands

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:46 -05:00
Sasikumar Chandrasekaran 9581ebebbe scsi: megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers Capabilities
The Megaraid driver has to support the SAS3.5 Generic Megaraid Controllers Firmware functionality.

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:46 -05:00
Sasikumar Chandrasekaran d889344e4e scsi: megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers
SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to have different
sizes for different number of supported VDs.

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:46 -05:00
Sasikumar Chandrasekaran fdd84e2514 scsi: megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing
Detect sequential Write IOs and pass the hint that it is part of sequential
stream to help HBA Firmware do the Full Stripe Writes. For read IOs on
certain RAID volumes like Read Ahead volumes,this will help driver to
send it to Firmware even if the IOs can potentially be sent to
hardware directly (called fast path) bypassing firmware.

Design: 8 streams are maintained per RAID volume as per the combined
firmware/driver design. When there is no stream detected the LRU stream
is used for next potential stream and LRU/MRU map is updated to make this
as MRU stream. Every time a stream is detected the MRU map
is updated to make the current stream as MRU stream.

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:45 -05:00
Sasikumar Chandrasekaran 2493c67e51 scsi: megaraid_sas: 128 MSIX Support
SAS3.5 Generic Megaraid based Controllers will have the support for 128 MSI-X vectors,
resulting in the need to support 128 reply queues

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:45 -05:00
Sasikumar Chandrasekaran 45f4f2eb3d scsi: megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid Controllers
This patch contains new pci device ids for SAS3.5 Generic Megaraid Controllers

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:45 -05:00
Linus Torvalds 7c0f6ba682 Replace <asm/uaccess.h> with <linux/uaccess.h> globally
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
  sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-24 11:46:01 -08:00
Hannes Reinecke fad119b707 scsi: megaraid_sas: switch to pci_alloc_irq_vectors
[mkp: fixed bad indentation]

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-12-07 18:52:43 -05:00
Tomas Henzl 18103efcac scsi: megaraid-sas: request irqs later
It is not good when an irq arrives before driver structures are
allocated.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-11-16 20:19:29 -05:00
Colin Ian King 644da3c39a scsi: megaraid_sas: add in missing white spaces in error messages text
A couple of dev_printk messages spans two lines and the literal string
is missing a white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-11-14 18:27:01 -05:00
Kashyap Desai d0fc91d67c scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware
Until now the megaraid_sas driver has reported successful completion on
SYNCHRONIZE_CACHE commands without sending them down to the controller.
The controller firmware has been responsible for taking care of flushing
disk caches for all drives that belong to a Virtual Disk at the time of
system reboot/shutdown.

There may have been a reason to avoid sending SYNCHRONIZE_CACHE to a VD
in the past but that no longer appears to be valid.

Older versions of MegaRaid firmware (Gen2 and Gen2.5) set the WCE bit
for Virtual Disks but the firmware does not report correct completion
status for a SYNCHRONIZE_CACHE command. As a result, we must use another
method to identify whether it is safe to send the command to the
controller. We use the canHandleSyncCache firmware flag in the scratch
pad register at offset 0xB4.

New SYNCHRONIZE_CACHE behavior:

IF 'JBOD'

	Driver sends SYNCHRONIZE_CACHE command to the firmware
	Firmware sends SYNCHRONIZE_CACHE to drive
	Firmware obtains status from drive and returns same status back to driver

ELSEIF 'VirtualDisk'

	IF firmware supports new API bit called canHandleSyncCache
		Driver sends SYNCHRONIZE_CACHE command to the firmware
		Firmware does not send SYNCHRONIZE_CACHE to drives
		Firmware returns SUCCESS
	ELSE
		Driver does not send SYNCHRONIZE_CACHE command to the firmware
		Driver return SUCCESS for that command
	ENDIF
ENDIF

[mkp: edited patch description]

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-11-08 17:39:35 -05:00
Kashyap Desai a1dfd62c1e scsi: megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
This patch addresses the issue of driver firing DCMDs in PCI
shutdown/detach path irrespective of firmware state.  Driver will now
check whether firmware is in operational state or not before firing
DCMDs. If firmware is in unrecoverable state or does not become
operational within specfied time, driver will skip firing DCMDs.

[mkp: fixed typos]

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-11-08 17:29:57 -05:00
Kashyap Desai 1e793f6fc0 scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
Commit 02b01e010a ("megaraid_sas: return sync cache call with
success") modified the driver to successfully complete SYNCHRONIZE_CACHE
commands without passing them to the controller. Disk drive caches are
only explicitly managed by controller firmware when operating in RAID
mode. So this commit effectively disabled writeback cache flushing for
any drives used in JBOD mode, leading to data integrity failures.

[mkp: clarified patch description]

Fixes: 02b01e010a
CC: stable@vger.kernel.org
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-10-24 21:31:43 -04:00
Linus Torvalds 4dfddf5036 SCSI misc on 20161006
This update includes the usual round of major driver updates (hpsa, be2iscsi,
 hisi_sas, zfcp, cxlflash).  There's a new incarnation of hpsa called smartpqi
 for which a driver is added, there's some cleanup work of the ibm vscsi target
 and updates to libfc, plus a whole host of minor fixes and updates and finally
 the removal of several ISA drivers which seem not to have been used for years.
 
 Signed-off-by: James Bottomley <jejb@linux.vnet.ibm.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJX9fZGAAoJEAVr7HOZEZN4TfkP/2bOHBGqyQ16P9jRjWXtC6pJ
 Fp/ZfU6ZrSpcGN49Wr9vyPbpvYKdtIZg3oUs6XhKmnfP+lbeIIJ5jxlEnwBVwWya
 JOOD91o8lLN7zRMuyfYIfgnm4dIU3GSLpnWIyfAhoMH1utiLLcq7s2XEM5girDft
 dVUL20XprtJkVsg2C+hhRAI8PMjWFInadj2eRIHdxJIDC8fXR+w8ojBShou+lf6Q
 /zYPgckTCBlZWIc/ohI3j52r4qmkChgX+3/jR+v9i5bGXjFfpmh0GzxM7tscESSa
 4Y/ZLTg72j/colYkA1jt04YLxA2dQCa6b8DmJIcUTL0WStsJUQH5hFFFHt3mSafI
 HirqRfHpmadHbfi5Kiyx688S5b0oVN4bMxvMoEOAUy7WVaLEr84GJ5VYhoAwkPhL
 USaDx6Hsa1OT0lGYAtyRKOUT/d55grztEOnSxBFiQgRoB8wrGX616Xg8VONy7JZS
 wEZtf1v5K0+ZXJiu4NtY+/RzQdOwu7OQHKfN5mLri8tJ+eo8d88ZwSARJxEZetSM
 P4EVR2ZjhL+Ct78v3i4Yj8FVMXHSzzulj530KQ/U7z/l4c2S54mtEKijDmXmto8k
 baiIah/wgaS/fznoOsJw+Iy/2HqsAtNZsReNcgNPLzfabTBXKSBXJDLmO4d3g/3s
 zwj1m3JtzAx2j3kQrkSv
 =cyTO
 -----END PGP SIGNATURE-----

Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI updates from James Bottomley:
 "This update includes the usual round of major driver updates (hpsa,
  be2iscsi, hisi_sas, zfcp, cxlflash). There's a new incarnation of hpsa
  called smartpqi for which a driver is added, there's some cleanup work
  of the ibm vscsi target and updates to libfc, plus a whole host of
  minor fixes and updates and finally the removal of several ISA drivers
  which seem not to have been used for years"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (173 commits)
  scsi: mvsas: Mark symbols static where possible
  scsi: pm8001: Mark symbols static where possible
  scsi: arcmsr: Simplify user_len checking
  scsi: fcoe: fix off by one in eth2fc_speed()
  scsi: dtc: remove from tree
  scsi: t128: remove from tree
  scsi: pas16: remove from tree
  scsi: u14-34f: remove from tree
  scsi: ultrastor: remove from tree
  scsi: in2000: remove from tree
  scsi: wd7000: remove from tree
  scsi: scsi_dh_alua: Fix memory leak in alua_rtpg()
  scsi: lpfc: Mark symbols static where possible
  scsi: hpsa: correct call to hpsa_do_reset
  scsi: ufs: Get a TM service response from the correct offset
  scsi: ibmvfc: Fix I/O hang when port is not mapped
  scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up
  scsi: ipr: Remove redundant messages at adapter init time
  scsi: ipr: Don't log unnecessary 9084 error details
  scsi: smartpqi: raid bypass lba calculation fix
  ...
2016-10-07 09:28:53 -07:00
Baoyou Xie 2f3e77323d scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up
We get a few warnings when building kernel with W=1:
drivers/scsi/megaraid/megaraid_sas_fusion.c:281:1: warning: no previous prototype for 'megasas_free_cmds_fusion' [-Wmissing-prototypes]
drivers/scsi/megaraid/megaraid_sas_fusion.c:714:1: warning: no previous prototype for 'megasas_ioc_init_fusion' [-Wmissing-prototypes]
....

In fact, these functions are declared in
drivers/scsi/megaraid/megaraid_sas_base.c, but should be declared in a
header file, thus can be recognized in other file.

So this patch adds the declarations into
drivers/scsi/megaraid/megaraid_sas_fusion.h.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-09-19 11:59:32 -04:00
Colin Ian King 4086eae52b scsi: megaraid_sas: add in missing white space in error message text
A dev_printk message spans two lines and the literal string is missing a
white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-09-14 13:12:28 -04:00
Christophe JAILLET 51f9039ffd scsi: megaraid_sas: Fix the search of first memory bar
The 2nd parameter of 'find_first_bit' is the number of bits to search.
In this case, we are passing 'sizeof(unsigned long)' which is likely to
be 4.

It is likely that the number of bits in a long was expected here, so use
BITS_PER_LONG instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-08-30 22:22:52 -04:00
Markus Elfring 709ab231f8 scsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation
Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-08-23 22:46:58 -04:00
Yinghai Lu e7f851684e megaraid_sas: Fix probing cards without io port
Found one megaraid_sas HBA probe fails,

[  187.235190] scsi host2: Avago SAS based MegaRAID driver
[  191.112365] megaraid_sas 0000:89:00.0: BAR 0: can't reserve [io  0x0000-0x00ff]
[  191.120548] megaraid_sas 0000:89:00.0: IO memory region busy!

and the card has resource like,
[  125.097714] pci 0000:89:00.0: [1000:005d] type 00 class 0x010400
[  125.104446] pci 0000:89:00.0: reg 0x10: [io  0x0000-0x00ff]
[  125.110686] pci 0000:89:00.0: reg 0x14: [mem 0xce400000-0xce40ffff 64bit]
[  125.118286] pci 0000:89:00.0: reg 0x1c: [mem 0xce300000-0xce3fffff 64bit]
[  125.125891] pci 0000:89:00.0: reg 0x30: [mem 0xce200000-0xce2fffff pref]

that does not io port resource allocated from BIOS, and kernel can not
assign one as io port shortage.

The driver is only looking for MEM, and should not fail.

It turns out megasas_init_fw() etc are using bar index as mask.  index 1
is used as mask 1, so that pci_request_selected_regions() is trying to
request BAR0 instead of BAR1.

Fix all related reference.

Fixes: b6d5d8808b ("megaraid_sas: Use lowest memory bar for SR-IOV VF support")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-08-10 22:28:54 -04:00
Sumit Saxena d9083160c2 megaraid_sas: Do not fire MR_DCMD_PD_LIST_QUERY to controllers which do not support it
There was an issue reported by Lucz Geza on Dell Perc 6i. As per issue
reported, megaraid_sas driver goes into an infinite error reporting loop
as soon as there is a change in the status of one of the
arrays (degrade, resync online etc ).  Below are the error logs reported
continuously-

Jun 25 08:49:30 ns8 kernel: [  757.757017] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.778017] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.799017] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.820018] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.841018] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115

This issue is very much specific to controllers which do not support
DCMD- MR_DCMD_PD_LIST_QUERY.  In case of any hotplugging/rescanning of
drives, AEN thread will be scheduled by driver and fire DCMD-
MR_DCMD_PD_LIST_QUERY and if this DCMD is failed then driver will fail
this event processing and will not go ahead for further events. This
will cause infinite loop of same event getting retried infinitely and
causing above mentioned logs.

Fix for this problem is: not to fire DCMD MR_DCMD_PD_LIST_QUERY for
controllers which do not support it and send DCMD SUCCESS status to AEN
function so that it can go ahead with other event processing.

Reported-by: Lucz Geza <geza@lucz.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-07-13 22:28:56 -04:00
Andy Lutomirski 13f307711b megaraid_sas: Downgrade two success messages to info
I actually read the error messages in my logs, and successful
initialization is not an error.

Arguably these log lines could be deleted entirely.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-05-05 21:03:52 -04:00
Sumit Saxena bd23d4abe5 megaraid_sas: task management code optimizations
This patch will do code optmization for task management functions.
Below are key changes:

1. Remove reset_device hook as it was not being used and driver was
setting this to NULL.

2. Create wrapper functions for task abort and target reset and inside
   these functions adapter specific calls be made. e.g. fusion adapters
   support task abort and target reset so task abort and target reset
   should be issued to fusion adapters only and for MFI adapters, print
   a message saying feature not supported.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-04-15 16:53:21 -04:00
Sumit Saxena c3e385a1b9 megaraid_sas: reduce memory footprints in kdump mode
This patch will reduce memory footprints of megaraid_sas driver when
booted in kdump mode.  Driver will not allocate memory for optional and
perfromance oriented features.  Below are key changes done in
megaraid_sas driver to do this:

1. Limit Controller's queue depth to 100 in kdump mode.

2. Do not allocate memory for system info buffer and PD info buffer.

3. Disable performance oriented features e.g. Disable RDPQ mode, disable
   dual queue depth, restrict to single MSI-x vector.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-04-15 16:53:20 -04:00
Arnd Bergmann 3deb9438d3 megaraid_sas: add missing curly braces in ioctl handler
gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl
function:

drivers/scsi/megaraid/megaraid_sas_base.c: In function 'megasas_mgmt_fw_ioctl':
drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
    kbuff_arr[i] = NULL;
    ^~~~~~~~~
drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if' clause, but it is not
   if (kbuff_arr[i])
   ^~

The code is actually correct, as there is no downside in clearing a NULL
pointer again.

This clarifies the code and avoids the warning by adding extra curly
braces.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 90dc9d98f0 ("megaraid_sas : MFI MPT linked list corruption fix")
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-03-18 15:22:55 -04:00
Sumit Saxena 3084558658 megaraid_sas: Don't issue kill adapter for MFI controllers in case of PD list DCMD failure
There are few MFI adapters which do not support MR_DCMD_PD_LIST_QUERY so
if MFI adapters fail this DCMD, it should not be considered as FATAL and
driver should not issue kill adapter and set per controller's instance
variable- pd_list_not_supported so that same variable can be used inside
functions- slave_alloc and slave_configure to allow firmware scan.

Killing adapter because of DCMD failure when this DCMD is not supported
causes driver's probe getting failed. This issue got introduced by
commit 6d40afbc7d ("megaraid_sas: MFI IO timeout handling").

Killing adapter in case of this DCMD failure should be limited to Fusion
adapters only. Per controller's instance variable allow_fw_scan is
removed as pd_list_not_supported better reflect the purpose.

Fixes: 6d40afbc7d
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-03-10 20:25:31 -05:00
Tomas Henzl b99dbe56d5 megaraid_sas: Add an i/o barrier
A barrier should be added to ensure proper ordering of memory mapped
writes.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com>
Acked-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena ea1c928bb6 megaraid_sas: Fix SMAP issue
Inside compat IOCTL hook of driver, driver was using wrong address of
ioc->frame.raw which leads sense_ioc_ptr to be calculated wrongly and
failing IOCTL.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 8f67c8c518 megaraid_sas: Fix for IO failing post OCR in SRIOV environment
Driver assumes that VFs always have peers present whenever they have
same LD IDs. But this is not the case.  This patch handles the above
mentioned by explicitly checking for a peer before making HA/non-HA path
decision.

Signed-off-by: Uday Lingala <uday.lingala@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Maurizio Lombardi 546e559c79 megaraid: fix null pointer check in megasas_detach_one().
The pd_seq_sync pointer can't be NULL, we have to check its entries
instead.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena e3d178ca77 megaraid_sas: Introduce module parameter for SCSI command timeout
This patch will introduce module-parameter for SCSI command timeout
value and fix setting of resetwaittime beyond a value.

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: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena ccc7507de2 megaraid_sas: MFI adapter OCR changes
Optimized MFI adapters' OCR path, particularly
megasas_wait_for_outstanding() function.

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: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 8a01a41d86 megaraid_sas: Make adprecovery variable atomic
Make instance->adprecovery variable atomic and removes hba_lock spinlock
while accessing instance->adprecovery.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 308ec459bc megaraid_sas: Dual queue depth support
1. For iMR controllers, firmware will report two queue depths:

   - Controller-wide queue depth
   - LDIO queue depth (240)

Controller-wide queue depth will be greater among the two. Using this
new feature, iMR can provide larger Queue depth(QD) for JBOD and limited
QD for Virtual Disk(VD).

2. megaraid_sas driver will throttle read/write LDIOs based on "LDIO
Queue Depth".

3. Dual queue depth can be enabled/disabled via module parameter. It is
enabled by default if the firmware supports it. Only specific firmware
builds will enable the feature.

4. Added sysfs parameter "ldio_outstanding" which permits querying the
number of outstanding LDIO requests at runtime.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena f9a9dee6a1 megaraid_sas: Code optimization build_and_issue_cmd return-type
build_and_issue_cmd should return SCSI_MLQUEUE_HOST_BUSY for a few error
cases instead of returning 1.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 179ac14291 megaraid_sas: Reply Descriptor Post Queue (RDPQ) support
This patch will create a reply queue pool for each MSI-X index and will
provide an array of base addresses instead of the single address of
legacy mode. Using this new interface the driver can support higher
queue depths through scattered DMA pools.

If array mode is not supported driver will fall back to the legacy
method of reply pool allocation. This limits controller queue depth to
1K max. To enable a queue depth of more than 1K driver requires firmware
to support array mode and scratch_pad3 will provide the new queue depth
value.

When RDPQ is used, downgrading to an older firmware release should not
be permitted. This may cause firmware fault and is not supported.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 2216c30523 megaraid_sas: Update device queue depth based on interface type
This patch will update device Queue depth based on interface type(SAS,
SATA..) for sysPDs.  For Virtual disks(VDs), there will be no change in
queue depth (will remain 256).  To fetch interface type (SAS or SATA or
FC..) of syspD, driver will send DCMD MR_DCMD_PD_GET_INFO.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 18365b1385 megaraid_sas: Task management support
This patch adds task management for SCSI commands. Added functions are
task abort and target reset.

1. Currently, megaraid_sas driver performs controller reset when any IO
times out.  With task management support added, task abort and target
reset will be tried to recover timed out IO. If task management fails,
then controller reset will be performaned. If the task management
request times out, fail the request and escalate to the next
level (controller reset).

2. mr_device_priv_data will be allocated for all generations of
controller, but is_tm_capable flag will never be set for
controllers (prior to Invader series) as firmware support is not
available for task management.

3. Task management capable firmware will set is_tm_capable flag in
firmware API.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 6d40afbc7d megaraid_sas: MFI IO timeout handling
This patch will do proper error handling for DCMD timeout failure cases
for Fusion adapters:

1. For MFI adapters, in case of DCMD timeout (DCMD which must return
SUCCESS) driver will call kill adapter.

2. What action needs to be taken in case of DCMD timeout is decided by
function dcmd_timeout_ocr_possible().  DCMD timeout causing OCR is
applicable to the following commands:

	MR_DCMD_PD_LIST_QUERY
	MR_DCMD_LD_GET_LIST
	MR_DCMD_LD_LIST_QUERY
	MR_DCMD_CTRL_SET_CRASH_DUMP_PARAMS
	MR_DCMD_SYSTEM_PD_MAP_GET_INFO
	MR_DCMD_LD_MAP_GET_INFO

3. If DCMD fails from driver init path there are certain DCMDs which
must return SUCCESS. If those DCMDs fail, driver bails out. For optional
DCMDs like pd_info etc., driver continues without executing certain
functionality.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
Sumit Saxena 11c71cb4ab megaraid_sas: Do not allow PCI access during OCR
This patch will do synhronization between OCR function and AEN function
using "reset_mutex" lock.  reset_mutex will be acquired only in the
first half of the AEN function which issues a DCMD. Second half of the
function which calls SCSI API (scsi_add_device/scsi_remove_device)
should be out of reset_mutex to avoid deadlock between scsi_eh thread
and driver.

During chip reset (inside OCR function), there should not be any PCI
access and AEN function (which is called in delayed context) may be
firing DCMDs (doing PCI writes) when chip reset is happening in parallel
which will cause FW fault. This patch will solve the problem by making
AEN thread and OCR thread mutually exclusive.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-02-23 21:27:02 -05:00
James Bottomley febdfbd213 SCSI queue for 4.4.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIVAwUAVkP2pu7pYBp1xd49AQL+dg/6Atk5KH17IKE+SGIAaIqS9rhckwqOB6qK
 7pT5gbvuyA8nB4eXUFPFk6VejYa6PdHL5wVf7a2w9pPJAoIogTkiYb9PvlRLbzBB
 OrBFfm8h00psQd8YpzEAIdPvVQGsR/OTqYVMXnrNN0pra81iFWwaiB5QcJukadYl
 +0d/2wJnw4887ZReO/51n9fJkPwIvs+jtCj7k36yX9NL9SRm8s/JlH3aVGRSzIBy
 ip7ahtdcw7ncqXCWJVzQ1HCdEiwcWkbMNI8gTFpJ4V5GR6A1ZkN+jNn88C/f5qQF
 1uAsIBy9B99mU5Rz7Vrbl8710DjT2SkVgQ43rC54MzszTuj34y4GNS+sCZyTfzFG
 vnEVWyX7Jzg1SLbp8KxjhhCrhegG8vXnyr6RJDfEzHsUHLxbnMKNGclDOny5NG4n
 TmXGFTfDKBVcHwFLOwwKXsjKicyirBDIRb2eKnqC0j56kFNQp9pWhFA62Xi/AOe6
 vqMj2I2t30za5X3iZv5XEvhv63fFMx2nflcYIA+rCqq1AMaC7T0X170czKb5g1v+
 aSZZ0qCFhMFUWETlHjOQSbHkZ6fsWJlgaPZS0ODsiGrbxXPtrHXH1lbLAh6ECveu
 O8dYKqC2kJbBoolqD2e59z1fQ6cW45sUHxiDjaeqgTlexwVEy25+t8uIBPUnRNwI
 1YTHKn3U+ug=
 =g6ZL
 -----END PGP SIGNATURE-----

Merge tag '4.4-scsi-mkp' into misc

SCSI queue for 4.4.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-11-12 07:06:18 -05:00
Christoph Hellwig 64d513ac31 scsi: use host wide tags by default
This patch changes the !blk-mq path to the same defaults as the blk-mq
I/O path by always enabling block tagging, and always using host wide
tags.  We've had blk-mq available for a few releases so bugs with
this mode should have been ironed out, and this ensures we get better
coverage of over tagging setup over different configs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-11-09 17:11:57 -08:00
Sumit Saxena aed335eecf megaraid_sas: Make tape drives visible on PERC5 controllers
The DELL PERC5 controller firmware does not list tape drives in response
to MR_DCMD_PD_LIST_QUERY. This causes tape drives not be exposed to the
OS when connected to a PERC5 controller.

This patch permits detection of tape drives connected to a PERC5
controller by exposing non-TYPE_DISK devices unconditionally.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-11-09 11:06:12 -05:00
sumit.saxena@avagotech.com 323c4a02c6 megaraid_sas : SMAP restriction--do not access user memory from IOCTL code
This is an issue on SMAP enabled CPUs and 32 bit apps running on 64 bit
OS. Do not access user memory from kernel code. The SMAP bit restricts
accessing user memory from kernel code.

Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-11-02 22:56:13 -05:00
sumit.saxena@avagotech.com 0b48d12d03 megaraid_sas: Make PI enabled VD 8 byte DMA aligned
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:31:33 -04:00
sumit.saxena@avagotech.com 91626c2701 megaraid_sas: Initialize tasklet before setting up IRQs
It may happen (kdump), that an interrupt is invoked just after the
setup_irqs function was called but before the tasklet was initialised.
At this phase the hw ints should have been disabled, but for unknown
reason this mechanism seems to not work properly.

From: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:29:49 -04:00
sumit.saxena@avagotech.com 3222251dbb megaraid_sas: Indicate online firmware upgrade support for Secure JBOD feature
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:28:12 -04:00
sumit.saxena@avagotech.com c4bd265415 megaraid_sas: Update OCR capability on controller properties change
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:23:42 -04:00
sumit.saxena@avagotech.com 357ae967ad megaraid_sas: Do not use PAGE_SIZE for max_sectors
Do not use PAGE_SIZE marco to calculate max_sectors per I/O
request. Driver code assumes PAGE_SIZE will be always 4096 which can
lead to wrongly calculated value if PAGE_SIZE is not 4096. This issue
was reported in Ubuntu Bugzilla Bug #1475166.

Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:20:23 -04:00
sumit.saxena@avagotech.com 7364d34b87 megaraid_sas: Support for Cutlass (12 Gbps) controller
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:18:07 -04:00
sumit.saxena@avagotech.com 90c204bc59 megaraid_sas: Support for Intruder (12 Gbps) controller
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:16:33 -04:00
sumit.saxena@avagotech.com 5a8cb85b56 megaraid_sas: Remove PCI id checks
Remove PCI id based checks and use instance->ctrl_context to decide
whether controller is MFI-based or a Fusion adapter. Additionally,
Fusion adapters are divided into two categories: Thunderbolt and
Invader.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:14:54 -04:00
sumit.saxena@avagotech.com 0d5b47a724 megaraid_sas: Expose TAPE drives unconditionally
Expose non-disk (TAPE drive, CD-ROM) unconditionally.

Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 03:05:11 -04:00
sumit.saxena@avagotech.com 92bb650578 megaraid_sas: Code refactor for use of requestorId
Some of these code changes were proposed by David Binderman.

Removed redudant check of requestorId. Redundant condition:
instance.requestorId. Check for plasma firmware 1.11 are now
restructured to support only specific device id.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 00:36:58 -04:00
sumit.saxena@avagotech.com 714f517745 megaraid_sas: Print critical firmware event messages
Print firmware events in human-readable form. This will help users track
any critical firmware events without special application support.

Sample syslogd output:

megaraid_sas 0000:02:00.0: 8619 (491648347s/0x0020/WARN) - Controller temperature threshold exceeded. This may indicate inadequate system cooling. Switching to low performance mode.

The format of logged events is:

"<pci_dev_id>: <sequence_number> (<timestamp>/<locale>/<class>) - <description>"

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 00:30:54 -04:00
sumit.saxena@avagotech.com 3761cb4cf6 megaraid_sas: JBOD sequence number support
Implemented JBOD map which will provide quick access for JBOD path and
also provide sequence number.  This will help hardware to fail command
to the FW in case of any sequence mismatch.

Fast Path I/O for JBOD will refer JBOD map (which has sequence number
per JBOD device) instead of RAID map.  Previously, the driver used RAID
map to get device handle for fast path I/O and this not have sequence
number information. Now, driver will use JBOD map instead.  As part of
error handling, if JBOD map is failed/not supported by firmware, driver
will continue using legacy behavior.

Now there will be three IO paths for JBOD (syspd):

 - JBOD map with sequence number (Fast Path)
 - RAID map without sequence number (Fast Path)
 - FW path via h/w exception queue deliberately setup devhandle
   0xFFFF (FW path).

Relevant data structures:

 - Driver send new DCMD MR_DCMD_SYSTEM_PD_MAP_GET_INFO for this purpose.
 - struct MR_PD_CFG_SEQ- This structure represent map of single physical
   device.
 - struct MR_PD_CFG_SEQ_NUM_SYNC- This structure represent whole JBOD
   map in general(size, count of sysPDs configured, struct MR_PD_CFG_SEQ
   of syspD with 0 index).
 - JBOD sequence map size is: sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC)
   + (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1)) which
   is allocated while setting up JBOD map at driver load time.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Martin Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 00:24:17 -04:00
sumit.saxena@avagotech.com e0bd0874f2 megaraid_sas: Increase timeout to 60 secs for abort frames during shutdown
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Martin Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-10-29 00:19:47 -04:00
Bjorn Helgaas da0dc9fb4e megaraid_sas: fix whitespace errors
Fix whitespace and indentation errors.  No code change.

[jejb: checkpatch fixes]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-08-26 07:36:51 -07:00
Bjorn Helgaas 1be1825453 megaraid_sas: use dev_printk when possible
Use dev_printk() when possible to make messages more useful.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-08-26 07:33:39 -07:00
Linus Torvalds acd53127c4 SCSI misc on 20150622
This is the usual grab bag of driver updates (lpfc, hpsa,
 megaraid_sas, cxgbi, be2iscsi) plus an assortment of minor updates.
 There are also one new driver: the Cisco snic; the advansys driver has
 been rewritten to get rid of the warning about converting it to the
 DMA API, the tape statistics patch got in and finally, there's a
 resuffle of SCSI header files to separate more cleanly initiator from
 target mode (and better share the common definitions).
 
 Signed-off-by: James Bottomley <JBottomley@Odin.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABAgAGBQJViKWdAAoJEDeqqVYsXL0MAr8IAMmlA6HBVjMJJFCEOY9corHj
 e70MNQa7LUgf+JCdOtzGcvHXTiFFd4IHZAwXUJAnsC4IU2QWEfi1bjUTErlqBIGk
 LoZlXXpEHnFpmWot3OluOzzcGcxede8rVgPiKWVVdojIngBC2+LL/i2vPCJ84ri9
 WCVlk6KBvWZXuU6JuOKAb2FO9HOX7Q61wuKAMast2Qc6RNc2ksgc7VbstsITqzZ9
 FVEsjmQ5lqUj+xdxBpiUOdUpc22IJ4VcpBgQ2HrThvg6vf4aq937RJ/g4vi/g0SU
 Utk0a3bUw1H/WnYAfJVFx83nVEsS/954Z7/ERDg1sjlfLYwQtQnpov0XIbPIbZU=
 =k9IT
 -----END PGP SIGNATURE-----

Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI updates from James Bottomley:
 "This is the usual grab bag of driver updates (lpfc, hpsa,
  megaraid_sas, cxgbi, be2iscsi) plus an assortment of minor updates.

  There is also one new driver: the Cisco snic.  The advansys driver has
  been rewritten to get rid of the warning about converting it to the
  DMA API, the tape statistics patch got in and finally, there's a
  resuffle of SCSI header files to separate more cleanly initiator from
  target mode (and better share the common definitions)"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (156 commits)
  snic: driver for Cisco SCSI HBA
  qla2xxx: Fix indentation
  qla2xxx: Comment out unreachable code
  fusion: remove dead MTRR code
  advansys: fix compilation errors and warnings when CONFIG_PCI is not set
  mptsas: fix depth param in scsi_track_queue_full
  megaraid: fix irq setup process regression
  lpfc: Update version to 10.7.0.0 for upstream patch set.
  lpfc: Fix to drop PLOGIs from fabric node till LOGO processing completes
  lpfc: Fix scsi task management error message.
  lpfc: Fix cq_id masking problem.
  lpfc: Fix scsi prep dma buf error.
  lpfc: Add support for using block multi-queue
  lpfc: Devices are not discovered during takeaway/giveback testing
  lpfc: Fix vport deletion failure.
  lpfc: Check for active portpeerbeacon.
  lpfc: Update driver version for upstream patch set 10.6.0.1.
  lpfc: Change buffer pool empty message to miscellaneous category
  lpfc: Fix incorrect log message reported for empty FCF record.
  lpfc: Fix rport leak.
  ...
2015-06-23 15:55:44 -07:00
Linus Torvalds cb8a4deaf9 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "As usual, mostly comment, kerneldoc and printk() fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  lpfc: Grammar s/an negative/a negative/
  ARM: lib/lib1funcs.S: fix typo s/substractions/subtractions/
  cx25821: cx25821-medusa-reg.h: fix 0x0x prefix
  lib: crc-itu-t.[ch] fix 0x0x prefix in integer constants
  rapidio: Fix kerneldoc and comment
  qla4xxx: Fix printk() in qla4_83xx_read_reset_template() and qla4_83xx_pre_loopback_config()
  treewide: Kconfig: fix wording / spelling
  usb/serial: fix grammar in Kconfig help text for FTDI_SIO
  megaraid_sas: fix kerneldoc
  netfilter: ebtables: fix comment grammar
  drm/radeon: fix comment
  isdn: fix grammar in comment
  ARM: KVM: fix comment
2015-06-23 14:08:54 -07:00
Tomas Henzl 258c3af2b9 megaraid: fix irq setup process regression
This fixes a regression caused by commit
d3557fc8be 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>
2015-06-13 08:32:30 -07:00
Sumit.Saxena@avagotech.com 2be2a98845 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>
2015-06-01 07:32:42 -07:00
Geert Uytterhoeven 4b63b2861e megaraid_sas: fix kerneldoc
Fix typo in kerneldoc identifier.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Cc: James E.J. Bottomley <JBottomley@parallels.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-05-26 15:12:33 +02:00
Christoph Hellwig a9555534d5 megaraid_sas : swap whole register in megasas_register_aen
Swap the whole 32 bits we read from the hardware instead of swapping
just the 16bits we care about in place later.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:31 -07:00
Christoph Hellwig 2213a4673e megaraid_sas : add missing byte swaps to the sriov code
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:31 -07:00
Christoph Hellwig 48100b0ed0 megaraid_sas : move endianness conversion into caller of megasas_get_seq_num
Converting structure fields in place is always a bad idea, and in this case
by moving it into the only caller we also only have to do a single byte
swap as most fields of this structure are never used.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:30 -07:00
Christoph Hellwig c6f5bf814f megaraid_sas : add endianness conversions for all ones
Add noop conversions for all ones to make sparse happy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:30 -07:00
Christoph Hellwig 9ab9ed38f6 megaraid_sas : add endianness annotations
This adds endianness annotations to all data structures, and a few
variables directly referencing them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:30 -07:00
Christoph Hellwig 8a232bb399 megaraid_sas : add missing __iomem annotations
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:29 -07:00
kbuild test robot 6a6981fea3 megaraid_sas : megasas_complete_outstanding_ioctls() can be static
drivers/scsi/megaraid/megaraid_sas_base.c:1701:6: sparse: symbol 'megasas_complete_outstanding_ioctls' was not declared. Should it be static?
From: Christoph Hellwig <hch@lst.de>

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:29 -07:00
Sumit.Saxena@avagotech.com 5765c5b8b3 megaraid_sas : Support for Avago's Single server High Availability product
This patch will add support for Single Server High Availability(SSHA) cluster
support.  Here is the short decsription of changes done to add support for
SSHA-

1) Host will send system's Unique ID based on DMI_PRODUCT_UUID to firmware.
2) Toggle the devhandle in LDIO path for Remote LDs.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:29 -07:00
Sumit.Saxena@avagotech.com 09fced1917 megaraid_sas : Add release date and update driver version
This patch will upgrade the driver version and add back the release date and
sysfs hook for the same.  Some internal applications uses sysfs parameter for
release date, so they were broken because of removal of release date from
sysfs.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:28 -07:00
Sumit.Saxena@avagotech.com 43cd7fe495 megaraid_sas : Modify driver's meta data to reflect Avago
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:28 -07:00
Sumit.Saxena@avagotech.com 4026e9aac3 megaraid_sas : Use Block layer tag support for internal command indexing
megaraid_sas driver will use block layer provided tag for indexing internal
MPT frames to get any unique MPT frame tied with tag.  Each IO request
submitted from SCSI mid layer will get associated MPT frame from MPT framepool
(retrieved and return back using spinlock inside megaraid_sas driver's
submission/completion call back). Getting MPT frame from MPT Frame pool is
very expensive operation because of associated spin lock operation (spinlock
overhead increase on multi NUMA node). This type of locking in driver is very
expensive call considering each IO request need - Acquire and Release of the
same lock.

With this support, in IO path driver will directly provide the unique command
index(which is based on block layer tag) and will get the MPT frame tied to
the tag and this way driver can get rid off lock, which synchronizes the
access to MPT frame pool while fetching and returning MPT frame from the pool.

This support in driver provides siginificant performance improvement(on multi
NUMA node system)on latest upstream with SCSI.MQ as well as on existing linux
distributions.

Here is the data for test executed at Avago-
- IO Tool- FIO
- 4 Socket SMC server. (4 NUMA node server)
- 12 SSDs in JBOD mode .
- 4K Rand READ, QD=32
- SCSI MQ x86_64 (Latest Upstream kernel)
- upto 300% Performance Improvement.

If IOs are running on single Node, perfromance gain is less, but as soon as
increase number of nodes, performance improvement is significant. IOs running
on all 4 NUMA nodes, with this patch applied IOPs observed was 1170K vs 344K
IOPs seen without this patch.

Logically, there are two parts of this patch- 1) Block layer tag support 2)
changes in calling convention of return_cmd.  part 2 will revert the changes
done by patch- 90dc9d9 megaraid_sas : MFI MPT linked list corruption fix
because changes done in part 1 has fixed the problem of MFI MPT linked list
corruption. part 2 is very much dependent on part 1, so we decided to have
single patch for these two logical changes.

[jejb: remove chatty printk pointed out by hch]
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:28 -07:00
Sumit.Saxena@avagotech.com d88da09a53 megaraid_sas : Enhanced few prints
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:28 -07:00
Sumit.Saxena@avagotech.com f26ac3a1a5 megaraid_sas : Move controller's queue depth calculation in adapter specific function
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:27 -07:00
Sumit.Saxena@avagotech.com 4a5c814d93 megaraid_sas : Add separate functions for building sysPD IOs and non RW LDIOs
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:27 -07:00
Sumit.Saxena@avagotech.com d3557fc8be megaraid_sas : Add separate function for setting up IRQs
This patch will create separate functions for- 1) setting up IRQs for MSI-x
interrupts 2) setting up IRQs for legacy interrupts 3) freeing up IRQs.  and
enable interrupts after adapter's initialization. The reason behind
initialising adapter earlier is: by that time firmware is operational and can
send interrupts, so better to use interrupt based interface to send internal
DCMD to firmware instead of using polling method, since MFI frames' pool size
is reduced and polling method does not free up MFI frame for fusion adapters,
so sending more DCMDs with polled method may cause MFI frames's pool go out of
frames and end up failing DCMD.

Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-05-25 08:46:26 -07:00
Sumit.Saxena@avagotech.com 1aecbc8d67 megaraid_sas: remove redundant memset call
struct fusion_context *fusion is already memset to '0', so remove a
redundant call to memmset "fusion->load_balance_info" to '0'.

Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09 15:44:37 +01:00
Sumit.Saxena@avagotech.com ae09a6c1fd megaraid_sas: reserve commands for IOCTLs and internal DCMDs
1) For fusion adapters, limit reserved frames for non SCSI commands to 8
   (3 for parallel IOCTLs + 5 for driver's internal DCMDs).
   Earlier reserved commands for non SCSI IO frames was set to 32, so with
   this implementation, increased per controller "can_queue".
   Behavior of MFI controllers will remain unchanged.

2) Optimize the code related to per controller's 'can_queue' setting.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09 15:44:36 +01:00
Sumit.Saxena@avagotech.com c8dd61eff2 megaraid_sas: complete outstanding IOCTLs before killing adapter
Driver calls megasas_complete_cmd() to call wake_up() for each MFI frame
that was issued through the ioctl() interface prior to the kill adapter.
This ensures userspace ioctl() system calls issued just before a kill
adapter don't get stuck in wait state and IOCTLs are returned to
the application.

Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09 15:44:36 +01:00
Sumit.Saxena@avagotech.com 7497cde883 megaraid_sas: add support for secure JBOD
This patch adds support for Secure Encrypting Drives (SED) in JBOD mode:

1) If the firmware supports SED JBOD, all non read/write commands to JBODs
   will be sent via firmware path, and read/write commands to JBODs will
   be sent via fastpath.
2) If the firmware does not support SED JBOD, driver will fall back to the
   old design, i.e. send all JBOD I/O via fastpath.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09 15:44:34 +01:00
Sumit.Saxena@avagotech.com 200aed582d megaraid_sas: endianness related bug fixes and code optimization
This patch addresses below issues:

1) Few endianness bug fixes.
2) Break the iteration after (MAX_LOGICAL_DRIVES_EXT - 1)),
   instead of MAX_LOGICAL_DRIVES_EXT.
3) Optimization in MFI INIT frame before firing.
4) MFI IO frame should be 256bytes aligned.  Code is optimized to reduce
   the size of frame for fusion adapters and make the MFI frame size
   calculation a bit transparent and readable.

Cc: <stable@vger.kernel.org>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2015-01-09 15:44:33 +01:00
Linus Torvalds a7cb7bb664 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree update from Jiri Kosina:
 "Usual stuff: documentation updates, printk() fixes, etc"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (24 commits)
  intel_ips: fix a type in error message
  cpufreq: cpufreq-dt: Move newline to end of error message
  ps3rom: fix error return code
  treewide: fix typo in printk and Kconfig
  ARM: dts: bcm63138: change "interupts" to "interrupts"
  Replace mentions of "list_struct" to "list_head"
  kernel: trace: fix printk message
  scsi: mpt2sas: fix ioctl in comment
  zbud, zswap: change module author email
  clocksource: Fix 'clcoksource' typo in comment
  arm: fix wording of "Crotex" in CONFIG_ARCH_EXYNOS3 help
  gpio: msm-v1: make boolean argument more obvious
  usb: Fix typo in usb-serial-simple.c
  PCI: Fix comment typo 'COMFIG_PM_OPS'
  powerpc: Fix comment typo 'CONIFG_8xx'
  powerpc: Fix comment typos 'CONFiG_ALTIVEC'
  clk: st: Spelling s/stucture/structure/
  isci: Spelling s/stucture/structure/
  usb: gadget: zero: Spelling s/infrastucture/infrastructure/
  treewide: Fix company name in module descriptions
  ...
2014-12-12 10:08:06 -08:00
Christoph Hellwig db5ed4dfd5 scsi: drop reason argument from ->change_queue_depth
Drop the now unused reason argument from the ->change_queue_depth method.
Also add a return value to scsi_adjust_queue_depth, and rename it to
scsi_change_queue_depth now that it can be used as the default
->change_queue_depth implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2014-11-24 14:45:27 +01:00
Christoph Hellwig 1e6f241604 scsi: don't allow setting of queue_depth bigger than can_queue
We won't ever queue more commands than the host allows.  Instead of
letting drivers either reject or ignore this case handle it in
common code.  Note that various driver use internal constant or
variables that are assigned to both shost->can_queue and checked
in ->change_queue_depth - I did remove those checks as well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
2014-11-24 14:45:26 +01:00
Sumit.Saxena@avagotech.com aa00832b4c megaraid_sas: do not process IOCTLs and SCSI commands during driver removal
Do not process any SCSI and IOCTL command further (return them with
appropriate return values to callers), while driver removal is in
progress or PCI shutdown is invoked.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-11-24 14:39:01 +01:00
Sumit.Saxena@avagotech.com 170c238701 megaraid_sas: corrected return of wait_event from abort frame path
Corrected wait_event() call which was waiting for wrong completion
status (0xFF).

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-11-24 14:38:53 +01:00
Sumit.Saxena@avagotech.com d009b5760f megaraid_sas: online Firmware upgrade support for Extended VD feature
In OCR (Online Controller Reset) path, driver sets adapter state to
MEGASAS_HBA_OPERATIONAL before getting new RAID map.  There will be a small
window where IO will come from OS with old RAID map.  This patch will
update adapter state to MEGASAS_HBA_OPERATIONAL, only after driver has new
RAID map to avoid any IOs getting build using old RAID map.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-11-24 14:38:46 +01:00
Sumit.Saxena@avagotech.com e399065be0 megaraid_sas: update MAINTAINERS and copyright information for megaraid drivers
Update MAINTAINERS list and copyright information for megaraid_sas driver.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-11-24 14:38:41 +01:00
Sumit.Saxena@avagotech.com d98a6deb75 megaraid_sas: driver version upgrade and remove some meta data of driver
Update driver version and remove some meta data (release date and extended
version) about megaraid_sas driver.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-11-24 14:38:37 +01:00
Masanari Iida 6774def642 treewide: fix typo in printk and Kconfig
This patch fix spelling typo in printk and Kconfig within
various part of kernel sources.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-11-20 14:56:11 +01:00
Christoph Hellwig c8b09f6fb6 scsi: don't set tagging state from scsi_adjust_queue_depth
Remove the tagged argument from scsi_adjust_queue_depth, and just let it
handle the queue depth.  For most drivers those two are fairly separate,
given that most modern drivers don't care about the SCSI "tagged" status
of a command at all, and many old drivers allow queuing of multiple
untagged commands in the driver.

Instead we start out with the ->simple_tags flag set before calling
->slave_configure, which is how all drivers actually looking at
->simple_tags except for one worke anyway.  The one other case looks
broken, but I've kept the behavior as-is for now.

Except for that we only change ->simple_tags from the ->change_queue_type,
and when rejecting a tag message in a single driver, so keeping this
churn out of scsi_adjust_queue_depth is a clear win.

Now that the usage of scsi_adjust_queue_depth is more obvious we can
also remove all the trivial instances in ->slave_alloc or ->slave_configure
that just set it to the cmd_per_lun default.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2014-11-12 11:19:43 +01:00
Jiang Liu c12de882e7 megaraid_sas: fix bug in handling return value of pci_enable_msix_range()
Function pci_enable_msix_range() may return negative values for error
conditions. So it's a bug by checking (pci_enable_msix_range() != 0)
for success and causes failure to megaraid driver when MSI is disabled.
[   16.487267] megaraid_sas 0000:02:00.0: Controller type: iMR
[   16.487275] genirq: Flags mismatch irq 0. 00000000 (megasas) vs. 00015a00 (tii
mer)
[   16.487347] megasas: Failed to register IRQ for vector 0.

Fixes: 8ae80ed173 "megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()"

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: <stable@vger.kernel.org> # 3.17
2014-11-10 15:25:41 +01:00
Sumit.Saxena@avagotech.com 0d9d8b9ff4 megaraid_sas : Driver version update
Resending the patch. Addressed the review comments by Tomas Henzl.

Driver version upgrade patch.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:19:29 -07:00
Sumit.Saxena@avagotech.com 90dc9d98f0 megaraid_sas : MFI MPT linked list corruption fix
Resending the patch. Addressed the review comments from Tomas Henzl.
Added comment for to-do work.

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

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

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

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

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:19:28 -07:00
Sumit.Saxena@avagotech.com ac95136ad4 megaraid_sas : Add module parameter to disable IRQ-CPU affinity hint
Resending the patch. Addressed the review comments from Tomas Henzl.

For certain deployment, we may need to disable irq cpu affinity hint.
This module parameter provides option for use to disable irq cpu affinity hint
and allow irqbalancer to handle the rest.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:14:26 -07:00
Sumit.Saxena@avagotech.com fb1a24ff65 megaraid_sas : Host lock less mode to enabled asynchronous IO submission
Resending the patch. Addressed the review comments from Tomas Henzl.

Megaraid_sas driver can now work in host lock less mode.
Remove host lock less as megaraid_sas driver will have safer access to raid map as described in earlier patch.

We now keep Driver Raid map copy, which will make sure
that driver will always have old or new map
Driver raid map will be replaced safely in MR_PopulateDrvRaidMap(), so there is no issue
even if IO is continue from the scsi mid layer.

There is a plan to remove "host_lock" and "hba_lock" usage from megaraid_sas in future.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:14:25 -07:00
Sumit.Saxena@avagotech.com 51087a8617 megaraid_sas : Extended VD support
Resending the patch. Addressed the review comments from Tomas Henzl.
reserved1 field(part of union) of Raid map struct was not required so it is removed.

Current MegaRAID firmware and hence the driver only supported 64VDs.
E.g: If the user wants to create more than 64VD on a controller,
    it is not possible on current firmware/driver.

New feature and requirement to support upto 256VD, firmware/driver/apps need changes.
In addition to that there must be a backward compatibility of the new driver with the
older firmware and vice versa.

RAID map is the interface between Driver and FW to fetch all required
fields(attributes) for each Virtual Drives.
In the earlier design driver was using the FW copy of RAID map where as
in the new design the Driver will keep the RAID map copy of its own; on which
it will operate for any raid map access in fast path.

Local driver raid map copy will provide ease of access through out the code
and provide generic interface for future FW raid map changes.

For the backward compatibility driver will notify FW that it supports 256VD
to the FW in driver capability field.
Based on the controller properly returned by the FW, the Driver will know
whether it supports 256VD or not and will copy the RAID map accordingly.

At any given time, driver will always have old or new Raid map.
So with this changes, driver can also work in host lock less mode. Please
see next patch which enable host lock less mode for megaraid_sas driver.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:14:24 -07:00
Sumit.Saxena@avagotech.com fc62b3fc90 megaraid_sas : Firmware crash dump feature support
Resending the patch. Addressed the review comments from Tomas Henzl.
Move buff_offset inside spinlock, corrected loop at crash dump buffer free,
reset_devices check is added to disable fw crash dump feature in kdump kernel.

This feature will provide similar interface as kernel crash dump feature.
When megaraid firmware encounter any crash, driver will collect the firmware raw image and
dump it into pre-configured location.

Driver will allocate two different segment of memory.
#1 Non-DMA able large buffer (will be allocated on demand) to capture actual FW crash dump.
#2 DMA buffer (persistence allocation) just to do a arbitrator job.

Firmware will keep writing Crash dump data in chucks of DMA buffer size into #2,
which will be copy back by driver to the host memory as described in #1.

Driver-Firmware interface:
==================
A.) Host driver can allocate maximum 512MB Host memory to store crash dump data.

This memory will be internal to the host and will not be exposed to the Firmware.
Driver may not be able to allocate 512 MB. In that case, driver will do possible memory
(available at run time) allocation to store crash dump data.

Let’s call this buffer as Host Crash Buffer.

Host Crash buffer will not be contigious as a whole, but it will have multiple chunk of contigious memory.
This will be internal to driver and firmware/application are unaware of it.
Partial allocation of Host Crash buffer may have valid information to debug depending upon
what was collected in that buffer and depending on nature of failure.

Complete Crash dump is the best case, but we do want to capture partial buffer just to grab something rather than nothing.
Host Crash buffer will be allocated only when FW Crash dump data is available,
and will be deallocated once application copy Host Crash buffer to the file.
Host Crash buffer size can be anything between 1MB to 512MB. (It will be multiple of 1MBs)

B.) Irrespective of underlying Firmware capability of crash dump support,
driver will allocate DMA buffer at start of the day for each MR controllers.
Let’s call this buffer as “DMA Crash Buffer”.

For this feature, size of DMA crash buffer will be 1MB.
(We will not gain much even if DMA buffer size is increased.)

C.) Driver will now read Controller Info sending existing dcmd “MR_DCMD_CTRL_GET_INFO”.
Driver should extract the information from ctrl info provided by firmware and
figure out if firmware support crash dump feature or not.

Driver will enable crash dump feature only if
“Firmware support Crash dump” +
“Driver was able to create DMA Crash Buffer”.

If either one from above is not set, Crash dump feature should be disable in driver.
Firmware will enable crash dump feature only if “Driver Send DCMD- MR_DCMD_SET_CRASH_BUF_PARA with MR_CRASH_BUF_TURN_ON”

Helper application/script should use sysfs parameter fw_crash_xxx to actually copy data from
host memory to the filesystem.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:14:23 -07:00
Sumit.Saxena@avagotech.com 07e38d94ef megaraid_sas : Do not scan non syspd drives
Resending the patch. Addressed the review comments from Tomas Henzl.

Current driver allow device scan for all the devices on channel 0 and 1.
E.a If we have two single drive raid volumes, we may see prints like below.
First two prints are for physical device which are used to form VD.
Prints like this creates confusion as it is really not required to scan any
hidden physical devices.

scsi1 : LSI SAS based MegaRAID driver
scsi 1:0:0:0: Direct-Access     LSI      MR9361-8i        4.21 PQ: 0 ANSI: 5
scsi 1:0:1:0: Direct-Access     LSI      MR9361-8i        4.21 PQ: 0 ANSI: 5
scsi 1:2:0:0: Direct-Access     LSI      MR9361-8i        4.21 PQ: 0 ANSI: 5
scsi 1:2:1:0: Direct-Access     LSI      MR9361-8i        4.21 PQ: 0 ANSI: 5

When slave_alloc called, sdev-type will not be set, so current code will always
return "0" in slave_alloc callback.
This patch make sure that driver return "-ENXIO" for non-syspd devices.

After this patch, we will see prints in syslog only for devices which are exposed.
For current example, below print will be available in syslog.

scsi1 : LSI SAS based MegaRAID driver
scsi 1:2:0:0: Direct-Access     LSI      MR9361-8i        4.21 PQ: 0 ANSI: 5
scsi 1:2:1:0: Direct-Access     LSI      MR9361-8i        4.21 PQ: 0 ANSI: 5

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:14:22 -07:00
Adam Radford 5e8d90070b megaraid_sas: Version and Changelog update
The following patch for megaraid_sas updates the driver version and
Documentation/scsi/ChangeLog.megaraid_sas.

Signed-off-by: Adam Radford <aradford@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:09:54 -07:00
Adam Radford 9ea81f8169 megaraid_sas: Add missing initial call to megasas_get_ld_vf_affiliation().
The following patch for megaraid_sas adds a missing initial call to
megasas_get_ld_vf_affiliation() at the end of megasas_probe_one().

Signed-off-by: Adam Radford <aradford@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:09:53 -07:00
Adam Radford 4cbfea8865 megaraid_sas: Fix LD/VF affiliation parsing
The following patch for megaraid_sas fixes the LD/VF affiliation policy parsing
code to account for LD targetId's and Hidden LD's (not yet affiliated with any
Virtual Functions).  This also breaks megasas_get_ld_vf_affiliation() into 2
separate functions:  megasas_get_ld_vf_affiliation_111() and
megasas_get_ld_Vf_affiliation_12() to reduce indentation levels.

Signed-off-by: Adam Radford <aradford@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:09:52 -07:00
Alexander Gordeev 8ae80ed173 megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Acked-by: Kashyap Desai <Kashyap.desai@avagotech.com>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:09:40 -07:00
Alexander Gordeev dd0881281d megaraid: Fail resume if MSI-X re-initialization failed
Currently the driver fails to analize MSI-X re-enablement
status on resuming and always assumes the success. This
update checks the MSI-X initialization result and fails
to resume if MSI-Xs re-enablement failed.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Acked-by: Kashyap Desai <Kashyap.desai@avagotech.com>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-09-16 09:09:40 -07:00
Joe Perches 7c845eb5e1 scsi: use pci_zalloc_consistent
Remove the now unnecessary memset too.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Adam Radford <linuxraid@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Cc: Dario Ballabio <ballabio_dario@emc.com>
Cc: Michael Neuffer <mike@i-Connect.Net>
Cc: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:29 -07:00
Tomas Henzl bc6ac5e8c2 megaraid_sas: fix a small problem when reading state value from hw
When the driver reads state values from the hw it might happen that
different values are read in subsequent reads and this can cause problems,
this may lead to a timeout in this function and a non working adapter.

Cc: Adam Radford <aradford@gmail.com>

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Shintaro Minemoto <fj3207hq@aa.jp.fujitsu.com>
Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-05-19 13:30:59 +02:00
adam radford 10b1db86e1 [SCSI] megaraid_sas: Version and Changelog update
The following patch for megaraid_sas updates the driver version to
v06.803.01.00-rc1, and updates Documentation/scsi/ChangeLog.megaraid_sas.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-03-15 10:19:21 -07:00
adam radford 229fe47cd0 [SCSI] megaraid_sas: Add Dell PowerEdge VRTX SR-IOV VF support
The following patch for megaraid_sas adds Dell PowerEdge VRTS SR-IOV VF
support (Device ID 0x002f).

This patch has some > 80 column lines that need to be left in place
for code readability purposes.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-03-15 10:19:21 -07:00
Sumit.Saxena@lsi.com 8058a1691b [SCSI] megaraid_sas: Performance boost fixes
Host lock is added back around queuecommand. Host lock removal can create race
conditon between ISR path(when RAID map update interrupt is raised) and IO
build path of driver, since IO build path is making use of RAID map, and in
case of RAID map update interrupt, old RAID map copy is memset to zero, which
some IOs may be referencing in build IO path.  Changes done for performance
boost- 1) Added code to set SMP IRQ affinity per CPU.  2) Pass MSI-x index,
while issuing sysPD IO.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-03-15 10:19:20 -07:00
Sumit.Saxena@lsi.com 46de63e260 [SCSI] megaraid_sas: Set 32-bit DMA mask
If consistent DMA mask is set to 64 bit, fall back to 32bit DMA mask and 32bit consistent DMA mask.
64bit consistent DMA mask may be set on some 64bit DMA slot, which causes DMA offset "10000000000000" and
MFI_INIT and IOCTL frames will have high memory addresses, leads to firmware FAULT.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-03-15 10:19:20 -07:00
Sumit.Saxena@lsi.com cfbe7554f6 [SCSI] megaraid_sas: Don't wait forever for non-IOCTL DCMDs
Don't wait forever for firmware response for internal DCMDs sent from driver
firmware. Such DCMDs will be posted to firmware with timeout. Timeout is also
introduced for DCMD sent to abort the commands. DCMD sent via IOCTL path will
still be always blocking to keep the IOCTL design intact.

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-03-15 10:19:20 -07:00
Hannes Reinecke 58968fc8fb [SCSI] megaraid_sas: check return value for megasas_get_pd_list()
When megasas_get_pd_list() fails we cannot detect any drives,
so we should be checking the return value accordingly.

[jejb: checkpatch fix]
Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-03-15 10:19:18 -07:00
Ben Collins 11f8a7b31f [SCSI] megaraid: Use resource_size_t for PCI resources, not long
The assumption that sizeof(long) >= sizeof(resource_size_t) can lead to
truncation of the PCI resource address, meaning this driver didn't work
on 32-bit systems with 64-bit PCI adressing ranges.

Signed-off-by: Ben Collins <ben.c@servergy.com>
Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-12-19 07:39:03 -08:00
Martin K. Petersen 54b2b50c20 [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers
Some host adapters do not pass commands through to the target disk
directly. Instead they provide an emulated target which may or may not
accurately report its capabilities. In some cases the physical device
characteristics are reported even when the host adapter is processing
commands on the device's behalf. This can lead to adapter firmware hangs
or excessive I/O errors.

This patch disables WRITE SAME for devices connected to host adapters
that provide an emulated target. Driver writers can disable WRITE SAME
by setting the no_write_same flag in the host adapter template.

[jejb: fix up rejections due to eh_deadline patch]
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: stable@kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-11-29 08:48:39 +04:00
Linus Torvalds 9073e1a804 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "Usual earth-shaking, news-breaking, rocket science pile from
  trivial.git"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (23 commits)
  doc: usb: Fix typo in Documentation/usb/gadget_configs.txt
  doc: add missing files to timers/00-INDEX
  timekeeping: Fix some trivial typos in comments
  mm: Fix some trivial typos in comments
  irq: Fix some trivial typos in comments
  NUMA: fix typos in Kconfig help text
  mm: update 00-INDEX
  doc: Documentation/DMA-attributes.txt fix typo
  DRM: comment: `halve' -> `half'
  Docs: Kconfig: `devlopers' -> `developers'
  doc: typo on word accounting in kprobes.c in mutliple architectures
  treewide: fix "usefull" typo
  treewide: fix "distingush" typo
  mm/Kconfig: Grammar s/an/a/
  kexec: Typo s/the/then/
  Documentation/kvm: Update cpuid documentation for steal time and pv eoi
  treewide: Fix common typo in "identify"
  __page_to_pfn: Fix typo in comment
  Correct some typos for word frequency
  clk: fixed-factor: Fix a trivial typo
  ...
2013-11-15 16:47:22 -08:00
Sumit.Saxena@lsi.com 999ece0af9 [SCSI] megaraid_sas: Fix synchronization problem between sysPD IO path and AEN path
There is syncronization problem between sysPD IO path and AEN path. Driver
maintains instance->pd_list[] array, which will get updated(by calling
function megasas_get_pd_list[]), whenever any of below events occurs-

MR_EVT_PD_INSERTED
MR_EVT_PD_REMOVED
MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED
MR_EVT_FOREIGN_CFG_IMPORTED

At same time running sysPD IO will be accessing the same array
instance->pd_list[], which is getting updated in AEN path, because of this IO
may not get correct PD info from instance->pd_list[] array.

Signed-off-by: Adam Radford <adam.radford@lsi.com>
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-10-25 11:27:36 +01:00
Sumit.Saxena@lsi.com 3993a86241 [SCSI] megaraid_sas: fixes for few endianess issues
Fixed two issues in this patch-
1) In function megasas_get_pd_list(), data read(pd_addr->deviceId) from DMAed memory is converted to CPU's endianess.
2) While register AEN, removed some endianness conversion on some fields, since their endianess is already converted.

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-10-25 09:57:58 +01:00
Jingoo Han 08b7e10716 SCSI: remove unnecessary pci_set_drvdata()
Since commit 0998d06310
(device-core: Ensure drvdata = NULL when no driver is bound),
the driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: James Bottomley <JBottomley@parallels.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-10-14 15:26:04 +02:00
Sumit.Saxena@lsi.com 94cd65ddf4 [SCSI] megaraid_sas: addded support for big endian architecture
This patch will add big endian architecture support to megaraid_sas
driver. The support added is for LSI MegaRAID all generation controllers-
(3Gb/s, 6Gb/s and 12 Gb/s controllers).

We have done basic sanity test @ppc64 arch and @x86_64. Additional
testing/observations are welcome.

[jejb: fix up rejections]
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-09-10 15:01:26 -07:00
adam radford 2b4857c30e [SCSI] megaraid_sas: Version and Changelog update
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-09-06 15:55:57 -07:00
adam radford 21c9e160a5 [SCSI] megaraid_sas: Add High Availability clustering support using shared Logical Disks
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-09-06 15:54:55 -07:00
Sumit.Saxena@lsi.com 6431f5d7c6 [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel
Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails
in kdump kernel with LSI MegaRAID controller(device id-0x73).

Actually this issue needs fix in firmware, but for firmware running in field,
this driver fix is proposed to resolve the issue.  At firmware initialization
time, if firmware does not come to ready state, driver will reset the adapter
and retry for firmware transition to ready state unconditionally(not only
executed for kdump kernel).

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-08-02 13:01:29 -07:00
Bjørn Mork 7a6a731bd0 [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries
commit 98cb7e44 ([SCSI] megaraid_sas: Sanity check user
supplied length before passing it to dma_alloc_coherent())
introduced a memory leak.  Memory allocated for entries
following zero length SGL entries will not be freed.

Reference: http://bugs.debian.org/688198

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Cc: <stable@vger.kernel.org>
Acked-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-07-05 22:42:42 +01:00
James Georgas a3fda7dd51 [SCSI] megaraid: minor cut and paste error fixed.
This looks like a cut and paste typo to me. Both of the
megasas_read_fw_status_reg_* functions involved are identical though, so
there was no bad behaviour. I changed it for consistency and clarity.

Signed-off-by: James Georgas <soulpa7ch@gmail.com>
Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-28 13:41:33 -07:00
Sumit.Saxena@lsi.com 7525be545c [SCSI] megaraid_sas: Changelog and driver version update
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:52:10 -07:00
Sumit.Saxena@lsi.com 404a8a1a89 [SCSI] megaraid_sas: Add support to differentiate between iMR vs MR Firmware
Add support to differentiate between iMR(no external memory) and MR(with
external memory) controllers.

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:51:05 -07:00
Sumit.Saxena@lsi.com bc93d425fc [SCSI] megaraid_sas: Add support for Uneven Span PRL11
MegaRAID older Firmware does not support uneven span configuration for PRL11.
E.g User wants to create 34 Driver PRL11 config, it was not possible using old
firmware, since it was not supported configuration in old firmware

Old Firmware expect even number of Drives in each span and same number of
physical drives at each span.  Considering above design, 17 Drives at Span-0
and 17 drives at span-1 was not possible.

Now, using this new feature Firmware and Driver both required changes.  New
Firmware can allow user to create 16 Drives at span-0 and 18 Drives at
span-1. This will allow user to create 34 Drives Uneven span PRL11.

RAID map is interface between Driver and FW to fetch all required
fields(attributes) for each Virtual Drives.  Since legacy RAID map consider
Even Span design, there was no place to keep Uneven span information in
existing Raid map.  Because of this limitation, for Uneven span VD, driver can
not use RAID map.

This patch address the changes required in Driver to support Uneven span PRL11
support.

1. Driver will find if Firmware has UnevenSpanSupport or not by reading
   Controller Info.
2. If Firmware has UnvenSpan PRL11 support, then Driver will inform about its
   capability of handling UnevenSpan PRL11 to the firmware.
3. Driver will update its copy of span info on each time Raid map update is
   called.
4. Follow different IO path if it is Uneven Span. (For Uneven Span, Driver
   uses Span Set info to find relavent fields for that particular Virtual
   Disk)

More verbose prints will be available by setting "SPAN_DEBUG" to 1 at
compilation time.

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:48:12 -07:00
Sumit.Saxena@lsi.com d46a3ad679 [SCSI] megaraid_sas: Add support for Extended MSI-x vectors for 12Gb/s controller
This Driver will use more than 8 MSI-x support provided by Invader/Fury max
upto 128 MSI-x.

[jejb: fix checkpatch warning]
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:46:31 -07:00
Sumit.Saxena@lsi.com 21d3c7105b [SCSI] megaraid_sas: Add support for MegaRAID Fury (device ID-0x005f) 12Gb/s controllers
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:40:53 -07:00
Sumit.Saxena@lsi.com 105900d56e [SCSI] megaraid_sas: Free event detail memory without device ID check
Free event detail memory from more common place, instead of doing it for
limited device types.

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:24:22 -07:00
Sumit.Saxena@lsi.com b5bccadd80 [SCSI] megaraid_sas: Fix the interrupt mask for Gen2 controller
Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 17:19:44 -07:00
Sumit.Saxena@lsi.com b09e66da3f [SCSI] megaraid_sas: Return DID_ERROR for SCSI IO, when controller is in critical h/w error
Do not return SCSI_MLQUEUE_HOST_BUSY, but send DID_ERROR to SCSI mid-layer, if
adapter is in critical error state.  "SCSI_MLQUEUE_HOST_BUSY" will keep same
SCSI command in loop and it is not a right return value, if controller is
hardware critical error.

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-06-24 16:55:17 -07:00
Dan Carpenter c64e483ea0 [SCSI] megaraid_sas: release lock on error path
We should unlock here before returning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-05-02 12:08:46 -07:00
Bjorn Helgaas 9936906597 [SCSI] megaraid_sas: Use correct #define for MSI-X capability
Previously we used PCI_MSI_FLAGS to locate a register in the MSI-X
capability.  This did work because the MSI and MSI-X flags happen
to be at the same offsets, but was confusing.

PCI_MSIX_FLAGS_ENABLE is already defined in include/uapi/linux/pci_regs.h,
so no need to define it again.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Adam Radford <aradford@gmail.com>
2013-04-18 11:07:46 -06:00
adam radford 5eca4a67b8 [SCSI] megaraid_sas: Version and Changelog update
This patch updates the megaraid_sas driver version and updates
Documentation/scsi/ChangeLog.megaraid_sas.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-02-22 15:37:15 +00:00
Greg Kroah-Hartman 6f03979051 Drivers: scsi: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Adam Radford <linuxraid@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:01 -08:00
Xiaotian Feng c1d390d8e6 megaraid: fix BUG_ON() from incorrect use of delayed work
megaraid use INIT_WORK to declare a hotplug_work, but cast the
hotplug_work from work_struct to delayed_work and
schedule_delayed_work on it.  This is very dangerous, as other part of
delayed_work might be kernel memories allocated by others.

With commit 8852aac ("workqueue: mod_delayed_work_on() shouldn't queue
timer on 0 delay"), schedule_delayed_work() will check dwork->timer
before queue_work even when @delay is 0, this causes megaraid code to
hit the BUG_ON() in workqueue code.  Change megaraid code to use
delayed work.

Signed-off-by: Xiaotian Feng <dannyfeng@tencent.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
2012-12-04 07:29:47 -08:00
adam radford ae59057b64 [SCSI] megaraid_sas: Version, Changelog, Copyright update
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-10-09 11:21:48 +01:00
adam radford a3a922099c [SCSI] megaraid_sas: Remove duplicate code
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-10-09 11:20:41 +01:00
adam radford 079eaddf2e [SCSI] megaraid_sas: Add module param for configurable MSI-X vector count
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-10-09 11:12:30 +01:00
James Bottomley fe709ed827 Merge SCSI misc branch into isci-for-3.6 tag 2012-10-02 08:55:12 +01:00
adam radford cdd75750a1 [SCSI] megaraid_sas: Version and Changelog update
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-08-24 13:10:29 +04:00
adam radford c007b8b2ec [SCSI] megaraid_sas: Add resetwaittime module parameter
This allows a user to adjust the wait time in seconds after I/O timeout before
resetting the adapter.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-08-24 13:10:29 +04:00
adam radford c5daa6a919 [SCSI] megaraid_sas: Add throttlequeuedepth module parameter
This allows a user to adjust the queue depth of the adapter when throttled due
to I/O timeout.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-08-24 13:10:28 +04:00
Kashyap Desai bd8d6dd43a [SCSI] megaraid_sas: Move poll_aen_lock initializer
The following patch moves the poll_aen_lock initializer from
megasas_probe_one() to megasas_init().  This prevents a crash when a user
loads the driver and tries to issue a poll() system call on the ioctl
interface with no adapters present.

Signed-off-by: Kashyap Desai <Kashyap.Desai@lsi.com>
Signed-off-by: Adam Radford <aradford@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-08-22 09:39:25 +04:00
adam radford e38a813ba9 [SCSI] megaraid_sas: Version and Changelog update
The following patch for megaraid_sas updates the driver version to
v00.00.06.15-rc1, and updates Documentation/scsi/ChangeLog.megaraid_sas.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-04-23 19:26:41 +01:00
adam radford 798edaadba [SCSI] megaraid_sas: Version and Changelog update
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-16 11:28:33 +04:00