Commit graph

647945 commits

Author SHA1 Message Date
Sasikumar Chandrasekaran
45d446038c scsi: megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid Controllers
An UNMAP command on a PI formatted device will leave the Logical Block Application
Tag and Logical Block Reference Tag as all F's (for those LBAs that are unmapped).
To avoid IO errors if those LBAs are subsequently read before they are written with
valid tag fields, the MPI SCSI IO requests need to set the EEDPFlags element EEDP
Escape Mode field, Bits [7:6] appropriately.  A value of 2 should be set to disable
all PI checks if the Logical Block Application Tag is 0xFFFF for PI types 1 and 2.
A value of 3 should be set to disable all PI checks if the Logical Block Application
Tag is 0xFFFF and the Logical Block Reference Tag is 0xFFFFFFFF for PI type 3.

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

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

Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:15:45 -05:00
Hanjun Guo
47069a81b6 scsi: remove useless acpi functions in the header file
commit f1bc1e4c44 ("ata: acpi: rework the ata acpi bind support")
removed scsi_register_acpi_bus_type() and
scsi_unregister_acpi_bus_type(), but forgot to remove them in the header
file, do it now.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:13:58 -05:00
Tomas Winkler
93fdd5ac64 scsi: ufs: refactor device descriptor reading
Pull device descriptor reading out of ufs quirk so it can be used also
for other purposes.

Revamp the fixup setup:

1. Rename ufs_device_info to ufs_dev_desc as very similar name
   ufs_dev_info is already in use.

2. Make the handlers static as they are not used out of the ufshdc.c
   file.

[mkp: applied by hand]

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 23:13:48 -05:00
Tomas Winkler
d79713f911 scsi: ufs: ufshcd_get_max_icc_level fix endianity handling
Reading big endian value from a buffer requires explicit cast.
Fix sparse warning:
drivers/scsi/ufs/ufshcd.c:4825:24: warning: cast to restricted __be16

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 22:59:58 -05:00
Tomas Winkler
8209b6d54e scsi: ufs: unexport descritpor reading functions
Unexport ufshcd_read_device_desc and ufshcd_read_string_desc there is no
really possibility to calling them directly outside of UFS context.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 22:59:40 -05:00
Tomas Winkler
26cf9155bf scsi: ufs: ufshcd_query_descriptor_retry should be static
Fix the following compilation warning:

drivers/scsi/ufs/ufshcd.c:2076:5: warning: no previous prototype for
 ufshcd_query_descriptor_retry  [-Wmissing-prototypes]

Also do not export the function, it should not be used out of ufs
context.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-10 22:59:07 -05:00
Emese Revfy
b6f0ec3621 scsi: esas2r: Fix format string type mistakes
This adds the missing __printf attribute which allows compile time
format string checking (and will be used by the coming initify gcc
plugin). Additionally, this fixes the warnings exposed by the attribute.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
[kees: split scsi/acpi, merged attr and fix, new commit messages]
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-09 23:52:26 -05:00
Christoph Hellwig
eab5c1503b scsi: pmcraid: switch to pci_alloc_irq_vectors
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-09 23:47:00 -05:00
Christoph Hellwig
984dc46c57 scsi: bfa: remove bfa_fcs_mod_s
Just call the functions directly instead of obsfucating the call chain.
This was in reply to a patch from Kees Cook to constify the function
pointer struct bfa_fcs_mod_s, but it turns out there is no reason to
have this indirection at all.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-09 23:34:58 -05:00
Colin Ian King
577419f704 scsi: qla2xxx: rename {vendor|hba}_indentifer to {vendor|hba}_identifer
Rename the vendor_indentifer and hba_indentifer fields to correct
spelling.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-09 23:25:19 -05:00
Nicolas Iooss
44a8f95444 scsi: qla2xxx: make msix_entries const
msix_entries and qla82xx_msix_entries arrays are never modified in
drivers/scsi/qla2xxx/qla_isr.c. Move their contents to read-only data.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-09 23:20:32 -05:00
Nicolas Iooss
e2e8f619ad scsi: qla2xxx: silence -Wformat-security warning
qla24xx_enable_msix() calls scnprintf() with a non-literal format
string. This makes clang report -Wformat-security warnings when
compiling this function:

    drivers/scsi/qla2xxx/qla_isr.c:3083:7: error: format string is not a
    string literal (potentially insecure) [-Werror,-Wformat-security]
                        msix_entries[i].name);
                        ^~~~~~~~~~~~~~~~~~~~
    drivers/scsi/qla2xxx/qla_isr.c:3083:7: note: treat the string as an
    argument to avoid this
                        msix_entries[i].name);
                        ^
                        "%s",
    drivers/scsi/qla2xxx/qla_isr.c:3119:7: error: format string is not a
    string literal (potentially insecure) [-Werror,-Wformat-security]
                        msix_entries[QLA_ATIO_VECTOR].name);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/qla2xxx/qla_isr.c:3119:7: note: treat the string as an
    argument to avoid this
                        msix_entries[QLA_ATIO_VECTOR].name);
                        ^
                        "%s",

Even though msix_entries[...].name are initialized as literal strings
with no % character and are never modified, introduce a "%s" format
parameter in order to silence this -Wformat-security warning and make
clang able to detect at compile time real bugs related to string
formatting.

[mkp: typo]

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-09 23:17:27 -05:00
James Smart
352e5fd105 scsi: lpfc: Reinstate lpfc_soft_wwn parameter
The lpfc 11.2.0.4 patch set deprecated, by removing, the lpfc_soft_wwn
parameter support.

This patch reinstates support, but adds a warning in the enablement of
the feature that indicates Broadcom (Emulex) does not support the
feature.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 20:56:41 -05:00
John Garry
da7b66e720 scsi: hisi_sas: lock sensitive region in hisi_sas_slot_abort()
When we call hisi_sas_slot_task_free() we should grab the hisi_hba.lock,
as hisi_sas_slot_task_free() accesses common hisi_hba elements.
Function hisi_sas_slot_abort() is missing this, so add it.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:24:11 -05:00
John Garry
64d6318732 scsi: hisi_sas: lock sensitive regions when servicing CQ interrupt
There is a bug in the current driver in that certain hisi_hba and port
structure elements which we access when servicing the CQ interrupt do
not use thread-safe accesses; these include hisi_sas_port linked-list of
active slots (hisi_sas_port.entry), bitmap of currently allocated IPTT
(in hisi_hba.slot_index_tags), and completion queue read pointer.

As a solution, lock these elements with the hisi_hba.lock.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:24:11 -05:00
John Garry
d177c40811 scsi: hisi_sas: service v2 hw CQ ISR with tasklet
Currently the all the slot processing for the completion queue is done
in ISR context. It is judged that the slot processing can take a long
time, especially when a SATA NCQ completes (upto 32 slots).

So, as a solution, defer the bulk of the ISR processing to tasklet
context. Each CQ will have its down tasklet.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:24:11 -05:00
Javier Martinez Canillas
ab3dabb3e8 scsi: ufs-qcom: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/scsi/ufs/ufs-qcom.ko | grep alias
$

After this patch:

$ modinfo drivers/scsi/ufs/ufs-qcom.ko | grep alias
alias:          of:N*T*Cqcom,ufshcC*
alias:          of:N*T*Cqcom,ufshc

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:20:30 -05:00
Dolev Raviv
ff8e20c662 scsi: ufs: Improve fatal error logs
Errors such as UIC error, illegal OCS values, and others may require
more information for debugging. Such information could be hibern8 events,
events sequences, recoverable errors, error history, and more.
This patch improves tracking of important errors and events in debug level
to be enabled when debugging a such issues. It includes:
* UIC error history
* Successful hibern8 events
* Successful command after hibern8 exit
* Clk-freq info
* Failed device command
* Infrastructure for dumping host controller debug information

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>
2017-01-05 18:10:04 -05:00
Lee Susman
1a07f2d96e scsi: ufs: add trace event for ufs commands
Use the ftrace infrastructure to conditionally trace ufs command events.
New trace event is created, which samples the following ufs command data:
- device name
- optional identification string
- task tag
- doorbell register
- number of transfer bytes
- interrupt status register
- request start LBA
- command opcode

Currently we only fully trace read(10) and write(10) commands.
All other commands which pass through ufshcd_send_command() will be
printed with "-1" in the lba and transfer_len fields.

Usage:
	echo 1 > /sys/kernel/debug/tracing/events/ufs/enable
	cat /sys/kernel/debug/tracing/trace_pipe

Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:10:04 -05:00
subhashj@codeaurora.org
911a0771b6 scsi: ufs: add time profiling support
This patch adds the profiling support for some of the time critical
operations like hibern8 enter/exit, clock gating & clock scaling.

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>
2017-01-05 18:10:04 -05:00
subhashj@codeaurora.org
d2aebb9b26 scsi: ufs: fix setting init power mode
Immediately after successful UFS link startup, UFS link power mode would
be in PWM-G1, 1-lane, SLOW-AUTO mode. But currently we are doing few
of the DME local/peer attributes access before setting the "hba->pwr_info"
to default power mode. If we are doing link startup as part of error
recovery then old power mode might be set to FAST mode and doing DME peer
access (after link startup but before updating "hba->pwr_info" to default
power mode) unintentionally tries to switch from FAST to FAST_AUTO mode (if
UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk is enabled).

Above issue is fixed by setting the default power mode immediately after
successful link startup.

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>
2017-01-05 18:10:04 -05:00
subhashj@codeaurora.org
4e768e7645 scsi: ufs: add capability to keep auto bkops always enabled
UFS device requires to perform bkops (back ground operations) periodically
but host can control (via auto-bkops parameter of device) when device can
perform bkops based on its performance requirements. In general, host
would like to enable the device's auto-bkops only when it's not doing any
regular data transfer but sometimes device may not behave properly if host
keeps the auto-bkops disabled. This change adds the capability to let the
device auto-bkops always enabled except suspend.

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>
2017-01-05 18:10:04 -05:00
subhashj@codeaurora.org
0c8f75869e scsi: ufs: set default UFS power management level
UFS device and link can be put in multiple different low power modes hence
UFS driver supports multiple different low power modes.
This change sets the default UFS power management level which should put
the link hibernate state and device in sleep state. This default power
management level gives good  power savings with relatively less enter/exit
latencies.

Reviewed-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:10:04 -05:00
subhashj@codeaurora.org
09690d5a6a scsi: ufs: provide sysfs attribute to select the PM level
This patch provides the sysfs attribute to choose the power management
level for UFS runtime and system suspend.

Reviewed-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:10:03 -05:00
Sahitya Tummala
fcb0c4b08a scsi: ufs: Add sysfs node to dynamically control clock scaling
Provide an option to enable/disable clock scaling during runtime.
Write 1/0 to "clkscale_enable" sysfs node to enable/disable clock
scaling.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:10:03 -05:00
Sahitya Tummala
b427411abb scsi: ufs: Add sysfs node to dynamically control clock gating
Provide an option to enable/disable clock gating during runtime.
Write 1 or 0 to "clkgate_enable" sysfs node to enable/disable
clock gating.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 18:10:03 -05:00
Dolev Raviv
e7d38257a4 scsi: ufs: fix multiple ufs spec violation
When a command to a W-LU is timed out via scsi, error handling
will treat it as any other LU and send commands such as
START_STOP with wrong format or task abort. Those commands are
illegal for W-LU according to the UFS spec.
To solve it, when an error is recognized those steps are skipped
and the last step, reset and restore process, is initiated.

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>
2017-01-05 18:10:03 -05:00
subhashj@codeaurora.org
7ff5ab4736 scsi: ufs: add tracing support
This change adds the ftrace support for following:
1. UFS initialization time
2. Clock gating states
3. Clock scaling states
4. Power management APIs latency
5. BKOPs enable/disable

Usage:
	echo 1 > /sys/kernel/debug/tracing/events/ufs/enable
	cat /sys/kernel/debug/tracing/trace_pipe

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>
2017-01-05 18:10:03 -05:00
Dolev Raviv
66cc820f9c scsi: ufs: dump debug info during failures
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.

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>
2017-01-05 18:10:03 -05:00
Cao jin
364757e468 scsi: qla4xxx: comments correction
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Acked-by: Nilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:34:12 -05:00
Colin Ian King
703e747a6b scsi: qedi: return via va_end to match corresponding va_start
Although on most systems va_end is a no-op, it is good practice to use
va_end on the function return path, especially since the va_start
documenation states:

  "Each invocation of va_start() must be matched by a corresponding
   invocation of va_end() in the same function."

Found with static analysis by CoverityScan, CIDs 1389477-1389479

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Manish Rangankar <manish.rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:31:13 -05:00
Jitendra Bhivare
a5c1be7005 scsi: be2iscsi: Update driver version
Version 11.2.1.0

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Ketan Mukadam
5fa7db2111 scsi: be2iscsi: Add warning message for unsupported adapter
Add a warning message to indicate obsolete/unsupported
BE2 Adapter Family devices

Signed-off-by: Ketan Mukadam <ketan.mukadam@avagotech.com>
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
dd940972f3 scsi: be2iscsi: Reinit SGL handle, CID tables after TPE
After TPE recovery, CID table needs to be repopulated as per CIDs in
WRBQ creation responses.

SGL handles table needs to be recreated for posting and its indices need
to be resetted.

This is achieved by calling beiscsi_cleanup_port when disabling and
beiscsi_init_port in enabling port.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
413f365657 scsi: be2iscsi: Add checks to validate CID alloc/free
Set CID slot to 0xffff to indicate empty.
Check if connection already exists in conn_table before binding.
Check if endpoint already NULL before putting back CID.
Break ep->conn link in free_ep to ignore completions after freeing.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
29e80b7ce3 scsi: be2iscsi: Remove wq_name from beiscsi_hba
wq_name is used only to set WQ name when its being allocated.
Remove it from beiscsi_hba structure and define locally.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
fa1261c4b6 scsi: be2iscsi: Remove unused struct members
Fix errors reported in static analysis.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
b7d98ca7fb scsi: be2iscsi: Remove redundant receive buffers posting
This duplicate code got added during manual merging.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
d740105548 scsi: be2iscsi: Fix iSCSI cmd cleanup IOCTL
Prepare the IOCTL with appropriate sizes of buffers of V0 and V1.
Set missing chute number in V1 IOCTL.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
3f7f62ee5b scsi: be2iscsi: Add checks to validate completions
Added check in beiscsi_process_cq for pio_handle.
pio_handle is cleared in beiscsi_put_wrb_handle.
This catches any case where task gets cleaned up just before completion.

Use back_lock before accessing pio_handle.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
392b7d2f12 scsi: be2iscsi: Set WRB invalid bit for SkyHawk
invalid bit in WRB indicates to FW that IO was invalidated before WRB
was fetched from host memory.

For SkyHawk, this invalid bit in WRB is at a different offset.
Use amap_iscsi_wrb_v2 to mark invalid bit for SkyHawk.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:13 -05:00
Jitendra Bhivare
faa0a22d54 scsi: be2iscsi: Take iscsi_task ref in abort handler
Hold the reference of iscsi_task till invalidation completes.
This prevents use of ICD when invalidation of that ICD is being processed.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00
Jitendra Bhivare
987132167f scsi: be2iscsi: Fix for crash in beiscsi_eh_device_reset
System crashes when sg_reset is executed in a loop.
CPU: 13 PID: 7073 Comm: sg_reset Tainted: G            E   4.8.0-rc1+ #4
RIP: 0010:[<ffffffffa0825370>]  [<ffffffffa0825370>]
beiscsi_eh_device_reset+0x160/0x520 [be2iscsi]
Call Trace:
[<ffffffff814c7c77>] ? scsi_host_alloc_command+0x47/0xc0
[<ffffffff814caafa>] scsi_try_bus_device_reset+0x2a/0x50
[<ffffffff814cb46e>] scsi_ioctl_reset+0x13e/0x260
[<ffffffff814ca477>] scsi_ioctl+0x137/0x3d0
[<ffffffffa05e4ba2>] sg_ioctl+0x572/0xc20 [sg]
[<ffffffff8123f627>] do_vfs_ioctl+0xa7/0x5d0

The accesses to beiscsi_io_task is being protected in device reset handler
with frwd_lock but the freeing of task can happen under back_lock.

Hold the reference of iscsi_task till invalidation completes.
This prevents use of ICD when invalidation of that ICD is being processed.
Use frwd_lock for iscsi_tasks looping and back_lock to access
beiscsi_io_task structures.

Rewrite mgmt_invalidation_icds to handle allocation and freeing of IOCTL
buffer in one place.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00
Jitendra Bhivare
f350501377 scsi: be2iscsi: Fix use of invalidate command table req
Remove shared structure inv_tbl in phba for all sessions to post
invalidation IOCTL.
Always allocate and then free the table after use in reset handler.
Abort handler needs just one instance so define it on stack.
Add checks for BE_INVLDT_CMD_TBL_SZ to not exceed invalidation
command table size in IOCTL.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00
Dan Carpenter
19099dc393 scsi: dpt_i2o: double free if adpt_i2o_online_hba() fails
There are two places where adpt_i2o_online_hba() is called.  Both
callers call adpt_i2o_delete_hba(pHba) if adpt_i2o_online_hba() fails
and since we also free it here that causes a double free bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00
Corentin Labbe
e0075478ca scsi: mptlan: Remove linux/miscdevice.h from mptlan.h
This patch remove linux/miscdevice.h from mptlan.h since mptlan.h does
not contain any miscdevice.  The only user of it is mptctl.c which
already include linux/miscdevice.h So no need to include it twice.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00
Kees Cook
5f5fca6db3 scsi: cciss: use designated initializers
Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00
Kees Cook
93380123fb scsi: hpsa: use designated initializers
Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-01-05 00:21:12 -05:00