summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
Commit message (Collapse)AuthorAgeFilesLines
* [SCSI] isci: update version to 1.2Lukasz Dorau2014-03-151-1/+1
| | | | | | | | | | | The version of isci driver has not been updated for 2 years. It was 83 isci commits ago. Suspend/resume support has been implemented and many bugs have been fixed since 1.1. Now update the version to 1.2. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: fix needless ata reset escalationsDan Williams2014-03-151-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isci is needlessly tying libata's hands by returning SAM_STAT_CHECK_CONDITION to some ata errors. Instead, prefer SAS_PROTO_RESPONSE to let libata (via sas_ata_task_done()) disposition the device-to-host fis. For example isci is triggering an HSM Violation where AHCI is showing a simple media error for the same bus condition: isci: ata7.00: failed command: READ VERIFY SECTOR(S) ata7.00: cmd 40/00:01:00:00:00/00:00:00:00:00/e0 tag 0 res 01/04:00:00:00:00/00:00:00:00:00/e0 Emask 0x3 (HSM violation) ahci: ata6.00: failed command: READ VERIFY SECTOR(S) ata6.00: cmd 40/00:01:00:00:00/00:00:00:00:00/e0 tag 0 res 51/40:01:00:00:00/00:00:00:00:00/e0 Emask 0x9 (media error) Note that the isci response matches this from sas_ata_task_done(): /* We saw a SAS error. Send a vague error. */ [..] dev->sata_dev.fis[3] = 0x04; /* status err */ dev->sata_dev.fis[2] = ATA_ERR; The end effect is that isci is needlessly triggering hard resets when they are not necessary. Reported-by: Xun Ni <xun.ni@intel.com> Tested-by: Nelson Cheng <nelson.cheng@intel.com> Acked-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: correct erroneous for_each_isci_host macroLukasz Dorau2014-03-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the first place, the loop 'for' in the macro 'for_each_isci_host' (drivers/scsi/isci/host.h:314) is incorrect, because it accesses the 3rd element of 2 element array. After the 2nd iteration it executes the instruction: ihost = to_pci_info(pdev)->hosts[2] (while the size of the 'hosts' array equals 2) and reads an out of range element. In the second place, this loop is incorrectly optimized by GCC v4.8 (see http://marc.info/?l=linux-kernel&m=138998871911336&w=2). As a result, on platforms with two SCU controllers, the loop is executed more times than it can be (for i=0,1 and 2). It causes kernel panic during entering the S3 state and the following oops after 'rmmod isci': BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff8131360b>] __list_add+0x1b/0xc0 Oops: 0000 [#1] SMP RIP: 0010:[<ffffffff8131360b>] [<ffffffff8131360b>] __list_add+0x1b/0xc0 Call Trace: [<ffffffff81661b84>] __mutex_lock_slowpath+0x114/0x1b0 [<ffffffff81661c3f>] mutex_lock+0x1f/0x30 [<ffffffffa03e97cb>] sas_disable_events+0x1b/0x50 [libsas] [<ffffffffa03e9818>] sas_unregister_ha+0x18/0x60 [libsas] [<ffffffffa040316e>] isci_unregister+0x1e/0x40 [isci] [<ffffffffa0403efd>] isci_pci_remove+0x5d/0x100 [isci] [<ffffffff813391cb>] pci_device_remove+0x3b/0xb0 [<ffffffff813fbf7f>] __device_release_driver+0x7f/0xf0 [<ffffffff813fc8f8>] driver_detach+0xa8/0xb0 [<ffffffff813fbb8b>] bus_remove_driver+0x9b/0x120 [<ffffffff813fcf2c>] driver_unregister+0x2c/0x50 [<ffffffff813381f3>] pci_unregister_driver+0x23/0x80 [<ffffffffa04152f8>] isci_exit+0x10/0x1e [isci] [<ffffffff810d199b>] SyS_delete_module+0x16b/0x2d0 [<ffffffff81012a21>] ? do_notify_resume+0x61/0xa0 [<ffffffff8166ce29>] system_call_fastpath+0x16/0x1b The loop has been corrected. This patch fixes kernel panic during entering the S3 state and the above oops. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Tested-by: Lukasz Dorau <lukasz.dorau@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: fix reset timeout handlingDan Williams2014-03-102-8/+1
| | | | | | | | | | | | | | | | | | | | | | | Remove an erroneous BUG_ON() in the case of a hard reset timeout. The reset timeout handler puts the port into the "awaiting link-up" state. The timeout causes the device to be disconnected and we need to be in the awaiting link-up state to re-connect the port. The BUG_ON() made the incorrect assumption that resets never timeout and we always complete the reset in the "resetting" state. Testing this patch also uncovered that libata continues to attempt to reset the port long after the driver has torn down the context. Once the driver has committed to abandoning the link it must indicate to libata that recovery ends by returning -ENODEV from ->lldd_I_T_nexus_reset(). Cc: <stable@vger.kernel.org> Acked-by: Lukasz Dorau <lukasz.dorau@intel.com> Reported-by: David Milburn <dmilburn@redhat.com> Reported-by: Xun Ni <xun.ni@intel.com> Tested-by: Xun Ni <xun.ni@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: Fix a infinite loop.Xinghai Yu2013-08-261-1/+1
| | | | | | | | | It seems the "phy_index++;" have been placed in wrong place, without it the while circle up will do a infinite loop. Signed-off-by: Xinghai Yu <yuxinghai@cn.fujitsu.com> Acked-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: fix breakage caused by >16byte CDB patchJames Bottomley2013-07-241-1/+1
| | | | | | | | | | | | | | | | | | Oops, apparently no-one I cc'd at intel actually bothered to check this patch for the isci driver: commit e73823f7a2c921dcf068d34ea03bd682498d9e42 Author: James Bottomley <JBottomley@Parallels.com> Date: Tue May 7 15:38:18 2013 -0700 [SCSI] libsas: implement > 16 byte CDB support sci_swab32_cpy needs multiples of four, so for commands that aren't that, it's rounding the wrong way. fix by doing (len+3)/4 instead of len/4. Reported-by: Tony Luck <tony.luck@intel.com> Tested-by: Tony Luck <tony.luck@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: Fix a race condition in the SSP task management pathJeff Skirvin2013-07-231-3/+6
| | | | | | | | | | | | | | This commit fixes a race condition in the isci driver abort task and SSP device task management path. The race is caused when an I/O termination in the SCU hardware is necessary because of an SSP target timeout condition, and the check of the I/O end state races against the HW-termination-driven end state. The failure of the race meant that no TMF was sent to the device to clean-up the pending I/O. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] libsas: implement > 16 byte CDB supportJames Bottomley2013-06-041-2/+2
| | | | | | | | | | | | | | | | | | Remove the arbitrary expectation in libsas that all SCSI commands are 16 bytes or less. Instead do all copies via cmd->cmd_len (and use a pointer to this in the libsas task instead of a copy). Note that this still doesn't enable > 16 byte CDB support in the underlying drivers because their internal format has to be fixed and the wire format of > 16 byte CDBs according to the SAS spec is different. the libsas drivers (isci, aic94xx, mvsas and pm8xxx are all updated for this change. Cc: Lukasz Dorau <lukasz.dorau@intel.com> Cc: Maciej Patelczyk <maciej.patelczyk@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Jack Wang <xjtuwjp@gmail.com> Cc: Lindar Liu <lindar_liu@usish.com> Cc: Xiangliang Yu <yuxiangl@marvell.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] sas: unify the pointlessly separated enums sas_dev_type and ↵James Bottomley2013-05-104-7/+7
| | | | | | | | | | | | | | | | | | sas_device_type These enums have been separate since the dawn of SAS, mainly because the latter is a procotol only enum and the former includes additional state for libsas. The dichotomy causes endless confusion about which one you should use where and leads to pointless warnings like this: drivers/scsi/mvsas/mv_sas.c: In function 'mvs_update_phyinfo': drivers/scsi/mvsas/mv_sas.c:1162:34: warning: comparison between 'enum sas_device_type' and 'enum sas_dev_type' [-Wenum-compare] Fix by eliminating one of them. The one kept is effectively the sas.h one, but call it sas_device_type and make sure the enums are all properly namespaced with the SAS_ prefix. Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] isci: add CONFIG_PM_SLEEP to suspend/resume functionsJingoo Han2013-04-111-4/+2
| | | | | | | | | | | | | | Add CONFIG_PM_SLEEP to suspend/resume functions to fix the following build warning when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SIMPLE_DEV_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/scsi/isci/init.c:725:12: warning: 'isci_suspend' defined but not used [-Wunused-function] drivers/scsi/isci/init.c:743:12: warning: 'isci_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* efi: Make 'efi_enabled' a function to query EFI facilitiesMatt Fleming2013-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally 'efi_enabled' indicated whether a kernel was booted from EFI firmware. Over time its semantics have changed, and it now indicates whether or not we are booted on an EFI machine with bit-native firmware, e.g. 64-bit kernel with 64-bit firmware. The immediate motivation for this patch is the bug report at, https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557 which details how running a platform driver on an EFI machine that is designed to run under BIOS can cause the machine to become bricked. Also, the following report, https://bugzilla.kernel.org/show_bug.cgi?id=47121 details how running said driver can also cause Machine Check Exceptions. Drivers need a new means of detecting whether they're running on an EFI machine, as sadly the expression, if (!efi_enabled) hasn't been a sufficient condition for quite some time. Users actually want to query 'efi_enabled' for different reasons - what they really want access to is the list of available EFI facilities. For instance, the x86 reboot code needs to know whether it can invoke the ResetSystem() function provided by the EFI runtime services, while the ACPI OSL code wants to know whether the EFI config tables were mapped successfully. There are also checks in some of the platform driver code to simply see if they're running on an EFI machine (which would make it a bad idea to do BIOS-y things). This patch is a prereq for the samsung-laptop fix patch. Cc: David Airlie <airlied@linux.ie> Cc: Corentin Chary <corentincj@iksaif.net> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Olof Johansson <olof@lixom.net> Cc: Peter Jones <pjones@redhat.com> Cc: Colin Ian King <colin.king@canonical.com> Cc: Steve Langasek <steve.langasek@canonical.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: <stable@vger.kernel.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Drivers: scsi: remove __dev* attributes.Greg Kroah-Hartman2013-01-031-4/+4
| | | | | | | | | | | | | | | | 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>
* [SCSI] isci: copy fis 0x34 response into proper bufferMaciej Patelczyk2012-11-131-1/+1
| | | | | | | | | | | | | | SATA MICROCODE DOWNALOAD fails on isci driver. After receiving Register Device to Host (FIS 0x34) frame Initiator resets phy. In the frame handler routine response (FIS 0x34) was copied into wrong buffer and upper layer did not receive any answer which resulted in timeout and reset. This patch corrects this bug. Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* Merge tag 'scsi-for-linus' of ↵Linus Torvalds2012-10-026-14/+78
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi Pull first round of SCSI updates from James Bottomley: "This is a large set of updates, mostly for drivers (qla2xxx [including support for new 83xx based card], qla4xxx, mpt2sas, bfa, zfcp, hpsa, be2iscsi, isci, lpfc, ipr, ibmvfc, ibmvscsi, megaraid_sas). There's also a rework for tape adding virtually unlimited numbers of tape drives plus a set of dif fixes for sd and a fix for a live lock on hot remove of SCSI devices. This round includes a signed tag pull of isci-for-3.6 Signed-off-by: James Bottomley <JBottomley@Parallels.com>" Fix up trivial conflict in drivers/scsi/qla2xxx/qla_nx.c due to new PCI helper function use in a function that was removed by this pull. * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (198 commits) [SCSI] st: remove st_mutex [SCSI] sd: Ensure we correctly disable devices with unknown protection type [SCSI] hpsa: gen8plus Smart Array IDs [SCSI] qla4xxx: Update driver version to 5.03.00-k1 [SCSI] qla4xxx: Disable generating pause frames for ISP83XX [SCSI] qla4xxx: Fix double clearing of risc_intr for ISP83XX [SCSI] qla4xxx: IDC implementation for Loopback [SCSI] qla4xxx: update copyrights in LICENSE.qla4xxx [SCSI] qla4xxx: Fix panic while rmmod [SCSI] qla4xxx: Fail probe_adapter if IRQ allocation fails [SCSI] qla4xxx: Prevent MSI/MSI-X falling back to INTx for ISP82XX [SCSI] qla4xxx: Update idc reg in case of PCI AER [SCSI] qla4xxx: Fix double IDC locking in qla4_8xxx_error_recovery [SCSI] qla4xxx: Clear interrupt while unloading driver for ISP83XX [SCSI] qla4xxx: Print correct IDC version [SCSI] qla4xxx: Added new mbox cmd to pass driver version to FW [SCSI] scsi_dh_alua: Enable STPG for unavailable ports [SCSI] scsi_remove_target: fix softlockup regression on hot remove [SCSI] ibmvscsi: Fix host config length field overflow [SCSI] ibmvscsi: Remove backend abstraction ...
| * Merge SCSI misc branch into isci-for-3.6 tagJames Bottomley2012-10-023-9/+73
| |\
| | * [SCSI] isci: Fix interrupt coalescing assumption of active TCsDave Jiang2012-09-241-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We always assign a dummy task context to a port in order to address a silicon issue. We have 4 ports per controller. So when idle, there are always exactly 4 TCs "active". The adaptive interrupt coalescing code uses number of active TCs to figure out the coalescing values. However, we never hit "0" TCs because of the 4 dummy TCs. Putting in fix so that we calculate this correctly. Reported-by: Dan Melnic <dan@seamicro.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
| | * [SCSI] isci: Allow SSP tasks into the task management path.Jeff Skirvin2012-09-241-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes a driver bug for SSP tasks that require task management in the target after they complete in the SCU hardware. The problem was manifested in the function "isci_task_abort_task", which tests to see if the sas_task.lldd_task is non-NULL before allowing task management; this bug would always NULL lldd_task in the SCU I/O completion path even if target management was required, which would prevent task / target manangement from happening. Note that in the case of SATA/STP targets, error recovery is provided by the libata error handler which is why SATA/STP device recovery worked correctly even though SSP handling did not. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
| | * [SCSI] isci: implement suspend/resume supportArtur Wojcik2012-08-243-3/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a "simple-dev-pm-ops" implementation that shuts down the domain and the device on suspend, and resumes the device and the domain on resume. All of the mechanics of restoring domain connectivity are handled by libsas once isci has notified libsas that all links should be back up. libsas is in charge of handling links that did not resume, or resumed out of order. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Jacek Danecki <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
| * | Merge tag 'isci-for-3.6' into for-nextJames Bottomley2012-09-135-5/+5
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | isci update for 3.6 1/ Fix the workaround for drives that have a slow response to COMSAS. Drives with this problem intermittently take a long time to be identified, or fail to be identified altogether. 2/ A minor fix for the efi variable code failure path 3/ A handful of smatch fixups from Dan Carpenter
| | * isci: add a couple __iomem annotationsDan Carpenter2012-07-032-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are __iomem. Sparse complains if we don't have that. drivers/scsi/isci/phy.c +149 70: warning: incorrect type in initializer (different address spaces) Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| | * isci: make function declaration match implementationDan Carpenter2012-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sparse complains that we redeclare this with a different type, because in the .c file we use an enum and in the .h file we declare the parameter as a u32. Probably it's best to use an enum in both places. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| | * isci: fix COMSAS negation timout workaround for WD SAS drivesDave Maurer2012-07-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following patch is a fix for the WD workaround COMSAS negation timeout change. This patch disables the OOB SM when the OOB is placed in reset, which allows the updated COMSAS negation timeout value to take effect. Cc: Dan Thompson <daniel.j.thompson@intel.com> Reported-by: Dan Thompson <daniel.j.thompson@intel.com> Signed-off-by: Dave Maurer <david.c.maurer@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| | * isci: fix isci_pci_probe() generates warning on efi failure pathDan Williams2012-07-032-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The oem parameter image embedded in the efi variable is at an offset from the start of the variable. However, in the failure path we try to free the 'orom' pointer which is only valid when the paramaters are being read from the legacy option-rom space. Since failure to load the oem parameters is unlikely and we keep the memory around in the success case just defer all de-allocation to devm. Cc: <stable@vger.kernel.org> Reported-by: Don Morris <don.morris@hp.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | | Merge branch 'for-linus' of ↵Linus Torvalds2012-10-015-5/+5
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull the trivial tree from Jiri Kosina: "Tiny usual fixes all over the place" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (34 commits) doc: fix old config name of kprobetrace fs/fs-writeback.c: cleanup riteback_sb_inodes kerneldoc btrfs: fix the commment for the action flags in delayed-ref.h btrfs: fix trivial typo for the comment of BTRFS_FREE_INO_OBJECTID vfs: fix kerneldoc for generic_fh_to_parent() treewide: fix comment/printk/variable typos ipr: fix small coding style issues doc: fix broken utf8 encoding nfs: comment fix platform/x86: fix asus_laptop.wled_type module parameter mfd: printk/comment fixes doc: getdelays.c: remember to close() socket on error in create_nl_socket() doc: aliasing-test: close fd on write error mmc: fix comment typos dma: fix comments spi: fix comment/printk typos in spi Coccinelle: fix typo in memdup_user.cocci tmiofb: missing NULL pointer checks tools: perf: Fix typo in tools/perf tools/testing: fix comment / output typos ...
| * | treewide: fix comment/printk/variable typosAnatol Pomozov2012-09-013-3/+3
| | | | | | | | | | | | | | | Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * | scsi: fix various printk and comment typosMasanari Iida2012-09-012-2/+2
| |/ | | | | | | | | | | | | Correct spelling typo within drivers/scsi Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* / [SCSI] isci: use sas eh strategy handlersDan Williams2012-07-201-0/+3
|/ | | | | | | | ...now that the strategy handlers guarantee eh context and notify the driver of bus reset. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* isci: End the RNC resumption wait when the RNC is destroyed.Jeff Skirvin2012-05-174-11/+33
| | | | | | | | | While the RNC is suspended for I/O cleanup, the remote device can be stopped and the RNC setup for destruction. These changes accomodate that case in the abort path. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Fixed RNC bug that lost the suspension or resumption during destroyJeff Skirvin2012-05-171-58/+38
| | | | | | | | | This fix corrects the saving of resume parameters when the destruction of the RNC has already been directed, and makes sure not to overwrite the RNC destruction callbacks. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Fix RNC AWAIT_SUSPENSION->INVALIDATING transition.Jeff Skirvin2012-05-171-5/+13
| | | | | | | | | | | | | | The RNC state machine would incorrectly transition from SCI_RNC_AWAIT_SUSPENSION directly to SCI_RNC_INVALIDATING when a destruct request was made. This would skip the increment of the suspension count and the abort of pending TCs (although the invalidating state would at least cleanup outstanding TCs). Instead, the RNC will transition to SCI_RNC_SUSPENDED and then start the destruction process. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Manage the IREQ_NO_AUTO_FREE_TAG under scic_lock.Jeff Skirvin2012-05-171-1/+4
| | | | | | | | | Since there is a possibilty of a timeout waiting for the RNC suspension, handle the exit case from the task termination under scic_lock, and leave the tag allocated if the termination timed-out. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Remove obviated host callback list.Jeff Skirvin2012-05-175-66/+31
| | | | | | | | | Since the callbacks to libsas now occur under scic_lock, there is no longer any reason to save the completed requests in a separate list for completion to libsas. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Check IDEV_GONE before performing abort path operations.Jeff Skirvin2012-05-172-21/+57
| | | | | | | | | | | | | | | | | | In the link fail path, set IDEV_GONE for every device on the domain when the last link in the port fails. In the abort path functions like isci_reset_device, make sure that there has not already been a detected domain failure with the device by checking IDEV_GONE, before performing any kind of hard reset, SMP phy control, or TMF operation. The check for IDEV_GONE makes sure that the device in the abort path really has control of the port with which it is associated. This prevents starting hard resets at incorrect times and scheduling unnecessary LUN resets for SATA devices. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Restore the ATAPI device RNC management code.Jeff Skirvin2012-05-173-20/+34
| | | | | | | | The ATAPI specific and STP general RNC suspension code had been incorrectly removed from the remote device code. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Don't wait for an RNC suspend if it's being destroyed.Jeff Skirvin2012-05-173-4/+28
| | | | | | | Make sure that the wait for suspend can handle the RNC destruction case. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Change the phy control and link reset interface for HW reasons.Jeff Skirvin2012-05-171-0/+2
| | | | | | | | | There is an apparent HW lockup caused when the PE is disabled while there is an outstanding TC in progress. This change puts the link into OOB to force the TC to end before the PE is disabled. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Added timeouts to RNC suspensions in the abort path.Jeff Skirvin2012-05-172-11/+55
| | | | | | | | | | | | This change adds timeouts to the RNC suspension wait. It makes the suspend and resume timeouts the same. The previous resume timeout of 5 ms was too short, and timeouts were seen in resumptions of devices in the abort task/LUN reset path - which would receive an RNC resumed message within a tenth of a second later. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Add protocol indicator for TMF requests.Jeff Skirvin2012-05-171-0/+6
| | | | | | | | | Requests contructed as task management requests need to have the protocol indicator set so the completion decode can observe any RNC suspension conditions. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Directly control IREQ_ABORT_PATH_ACTIVE when completing TMFs.Jeff Skirvin2012-05-171-0/+3
| | | | | | | | | TMF requests, unlike normal I/O requests, need to handle I/O management conditions in the completion function because TMFs are not handled in the completion tasklet. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Wait for RNC resumption before leaving the abort path.Jeff Skirvin2012-05-172-2/+53
| | | | | | | | | | In the case of TMF execution, or device resets, wait for the RNC to fully resume before returning to the caller. This ensures that the remote device will not fail I/O requests while waiting for the RNC resumption to complete. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Fix RNC suspend call for SCI_RESUMING state.Jeff Skirvin2012-05-171-8/+4
| | | | | | | | | | | Instead of immediately transitioning to the SCI_RNC_AWAIT_SUSPENSION state, handle the SCI_RNC_RESUMING suspend transition from the SCI_RNC_READY state like the SCI_RNC_INVALIDATING --> SCI_RNC_POSTING transitions do now, by setting the destination state for the entry into the READY state. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Manage tag releases differently when aborting tasks.Jeff Skirvin2012-05-174-6/+12
| | | | | | | | When an individual request is being terminated, the request's tag is managed in the terminate function. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Callbacks to libsas occur under scic_lock and are synchronized.Jeff Skirvin2012-05-172-13/+40
| | | | | | | | | This patch changes the callback mechanism to libsas to only occur while the scic_lock is held; the abort path cleanup of I/Os also checks to make sure IREQ_ABORT_PATH_ACTIVE is clear before proceding. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: When in the abort path, defeat other resume calls until done.Jeff Skirvin2012-05-173-46/+83
| | | | | | | | | | | Completion of I/Os during the one of the abort path interface calls from libsas can drive remote device state changes and the resumption of the device RNC. This is a problem when the abort path is attempting to cleanup outstanding I/O at the same time - the resumption can prevent the termination from occuring correctly. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Implement waiting for suspend in the abort path.Jeff Skirvin2012-05-175-22/+66
| | | | | | | | | | In order to prevent a device from receiving an I/O request while still in an RNC suspending or resuming state (and therefore failing that I/O back to libsas with a reset required status) wait for the RNC state change before proceding in the abort path. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Make sure all TCs are terminated and cleaned in LUN reset.Jeff Skirvin2012-05-171-6/+8
| | | | | | | | | | | | In the libsas error path, SATA disks require extra handling in libata to recover operation. However, libsas expects to be able to immediately recover all outstanding I/O once the error handler escalation stops. This patch fixes the condition where the libata error handler is scheduled for operation but libsas has already deleted the outstanding sas_tasks. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Manage the LLHANG timer enable/disable per-device.Jeff Skirvin2012-05-173-8/+20
| | | | | | | | The LLHANG timer should be enabled once per device. This patch corrects both the timer enable and the timer disable for the remote device. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Save the suspension hint for upcoming suspensions.Jeff Skirvin2012-05-174-18/+12
| | | | | | | | | | In the case of a suspend call while in SCI_RNC_POSTING or INVALIDATING states, the LLHANG detect needed to be saved so the upcoming suspension would enable it correctly. The unused suspend callback parameters were removed. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Fix the terminated I/O to not call sas_task_abort().Jeff Skirvin2012-05-171-1/+1
| | | | | | | | | | | This addresses a regression from the commit "isci: Redesign device suspension, abort, cleanup." in which the sas_task end condition for terminated I/Os was made to call back on sas_task_abort()". This commit will be rolled into the original. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* isci: Distinguish between remote device suspension casesJeff Skirvin2012-05-174-25/+28
| | | | | | | | For NCQ error conditions among others, there is no need to enable the link layer hang detect timer. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>