summaryrefslogtreecommitdiff
path: root/drivers/message/fusion/mptsas.c
AgeCommit message (Collapse)Author
2018-04-29scsi: mptsas: Disable WRITE SAMEMartin K. Petersen
commit 94e5395d2403c8bc2504a7cbe4c4caaacb7b8b84 upstream. First generation MPT Fusion controllers can not translate WRITE SAME when the attached device is a SATA drive. Disable WRITE SAME support. Reported-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz> Cc: <stable@vger.kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-29scsi: scsi_transport_sas: switch to bsg-lib for SMP passthroughChristoph Hellwig
Simplify the SMP passthrough code by switching it to the generic bsg-lib helpers that abstract away the details of the request code, and gets drivers out of seeing struct scsi_request. For the libsas host SMP code there is a small behavior difference in that we now always clear the residual len for successful commands, similar to the three other SMP handler implementations. Given that there is no partial command handling in the host SMP handler this should not matter in practice. [mkp: typos and checkpatch fixes] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-25scsi: mptsas: Fixup device hotplug for VMWare ESXiHannes Reinecke
VMWare ESXi emulates an mptsas HBA, but exposes all drives as direct-attached SAS drives. This it not how the driver originally envisioned things; SAS drives were supposed to be connected via an expander, and only SATA drives would be direct attached. As such, any hotplug event for direct-attach SAS drives was silently ignored, and the guest failed to detect new drives from within a VMWare ESXi environment. [mkp: typos] Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1030850 Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-02-21Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds
Pull SCSI updates from James Bottomley: "This update includes the usual round of major driver updates (ncr5380, ufs, lpfc, be2iscsi, hisi_sas, storvsc, cxlflash, aacraid, megaraid_sas, ...). There's also an assortment of minor fixes and the major update of switching a bunch of drivers to pci_alloc_irq_vectors from Christoph" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (188 commits) scsi: megaraid_sas: handle dma_addr_t right on 32-bit scsi: megaraid_sas: array overflow in megasas_dump_frame() scsi: snic: switch to pci_irq_alloc_vectors scsi: megaraid_sas: driver version upgrade scsi: megaraid_sas: Change RAID_1_10_RMW_CMDS to RAID_1_PEER_CMDS and set value to 2 scsi: megaraid_sas: Indentation and smatch warning fixes scsi: megaraid_sas: Cleanup VD_EXT_DEBUG and SPAN_DEBUG related debug prints scsi: megaraid_sas: Increase internal command pool scsi: megaraid_sas: Use synchronize_irq to wait for IRQs to complete scsi: megaraid_sas: Bail out the driver load if ld_list_query fails scsi: megaraid_sas: Change build_mpt_mfi_pass_thru to return void scsi: megaraid_sas: During OCR, if get_ctrl_info fails do not continue with OCR scsi: megaraid_sas: Do not set fp_possible if TM capable for non-RW syspdIO, change fp_possible to bool scsi: megaraid_sas: Remove unused pd_index from megasas_build_ld_nonrw_fusion scsi: megaraid_sas: megasas_return_cmd does not memset IO frame to zero scsi: megaraid_sas: max_fw_cmds are decremented twice, remove duplicate scsi: megaraid_sas: update can_queue only if the new value is less scsi: megaraid_sas: Change max_cmd from u32 to u16 in all functions scsi: megaraid_sas: set pd_after_lb from MR_BuildRaidContext and initialize pDevHandle to MR_DEVHANDLE_INVALID scsi: megaraid_sas: latest controller OCR capability from FW before sending shutdown DCMD ...
2017-02-06scsi: remove eh_timed_out methods in the transport templateChristoph Hellwig
Instead define the timeout behavior purely based on the host_template eh_timed_out method and wire up the existing transport implementations in the host templates. This also clears up the confusion that the transport template method overrides the host template one, so some drivers have to re-override the transport template one. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-27block: split scsi_request out of struct requestChristoph Hellwig
And require all drivers that want to support BLOCK_PC to allocate it as the first thing of their private data. To support this the legacy IDE and BSG code is switched to set cmd_size on their queues to let the block layer allocate the additional space. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
2016-04-29mptsas: fix checks for dma mapping errorsAlexey Khoroshilov
mptsas_smp_handler() checks for dma mapping errors by comparison returned address with zero, while pci_dma_mapping_error() should be used. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-11-09scsi: use host wide tags by defaultChristoph Hellwig
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-06-13mptsas: fix depth param in scsi_track_queue_fullTomas Henzl
A user of scsi_track_queue_full should pass to the function a constant value untill the queue-depth changes, otherwise the internal logic in scsi_track_queue_full rejects the change. Other users of this function use a 'sdev->queue_depth - 1' as depth parameter, let's do the same. Signed-off-by: Tomas Henzl <thenzl@redhat.com> Acked-by: "Sreekanth Reddy" <Sreekanth.reddy@avagotech.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2014-11-12scsi: always assign block layer tags if enabledChristoph Hellwig
Allow a driver to ask for block layer tags by setting .use_blk_tags in the host template, in which case it will always see a valid value in request->tag, similar to the behavior when using blk-mq. This means even SCSI "untagged" commands will now have a tag, which is especially useful when using a host-wide tag map. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
2014-07-25mptfusion: tweak null pointer checksJoe Lawrence
Fixes the following smatch warnings: drivers/message/fusion/mptbase.c:652 mptbase_reply() warn: variable dereferenced before check 'reply' (see line 639) [JL: No-brainer, the enclosing switch statement dereferences reply, so we can't get here unless reply is valid.] drivers/message/fusion/mptsas.c:1255 mptsas_taskmgmt_complete() error: we previously assumed 'pScsiTmReply' could be null (see line 1227) [HCH: Reading the code in mptsas_taskmgmt_complete it's pretty obvious that it can't do anything useful if mr/pScsiTmReply are NULL, so I suspect it would be best to just return at the beginning of the function. I'd love to understand if it actually could ever be zero, which I doubt. Maybe the LSI people can shed some light on that?] drivers/message/fusion/mptsas.c:3888 mptsas_not_responding_devices() error: we previously assumed 'port_info->phy_info' could be null (see line 3875) [HCH: It's pretty obvious from reading mptsas_sas_io_unit_pg0 that we never register a port_info with a NULL phy_info in the lists, so all NULL checks on it could be deleted.] drivers/message/fusion/mptscsih.c:1284 mptscsih_info() error: we previously assumed 'h' could be null (see line 1274) [HCH: shost_priv can't return NULL, so the if (h) should be removed.] drivers/message/fusion/mptscsih.c:1388 mptscsih_qcmd() error: we previously assumed 'vdevice' could be null (see line 1373) [HCH: vdevice can't ever be NULL here, it's allocated in ->slave_alloc and thus guaranteed to be around when ->queuecommand is called.] Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Acked-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25mptfusion: combine fw_event_work and its event_dataJoe Lawrence
Tack the firmware reply event_data payload to the end of its corresponding struct fw_event_work allocation. Rework fw_event_work allocation calculations to include the event_data size where appropriate. This clarifies the code a bit and avoids the following smatch warnings: drivers/message/fusion/mptsas.c:1003 mptsas_queue_device_delete() error: memcpy() 'fw_event->event_data' too small (29 vs 36) drivers/message/fusion/mptsas.c:1017 mptsas_queue_rescan() error: not allocating enough data 168 vs 160 Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Acked-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25mptfusion: mark file-private functions as staticJoe Lawrence
Fixes the following sparse warnings: drivers/message/fusion/mptbase.c:7011:1: warning: symbol 'mpt_SoftResetHandler' was not declared. Should it be static? drivers/message/fusion/mptsas.c:1578:23: warning: symbol 'mptsas_refreshing_device_handles' was not declared. Should it be static? drivers/message/fusion/mptsas.c:3653:24: warning: symbol 'mptsas_expander_add' was not declared. Should it be static? drivers/message/fusion/mptsas.c:5327:1: warning: symbol 'mptsas_shutdown' was not declared. Should it be static? drivers/message/fusion/mptspi.c:624:1: warning: symbol 'mptscsih_quiesce_raid' was not declared. Should it be static? Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Acked-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
2014-07-25scsi: convert device_busy to atomic_tChristoph Hellwig
Avoid taking the queue_lock to check the per-device queue limit. Instead we do an atomic_inc_return early on to grab our slot in the queue, and if necessary decrement it after finishing all checks. Unlike the host and target busy counters this doesn't allow us to avoid the queue_lock in the request_fn due to the way the interface works, but it'll allow us to prepare for using the blk-mq code, which doesn't use the queue_lock at all, and it at least avoids a queue_lock round trip in scsi_device_unbusy, which is still important given how busy the queue_lock is. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Webb Scales <webbnh@hp.com> Acked-by: Jens Axboe <axboe@kernel.dk> Tested-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Robert Elliott <elliott@hp.com>
2014-05-28fusion: Remove use of DEF_SCSI_QCMDMatthew Wilcox
Removing the host_lock from the I/O submission path gives a huge scalability improvement. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org> Reviewed-by: Praveen Krishnamoorthy <Praveen.krishnamoorthy@lsi.com> Acked-by: Sreekanth Reddy <Sreekanth.reddy@lsi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2013-11-23block: Kill bio_segments()/bi_vcnt usageKent Overstreet
When we start sharing biovecs, keeping bi_vcnt accurate for splits is going to be error prone - and unnecessary, if we refactor some code. So bio_segments() has to go - but most of the existing users just needed to know if the bio had multiple segments, which is easier - add a bio_multiple_segments() for them. (Two of the current uses of bio_segments() are going to go away in a couple patches, but the current implementation of bio_segments() is unsafe as soon as we start doing driver conversions for immutable biovecs - so implement a dumb version for bisectability, it'll go away in a couple patches) Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Neil Brown <neilb@suse.de> Cc: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
2013-05-08Merge branch 'for-3.10/core' of git://git.kernel.dk/linux-blockLinus Torvalds
Pull block core updates from Jens Axboe: - Major bit is Kents prep work for immutable bio vecs. - Stable candidate fix for a scheduling-while-atomic in the queue bypass operation. - Fix for the hang on exceeded rq->datalen 32-bit unsigned when merging discard bios. - Tejuns changes to convert the writeback thread pool to the generic workqueue mechanism. - Runtime PM framework, SCSI patches exists on top of these in James' tree. - A few random fixes. * 'for-3.10/core' of git://git.kernel.dk/linux-block: (40 commits) relay: move remove_buf_file inside relay_close_buf partitions/efi.c: replace useless kzalloc's by kmalloc's fs/block_dev.c: fix iov_shorten() criteria in blkdev_aio_read() block: fix max discard sectors limit blkcg: fix "scheduling while atomic" in blk_queue_bypass_start Documentation: cfq-iosched: update documentation help for cfq tunables writeback: expose the bdi_wq workqueue writeback: replace custom worker pool implementation with unbound workqueue writeback: remove unused bdi_pending_list aoe: Fix unitialized var usage bio-integrity: Add explicit field for owner of bip_buf block: Add an explicit bio flag for bios that own their bvec block: Add bio_alloc_pages() block: Convert some code to bio_for_each_segment_all() block: Add bio_for_each_segment_all() bounce: Refactor __blk_queue_bounce to not use bi_io_vec raid1: use bio_copy_data() pktcdvd: Use bio_reset() in disabled code to kill bi_idx usage pktcdvd: use bio_copy_data() block: Add bio_copy_data() ...
2013-04-09fusion: switch to ->show_info()Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-03-23block: Remove some unnecessary bi_vcnt usageKent Overstreet
More prep work for immutable bvecs/effecient bio splitting - usage of bi_vcnt has to be auditing, so getting rid of all the unnecessary usage makes that easier. Plus, bio_segments() is really what this code wanted, as it respects the current value of bi_idx. Signed-off-by: Kent Overstreet <koverstreet@google.com> CC: Jens Axboe <axboe@kernel.dk> CC: Eric Moore <Eric.Moore@lsi.com> CC: "James E.J. Bottomley" <JBottomley@parallels.com> CC: linux-scsi@vger.kernel.org
2013-01-03Drivers: message: remove __dev* attributes.Greg Kroah-Hartman
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, 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: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2011-12-15[SCSI] mptsas: Add device ID for SAS1068_820XELP.Chandrakala Chavva
Signed-off-by: Chandrakala Chavva <cchavva@caviumnetworks.com> Signed-off-by: David Daney <david.daney@cavium.com> Acked-by: "Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-27[SCSI] mptfusion: Fix for device offline while doing aggressive HBA resetkashyap.desai@lsi.com
[Resend patch as per Bernd Schubert comment ] Issue: Device goes offline while doing aggressive HBA reset along with IO using some utility. Root cause: FW goes into bad state due to aggressive reset. Softreset does not help to recover FW. And also aggressive reset open up the window for Error handling thread to kicked off at the same time HBA will be in constant RESET loop as part of aggressive reset test case can lead Device to goes offline. Changes: 1. Added extra check as below inside eh_timed_out call back as below. if(ioc->ioc_reset_in_progress) Rc = EH_TIMER_RESET 2. Removed " DOORBELL_ACTIVE" check for SAS controller from task management context. Since SAS controller uses high priority queue for task management. This check is not required for SAS controller. 3. Moved SoftReset call to HardReset from Task Mgmt context. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-27[SCSI] mptfusion: Avoid out of order Event processing due to cpu migrationkashyap.desai@lsi.com
Driver will now schedule MPI event using "delay_work_queue_on" to specify same CPU to be used to schedule work. Earlier it used "delay_work_queue" which can cause migration of work due to kernel' timer migration feature. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-27[SCSI] mptfusion: Better handling of DEAD IOC PCI-E Link down error conditionkashyap.desai@lsi.com
Find Non-Operation IOC and remove it from OS: Detecting dead(non-functional) ioc will be done reading doorbell register value from fault reset thread, which has been called from work thread context after each specific interval. If doorbell value is 0xFFFFFFFF, it will be considered as IOC is non-operational and marked as dead ioc. Once Dead IOC has been detected, it will be removed at pci layer using "pci_remove_bus_device" API. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-27[SCSI] mptfusion: Set max sector count module parameterkashyap.desai@lsi.com
The max_sector setting is currently hard-coded in the driver to 8192 sectors (4MB transfers). Using new module parameter, if max_sectors is specified at load time, the default of 8192 will be overridden. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-05-17[SCSI] mptsas: Fix annoying warningBorislav Petkov
Shut up drivers/message/fusion/mptsas.c: In function 'mptsas_event_process': drivers/message/fusion/mptsas.c:5015: warning: unused variable 'log_info' for configs with CONFIG_SCSI_MPT2SAS_LOGGING unset. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com> Signed-off-by: James Bottomley <jbottomley@parallels.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-02-12[SCSI] mptfusion: Remove bus reset for mptsas moduleKashyap, Desai
Bus reset is not required for SAS Controller. It is valid for mptspi and mptfc, but for mptsas it is not required. It is an extra work for Error handling escallation for mptsas. Removing bus reset from error handling will eventually speedup Error handling for SAS controller. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] mptfusion: Support SAS2.0 Devices with SAS1.0 ControllersKashyap, Desai
SAS1.0 Controller was not able to detect SAS2.0 Expanders due to Link RATE detection was limited to 1.5 Gbps and 3.0 Gbps for SAS1 controllers. Added detection for 6.0 Gbps link. Now, user can mix-up 6.0 Gpbs links with SAS1.0 controller. e.g SAS1.0 HBA <----> SAS2.0 Expander <------> SAS2.0 Expander <--------> SAS1.0 Drive. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-22Merge branch 'master' into for-nextJiri Kosina
Conflicts: MAINTAINERS arch/arm/mach-omap2/pm24xx.c drivers/scsi/bfa/bfa_fcpim.c Needed to update to apply fixes for which the old branch was too outdated.
2010-11-16SCSI host lock push-downJeff Garzik
Move the mid-layer's ->queuecommand() invocation from being locked with the host lock to being unlocked to facilitate speeding up the critical path for drivers who don't need this lock taken anyway. The patch below presents a simple SCSI host lock push-down as an equivalent transformation. No locking or other behavior should change with this patch. All existing bugs and locking orders are preserved. Additionally, add one parameter to queuecommand, struct Scsi_Host * and remove one parameter from queuecommand, void (*done)(struct scsi_cmnd *) Scsi_Host* is a convenient pointer that most host drivers need anyway, and 'done' is redundant to struct scsi_cmnd->scsi_done. Minimal code disturbance was attempted with this change. Most drivers needed only two one-line modifications for their host lock push-down. Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Acked-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-11-01tree-wide: fix comment/printk typosUwe Kleine-König
"gadget", "through", "command", "maintain", "maintain", "controller", "address", "between", "initiali[zs]e", "instead", "function", "select", "already", "equal", "access", "management", "hierarchy", "registration", "interest", "relative", "memory", "offset", "already", Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-07-28[SCSI] mptfusion: Extra debug prints added relavent to Device missing delay ↵Kashyap, Desai
error handling Adding function name in original debug prints and few more debug prints are added. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-28[SCSI] mptfusion: Block Error handling for deleting devices or Device in DMDKashyap, Desai
Issue description: In multipath topology, when device deletion is in transient state, multipath driver can call blk_flush_queue() as part of path failure. Before device get deleted from OS, Device may go OFFLINE as part of error handling kicked off triggered from multipathing driver. Above condition hits more frequently if device missing delay timer (which is LSI specific firmware parameter) is non zero value. root cause of this issue is Error handling thread is getting kicked off for device which is not really present(in transient state of deleting). This patch has solution for this issue. driver is now using eh_timed_out callback. See below. mptsas_transport_template->eh_timed_out = mptsas_eh_timed_out Using mptsas_eh_timed_out function, driver can decide weather vdevice is under Device missing delay or deleting state. for either of those cases, there is BLK_EH_RESET_TIMER return to scsi mid and error handling thread will not be kicked off for that particular scsi command. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27[SCSI] mptfusion: print Doorbell register in a case of hard reset and timeoutKei Tokunaga
Printing Doorbell register in a case of hard reset and timeout should be useful for figuring out the state of the system. Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com> Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27[SCSI] mptsas: fixed hot-removal processingKei Tokunaga
This patch fixes mptsas disk hot-removal processing. The hot-removal processing doesn't complete because of this condition. drivers/message/fusion/mptsas.c: mptsas_taskmgmt_complete() if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off) mptsas_queue_device_delete(...); mptsas_queue_device_delete(), which must be called for hot-removal, never gets called because mptsas_find_vtarget() always returns 0 here. At that time, the vtarget has already been freed in mptsas_target_destroy(), and also the scsi_device has been marked as SDEV_DEL. As a result of the issue, port deletion functions won't get called and the device ends up being in an incomplete state. (Some data structures and sysfs entries, which should be removed in hot-removal, remain.) One side effect of this is that a hot-addition of the device (bringing the device back on) fails. This patch just removes mptsas_find_vtarget() from the if-state condition. Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com> Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27[SCSI] mptfusion: Added code for occationally SATA hotplug failure.Kashyap, Desai
Issue: SATA hotplug does not work sometimes. At the time of ADD device/ADD phys disk, drive may fail to add SATA device due to temporary SAS Address for SATA device generated by firmware. Final SAS address for SATA driver will be generated only after disk spinup is done. This may take some times for slow spining SATA drives. At phy link up driver gets attached device sas address and stores into phyinfo. At the time of ADD event driver will read sas device page0 using channel and FW ID provided in ADD Device event. Here in case of SATA drives, driver will see miss match in phyinfo->sas_address and latest sas address read from SAS DEVICE PAGE0 and eventually device won't be added to OS. Fix: When Driver read SAS DEVICE PAGE0, it can identify Device type looking at device_info. If device is SATA drive and sas address mismatch happens, Driver will do same stuffs which happened at the time of LINK UP to get correct piece of information from Pages. ( Find parent device and refresh parent device phys either HBA refresh/Exp refresh) Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27[SCSI] mptfusion: schedule_target_reset from all Reset contextKashyap, Desai
Issue: target reset will be queued to driver's internal queue to get schedule later. When driver add target into internal target_reset queue we will block IOs on those target using scsi midlayer API. Now due to some cause driver is not executing those target_reset list and it is always in block state. Changes: now we are clearing target_reset queue from all other Callback context instead of only DeviceReset context.Now wherever driver is clearing taskmgmt_in_progress flag it is considering target_reset queue cleanup also. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27[SCSI] mptfusion: Added sanity to check B_T mapping for device before adding ↵Kashyap, Desai
to OS Added sanity check before treating any device is a valid device. It is possible that firmware can have device page0 in its table, but that devicemay not be available in topology. Device will be available in topology only if there is Bus Target mapping is done in firmware. Driver will always check B_T mapping of firmware before reporting device to upper layer. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27[SCSI] mptfusion: Corrected declaration of device_missing_delayKashyap, Desai
device missing delay is 8 bit value in io unit pg1. Making correct variable declaration for device_missing_delay. The driver is storing the calculated device missing delay in IOC structure as a u8 instead of a u16. It needs to be a u16 if the delay is > 255. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11[SCSI] mptfusion: Proper error handling is added after mpt_config timeoutKashyap, Desai
Added proper error handling after mpt_config. Now check of MPI_IOCSTATUS_CONFIG_INVALID_PAGE is added. If error is MPI_IOCSTATUS_CONFIG_INVALID_PAGE, driver will return -ENODEV. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11[SCSI] mptfusion: Check for command status is added after completion.Kashyap, Desai
1) Corrected name string as "MPT SAS HOST" 2) Added proper check conditions for MPT_MGMT_STATUS_COMMAND_GOOD. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11[SCSI] mptfusion: Proper bus_type check is addedKashyap, Desai
Added proper bus_type check before processing event/ reset handler. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11[SCSI] mptfusion: mpt_detach is called properly at the time of rmmodKashyap, Desai
Current design of mptsas is as follow. MPTSAS will do probe() if pci id matches for available card in system, irrespective of mode of controller. If controller is I/T mode or I mode, things are fine. If controller is only in T mode, mptsas is not doing complete process of mptsas_probe(). It will only make sure IOC structure is created and IOC reference is available for mptstm driver. Now While removing module we should take care case of Target mode only mptsas. If we are removing IOC which is only in Target mode, We should only detach IOC instead of following rest of the cleanup process which is only required for T mode controller. Now For T mode controller, only part clean up is done instead of complete cleanup. mpt_detach will call early in case of Target mode only controller. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11[SCSI] mptfusion: Added new less expensive RESET (Message Unit Reset)Kashyap, Desai
Message Unit Reset - instructs the IOC to reset the Reply Post and Free FIFO's. All the Message Frames on Reply Free FIFO are discarded. All posted buffers are freed, and event notification is turned off. IOC doesnt reply to any outstanding request. This will transfer IOC to READY state. Message unit ready is less expensive operations than Hard Reset. soft reset will not force Firmware to reload again, it only do clean up of Message units. mpt_Soft_Hard_ResetHandler will first try for Soft Reset,if it fails then go for big hammer reset which is Hard Reset. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-01-18[SCSI] mptfusion: block device when target is being removed by FWKashyap, Desai
Add support to set the sdev state to SDEV_BLOCK during device removal to stop IOs comming to the deleting driver immediately. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-01-18[SCSI] mptfusion: Added sysfs expander manufacture information at the time ↵Kashyap, Desai
of expander add. Added new function mptsas_exp_manufacture_info, which will obtain the REPORT_MANUFACTURING, and fill the details into the sas_expander_device object when the expander port is created. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2009-09-12[SCSI] mptsas : FW event thread and scsi mid layer deadlock in SYNCHRONIZE ↵Kashyap, Desai
CACHE command Normally In HBA reset path MPT driver will flush existing work in current work queue (mpt/0) . This is just a dummy activity for MPT driver point of view, since HBA reset will turn off Work queue events. It means we will simply returns from work queue without doing anything. But for the case where Work is already done (half the way), we have to have that work to be done. Considering above condition we stuck forever since Deadlock in scsi midlayer and MPT driver. sd_sync_cache() will wait forever since HBA is not in Running state, and it will never come into Running state since sd_sync_cache() is called from HBA reset context. Now new code will not wait for half cooked work to be finished before returning from HBA reset. Once we are out of HBA reset, EH thread will change host state to running from recovery and work waiting for running state of HBA will be finished. New code is turning ON firmware event from another special work called Rescan toplogy. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2009-09-12[SCSI] mptsas : NULL pointer on big endian systems causing Expander not to ↵Kashyap, Desai
tear off On Big endian system kernel will crash due to address translation is not handle properly. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>