Uma Krishnan [Tue, 29 Nov 2016 00:41:36 +0000 (18:41 -0600)]
scsi: cxlflash: Improve context_reset() logic
Currently, the context reset routine waits for command room to
be available before sending the reset request. Per review of the
SISLite specification and clarifications from the CXL Flash AFU
designers, this wait is unnecessary. The reset request can be
sent anytime regardless of command room, so long as only a single
reset request is active at any one point in time.
This commit simplifies the reset routine by removing the wait for
command room. Additionally it adds a debug trace to help pinpoint
hardware errors when a context reset does not complete.
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Uma Krishnan [Tue, 29 Nov 2016 00:41:19 +0000 (18:41 -0600)]
scsi: cxlflash: Fix crash in cxlflash_restore_luntable()
During test, the following crash was observed:
[34538.981505] Faulting instruction address: 0xd000000007c9c870
cpu 0x9: Vector: 300 (Data Access) at [
c0000007f1e8f590]
pc:
d000000007c9c870: cxlflash_restore_luntable+0x70/0x1d0 [cxlflash]
lr:
d000000007c9c84c: cxlflash_restore_luntable+0x4c/0x1d0 [cxlflash]
sp:
c0000007f1e8f810
msr:
9000000100009033
dar:
c00000171d637438
dsisr:
40000000
current = 0xc0000007f1e43f90
paca = 0xc000000007b25100 softe: 0 irq_happened: 0x01
pid = 493, comm = eehd
enter ? for help
[
c0000007f1e8f8a0]
d000000007c940b0 init_afu+0xd60/0x1200 [cxlflash]
[
c0000007f1e8f9a0]
d000000007c945a8 cxlflash_pci_slot_reset+0x58/0xe0 [cxlflash]
[
c0000007f1e8fa20]
d00000000715f790 cxl_pci_slot_reset+0x230/0x340 [cxl]
[
c0000007f1e8fae0]
c000000000040dd4 eeh_report_reset+0x144/0x180
[
c0000007f1e8fb20]
c00000000003f708 eeh_pe_dev_traverse+0x98/0x170
[
c0000007f1e8fbb0]
c000000000041618 eeh_handle_normal_event+0x328/0x410
[
c0000007f1e8fc30]
c000000000041db8 eeh_handle_event+0x178/0x330
[
c0000007f1e8fce0]
c000000000042118 eeh_event_handler+0x1a8/0x1b0
[
c0000007f1e8fd80]
c00000000011420c kthread+0xec/0x100
[
c0000007f1e8fe30]
c00000000000a47c ret_from_kernel_thread+0x5c/0xe0
When superpipe mode is disabled for a LUN, the references for the
local lun are deleted but the LUN is still identified as being present
in the LUN table. This mismatched state can result in the above crash
when the LUN table is restored during an error recovery operation.
To fix this issue, the local LUN information structure is updated to
reflect the LUN is no longer in the LUN table once all references to
the LUN are gone.
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Uma Krishnan [Tue, 29 Nov 2016 00:41:06 +0000 (18:41 -0600)]
scsi: cxlflash: Set sg_tablesize to 1 instead of SG_NONE
The following Oops is encountered when blk_mq is enabled with the
cxlflash driver:
[ 2960.817172] Oops: Kernel access of bad area, sig: 11 [#5]
[ 2960.817309] NIP __blk_mq_run_hw_queue+0x278/0x4c0
[ 2960.817313] LR __blk_mq_run_hw_queue+0x2bc/0x4c0
[ 2960.817314] Call Trace:
[ 2960.817320] __blk_mq_run_hw_queue+0x2bc/0x4c0 (unreliable)
[ 2960.817324] blk_mq_run_hw_queue+0xd8/0x100
[ 2960.817329] blk_mq_insert_requests+0x14c/0x1f0
[ 2960.817333] blk_mq_flush_plug_list+0x150/0x190
[ 2960.817338] blk_flush_plug_list+0x11c/0x2b0
[ 2960.817344] blk_finish_plug+0x58/0x80
[ 2960.817348] __do_page_cache_readahead+0x1c0/0x2e0
[ 2960.817352] force_page_cache_readahead+0x68/0xd0
[ 2960.817356] generic_file_read_iter+0x43c/0x6a0
[ 2960.817359] blkdev_read_iter+0x68/0xa0
[ 2960.817361] __vfs_read+0x11c/0x180
[ 2960.817364] vfs_read+0xa4/0x1c0
[ 2960.817366] SyS_read+0x6c/0x110
[ 2960.817369] system_call+0x38/0xb4
The SCSI blk_mq stack assumes that sg_tablesize is always a non-zero
value with scsi_mq_setup_tags() allocating tags using sg_tablesize.
The cxlflash driver currently uses SG_NONE (0) for the sg_tablesize
as the devices it supports are not capable of scatter gather. This
mismatch of values results in the Oops above.
To resolve this issue, sg_tablesize for cxlflash can simply be set
to 1, a value which satisfies the constraints in cxlflash and the
lack of support of SG_NONE in SCSI blk_mq.
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
subhashj@codeaurora.org [Thu, 24 Nov 2016 00:33:19 +0000 (16:33 -0800)]
scsi: ufs: fix default power mode to FAST/SLOW
We would by default like to run in FAST/SLOW mode instead
of FASTAUTO/SLOWAUTO mode for performance reasons. This
change sets the default speed mode to FAST/SLOW mode.
Reviewed-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
subhashj@codeaurora.org [Thu, 24 Nov 2016 00:33:08 +0000 (16:33 -0800)]
scsi: ufs: optimize system suspend handling
Consider following sequence of events:
1. UFS is runtime suspended, link_state = Hibern8, device_state = sleep
2. System goes into system suspend, ufshcd_system_suspend() brings both
link and device to active state and then puts the device in Power_Down
state and link in OFF state.
3. System resumes at some later point in time, ufshcd_system_resume()
doesn't do anything as UFS state is runtime suspended. Note that link
is still on OFF state and device is in Power_Down state.
4. Now system again goes into suspend without any UFS accesses before it.
ufshcd_system_suspend() again brings both link and device to active
state and then puts the device in Power_Down state and link if OFF
state. But it's unnecessary to bring the link & device in active state
as both link and device are already in desired low power states. This
change fixes this issue by adding proper state checks in
ufshcd_system_suspend().
Reviewed-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yaniv Gardi [Thu, 24 Nov 2016 00:32:49 +0000 (16:32 -0800)]
scsi: ufs: fix condition in which DME command failure msg is printed out
The condition in which error message is printed out was incorrect and
resulted error message only if retries exhausted.
But retries happens only if DME command is a peer command, and thus
DME commands which are not peer commands and fail are not printed out.
This change fixes this issue.
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dolev Raviv [Thu, 24 Nov 2016 00:32:32 +0000 (16:32 -0800)]
scsi: ufs: handle errors from PHY_ADAPTER_ERROR register
The PHY_ADAPTER_ERROR status register indicates PHY lane errors
reported by the M-PHY layer. In some occasions the controller
can recover from such errors. When the error is not recoverable,
a stuck DB error will occur. Since the stuck DB error is spotted
separately, no action other than clearing the register is necessary.
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
subhashj@codeaurora.org [Thu, 24 Nov 2016 00:32:20 +0000 (16:32 -0800)]
scsi: ufs: issue link starup 2 times if device isn't active
If we issue the link startup to the device while its UniPro state is
LinkDown (and device state is sleep/power-down) then link startup
will not move the device state to Active. Device will only move to
active state if the link starup is issued when its UniPro state is
LinkUp. So in this case, we would have to issue the link startup 2
times to make sure that device moves to active state.
Reviewed-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
subhashj@codeaurora.org [Thu, 24 Nov 2016 00:32:08 +0000 (16:32 -0800)]
scsi: ufs: ensure that host pa_tactivate is higher than device
Some UFS devices require host PA_TACTIVATE to be higher than
device PA_TACTIVATE otherwise it may get stuck during hibern8 sequence.
This change allows this by using quirk.
Reviewed-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
subhashj@codeaurora.org [Thu, 24 Nov 2016 00:31:52 +0000 (16:31 -0800)]
scsi: ufs: increase the scsi query response timeout
It is found thats UFS device may take longer than 30ms to respond to
query requests and in this case we might run into following scenario:
1. UFS host SW sends a query request to UFS device to read an attribute
value. SW uses tag #31 for this purpose.
2. UFS host SW waits for 30ms to get the query response (and doorbell
to be cleared by UFS host HW).
3. UFS device doesn't respond back within 30ms hence UFS host SW times
out waiting for the query response.
4. UFS host SW clears the tag#31 from UTRLCLR register.
5. UFS host SW waits until UFS host HW to clear tag#31 from the doorbell
register.
6. UFS host SW retries the same query request on same tag#31 (sends a query
request to device to read an attribute value).
7. UFS host HW gets the query response from the device but this was
intended as a query response for the 1st query request sent (step-1).
8. Now UFS device sends another query response to host (for query request
sent @step-6).
Now there are 2 issues that could happen with above scenario:
1. UFS device should have actually responded back with only one query
response but it is found that device may respond back with 2 query
responses.
2. If UFS device responds back with 2 resposes on same tag, host HW/SW
behaviour isn't predictable.
To avoid running into above scenario, we would basically allow device
to take longer (upto 1.5 seconds) for query response.
Reviewed-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
subhashj@codeaurora.org [Thu, 24 Nov 2016 00:31:41 +0000 (16:31 -0800)]
scsi: ufs: fix failure to read the string descriptor
While reading variable size descriptors (like string descriptor), some UFS
devices may report the "LENGTH" (field in "Transaction Specific fields" of
Query Response UPIU) same as what was requested in Query Request UPIU
instead of reporting the actual size of the variable size descriptor.
Although it's safe to ignore the "LENGTH" field for variable size
descriptors as we can always derive the length of the descriptor from
the descriptor header fields. Hence this change impose the length match
check only for fixed size descriptors (for which we always request the
correct size as part of Query Request UPIU).
Reviewed-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yaniv Gardi [Thu, 24 Nov 2016 00:31:30 +0000 (16:31 -0800)]
scsi: ufs: update device descriptor maximum size
According to JESD220B - UFS v2.0, the maximum size of device descriptor
has changed from 0x1F to 0x40. This patch updates the maximum size of
this descriptor.
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Yaniv Gardi [Thu, 24 Nov 2016 00:31:18 +0000 (16:31 -0800)]
scsi: ufs: add index details to query error messages
When sending query to the device, the index of the failure
is additional useful information that should be printed out as it
might specify the logical unit (LU) where the error occurred.
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dolev Raviv [Thu, 24 Nov 2016 00:30:49 +0000 (16:30 -0800)]
scsi: ufs: add queries retry mechanism
Some of the queries might fail during init. To avoid
system failure, we add retry mechanism to issue queries
several times.
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Quentin Lambert [Sat, 19 Nov 2016 17:42:34 +0000 (18:42 +0100)]
scsi: dpt_i2o: Add a missing call to kfree
Most error branches following the call to kzalloc contain a call to
kfree. This patch add these calls where they are missing.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Quentin Lambert [Sat, 19 Nov 2016 17:43:40 +0000 (18:43 +0100)]
scsi: isci: Add a missing call to pci_unmap_biosrom
Most error branches following the call to pci_map_biosrom contain a call
to pci_unmap_biosrom. This patch add these calls where they are missing.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Arnd Bergmann [Fri, 18 Nov 2016 16:14:01 +0000 (17:14 +0100)]
scsi: isci: avoid array subscript warning
I'm getting a new warning with gcc-7:
isci/remote_node_context.c: In function 'sci_remote_node_context_destruct':
isci/remote_node_context.c:69:16: error: array subscript is above array bounds [-Werror=array-bounds]
This is odd, since we clearly cover all values for enum
scis_sds_remote_node_context_states here. Anyway, checking for an array
overflow can't harm and it makes the warning go away.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Tue, 29 Nov 2016 10:47:25 +0000 (13:47 +0300)]
scsi: hisi_sas: shift vs compare typos
There are some typos where we intended "<<" but have "<". Seems likely
to cause a bunch of problems.
Fixes:
d3b688d3c69d ("scsi: hisi_sas: add v2 hw support for ECC and AXI bus fatal error")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Quentin Lambert [Fri, 25 Nov 2016 12:23:51 +0000 (13:23 +0100)]
scsi: aic94xx: Add a missing call to kfree
Most error branches following the call to kzalloc contain a call to
kfree. This patch add these calls where they are missing and set the
relevant pointers to NULL.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Fri, 18 Nov 2016 07:32:49 +0000 (08:32 +0100)]
scsi: hpsa: add 'ctlr_num' sysfs attribute
Add a sysfs attribute 'ctlr_num' holding the current HPSA controller
number. This is required to construct compability 'cciss' links.
[mkp: fixed typo]
Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Fri, 18 Nov 2016 07:32:47 +0000 (08:32 +0100)]
scsi: hpsa: use correct DID_NO_CONNECT hostbyte
NOT_READY is a sense key, not a legit scsi hostbyte value. Use
DID_NO_CONNECT instead.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Wed, 23 Nov 2016 00:17:13 +0000 (16:17 -0800)]
scsi: srp_transport: Move queuecommand() wait code to SCSI core
Additionally, rename srp_wait_for_queuecommand() into
scsi_wait_for_queuecommand() and add a comment about the queuecommand()
call from scsi_send_eh_cmnd().
Note: this patch changes scsi_internal_device_block from a function that
did not sleep into a function that may sleep. This is fine for all
callers of this function:
* scsi_internal_device_block() is called from the mpt3sas device while
that driver holds the ioc->dm_cmds.mutex. This means that the mpt3sas
driver calls this function from thread context.
* scsi_target_block() is called by __iscsi_block_session() from
kernel thread context and with IRQs enabled.
* The SRP transport code also calls scsi_target_block() from kernel
thread context while sleeping is allowed.
* The snic driver also calls scsi_target_block() from a context from
which sleeping is allowed. The scsi_target_block() call namely occurs
immediately after a scsi_flush_work() call.
[mkp: s/shost/sdev/]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: James Bottomley <jejb@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Doug Ledford <dledford@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Thu, 24 Nov 2016 10:52:38 +0000 (13:52 +0300)]
scsi: libfc: Remove an unneeded condition
We verified that resp_code is FC_SPP_RESP_ACK earlier so we don't need
to check again here.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Santosh Y [Thu, 24 Nov 2016 04:58:51 +0000 (12:58 +0800)]
scsi: ufs: Add missing UFS_MASK macro definition
Reported-by: Venkatraman S <svenkatr@ti.com>
Reviewed-by: Vinayak Holikatti <vinholikatti@gmail.com>
Signed-off-by: Santosh Y <santoshsy@gmail.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:40 +0000 (20:48 +0800)]
scsi: hisi_sas: add PHY set linkrate support for v1 and v2 hw
Add the function to set PHY min and max linkrate through
sysfs interface.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Mon, 7 Nov 2016 12:48:39 +0000 (20:48 +0800)]
scsi: hisi_sas: use atomic64_t for hisi_sas_device.running_req
Sometimes the value of hisi_sas_device.running_req
would go negative unless we have the check for
running_req >= 0 before trying to decrement.
This is because using running_req is not thread-safe.
As such, the value for running_req may be actually incorrect,
so use atomic64_t instead.
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:38 +0000 (20:48 +0800)]
scsi: hisi_sas: check SATA FIS when directly attaching SATA device
Check ERR bit of status to decide whether there is something wrong with
initial register-D2H FIS. If error exists, PHY reset the channel to
restart OOB.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:37 +0000 (20:48 +0800)]
scsi: hisi_sas: modify some values in get_ata_protocol()
Modify and add some SATA commands according to SATA protocol.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:36 +0000 (20:48 +0800)]
scsi: hisi_sas: delete repeated configuration in free_device_v2_hw()
Delete repeated configuration items for hisi_sas_device() when
we free a device. These items are now only set in
hisi_sas_dev_gone().
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:35 +0000 (20:48 +0800)]
scsi: hisi_sas: modify return value of hisi_sas_query_task()
sas_scsi_find_task() only deals with return value
TMF_RESP_FUNC_FAILED/TMF_RESP_FUNC_SUCC/TMF_RESP_FUNC_COMPLETE of
query task. So for LLDD errors just return TMF_RESP_FUNC_FAILED.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:34 +0000 (20:48 +0800)]
scsi: hisi_sas: replace WARN_ON() with dev_warn() for internal abort
Replace WARN_ON() with dev_warn() print when internal abort fails.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:33 +0000 (20:48 +0800)]
scsi: hisi_sas: fix port form bug in hisi_sas_port_notify_formed()
When we form a wideport, we should use hardware PHY port_id instead
of sas_phy->id.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:32 +0000 (20:48 +0800)]
scsi: hisi_sas: only process broadcast change in phy_bcast_v2_hw()
There are many BROADCAST primitives generated by the host.
We are only interested in BROADCAST (CHANGE) primitives currently,
so only process this.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:31 +0000 (20:48 +0800)]
scsi: hisi_sas: alloc queue id of slot according to device id
Currently slots are allocated from queues in a round-robin fashion.
This causes a problem for internal commands in device mode. For this
mode, we should ensure that the internal abort command is the last
command seen in the host for that device. We can only ensure this when
we place the internal abort command after the preceding commands for
device that in the same queue, as there is no order in which the host
will select a queue to execute the next command.
This queue restriction makes supporting scsi mq more tricky in
the future, but should not be a blocker.
Note: Even though v1 hw does not support internal abort, the
allocation method is chosen to be the same for consistency.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xiang Chen [Mon, 7 Nov 2016 12:48:30 +0000 (20:48 +0800)]
scsi: hisi_sas: add v2 hw support for ECC and AXI bus fatal error
For ECC 1bit error, logic can recover it, so we only print
a warning.
For ECC multi-bit and AXI bus fatal error, we panic.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Quentin Lambert [Sat, 19 Nov 2016 17:43:18 +0000 (18:43 +0100)]
scsi: pmcraid: Add missing resource releases
Most error branches following the call to pmcraid_get_free_cmd contain a
call to pmcraid_return_cmd. This patch add these calls where they are
missing.
Moreover, most error branches following the call to class_create contain
a call to class_destroy. This patch add these calls where they are
missing.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kiwoong Kim [Tue, 22 Nov 2016 08:06:59 +0000 (17:06 +0900)]
scsi: ufs: introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk
Some UFS host controllers may think granularities of PRDT length and
offset as bytes, not double words.
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bjorn Andersson [Sun, 20 Nov 2016 06:34:51 +0000 (22:34 -0800)]
scsi: ufs: qcom: Properly clear hba priv on failure
ufs_qcom_init() sets the hba priv data before attempting to acquire the
phy handle, so make sure to clear this in the case of an error. Failing
to do this will make ufs_qcom_setup_clocks() operate on the uninitalized
host object.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Arnd Bergmann [Wed, 16 Nov 2016 15:14:27 +0000 (16:14 +0100)]
scsi: bfa: turn bfa_mem_{kva,dma}_setup into inline functions
These two macros cause lots of warnings with gcc-7:
drivers/scsi/bfa/bfa_svc.c: In function 'bfa_fcxp_meminfo':
drivers/scsi/bfa/bfa_svc.c:521:103: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
Using inline functions makes them much more readable and avoids the
warnings.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked by: Anil Gurumurthy <anil.gurumurthy@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Helge Deller [Thu, 17 Nov 2016 20:46:20 +0000 (21:46 +0100)]
scsi: mptfusion: Fix printk continuations
Fix the printk continuations when running the mptfusion driver.
This patch brings the capabilities into one single syslog line again:
mptbase: ioc1: Initiating bringup
ioc1: LSI53C1030 B2: Capabilities={Initiator,Target}
scsi host3: ioc1: LSI53C1030 B2, FwRev=01032341h, Ports=1, MaxQ=255, IRQ=67
Tested on a parisc C8000 machine.
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Tue, 8 Nov 2016 07:11:30 +0000 (08:11 +0100)]
scsi: aacraid: switch to pci_alloc_irq_vectors
Use pci_alloc_irq_vectors and drop the hand-crafted interrupt affinity
routines.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Reviewed-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:24 +0000 (10:31 +0100)]
scsi: fc: move FC transport's bsg code to bsg-lib
Now that all conversions are done, move the FibreChannel bsg code over
to the bsg library.
This patch is derived from work done by Mike Christie in 2011 [1] but
only the iscsi parts got merged back then.
[1] http://marc.info/?l=linux-scsi&m=
131149780921009&w=2
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:23 +0000 (10:31 +0100)]
block: add bsg_job_put() and bsg_job_get()
Add bsg_job_put() and bsg_job_get() so don't need to export
bsg_destroy_job() any more.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:22 +0000 (10:31 +0100)]
scsi: fc: use bsg_job_done
fc_bsg_jobdone() and bsg_job_done() are 1:1 copies now so use the
bsg-lib one instead of the FC private implementation.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:21 +0000 (10:31 +0100)]
scsi: fc: use bsg_softirq_done
bsg_softirq_done() and fc_bsg_softirq_done() are copies of each other, so
ditch the fc specific one.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:20 +0000 (10:31 +0100)]
scsi: fc: Use bsg_destroy_job
fc_destroy_bsgjob() and bsg_destroy_job() are now 1:1 copies, so use the
latter. As bsg_destroy_job() comes from bsg-lib we need to select it in
Kconfig once CONFOG_SCSI_FC_ATTRS is active.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:19 +0000 (10:31 +0100)]
scsi: change FC drivers to use 'struct bsg_job'
Change FC drivers to use 'struct bsg_job' from bsg-lib.h instead of
'struct fc_bsg_job' from scsi_transport_fc.h and remove 'struct
fc_bsg_job'.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:18 +0000 (10:31 +0100)]
block: add reference counting for struct bsg_job
Add reference counting to 'struct bsg_job' so we can implement a reuqest
timeout handler for bsg_jobs, which is needed for Fibre Channel.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:17 +0000 (10:31 +0100)]
scsi: fc: implement kref backed reference counting
Implement kref backed reference counting instead of rolling our own. This
elimnates the need of the following fields in 'struct fc_bsg_job':
* ref_cnt
* state_flags
* job_lock
bringing us close to unification of 'struct fc_bsg_job' and 'struct bsg_job'.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:16 +0000 (10:31 +0100)]
scsi: libfc: don't set FC_RQST_STATE_DONE before calling fc_bsg_jobdone()
Don't set FC_RQST_STATE_DONE before calling fc_bsg_jobdone() as
fc_bsg_jobdone() calls blk_complete_requeust() which raises a soft-IRQ
that ends up in fc_bsg_sofirq_done() and fc_bsg_softirq_done() sets the
FC_RQST_STATE_DONE flag.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:15 +0000 (10:31 +0100)]
scsi: fc: provide fc_bsg_to_rport() helper
Provide fc_bsg_to_rport() helper that will become handy when we're
moving from struct fc_bsg_job to a plain struct bsg_job. Also move all
LLDDs to use the new helper.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:14 +0000 (10:31 +0100)]
scsi: fc: provide fc_bsg_to_shost() helper
Provide fc_bsg_to_shost() helper that will become handy when we're
moving from struct fc_bsg_job to a plain struct bsg_job. Also use this
little helper in the LLDDs.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:13 +0000 (10:31 +0100)]
scsi: fc: Export fc_bsg_jobdone and use it in FC drivers
Export fc_bsg_jobdone so drivers can use it directly instead of doing
the round-trip via struct fc_bsg_job::job_done() and use it in the
LLDDs. That way we can also unify the interfaces of fc_bsg_jobdone and
bsg_job_done.
As we've converted all LLDDs over to use fc_bsg_jobdone() directly, we
can remove the function pointer from struct fc_bsg_job as well.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:12 +0000 (10:31 +0100)]
scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly
Don't use fc_bsg_job::request and fc_bsg_job::reply directly, but use
helper variables bsg_request and bsg_reply. This will be helpful when
transitioning to bsg-lib.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Johannes Thumshirn [Thu, 17 Nov 2016 09:31:11 +0000 (10:31 +0100)]
scsi: Get rid of struct fc_bsg_buffer
struct fc_bsg_buffer is just a clone of struct bsg_buffer from bsg-lib,
so use this one instead.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Arnd Bergmann [Wed, 16 Nov 2016 15:08:34 +0000 (16:08 +0100)]
scsi: mvsas: fix command_active typo
gcc-7 notices that the condition in mvs_94xx_command_active looks
suspicious:
drivers/scsi/mvsas/mv_94xx.c: In function 'mvs_94xx_command_active':
drivers/scsi/mvsas/mv_94xx.c:671:15: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
This was introduced when the mv_printk() statement got added, and leads
to the condition being ignored. This is probably harmless.
Changing '&&' to '&' makes the code look reasonable, as we check the
command bit before setting and printing it.
Fixes:
a4632aae8b66 ("[SCSI] mvsas: Add new macros and functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Geliang Tang [Wed, 16 Nov 2016 13:00:58 +0000 (21:00 +0800)]
scsi: dmx3191d: use module_pci_driver
Use module_pci_driver() helper to simplify the code.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Satish Kharat [Wed, 16 Nov 2016 08:54:01 +0000 (00:54 -0800)]
scsi: fnic: Correcting rport check location in fnic_queuecommand_lck
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Zang Leigang [Wed, 16 Nov 2016 03:29:37 +0000 (11:29 +0800)]
scsi: ufs: introduce a new ufshcd_statea UFSHCD_STATE_EH_SCHEDULED
Add a new ufshcd_state, indicats that an err handler may get to run
immediately. Use UFSHCD_STATE_ERROR here looks not literaly correct.
Signed-off-by: Zang Leigang <zangleigang@hisilicon.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Satish Kharat [Tue, 15 Nov 2016 20:39:29 +0000 (12:39 -0800)]
MAINTAINERS: Updating maintainers list for Cisco FNI and SNIC drivers
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Don Brace [Tue, 15 Nov 2016 20:45:32 +0000 (14:45 -0600)]
scsi: hpsa: correct logical resets
- driver was not calling done in some cases which causes the volume to
be offlined.
- avoid doing rescan during a reset.
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Tomas Henzl [Tue, 1 Nov 2016 16:32:02 +0000 (17:32 +0100)]
scsi: megaraid-sas: request irqs later
It is not good when an irq arrives before driver structures are
allocated.
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Mon, 14 Nov 2016 12:59:35 +0000 (12:59 +0000)]
scsi: hpsa: free irq on q indexed by h->intr_mode and not i
Use correct index on q, use h->intr_mode instead of i. Issue detected
using static analysis with cppcheck
Fixes:
bc2bb1543e62a5d0 ("scsi: hpsa: use pci_alloc_irq_vectors and automatic irq affinity")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sat, 12 Nov 2016 18:30:26 +0000 (18:30 +0000)]
scsi: isci: fix typo in deg_dbg message
Trivial fix to typo "repsonse" to "response" in dev_dbg message.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sat, 12 Nov 2016 16:49:50 +0000 (16:49 +0000)]
scsi: isci: fix spelling mistakes in dev_warn messages
Trivial fix to spelling mistake "suspeneded" to "suspended" in dev_warn
messages.
[mkp: corrected description. Patch is against the isci driver, not iscsi]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Sat, 12 Nov 2016 16:25:24 +0000 (16:25 +0000)]
scsi: megaraid_sas: add in missing white spaces in error messages text
A couple of dev_printk messages spans two lines and the literal string
is missing a white space between words. Add the white space.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Sat, 12 Nov 2016 00:55:50 +0000 (16:55 -0800)]
scsi: scsi_transport_fc: Hold queue lock while calling blk_run_queue_async()
It is required to hold the queue lock when calling blk_run_queue_async()
to avoid that a race between blk_run_queue_async() and
blk_cleanup_queue() is triggered. Additionally, remove the get_device()
and put_device() calls from fc_bsg_goose_queue. It is namely the
responsibility of the caller of fc_bsg_goose_queue() to ensure that the
bsg queue does not disappear while fc_bsg_goose_queue() is in progress.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: James Smart <james.smart@avagotech.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ondrej Zary [Thu, 10 Nov 2016 23:00:20 +0000 (10:00 +1100)]
scsi: g_NCR5380: Fix release_region in error handling
When a SW-configurable card is specified but not found, the driver
releases wrong region, causing the following message in kernel log:
Trying to free nonexistent resource <
0000000000000000-
000000000000000f>
Fix it by assigning base earlier.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Fixes:
a8cfbcaec0c1 ("scsi: g_NCR5380: Stop using scsi_module.c")
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kiwoong Kim [Thu, 10 Nov 2016 12:17:43 +0000 (21:17 +0900)]
scsi: ufs: introduce hibern8_notify callback
Some UFS host controller may need to configure some things around
hibern8 enter/exit
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kiwoong Kim [Thu, 10 Nov 2016 12:16:15 +0000 (21:16 +0900)]
scsi: ufs: introduce setup_task_mgmt
Some UFS host controller may need to configure some things before any
task management request is issued
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kiwoong Kim [Thu, 10 Nov 2016 12:14:36 +0000 (21:14 +0900)]
scsi: ufs: introduce setup_xfer_req callback
Some UFS host controller may need to configure some things before any
transfer request is issued.
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig [Wed, 9 Nov 2016 18:42:22 +0000 (10:42 -0800)]
scsi: hpsa: use pci_alloc_irq_vectors and automatic irq affinity
This patch converts over hpsa to use the pci_alloc_irq_vectors including
the PCI_IRQ_AFFINITY flag that automatically assigns spread out irq
affinity to the I/O queues.
It also cleans up the per-ctrl interrupt state due to the use of the
pci_irq_vector and pci_free_irq_vectors helpers that don't need to know
the exact irq type. Additionally it changes a little oddity in the
existing code that was using different array indixes into the per-vector
arrays depending on whether a controller is using a single INTx or
single MSI irq.
[mkp: fixed typo]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Don Brace <don.brace@microsemi.com>
Tested-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chanwoo Choi [Tue, 8 Nov 2016 09:13:28 +0000 (18:13 +0900)]
scsi: ufs: Use the resource-managed function to add devfreq device
This patch uses the resource-managed to add the devfreq device. This
function will make it easy to handle the devfreq device.
- struct devfreq *devm_devfreq_add_device(struct device *dev,
struct devfreq_dev_profile *profile,
const char *governor_name,
void *data);
Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Mon, 7 Nov 2016 16:38:57 +0000 (16:38 +0000)]
scsi: fix spelling mistake in error message
Trivial fix to spelling mistake "operatio" to "operation" in critical
error message
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Mon, 31 Oct 2016 15:34:46 +0000 (09:34 -0600)]
scsi: mpt3sas: fix some spelling mistakes in message and comments
Trivial fixes, minor spelling mistakes in comments and in a KERN_INFO
message.
[mkp: fixed spelling mistake in patch description]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:51 +0000 (15:37 +0530)]
scsi: ufs: qcom: Don't free resource-managed kmalloc element
Host is allocated by managed kmalloc (devm_kmalloc). The
memory allocated with this function is automatically
freed on driver detach.
So, no need to make an exclusive free call over it.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:50 +0000 (15:37 +0530)]
scsi: ufs: qcom: Add phy_exit call in hcd exit path
Do a phy_exit() over the ufs phy in the ufs qcom exit path
to de-initialize the phy.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:49 +0000 (15:37 +0530)]
phy: qcom-ufs: Remove common layer phy exit callback
The common layer phy exit callback ufs_qcom_phy_exit()
calls phy_power_off() that has no meaning when phy_power_off()
callback is already registered with the phy provider and
the consumer makes use of the same.
Instead, add a no-op specific phy_exit() callback for now
to add the exit sequence at a later point.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:48 +0000 (15:37 +0530)]
scsi: ufs-qcom: phy/hcd: Refactoring phy clock handling
Add phy clock enable code to phy_power_on/off callbacks, and
remove explicit calls to enable these phy clocks from the
ufs-qcom hcd driver.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:47 +0000 (15:37 +0530)]
phy: qcom-ufs-qmp-xx: Move clock and regulator init out of phy init
The phy init is meant to do phy initialization rather than
just getting the clock and regulator. Move these clock and
regulator get to probe(), to make room for actual phy
initialization sequence.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:46 +0000 (15:37 +0530)]
phy: qcom-ufs: Remove unnecessary function declarations
Move the functions' definitions to remove unnecessary
declarations.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:45 +0000 (15:37 +0530)]
phy: qcom-ufs-qmp-xx: Discard remove callback for drivers.
remove() callback does a phy_power_off() only over the phy,
and nothing else now.
The phy_power_off() over the generic phy is called from the phy
consumer, and phy provider driver should not explicitly need to
call any phy ops.
So discard the remove callback for qcom-ufs phy platform drivers.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:44 +0000 (15:37 +0530)]
phy: qcom-ufs: Skip obtaining rx/tx_iface_clk for msm8996 based phy
The tx_iface_clk and rx_iface_clk no longer exist with UFS Phy
present on msm8996. So skip obtaining these clocks using
compatible match.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:43 +0000 (15:37 +0530)]
phy: qcom-ufs-14nm: Add new compatible for msm8996 based phy
Add a new compatible string for 14nm ufs phy present on msm8996
chipset. This phy is bit different from the legacy 14nm ufs phy
in terms of the clocks that are needed to be handled in the driver.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:42 +0000 (15:37 +0530)]
phy: qcom-ufs: Cleanup clock and regulator initialization
Different menthods pass around generic phy pointer to
extract device pointer. Instead, pass the device pointer
directly between function calls.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:41 +0000 (15:37 +0530)]
phy: qcom-ufs: Use devm sibling of kstrdup for regulator names
This helps us in avoiding any requirement for kfree() operation
to be called exclusively over the allocated string pointer.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Vivek Gautam [Tue, 8 Nov 2016 10:07:40 +0000 (15:37 +0530)]
phy: qcom-ufs: Remove unnecessary BUG_ON
BUG_ON() are not preferred in the driver, plus the variable
on which BUG_ON is asserted is already checked in the code
before passing.
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kashyap Desai [Fri, 21 Oct 2016 13:33:36 +0000 (06:33 -0700)]
scsi: megaraid_sas: driver version upgrade
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kashyap Desai [Fri, 21 Oct 2016 13:33:35 +0000 (06:33 -0700)]
scsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map
CC: stable@vger.kernel.org
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kashyap Desai [Fri, 21 Oct 2016 13:33:34 +0000 (06:33 -0700)]
MAINTAINERS: Update megaraid maintainers list
Update MEGARAID drivers maintainers list.
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kashyap Desai [Fri, 21 Oct 2016 13:33:33 +0000 (06:33 -0700)]
scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware
Until now the megaraid_sas driver has reported successful completion on
SYNCHRONIZE_CACHE commands without sending them down to the controller.
The controller firmware has been responsible for taking care of flushing
disk caches for all drives that belong to a Virtual Disk at the time of
system reboot/shutdown.
There may have been a reason to avoid sending SYNCHRONIZE_CACHE to a VD
in the past but that no longer appears to be valid.
Older versions of MegaRaid firmware (Gen2 and Gen2.5) set the WCE bit
for Virtual Disks but the firmware does not report correct completion
status for a SYNCHRONIZE_CACHE command. As a result, we must use another
method to identify whether it is safe to send the command to the
controller. We use the canHandleSyncCache firmware flag in the scratch
pad register at offset 0xB4.
New SYNCHRONIZE_CACHE behavior:
IF 'JBOD'
Driver sends SYNCHRONIZE_CACHE command to the firmware
Firmware sends SYNCHRONIZE_CACHE to drive
Firmware obtains status from drive and returns same status back to driver
ELSEIF 'VirtualDisk'
IF firmware supports new API bit called canHandleSyncCache
Driver sends SYNCHRONIZE_CACHE command to the firmware
Firmware does not send SYNCHRONIZE_CACHE to drives
Firmware returns SUCCESS
ELSE
Driver does not send SYNCHRONIZE_CACHE command to the firmware
Driver return SUCCESS for that command
ENDIF
ENDIF
[mkp: edited patch description]
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig [Tue, 1 Nov 2016 14:12:49 +0000 (08:12 -0600)]
scsi: smartpqi: switch to pci_alloc_irq_vectors
Which cleans up a lot of the MSI-X handling, and allows us to use the
PCI IRQ layer provided vector mapping, which we can then expose to
blk-mq.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Acked-by: Don Brace <don.brace@microsemi.com>
Tested-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig [Tue, 1 Nov 2016 14:12:48 +0000 (08:12 -0600)]
scsi: allow LLDDs to expose the queue mapping to blk-mq
Just hand through the blk-mq map_queues method in the host template.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig [Tue, 1 Nov 2016 14:12:47 +0000 (08:12 -0600)]
blk-mq: export blk_mq_map_queues
This will allow SCSI to have a single blk_mq_ops structure that either
lets the LLDD map the queues to PCIe MSIx vectors or use the default.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Subhash Jadavani [Fri, 28 Oct 2016 00:26:24 +0000 (17:26 -0700)]
scsi: ufs: change device rails hpm mode ramp up sequence
When we are resuming the UFS device rails in HPM mode, we are first
powering on the VCC rail while VCCQ and VCCQ2 rails still being in LPM
mode. Some UFS devices may take VCC on event as hint that host wants UFS
device to be resumed and may start drawing more power from the
VCCQ/VCCQ2 rails (while they are still in LPM mode) causing voltage drop
on these rails. This change fixes this issue by bringing VCCQ & VCCQ2
rails out of LPM before powering on VCC rail.
Reviewed-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Subhash Jadavani [Fri, 28 Oct 2016 00:26:09 +0000 (17:26 -0700)]
scsi: ufs: suspend clock scaling at the start of suspend
Currently clock scaling is suspended only after the host and device are
put in low power mode but we should avoid clock scaling running after
UFS link is put in low power mode (hibern8). This change suspends clock
scaling before putting host/device in low power mode.
Reviewed-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Subhash Jadavani [Fri, 28 Oct 2016 00:25:58 +0000 (17:25 -0700)]
scsi: ufshcd: release resources if probe fails
If ufshcd pltfrm/pci driver's probe fails for some reason then ensure
that scsi host is released to avoid memory leak but managed memory
allocations (via devm_* calls) need not to be freed explicitly on probe
failure as memory allocated with these functions is automatically freed
on driver detach.
Reviewed-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Subhash Jadavani [Fri, 28 Oct 2016 00:25:47 +0000 (17:25 -0700)]
scsi: ufs: fix race between clock gating and devfreq scaling work
UFS devfreq clock scaling work may require clocks to be ON if it need to
execute some UFS commands hence it may request for clock hold before
issuing the command. But if UFS clock gating work is already running in
parallel, ungate work would end up waiting for the clock gating work to
finish and as clock gating work would also wait for the clock scaling
work to finish, we would enter in deadlock state. Here is the call trace
during this deadlock state:
Workqueue: devfreq_wq devfreq_monitor
__switch_to
__schedule
schedule
schedule_timeout
wait_for_common
wait_for_completion
flush_work
ufshcd_hold
ufshcd_send_uic_cmd
ufshcd_dme_get_attr
ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div
ufs_qcom_clk_scale_notify
ufshcd_scale_clks
ufshcd_devfreq_target
update_devfreq
devfreq_monitor
process_one_work
worker_thread
kthread
ret_from_fork
Workqueue: events ufshcd_gate_work
__switch_to
__schedule
schedule
schedule_preempt_disabled
__mutex_lock_slowpath
mutex_lock
devfreq_monitor_suspend
devfreq_simple_ondemand_handler
devfreq_suspend_device
ufshcd_gate_work
process_one_work
worker_thread
kthread
ret_from_fork
Workqueue: events ufshcd_ungate_work
__switch_to
__schedule
schedule
schedule_timeout
wait_for_common
wait_for_completion
flush_work
__cancel_work_timer
cancel_delayed_work_sync
ufshcd_ungate_work
process_one_work
worker_thread
kthread
ret_from_fork
This change fixes this deadlock by doing this in devfreq work (devfreq_wq):
Try cancelling clock gating work. If we are able to cancel gating work
or it wasn't scheduled, hold the clock reference count until scaling is
in progress. If gate work is already running in parallel, let's skip
the frequecy scaling at this time and it will be retried once next scaling
window expires.
Reviewed-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:42 +0000 (13:34 +0530)]
scsi: mpt3sas: Bump driver version as "14.101.00.00"
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:41 +0000 (13:34 +0530)]
scsi: mpt3sas: Fix for Endianness issue.
Use le16_to_cpu only for accessing two byte data provided by controller.
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>