summaryrefslogtreecommitdiff
path: root/drivers/scsi (follow)
Commit message (Collapse)AuthorAge
...
* | scsi: ufs: Enable quirk to ignore sending WRITE_SAME commandSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | | | WRITE_SAME command is not supported by UFS. Enable a quirk for the upper level drivers to not send WRITE SAME command. Change-Id: If3108134ceefbcb9c8585c1b489b4124ffa6b1ad Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs-msm: override HS rate series with vendor specificsSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | High Speed rate series might always be set to rate "A" if the vendor doesn't specify any rate during pre-power change notify. Change-Id: Ied7ce3eba98ffbece97ec06eb6cab8df1d104f52 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs: add ioctl interface for query requestDolev Raviv2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch exposes the ioctl interface for UFS driver via SCSI device ioctl interface. As of now UFS driver would provide the ioctl for query interface to connected UFS device. Change-Id: I7a5cea8de925dc0ecb6643774321e2c3690c504e Signed-off-by: Dolev Raviv <draviv@codeaurora.org> [gbroner@codeaurora.org: dropping changes to the following files: include/uapi/scsi/Kbuild include/uapi/scsi/ufs/Kbuild include/uapi/scsi/ufs/ioctl.h include/uapi/scsi/ufs/ufs.h which are already included in previous change titled: 'uapi: scsi: ufs: add ioctl interface for query request'] Signed-off-by: Gilad Broner <gbroner@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts and compilation errors] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs: fix a compilation warningYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | Assign a value to 'ret' in order to prevent a compilation warning of: 'ret' may be used uninitialized in this function. Change-Id: Id10d0e5e8204d233cf4906bc33709d3c012d964f Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
* | scsi: ufs: change the default preferences of vendor pwr change to HSYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | In this change the default preferences of the UFS vendor are set to work in HS-G1- 1 Lane, as the enviroment became stable. Change-Id: I340190d5c6cf4f848f9def7eba8831fb299adadb Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
* | scsi: ufs-msm: avoid code duplication when setting timer registerYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | | | | | | | since two different routines implement almost the same logic of scanning the ufs clocks, getting the rate of "core_clk" and setting a vendor timer register with a calculated value, we should use only one routine to do that in order to minimize potential errors Change-Id: I22728295074acfbe4d421996ea9eaa1f29cb3a32 Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
* | scsi: ufs-msm: add vendor specific support for power change callbackYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes, the device shall report its maximum power and speed capabilities, but we might not wish to configure it to use those maximum capabilities. In this change we implement the vendor specific callback that should determines what parameters we should use in power change. It takes into account the maximum capabilities of the device, and also the pre-defined vendor preferences. According to both set of parameters, it calculates the maximum power and speed that are still acceptable by both: the vendor preferences and the devices capabilities. Change-Id: I3ef468d3882f3ed9d49a99aa285af4a1f58063a0 Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> [subhashj@codeaurora.org: fixed compilation errors] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs-msm: fix fall-through in switch caseYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | | | fix fall through in msm_ufs_link_startup_notify() during PRE_CHANGE, since we would like msm_ufs_enable_tx_lanes(hba) to happen only in POST_CHANGE Change-Id: I91b1134ef7060ee8b8189335d0ef7b5a4f546534 Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
* | scsi: ufs-msm: fix issue with setting the ref_clk enable flagSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | Fix missing update of ref_clk enable reference count when the clocks are enabled and also enable shutting down the phy and device during system suspend. Change-Id: I7772cd87e0d0528ab5dbe6ea9f09e6d02c86f96c Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs: expose driver run time data and hci regs via debugfsYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | This change adds a few more options to a user to get a complete status and statistics regarding the UFS driver, via debugfs This information includes: 1. UFS Host Controller registers (cat /sys/kernel/debug/ufs/host_regs) 2. hba values (cat /sys/kernel/debug/ufs/show_hba) Change-Id: Iac60de81a56ed42de72c3a7946a0d2bb5fab2903 Signed-off-by: Dolev Raviv <draviv@codeaurora.org> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
* | scsi: ufs: dump debug info during failuresDolev Raviv2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | Inserts driver dumps for UFS Host Controller registers, Transfer Requests and Task Management Requests. The dumps will occur on driver initialization failure, ufshcd_abort() and on error handling path. Change-Id: Ie8683e22a619cdae20680b15930e546e84f8aa73 Signed-off-by: Dolev Raviv <draviv@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs-msm: add power management supportSubhash Jadavani2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the vendor specific UFS power management support for MSM platform. If UFS link hibernate operation is broken in HW, make sure that link remains active and device in sleep state during the runtime suspend. During system suspend, keep both link and device in power off state. If UFS link hibernate operation is working properly in HW, keep the link in hibernate state and device in sleep state during both runtime and system suspend. Change-Id: Ibc5be00eb9d5fd72ed116b887d835a12ed97ae78 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs: Allowing power mode changeYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | | | | | | | Due to M-PHY issues, moving from HS to any other mode or gear or even Hibern8 causes some un-predicted behavior of the device. This patch fixes this issues. Change-Id: I4540e30703aa1212099b2316e158b09e311c7420 Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs-msm: enable broken power mode change quirkSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | UFS devices on msm ufs v1.1 controller fail to change power mode during initialization. Enable the UFSHCD_QUIRK_BROKEN_PWR_MODE_CHANGE quirk to make sure the power mode is not switched. Change-Id: Ie02ae5a2da3604a83828325719eb5edb167ca82e Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs-msm: enable broken command queuing quirkYaniv Gardi2016-03-22
| | | | | | | | | | | | | | | | | | | | Some devices, even though advertises command queuing capability, may not behave well when multiple commands are queued concurrently. Disable command queuing for the device to avoid command hangs when multiple commands are sent. Change-Id: I7458c081976e96d2a97c8c9544acfd29163d9e1f Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
* | scsi: ufs-msm: Add reference clock control supportSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | Reference clock is propogated from source to PHY with various LDO gating logic in between. Add support for enabling these LDOs and also source reference clock. Change-Id: I0de6d5d47aff175cd5526b6de2f8e4078cb08316 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs: try read capacity (10) firstSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | UFS 1.1 specification defines READ_CAPACTIY(16) as an optional command. Hence, try READ_CAPACITY(10) first, if the device returns 0xFFFF_FFFF as returned logical block address then send READ_CAPACITY(16) to read the actual device capacity. Change-Id: I2690d26be967e6be4debdc773100c55ba751aa1f Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs-msm: modify PHY register configurationsSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | Modify the PHY power up calibration values according to the latest hardware specification. Change-Id: I145dc8d5644c1914bb0fcb9c9b5790cf2b8de367 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs-msm: Enable 64-bit addressing support quirkSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | MSM UFS host controller advertises CAP.64AS bit as zero even though it can adress upto 36 bits. Change-Id: Ia8edd9ede3cc5e8358775d1efca5451cc3559773 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs: Allow 64-bit broken quirkSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | Some UFS host controllers might advertise that 64-bit addressing is not supported even though it supports >32-bit addressing. Add a quirk so that 64-bit is enabled and dma mask is set accordingly. Change-Id: Ie17662f55dda1da7d508efb881ac8fb8fa95f15a Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | ufs-pltfrm: initialize DMA mask for device-tree probed deviceAkinobu Mita2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device-tree probed device for ARM doesn't have dev->dma_mask. So dma_set_mask() for the device doesn't succeed. The popular trick for this is - dev->dma_mask = &dev->coherent_dma_mask; Currently there is no dma_set_mask() call in ufs-pltfrm, but the forthcoming fix needs proper DMA mask setting in ufs core driver. So initializing dev->dma_mask as described above is required. Change-Id: I8428f106ca2d97badb7bf57cbb1d3ee14dddaf7f Signed-off-by: Akinobu Mita <mita@fixstars.com> Cc: Sujit Reddy Thumma <sthumma@codeaurora.org> Cc: Vinayak Holikatti <vinholikatti@gmail.com> Cc: Santosh Y <santoshsy@gmail.com> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: linux-scsi@vger.kernel.org Patch-mainline: linux-scsi@vger.kernel.org @ 2013/08/19 19:26 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs-msm: Fix unnecessary poll during initializationSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | In msm_ufs_check_hibern8(), the loop never breaks until timeout even if the tx_fsm_val is equal to expected value. Change-Id: I6f5ee6aea2e50ff6c88547d5e651d6cccfd25212 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs-msm: fix UFS version register bugSubhash Jadavani2016-03-22
| | | | | | | | | | | | | | | | | | | | Qualcomm MSM UFS controller version register (VER) wrongly advertise the version as v1.0 though controller implementation is as per UFSHCI v1.1 specification. This patch corrects this HW behaviour with appropriate quirk handling. Change-Id: Idc99e8504617e7828043e06afdaecb7ddc4218f8 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs-msm: advertise deviations from UFSHCI standard specSubhash Jadavani2016-03-22
| | | | | | | | | | | | | | | | | | HIBERN8 & Interrupt aggregation feature is broken on MSM UFS controller HW revision 1.1.0 hence this patch advertise UFSHCD_QUIRK_BROKEN_HIBERN8 & UFSHCD_QUIRK_BROKEN_INTR_AGGR quirks to standard UFSHCD driver. Change-Id: I14f063f5802c7dce95e4fd41a9edcb2ed566caa6 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs: add support to allow non standard behaviours (quirks)Subhash Jadavani2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some implementation of UFS host controller HW might have some non-standard behaviours (quirks) when compared to behaviour specified by UFSHCI specification. This patch add support to allow specifying all such quirks to standard UFS host controller driver so standard driver takes them into account. Currently only couple of quirks (UFSHCD_QUIRK_BROKEN_HIBERN8 & UFSHCD_QUIRK_BROKEN_INTR_AGGR) are added but new quirks can be added as and when other non standard behaviours are found. Change-Id: Ie8e686bb59e7933a281a4ff189a35c71036b1e92 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs: program number of TX lanes to drive in MSM UFS PHYSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | After link startup the phy adapter (PA) layer in Uni-Pro automatically detects the number of available lanes for communication with the device. Since it is choice of s/w to use all the available lanes or a partial of them, it is necessary to communicate to MSM PHY about the lanes not being used so that PHY can stop driving them. Change-Id: I6f005e67a4c0a35dcba0ff186de5817af1b0439d Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
* | scsi: ufs: Add UFS host PHY driver for MSM targetsSujit Reddy Thumma2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add MSM UFS host PHY driver which binds with UFSHCD platform driver exposing vendor specific operations to initialize the PHY. Since the controller and PHY are tightly coupled in the system, some of the MSM specific controller register configuration is also applied inline while initializing PHY. Add a new compatible property "qcom,ufshc" which specifies the UFS host controller on MSM platforms. The UFS controller driver binds with UFS PHY driver using the phandle reference of PHY devicetree node. Change-Id: If695a844d03268151c6c846bdfa6cee8ff84491b Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> [venkatg@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | scsi: ufs: add debugfs for ufsLee Susman2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | Adding debugfs capability for ufshcd. This patch also implements command tag statistics enabling, disabling, printing and resetting. Change-Id: Idea0323391029c446a0a75aa5bea7070e3ab8125 Signed-off-by: Lee Susman <lsusman@codeaurora.org> [gbroner@codeaurora.org: fix minor merge conflict] Signed-off-by: Gilad Broner <gbroner@codeaurora.org> [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
* | scsi: ufs: created UFS unit-tests frameworkDolev Raviv2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | Created a new UFS block device test framework. This test includes: - Basic read after write command - Random buffer length - Ability to run test multiple times Change-Id: I06fe7bf7d325037d6039a4acfdfb9c2c8960a435 Signed-off-by: Dolev Raviv <draviv@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
* | scsi: ufs: clear UTRD, UPIU req and rsp before new transfersMaya Erez2016-03-22
|/ | | | | | | | | | | | | | | | | | | Clear the UFS data structures before sending new request. The SCSI command is sent to the device within the UFS UPIU request. As part of the transfer UPIU preparation, the SCSI command is copied to the UPIU structure according to the SCSI command size. As different SCSI commands differ in size from each other, we need to clear the whole SCSI command field to prevent sending uninitialized data to the device. The UPIU response doesn't always include the sense data and can differ in size. Hence, the UPIU response should also be cleared before the transfer. Change-Id: I9bba619dc884e973a05566e0f975bd8473612644 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org>
* Merge remote-tracking branch 'mkp-scsi/4.4/scsi-fixes' into fixesJames Bottomley2015-12-28
|\
| * sd: Reject optimal transfer length smaller than page sizeMartin K. Petersen2015-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eryu Guan reported that loading scsi_debug would fail. This turned out to be caused by scsi_debug reporting an optimal I/O size of 32KB which is smaller than the 64KB page size on the PowerPC system in question. Add a check to ensure that we only use the device-reported OPTIMAL TRANSFER LENGTH if it is bigger than or equal to the page cache size. Reported-by: Eryu Guan <guaneryu@gmail.com> Reported-by: Ming Lei <tom.leiming@gmail.com> Reviewed-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | Merge remote-tracking branch 'mkp-scsi/4.4/scsi-fixes' into fixesJames Bottomley2015-12-17
|\|
| * Revert "SCSI: Fix NULL pointer dereference in runtime PM"Ken Xue2015-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 49718f0fb8c9 ("SCSI: Fix NULL pointer dereference in runtime PM") The old commit may lead to a issue that blk_{pre|post}_runtime_suspend and blk_{pre|post}_runtime_resume may not be called in pairs. Take sr device as example, when sr device goes to runtime suspend, blk_{pre|post}_runtime_suspend will be called since sr device defined pm->runtime_suspend. But blk_{pre|post}_runtime_resume will not be called since sr device doesn't have pm->runtime_resume. so, sr device can not resume correctly anymore. More discussion can be found from below link. http://marc.info/?l=linux-scsi&m=144163730531875&w=2 Signed-off-by: Ken Xue <Ken.Xue@amd.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: Xiangliang Yu <Xiangliang.Yu@amd.com> Cc: James E.J. Bottomley <JBottomley@odin.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Michael Terry <Michael.terry@canonical.com> Cc: stable@vger.kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | ses: fix additional element traversal bugJames Bottomley2015-12-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KASAN found that our additional element processing scripts drop off the end of the VPD page into unallocated space. The reason is that not every element has additional information but our traversal routines think they do, leading to them expecting far more additional information than is present. Fix this by adding a gate to the traversal routine so that it only processes elements that are expected to have additional information (list is in SES-2 section 6.1.13.1: Additional Element Status diagnostic page overview) Reported-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Tested-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* | ses: Fix problems with simple enclosuresJames Bottomley2015-12-10
|/ | | | | | | | | | | | | | | | | | Simple enclosure implementations (mostly USB) are allowed to return only page 8 to every diagnostic query. That really confuses our implementation because we assume the return is the page we asked for and end up doing incorrect offsets based on bogus information leading to accesses outside of allocated ranges. Fix that by checking the page code of the return and giving an error if it isn't the one we asked for. This should fix reported bugs with USB storage by simply refusing to attach to enclosures that behave like this. It's also good defensive practise now that we're starting to see more USB enclosures. Reported-by: Andrea Gelmini <andrea.gelmini@gelma.net> Cc: stable@vger.kernel.org Reviewed-by: Ewan D. Milne <emilne@redhat.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
* Merge tag 'scsi-fixes' of ↵Linus Torvalds2015-12-06
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi Pull SCSI fixes from James Bottomley: "This is quite a bumper crop of fixes: three from Arnd correcting various build issues in some configurations, a lock recursion in qla2xxx. Two potentially exploitable issues in hpsa and mvsas, a potential null deref in st, a revert of a bdi registration fix that turned out to cause even more problems, a set of fixes to allow people who only defined MPT2SAS to still work after the mpt2/mpt3sas merger and a couple of fixes for issues turned up by the hyper-v storvsc driver" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: mpt3sas: fix Kconfig dependency problem for mpt2sas back compatibility Revert "scsi: Fix a bdi reregistration race" mpt3sas: Add dummy Kconfig option for backwards compatibility Fix a memory leak in scsi_host_dev_release() block/sd: Fix device-imposed transfer length limits scsi_debug: fix prevent_allow+verify regressions MAINTAINERS: Add myself as co-maintainer of the SCSI subsystem. sd: Make discard granularity match logical block size when LBPRZ=1 scsi: hpsa: select CONFIG_SCSI_SAS_ATTR scsi: advansys needs ISA dma api for ISA support scsi_sysfs: protect against double execution of __scsi_remove_device() st: fix potential null pointer dereference. scsi: report 'INQUIRY result too short' once per host advansys: fix big-endian builds qla2xxx: Fix rwlock recursion hpsa: logical vs bitwise AND typo mvsas: don't allow negative timeouts mpt3sas: Fix use sas_is_tlr_enabled API before enabling MPI2_SCSIIO_CONTROL_TLR_ON flag
| * Merge branch 'mkp-fixes' into fixesJames Bottomley2015-12-03
| |\
| | * mpt3sas: fix Kconfig dependency problem for mpt2sas back compatibilityJames Bottomley2015-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The non-PCI builds of the O day test project are failing: On Thu, 2015-12-03 at 05:02 +0800, kbuild test robot wrote: > warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct > dependencies (SCSI_LOWLEVEL && PCI && SCSI) The problem is that select and depend don't interact because Kconfig doesn't have a SAT solver, so depend picks up dependencies and select does onward selects, but select doesn't pick up dependencies. To fix this, we need to add the correct dependencies to the MPT2SAS option like this. Reported-by: kbuild test robot <fengguang.wu@intel.com> Fixes: b840c3627b6f4f856b333a14a72f8ed86da2f86c Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
| | * mpt3sas: Add dummy Kconfig option for backwards compatibilityMartin K. Petersen2015-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mpt2sas driver was recently folded into mpt3sas to reduce code duplication. To avoid problems for people that only have CONFIG_SCSI_MPT2SAS in their .config we introduce a dummy option that will select MPT3SAS if MPT2SAS was previously enabled. This is a temporary measure and we will deprecate this config option in 4.6. Reported-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Christoph Hellwig <hch@lst.de> Acked-by: James Bottomley <James.Bottomley@hansenpartnership.com> CC: Ingo Molnar <mingo@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * Fix a memory leak in scsi_host_dev_release()Bart Van Assche2015-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid that kmemleak reports the following memory leak if a SCSI LLD calls scsi_host_alloc() and scsi_host_put() but neither scsi_host_add() nor scsi_host_remove(). The following shell command triggers that scenario: for ((i=0; i<2; i++)); do srp_daemon -oac | while read line; do echo $line >/sys/class/infiniband_srp/srp-mlx4_0-1/add_target done done unreferenced object 0xffff88021b24a220 (size 8): comm "srp_daemon", pid 56421, jiffies 4295006762 (age 4240.750s) hex dump (first 8 bytes): 68 6f 73 74 35 38 00 a5 host58.. backtrace: [<ffffffff8151014a>] kmemleak_alloc+0x7a/0xc0 [<ffffffff81165c1e>] __kmalloc_track_caller+0xfe/0x160 [<ffffffff81260d2b>] kvasprintf+0x5b/0x90 [<ffffffff81260e2d>] kvasprintf_const+0x8d/0xb0 [<ffffffff81254b0c>] kobject_set_name_vargs+0x3c/0xa0 [<ffffffff81337e3c>] dev_set_name+0x3c/0x40 [<ffffffff81355757>] scsi_host_alloc+0x327/0x4b0 [<ffffffffa03edc8e>] srp_create_target+0x4e/0x8a0 [ib_srp] [<ffffffff8133778b>] dev_attr_store+0x1b/0x20 [<ffffffff811f27fa>] sysfs_kf_write+0x4a/0x60 [<ffffffff811f1e8e>] kernfs_fop_write+0x14e/0x180 [<ffffffff81176eef>] __vfs_write+0x2f/0xf0 [<ffffffff811771e4>] vfs_write+0xa4/0x100 [<ffffffff81177c64>] SyS_write+0x54/0xc0 [<ffffffff8151b257>] entry_SYSCALL_64_fastpath+0x12/0x6f Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Reviewed-by: Lee Duncan <lduncan@suse.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: stable <stable@vger.kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * block/sd: Fix device-imposed transfer length limitsMartin K. Petersen2015-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4f258a46346c ("sd: Fix maximum I/O size for BLOCK_PC requests") had the unfortunate side-effect of removing an implicit clamp to BLK_DEF_MAX_SECTORS for REQ_TYPE_FS requests in the block layer code. This caused problems for some SMR drives. Debugging this issue revealed a few problems with the existing infrastructure since the block layer didn't know how to deal with device-imposed limits, only limits set by the I/O controller. - Introduce a new queue limit, max_dev_sectors, which is used by the ULD to signal the maximum sectors for a REQ_TYPE_FS request. - Ensure that max_dev_sectors is correctly stacked and taken into account when overriding max_sectors through sysfs. - Rework sd_read_block_limits() so it saves the max_xfer and opt_xfer values for later processing. - In sd_revalidate() set the queue's max_dev_sectors based on the MAXIMUM TRANSFER LENGTH value in the Block Limits VPD. If this value is not reported, fall back to a cap based on the CDB TRANSFER LENGTH field size. - In sd_revalidate(), use OPTIMAL TRANSFER LENGTH from the Block Limits VPD--if reported and sane--to signal the preferred device transfer size for FS requests. Otherwise use BLK_DEF_MAX_SECTORS. - blk_limits_max_hw_sectors() is no longer used and can be removed. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=93581 Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: sweeneygj@gmx.com Tested-by: Arzeets <anatol.pomozov@gmail.com> Tested-by: David Eisner <david.eisner@oriel.oxon.org> Tested-by: Mario Kicherer <dev@kicherer.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi_debug: fix prevent_allow+verify regressionsDouglas Gilbert2015-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruediger Meier observed a regression with the PREVENT ALLOW MEDIUM REMOVAL command in lk 3.19: http://www.spinics.net/lists/util-linux-ng/msg11448.html Inspection indicated the same regression with VERIFY(10). The patch is against lk 3.19.3 and also works with lk 4.3.0 . With this patch both commands are accepted and do nothing. ChangeLog: - fix the lk 3.19 regression so that the PREVENT ALLOW MEDIUM REMOVAL command is supported once again - same fix for VERIFY(10) Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * sd: Make discard granularity match logical block size when LBPRZ=1Martin K. Petersen2015-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A device may report an OPTIMAL UNMAP GRANULARITY and UNMAP GRANULARITY ALIGNMENT in the Block Limits VPD. These parameters describe the device's internal provisioning allocation units. By default the block layer will round and align any discard requests based on these limits. If a device reports LBPRZ=1 to guarantee zeroes after discard, however, it is imperative that the block layer does not leave out any parts of the requested block range. Otherwise the device can not do the required zeroing of any partial allocation units and this can lead to data corruption. Since the dm thinp personality relies on the block layer's current behavior and is unable to deal with partial discard blocks we work around the problem by setting the granularity to match the logical block size when LBPRZ is enabled. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: hpsa: select CONFIG_SCSI_SAS_ATTRArnd Bergmann2015-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hpsa driver recently started using the sas transport class, but it does not ensure that the corresponding code is actually built, which may lead to a link error: drivers/built-in.o: In function `hpsa_free_sas_phy': (.text+0x1ce874): undefined reference to `sas_port_delete_phy' (.text+0x1ce87c): undefined reference to `sas_phy_free' drivers/built-in.o: In function `hpsa_alloc_sas_port': (.text+0x1ceb9c): undefined reference to `sas_port_alloc_num' (.text+0x1ceba8): undefined reference to `sas_port_add' drivers/built-in.o: In function `hpsa_init': (.init.text+0x8838): undefined reference to `sas_attach_transport' (.init.text+0x8868): undefined reference to `sas_release_transport This adds 'select SCSI_SAS_ATTR' in the Kconfig entry, just like we do for all other drivers using those functions. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: d04e62b9d63a ("hpsa: add in sas transport class") Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Don Brace <don.brace@pmcs.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: advansys needs ISA dma api for ISA supportArnd Bergmann2015-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The advansys drvier uses the request_dma function that is used on ISA machines for the internal DMA controller, which causes build errors on platforms that have ISA slots but do not provide the ISA DMA API: drivers/scsi/advansys.c: In function 'advansys_board_found': drivers/scsi/advansys.c:11300:10: error: implicit declaration of function 'request_dma' [-Werror=implicit-function-declaration] The problem now showed up in ARM randconfig builds after commit 6571fb3f8b7f ("advansys: Update to version 3.5 and remove compilation warning") made it possible to build on platforms that have neither VIRT_TO_BUS nor ISA_DMA_API but that do have ISA. This adds the missing dependency. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi_sysfs: protect against double execution of __scsi_remove_device()Vitaly Kuznetsov2015-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some host errors storvsc module tries to remove sdev by scheduling a job which does the following: sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun); if (sdev) { scsi_remove_device(sdev); scsi_device_put(sdev); } While this code seems correct the following crash is observed: general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC RIP: 0010:[<ffffffff81169979>] [<ffffffff81169979>] bdi_destroy+0x39/0x220 ... [<ffffffff814aecdc>] ? _raw_spin_unlock_irq+0x2c/0x40 [<ffffffff8127b7db>] blk_cleanup_queue+0x17b/0x270 [<ffffffffa00b54c4>] __scsi_remove_device+0x54/0xd0 [scsi_mod] [<ffffffffa00b556b>] scsi_remove_device+0x2b/0x40 [scsi_mod] [<ffffffffa00ec47d>] storvsc_remove_lun+0x3d/0x60 [hv_storvsc] [<ffffffff81080791>] process_one_work+0x1b1/0x530 ... The problem comes with the fact that many such jobs (for the same device) are being scheduled simultaneously. While scsi_remove_device() uses shost->scan_mutex and scsi_device_lookup() will fail for a device in SDEV_DEL state there is no protection against someone who did scsi_device_lookup() before we actually entered __scsi_remove_device(). So the whole scenario looks like that: two callers do simultaneous (or preemption happens) calls to scsi_device_lookup() ant these calls succeed for both of them, after that they try doing scsi_remove_device(). shost->scan_mutex only serializes their calls to __scsi_remove_device() and we end up doing the cleanup path twice. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * st: fix potential null pointer dereference.Maurizio Lombardi2015-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If cdev_add() returns an error, the code calls cdev_del() passing the STm->cdevs[rew] pointer as parameter; the problem is that the pointer has not been initialized yet. This patch fixes the problem by moving the STm->cdevs[rew] pointer initialization before the call to cdev_add(). It also sets STm->devs[rew] and STm->cdevs[rew] to NULL in case of failure. Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * scsi: report 'INQUIRY result too short' once per hostVitaly Kuznetsov2015-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some host adapters (e.g. Hyper-V storvsc) are known for not respecting the SPC-2/3/4 requirement for 'INQUIRY data (see table ...) shall contain at least 36 bytes'. As a result we get tons on 'scsi 0:7:1:1: scsi scan: INQUIRY result too short (5), using 36' messages on console. This can be problematic for slow consoles. Introduce short_inquiry flag in struct Scsi_Host to print the message once per host. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| | * advansys: fix big-endian buildsArnd Bergmann2015-11-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building the advansys driver in a big-endian configuration such as ARM allmodconfig shows a warning: drivers/scsi/advansys.c: In function 'adv_build_req': include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) drivers/scsi/advansys.c:7806:22: note: in expansion of macro 'cpu_to_le32' scsiqp->sense_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE); It turns out that the commit that introduced this used the cpu_to_le32() incorrectly on an 8-bit field, which results in the sense_len to always be set to zero, as the SCSI_SENSE_BUFFERSIZE value gets moved to upper byte of the 32-bit intermediate. This removes the cpu_to_le32() call to restore the original version. I found this only by looking at the compiler output and have not done a full review for possible further endianess bugs in the same driver. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 811ddc057aac ("advansys: use DMA-API for mapping sense buffer") Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: stable@vger.kernel.org # v4.2+ Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>