[PATCH] mpt2sas: Remove usage of 'struct timeval'

2015-02-03 Thread Tina Ruchandani
'struct timeval' will have its tv_sec value overflow on 32-bit systems
in year 2038 and beyond. This patch replaces the use of struct timeval
for computing mpi_request.TimeStamp, and instead uses ktime_t which provides
64-bit seconds value. The timestamp computed remains unaffected (milliseconds
since Unix epoch).

Signed-off-by: Tina Ruchandani ruchandani.t...@gmail.com
---
 drivers/scsi/mpt2sas/mpt2sas_base.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 58e4521..6d80477 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -57,6 +57,7 @@
 #include linux/sort.h
 #include linux/io.h
 #include linux/time.h
+#include linux/ktime.h
 #include linux/kthread.h
 #include linux/aer.h
 
@@ -3616,7 +3617,7 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int 
sleep_flag)
Mpi2IOCInitRequest_t mpi_request;
Mpi2IOCInitReply_t mpi_reply;
int i, r = 0;
-   struct timeval current_time;
+   ktime_t current_time;
u16 ioc_status;
u32 reply_post_free_array_sz = 0;
Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL;
@@ -3678,9 +3679,8 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int 
sleep_flag)
/* This time stamp specifies number of milliseconds
 * since epoch ~ midnight January 1, 1970.
 */
-   do_gettimeofday(current_time);
-   mpi_request.TimeStamp = cpu_to_le64((u64)current_time.tv_sec * 1000 +
-   (current_time.tv_usec / 1000));
+   current_time = ktime_get_real();
+   mpi_request.TimeStamp = cpu_to_le64(ktime_to_ms(current_time));
 
if (ioc-logging_level  MPT_DEBUG_INIT) {
__le32 *mfp;
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: Remove usage of struct timeval

2015-02-03 Thread Tina Ruchandani
struct timeval will have its tv_sec field overflow on 32-bit systems
in year 2038 and beyond. This patch removes the usage of struct timeval
and instead uses 64-bit ktime_t to get the current milliseconds
to populate pmcraid_timestamp_data.

Signed-off-by: Tina Ruchandani ruchandani.t...@gmail.com
---
 drivers/scsi/pmcraid.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 8c27b6a..98af06f 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -25,6 +25,7 @@
 #include linux/fs.h
 #include linux/init.h
 #include linux/types.h
+#include linux/ktime.h
 #include linux/errno.h
 #include linux/kernel.h
 #include linux/ioport.h
@@ -5569,11 +5570,9 @@ static void pmcraid_set_timestamp(struct pmcraid_cmd 
*cmd)
__be32 time_stamp_len = cpu_to_be32(PMCRAID_TIMESTAMP_LEN);
struct pmcraid_ioadl_desc *ioadl = ioarcb-add_data.u.ioadl;
 
-   struct timeval tv;
__le64 timestamp;
 
-   do_gettimeofday(tv);
-   timestamp = tv.tv_sec * 1000;
+   timestamp = ktime_to_ms(ktime_get_real());
 
pinstance-timestamp_data-timestamp[0] = (__u8)(timestamp);
pinstance-timestamp_data-timestamp[1] = (__u8)((timestamp)  8);
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mpt3sas: Remove usage of 'struct timeval'

2015-02-03 Thread Tina Ruchandani
'struct timeval' will have its tv_sec value overflow on 32-bit systems
in year 2038 and beyond. This patch replaces the use of struct timeval
for computing mpi_request.TimeStamp, and instead uses ktime_t which provides
64-bit seconds value. The timestamp computed remains unaffected (milliseconds
since Unix epoch).

Signed-off-by: Tina Ruchandani ruchandani.t...@gmail.com
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 1560115..ee9c3c6 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -56,6 +56,7 @@
 #include linux/dma-mapping.h
 #include linux/io.h
 #include linux/time.h
+#include linux/ktime.h
 #include linux/kthread.h
 #include linux/aer.h
 
@@ -3735,7 +3736,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int 
sleep_flag)
Mpi2IOCInitRequest_t mpi_request;
Mpi2IOCInitReply_t mpi_reply;
int i, r = 0;
-   struct timeval current_time;
+   ktime_t current_time;
u16 ioc_status;
u32 reply_post_free_array_sz = 0;
Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL;
@@ -3797,9 +3798,8 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int 
sleep_flag)
/* This time stamp specifies number of milliseconds
 * since epoch ~ midnight January 1, 1970.
 */
-   do_gettimeofday(current_time);
-   mpi_request.TimeStamp = cpu_to_le64((u64)current_time.tv_sec * 1000 +
-   (current_time.tv_usec / 1000));
+   current_time = ktime_get_real();
+   mpi_request.TimeStamp = cpu_to_le64(ktime_to_ms(current_time));
 
if (ioc-logging_level  MPT_DEBUG_INIT) {
__le32 *mfp;
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [SCSI] bfa: Remove use of struct timeval

2015-02-03 Thread Tina Ruchandani
struct timeval will have its tv_sec field overflow on 32-bit systems
in year 2038 and beyond. This patch removes the usage of struct timeval
and instead uses ktime_get_real_seconds() which returns 64-bit wall-clock
seconds.

Signed-off-by: Tina Ruchandani ruchandani.t...@gmail.com
---
 drivers/scsi/bfa/bfa_svc.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index 625225f..5554461 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -14,6 +14,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  */
+#include linux/ktime.h
 
 #include bfad_drv.h
 #include bfad_im.h
@@ -303,16 +304,9 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec)
return 0;
 }
 
-static u64
-bfa_get_log_time(void)
+static u64 bfa_get_log_time(void)
 {
-   u64 system_time = 0;
-   struct timeval tv;
-   do_gettimeofday(tv);
-
-   /* We are interested in seconds only. */
-   system_time = tv.tv_sec;
-   return system_time;
+   return ktime_get_real_seconds();
 }
 
 static void
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] Sync iscsi fw boot flags

2015-02-03 Thread michaelc
From: Mike Christie micha...@cs.wisc.edu

iBFT and non-iBFT drivers use the same iscsi boot sysfs
interface. For iBFT we just directly export whatever
is left by the FW. For non-iBFT drivers we do vendor
specific commands to get the info or its just hard coded.

This patch syncs up how non-iBFT drivers export boot flag
info. The boot flags being defined in this patch match
the iBFT flags that indicate if the boot info found was
valid and if it was used for to boot with.

Signed-off-by: Mike Christie micha...@cs.wisc.edu
---
 drivers/scsi/be2iscsi/be_main.c  | 8 +---
 drivers/scsi/qla4xxx/ql4_def.h   | 1 -
 drivers/scsi/qla4xxx/ql4_os.c| 6 --
 include/linux/iscsi_boot_sysfs.h | 3 +++
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index f319340..cd4aff9 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -429,7 +429,8 @@ static ssize_t beiscsi_show_boot_tgt_info(void *data, int 
type, char *buf)
 auth_data.chap.intr_secret);
break;
case ISCSI_BOOT_TGT_FLAGS:
-   rc = sprintf(str, 2\n);
+   rc = sprintf(str, %u\n,
+ISCSI_BOOT_FLAG_VALID | 
ISCSI_BOOT_FLAG_FW_BOOT_SEL);
break;
case ISCSI_BOOT_TGT_NIC_ASSOC:
rc = sprintf(str, 0\n);
@@ -466,8 +467,9 @@ static ssize_t beiscsi_show_boot_eth_info(void *data, int 
type, char *buf)
 
switch (type) {
case ISCSI_BOOT_ETH_FLAGS:
-   rc = sprintf(str, 2\n);
-   break;
+   rc = sprintf(str, %u\n,
+ISCSI_BOOT_FLAG_VALID | 
ISCSI_BOOT_FLAG_FW_BOOT_SEL);
+   break;
case ISCSI_BOOT_ETH_INDEX:
rc = sprintf(str, 0\n);
break;
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 8f6d0fb..0380669 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -796,7 +796,6 @@ struct scsi_qla_host {
 #define CHAP_DMA_BLOCK_SIZE512
struct workqueue_struct *task_wq;
unsigned long ddb_idx_map[MAX_DDB_ENTRIES / BITS_PER_LONG];
-#define SYSFS_FLAG_FW_SEL_BOOT 2
struct iscsi_boot_kset *boot_kset;
struct ql4_boot_tgt_info boot_tgt;
uint16_t phy_port_num;
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6d25879..b63985f 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -5705,7 +5705,8 @@ static ssize_t qla4xxx_show_boot_eth_info(void *data, int 
type, char *buf)
 
switch (type) {
case ISCSI_BOOT_ETH_FLAGS:
-   rc = sprintf(str, %d\n, SYSFS_FLAG_FW_SEL_BOOT);
+   rc = sprintf(str, %d\n,
+ISCSI_BOOT_FLAG_VALID | 
ISCSI_BOOT_FLAG_FW_BOOT_SEL);
break;
case ISCSI_BOOT_ETH_INDEX:
rc = sprintf(str, 0\n);
@@ -5814,7 +5815,8 @@ qla4xxx_show_boot_tgt_info(struct ql4_boot_session_info 
*boot_sess, int type,
 (char *)boot_conn-chap.intr_secret);
break;
case ISCSI_BOOT_TGT_FLAGS:
-   rc = sprintf(str, %d\n, SYSFS_FLAG_FW_SEL_BOOT);
+   rc = sprintf(str, %d\n,
+ISCSI_BOOT_FLAG_VALID | 
ISCSI_BOOT_FLAG_FW_BOOT_SEL);
break;
case ISCSI_BOOT_TGT_NIC_ASSOC:
rc = sprintf(str, 0\n);
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index 2a8b165..3f273d6 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -16,6 +16,9 @@
 #ifndef _ISCSI_BOOT_SYSFS_
 #define _ISCSI_BOOT_SYSFS_
 
+#define ISCSI_BOOT_FLAG_VALID  0x1
+#define ISCSI_BOOT_FLAG_FW_BOOT_SEL0x2
+
 /*
  * The text attributes names for each of the kobjects.
 */
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: Remove use of struct timeval

2015-02-03 Thread Tina Ruchandani
Function stex_gettime uses 'struct timeval' whose tv_sec value
will overflow on 32-bit systems in year 2038 and beyond. This patch
replaces the use of struct timeval and do_gettimeofday with
ktime_get_real_seconds, which returns a 64-bit seconds value.

Signed-off-by: Tina Ruchandani ruchandani.t...@gmail.com
---
 drivers/scsi/stex.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 98a62bc..40b6290 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -25,6 +25,7 @@
 #include linux/types.h
 #include linux/module.h
 #include linux/spinlock.h
+#include linux/ktime.h
 #include asm/io.h
 #include asm/irq.h
 #include asm/byteorder.h
@@ -364,10 +365,7 @@ MODULE_VERSION(ST_DRIVER_VERSION);
 
 static void stex_gettime(__le64 *time)
 {
-   struct timeval tv;
-
-   do_gettimeofday(tv);
-   *time = cpu_to_le64(tv.tv_sec);
+   *time = cpu_to_le64(ktime_get_real_seconds());
 }
 
 static struct status_msg *stex_get_status(struct st_hba *hba)
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 11:56:16PM +, Al Viro wrote:
 On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote:
  +* Copy over the virtio-scsi request header, which when
  +* ANY_LAYOUT is enabled may span multiple iovecs, or a
  +* single iovec may contain both the header + outgoing
  +* WRITE payloads.
  +*
  +* copy_from_iter() is modifying the iovecs as copies over
  +* req_size bytes into req, so the returned out_iter.iov[0]
  +* will contain the correct start + offset of the outgoing
  +* WRITE payload, if DMA_TO_DEVICE is set.
 
 It does no such thing.  What it does, though, is changing out_iter so
 that subsequent copy_from_iter() will return the data you want.  Note
 that out_iter.iov[0] will contain the correct _segment_ of that vector,
 with the data you want at out_iter.iov_offset bytes from the beginning
 of that segment.  .iov may come to point to subsequent segments and 
 .iov_offset
 keeps changing, but segments themselves are never changed.
 
  +*/
  +   iov_iter_init(out_iter, READ, vq-iov[0], out,
 WRITE, please - as in this is
 the source of some write, we'll be copying _from_ it.  READ would be
 destination of some read, we'll be copying into it.
 
  +(data_direction == DMA_TO_DEVICE) ?
  + req_size + exp_data_len : req_size);
  +
  +   ret = copy_from_iter(req, req_size, out_iter);
 
 ...
 
  +   /*
  +* Determine start of T10_PI or data payload iovec in ANY_LAYOUT
  +* mode based upon data_direction.
  +*
  +* For DMA_TO_DEVICE, this is iov_out from copy_from_iter()
  +* with the already recalculated iov_base + iov_len.
 
 ITYM this is out_iter, which is already pointing to the right place
 
 AFAICS, the actual use is correct, it's just that the comments are confused.

Looks like it'd be nicer to pass iters around as much as possible,
try to reduce the amount of poking at the underlying iov.

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi_logging: return void for dev_printk() functions

2015-02-03 Thread Hannes Reinecke
dev_printk() is now a void function, so the related functions
scmd_printk() and sdev_prefix_printk() should be made void, too.

Reported-by: Stephen Rothwell s...@canb.auug.org.au
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/scsi_logging.c | 22 +-
 include/scsi/scsi_device.h  |  4 ++--
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index ecc5918..bd70339 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -93,20 +93,19 @@ static size_t sdev_format_header(char *logbuf, size_t 
logbuf_len,
return off;
 }
 
-int sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
-  const char *name, const char *fmt, ...)
+void sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
+   const char *name, const char *fmt, ...)
 {
va_list args;
char *logbuf;
size_t off = 0, logbuf_len;
-   int ret;
 
if (!sdev)
-   return 0;
+   return;
 
logbuf = scsi_log_reserve_buffer(logbuf_len);
if (!logbuf)
-   return 0;
+   return;
 
if (name)
off += scnprintf(logbuf + off, logbuf_len - off,
@@ -116,26 +115,24 @@ int sdev_prefix_printk(const char *level, const struct 
scsi_device *sdev,
off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
va_end(args);
}
-   ret = dev_printk(level, sdev-sdev_gendev, %s, logbuf);
+   dev_printk(level, sdev-sdev_gendev, %s, logbuf);
scsi_log_release_buffer(logbuf);
-   return ret;
 }
 EXPORT_SYMBOL(sdev_prefix_printk);
 
-int scmd_printk(const char *level, const struct scsi_cmnd *scmd,
+void scmd_printk(const char *level, const struct scsi_cmnd *scmd,
const char *fmt, ...)
 {
va_list args;
char *logbuf;
size_t off = 0, logbuf_len;
-   int ret;
 
if (!scmd || !scmd-cmnd)
-   return 0;
+   return;
 
logbuf = scsi_log_reserve_buffer(logbuf_len);
if (!logbuf)
-   return 0;
+   return;
off = sdev_format_header(logbuf, logbuf_len, scmd_name(scmd),
 scmd-request-tag);
if (off  logbuf_len) {
@@ -143,9 +140,8 @@ int scmd_printk(const char *level, const struct scsi_cmnd 
*scmd,
off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
va_end(args);
}
-   ret = dev_printk(level, scmd-device-sdev_gendev, %s, logbuf);
+   dev_printk(level, scmd-device-sdev_gendev, %s, logbuf);
scsi_log_release_buffer(logbuf);
-   return ret;
 }
 EXPORT_SYMBOL(scmd_printk);
 
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 2e0281e..a4c9336 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -237,14 +237,14 @@ struct scsi_dh_data {
  * like scmd_printk, but the device name is passed in
  * as a string pointer
  */
-__printf(4, 5) int
+__printf(4, 5) void
 sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
const char *, ...);
 
 #define sdev_printk(l, sdev, fmt, a...)\
sdev_prefix_printk(l, sdev, NULL, fmt, ##a)
 
-__printf(3, 4) int
+__printf(3, 4) void
 scmd_printk(const char *, const struct scsi_cmnd *, const char *, ...);
 
 #define scmd_dbg(scmd, fmt, a...) \
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1 4/4] scsi: ufs: inject errors to verify error handling

2015-02-03 Thread Gilad Broner
From: Sujit Reddy Thumma sthu...@codeaurora.org

Use fault-injection framework to simulate error conditions
in the controller and verify error handling mechanisms
implemented in UFS host controller driver.

This is used only during development and hence
guarded by CONFIG_UFS_FAULT_INJECTION debug config option.

Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
---
 drivers/scsi/ufs/debugfs.c | 140 +
 drivers/scsi/ufs/debugfs.h |  12 +++-
 drivers/scsi/ufs/ufshcd.c  |   2 +
 drivers/scsi/ufs/ufshcd.h  |   5 ++
 lib/Kconfig.debug  |  14 +
 5 files changed, 172 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/debugfs.c b/drivers/scsi/ufs/debugfs.c
index 10d2b50..add47b0 100644
--- a/drivers/scsi/ufs/debugfs.c
+++ b/drivers/scsi/ufs/debugfs.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include linux/random.h
 #include debugfs.h
 #include unipro.h
 
@@ -41,6 +42,143 @@ struct desc_field_offset {
} while (0)
 #define DOORBELL_CLR_TOUT_US   (1000 * 1000) /* 1 sec */
 
+#ifdef CONFIG_UFS_FAULT_INJECTION
+
+#define INJECT_COMMAND_HANG (0x0)
+
+static DECLARE_FAULT_ATTR(fail_default_attr);
+static char *fail_request;
+module_param(fail_request, charp, 0);
+
+static bool inject_fatal_err_tr(struct ufs_hba *hba, u8 ocs_err)
+{
+   int tag;
+
+   tag = find_first_bit(hba-outstanding_reqs, hba-nutrs);
+   if (tag == hba-nutrs)
+   return 0;
+
+   ufshcd_writel(hba, ~(1  tag), REG_UTP_TRANSFER_REQ_LIST_CLEAR);
+   (hba-lrb[tag])-utr_descriptor_ptr-header.dword_2 =
+   cpu_to_be32(ocs_err);
+
+   /* fatal error injected */
+   return 1;
+}
+
+static bool inject_fatal_err_tm(struct ufs_hba *hba, u8 ocs_err)
+{
+   int tag;
+
+   tag = find_first_bit(hba-outstanding_tasks, hba-nutmrs);
+   if (tag == hba-nutmrs)
+   return 0;
+
+   ufshcd_writel(hba, ~(1  tag), REG_UTP_TASK_REQ_LIST_CLEAR);
+   (hba-utmrdl_base_addr[tag])-header.dword_2 =
+   cpu_to_be32(ocs_err);
+
+   /* fatal error injected */
+   return 1;
+}
+
+static bool inject_cmd_hang_tr(struct ufs_hba *hba)
+{
+   int tag;
+
+   tag = find_first_bit(hba-outstanding_reqs, hba-nutrs);
+   if (tag == hba-nutrs)
+   return 0;
+
+   __clear_bit(tag, hba-outstanding_reqs);
+   hba-lrb[tag].cmd = NULL;
+   __clear_bit(tag, hba-lrb_in_use);
+
+   /* command hang injected */
+   return 1;
+}
+
+static int inject_cmd_hang_tm(struct ufs_hba *hba)
+{
+   int tag;
+
+   tag = find_first_bit(hba-outstanding_tasks, hba-nutmrs);
+   if (tag == hba-nutmrs)
+   return 0;
+
+   __clear_bit(tag, hba-outstanding_tasks);
+   __clear_bit(tag, hba-tm_slots_in_use);
+
+   /* command hang injected */
+   return 1;
+}
+
+void ufsdbg_fail_request(struct ufs_hba *hba, u32 *intr_status)
+{
+   u8 ocs_err;
+   static const u32 errors[] = {
+   CONTROLLER_FATAL_ERROR,
+   SYSTEM_BUS_FATAL_ERROR,
+   INJECT_COMMAND_HANG,
+   };
+
+   if (!should_fail(hba-debugfs_files.fail_attr, 1))
+   goto out;
+
+   *intr_status = errors[prandom_u32() % ARRAY_SIZE(errors)];
+   dev_info(hba-dev, %s: fault-inject error: 0x%x\n,
+   __func__, *intr_status);
+
+   switch (*intr_status) {
+   case CONTROLLER_FATAL_ERROR: /* fall through */
+   ocs_err = OCS_FATAL_ERROR;
+   goto set_ocs;
+   case SYSTEM_BUS_FATAL_ERROR:
+   ocs_err = OCS_INVALID_CMD_TABLE_ATTR;
+set_ocs:
+   if (!inject_fatal_err_tr(hba, ocs_err))
+   if (!inject_fatal_err_tm(hba, ocs_err))
+   *intr_status = 0;
+   break;
+   case INJECT_COMMAND_HANG:
+   if (!inject_cmd_hang_tr(hba))
+   inject_cmd_hang_tm(hba);
+   break;
+   default:
+   BUG();
+   /* some configurations ignore panics caused by BUG() */
+   break;
+   }
+out:
+   return;
+}
+
+static void ufsdbg_setup_fault_injection(struct ufs_hba *hba)
+{
+   hba-debugfs_files.fail_attr = fail_default_attr;
+
+   if (fail_request)
+   setup_fault_attr(hba-debugfs_files.fail_attr, fail_request);
+
+   /* suppress dump stack everytime failure is injected */
+   hba-debugfs_files.fail_attr.verbose = 0;
+
+   if (IS_ERR(fault_create_debugfs_attr(inject_fault,
+   hba-debugfs_files.debugfs_root,
+   hba-debugfs_files.fail_attr)))
+   dev_err(hba-dev, %s: failed to create debugfs entry\n,
+   __func__);
+}
+#else
+void ufsdbg_fail_request(struct ufs_hba *hba, u32 *intr_status)
+{
+}
+
+static void 

[PATCH v1 3/4] scsi: ufs: add trace events and dump prints for debug

2015-02-03 Thread Gilad Broner
Add trace events to driver to allow monitoring and profilig
of activities such as PM suspend/resume, hibernate enter/exit,
clock gating and clock scaling up/down.
In addition, add UFS host controller register dumps to provide
detailed information in case of errors to assist in analysis
of issues.

Signed-off-by: Dolev Raviv dra...@codeaurora.org
Signed-off-by: Subhash Jadavani subha...@codeaurora.org
Signed-off-by: Lee Susman lsus...@codeaurora.org
Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
Signed-off-by: Yaniv Gardi yga...@codeaurora.org
---
 drivers/scsi/ufs/ufs-qcom.c  |  53 +
 drivers/scsi/ufs/ufshcd.c| 509 ---
 drivers/scsi/ufs/ufshcd.h|  49 -
 drivers/scsi/ufs/ufshci.h|   1 +
 include/linux/ftrace_event.h |   3 +
 include/trace/events/ufs.h   | 227 +++
 6 files changed, 811 insertions(+), 31 deletions(-)
 create mode 100644 include/trace/events/ufs.h

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index fd01255..bd16155 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -31,6 +31,14 @@ static int ufs_qcom_get_bus_vote(struct ufs_qcom_host *host,
const char *speed_mode);
 static int ufs_qcom_set_bus_vote(struct ufs_qcom_host *host, int vote);
 
+static void ufs_qcom_dump_regs(struct ufs_hba *hba, int offset, int len,
+   char *prefix)
+{
+   print_hex_dump(KERN_ERR, prefix,
+   len  4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE,
+   16, 4, hba-mmio_base + offset, len * 4, false);
+}
+
 static int ufs_qcom_get_connected_tx_lanes(struct ufs_hba *hba, u32 *tx_lanes)
 {
int err = 0;
@@ -1037,6 +1045,50 @@ void ufs_qcom_clk_scale_notify(struct ufs_hba *hba)
dev_req_params-hs_rate);
 }
 
+static void ufs_qcom_print_hw_debug_reg_all(struct ufs_hba *hba)
+{
+   u32 reg;
+
+   ufs_qcom_dump_regs(hba, UFS_UFS_DBG_RD_REG_OCSC, 44,
+   UFS_UFS_DBG_RD_REG_OCSC );
+
+   reg = ufshcd_readl(hba, REG_UFS_CFG1);
+   reg |= UFS_BIT(17);
+   ufshcd_writel(hba, reg, REG_UFS_CFG1);
+
+   ufs_qcom_dump_regs(hba, UFS_UFS_DBG_RD_EDTL_RAM, 32,
+   UFS_UFS_DBG_RD_EDTL_RAM );
+   ufs_qcom_dump_regs(hba, UFS_UFS_DBG_RD_DESC_RAM, 128,
+   UFS_UFS_DBG_RD_DESC_RAM );
+   ufs_qcom_dump_regs(hba, UFS_UFS_DBG_RD_PRDT_RAM, 64,
+   UFS_UFS_DBG_RD_PRDT_RAM );
+
+   ufshcd_writel(hba, (reg  ~UFS_BIT(17)), REG_UFS_CFG1);
+
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_UAWM, 4,
+   UFS_DBG_RD_REG_UAWM );
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_UARM, 4,
+   UFS_DBG_RD_REG_UARM );
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_TXUC, 48,
+   UFS_DBG_RD_REG_TXUC );
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_RXUC, 27,
+   UFS_DBG_RD_REG_RXUC );
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_DFC, 19,
+   UFS_DBG_RD_REG_DFC );
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_TRLUT, 34,
+   UFS_DBG_RD_REG_TRLUT );
+   ufs_qcom_dump_regs(hba, UFS_DBG_RD_REG_TMRLUT, 9,
+   UFS_DBG_RD_REG_TMRLUT );
+}
+
+static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)
+{
+   ufs_qcom_dump_regs(hba, REG_UFS_SYS1CLK_1US, 5,
+   REG_UFS_SYS1CLK_1US );
+
+   ufs_qcom_print_hw_debug_reg_all(hba);
+}
+
 /**
  * struct ufs_hba_qcom_vops - UFS QCOM specific variant operations
  *
@@ -1054,5 +1106,6 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops 
= {
.pwr_change_notify  = ufs_qcom_pwr_change_notify,
.suspend= ufs_qcom_suspend,
.resume = ufs_qcom_resume,
+   .dbg_register_dump  = ufs_qcom_dump_dbg_regs,
 };
 EXPORT_SYMBOL(ufs_hba_qcom_vops);
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f2e446b..f4dc607 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -45,6 +45,9 @@
 #include unipro.h
 #include debugfs.h
 
+#define CREATE_TRACE_POINTS
+#include trace/events/ufs.h
+
 #ifdef CONFIG_DEBUG_FS
 
 #define UFSHCD_UPDATE_ERROR_STATS(hba, type)   \
@@ -145,6 +148,8 @@
_ret = ufshcd_disable_vreg(_dev, _vreg);\
_ret;   \
})
+#define ufshcd_hex_dump(prefix_str, buf, len) \
+print_hex_dump(KERN_ERR, prefix_str, DUMP_PREFIX_OFFSET, 16, 4, buf, len, 
false)
 
 static u32 ufs_query_desc_max_size[] = {
QUERY_DESC_DEVICE_MAX_SIZE,
@@ -272,6 +277,151 @@ static inline void ufshcd_disable_irq(struct ufs_hba *hba)
}
 }
 
+#ifdef CONFIG_TRACEPOINTS
+static void ufshcd_add_command_trace(struct ufs_hba *hba,
+   unsigned int tag, const char *str)
+{
+   sector_t lba = -1;
+   u8 opcode = 

[PATCH v1 2/4] scsi: ufs: add debugfs for ufs

2015-02-03 Thread Gilad Broner
From: Lee Susman lsus...@codeaurora.org

Adding debugfs capability for ufshcd.

debugfs attributes introduced in this patch:
 - View driver/controller runtime data
 - Command tag statistics for performance analisis
 - Dump device descriptor info
 - Track recoverable errors statistics during runtime
 - Change UFS power mode during runtime
 entry a string in the format 'GGLLMM' where:
 G - selected gear
 L - number of lanes
 M - power mode
 (1=fast mode, 2=slow mode, 4=fast-auto mode,
  5=slow-auto mode)
 First letter is for RX, second is for TX.
 - Get/set DME attributes

Signed-off-by: Lee Susman lsus...@codeaurora.org
Signed-off-by: Dolev Raviv dra...@codeaurora.org
Signed-off-by: Yaniv Gardi yga...@codeaurora.org
Signed-off-by: Raviv Shvili rshv...@codeaurora.org
Signed-off-by: Gilad Broner gbro...@codeaurora.org
---
 drivers/scsi/ufs/Makefile  |   1 +
 drivers/scsi/ufs/debugfs.c | 898 +
 drivers/scsi/ufs/debugfs.h |  32 ++
 drivers/scsi/ufs/ufshcd.c  | 230 +++-
 drivers/scsi/ufs/ufshcd.h  |  65 
 drivers/scsi/ufs/ufshci.h  |   2 +
 6 files changed, 1216 insertions(+), 12 deletions(-)
 create mode 100644 drivers/scsi/ufs/debugfs.c
 create mode 100644 drivers/scsi/ufs/debugfs.h

diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
index 31adca5..f60a4b9 100644
--- a/drivers/scsi/ufs/Makefile
+++ b/drivers/scsi/ufs/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_SCSI_UFS_QCOM_ICE) += ufs-qcom-ice.o
 obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o
 obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
 obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
+obj-$(CONFIG_DEBUG_FS) += debugfs.o
diff --git a/drivers/scsi/ufs/debugfs.c b/drivers/scsi/ufs/debugfs.c
new file mode 100644
index 000..10d2b50
--- /dev/null
+++ b/drivers/scsi/ufs/debugfs.c
@@ -0,0 +1,898 @@
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * UFS debugfs - add debugfs interface to the ufshcd.
+ * This is currently used for statistics collection and exporting from the
+ * UFS driver.
+ * This infrastructure can be used for debugging or direct tweaking
+ * of the driver from userspace.
+ *
+ */
+
+#include debugfs.h
+#include unipro.h
+
+enum field_width {
+   BYTE= 1,
+   WORD= 2,
+};
+
+struct desc_field_offset {
+   char *name;
+   int offset;
+   enum field_width width_byte;
+};
+
+#define UFS_ERR_STATS_PRINT(file, error_index, string, error_seen) \
+   do {\
+   if (err_stats[error_index]) {   \
+   seq_printf(file, string,\
+   err_stats[error_index]);\
+   error_seen = true;  \
+   }   \
+   } while (0)
+#define DOORBELL_CLR_TOUT_US   (1000 * 1000) /* 1 sec */
+
+#define BUFF_LINE_CAPACITY 16
+#define TAB_CHARS 8
+
+static int ufsdbg_tag_stats_show(struct seq_file *file, void *data)
+{
+   struct ufs_hba *hba = (struct ufs_hba *)file-private;
+   struct ufs_stats *ufs_stats;
+   int i, j;
+   int max_depth;
+   bool is_tag_empty = true;
+   unsigned long flags;
+   char *sep =  | * | ;
+
+   if (!hba)
+   goto exit;
+
+   ufs_stats = hba-ufs_stats;
+
+   if (!ufs_stats-enabled) {
+   pr_debug(%s: ufs statistics are disabled\n, __func__);
+   seq_puts(file, ufs statistics are disabled);
+   goto exit;
+   }
+
+   max_depth = hba-nutrs;
+
+   spin_lock_irqsave(hba-host-host_lock, flags);
+   /* Header */
+   seq_printf(file,  Tag Stat\t\t%s Queue Fullness\n, sep);
+   for (i = 0; i  TAB_CHARS * (TS_NUM_STATS + 4); i++) {
+   seq_puts(file, -);
+   if (i == (TAB_CHARS * 3 - 1))
+   seq_puts(file, sep);
+   }
+   seq_printf(file,
+   \n #\tnum uses\t%s\t #\tAll\t Read\t Write\t Flush\n,
+   sep);
+
+   /* values */
+   for (i = 0; i  max_depth; i++) {
+   if (ufs_stats-tag_stats[i][0] = 0 
+   ufs_stats-tag_stats[i][1] = 0 
+   ufs_stats-tag_stats[i][2] = 0 
+   ufs_stats-tag_stats[i][3] = 0)
+   continue;
+
+ 

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-03 Thread Michael S. Tsirkin
 +  * copy_from_iter() is modifying the iovecs as copies over
 +  * req_size bytes into req, so the returned out_iter.iov[0]
 +  * will contain the correct start + offset of the outgoing
 +  * WRITE payload, if DMA_TO_DEVICE is set.
 +  */

Does it, in fact, do this?
I thought so too, but Al Viro corrected me that it's
not supposed to.

-- 
MST
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1 1/4] scsi: ufs: add ioctl interface for query request

2015-02-03 Thread Gilad Broner
From: Dolev Raviv dra...@codeaurora.org

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.

Signed-off-by: Dolev Raviv dra...@codeaurora.org
Signed-off-by: Noa Rubens n...@codeaurora.org
Signed-off-by: Raviv Shvili rshv...@codeaurora.org
Signed-off-by: Yaniv Gardi yga...@codeaurora.org
---
 drivers/scsi/ufs/ufs.h|  53 +++---
 drivers/scsi/ufs/ufshcd.c | 225 +-
 include/uapi/scsi/Kbuild  |   1 +
 include/uapi/scsi/ufs/Kbuild  |   3 +
 include/uapi/scsi/ufs/ioctl.h |  57 +++
 include/uapi/scsi/ufs/ufs.h   |  66 +
 6 files changed, 361 insertions(+), 44 deletions(-)
 create mode 100644 include/uapi/scsi/ufs/Kbuild
 create mode 100644 include/uapi/scsi/ufs/ioctl.h
 create mode 100644 include/uapi/scsi/ufs/ufs.h

diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index 42c459a..1f023c4 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -38,6 +38,7 @@
 
 #include linux/mutex.h
 #include linux/types.h
+#include scsi/ufs/ufs.h
 
 #define MAX_CDB_SIZE   16
 #define GENERAL_UPIU_REQUEST_SIZE 32
@@ -71,6 +72,16 @@ enum {
UFS_UPIU_RPMB_WLUN  = 0xC4,
 };
 
+/**
+ * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor
+ * @lun: LU number to check
+ * @return: true if the lun has a matching unit descriptor, false otherwise
+ */
+static inline bool ufs_is_valid_unit_desc_lun(u8 lun)
+{
+   return (lun == UFS_UPIU_RPMB_WLUN || (lun  UFS_UPIU_MAX_GENERAL_LUN));
+}
+
 /*
  * UFS Protocol Information Unit related definitions
  */
@@ -126,35 +137,6 @@ enum {
UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST  = 0x81,
 };
 
-/* Flag idn for Query Requests*/
-enum flag_idn {
-   QUERY_FLAG_IDN_FDEVICEINIT  = 0x01,
-   QUERY_FLAG_IDN_PWR_ON_WPE   = 0x03,
-   QUERY_FLAG_IDN_BKOPS_EN = 0x04,
-};
-
-/* Attribute idn for Query requests */
-enum attr_idn {
-   QUERY_ATTR_IDN_ACTIVE_ICC_LVL   = 0x03,
-   QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
-   QUERY_ATTR_IDN_EE_CONTROL   = 0x0D,
-   QUERY_ATTR_IDN_EE_STATUS= 0x0E,
-};
-
-/* Descriptor idn for Query requests */
-enum desc_idn {
-   QUERY_DESC_IDN_DEVICE   = 0x0,
-   QUERY_DESC_IDN_CONFIGURAION = 0x1,
-   QUERY_DESC_IDN_UNIT = 0x2,
-   QUERY_DESC_IDN_RFU_0= 0x3,
-   QUERY_DESC_IDN_INTERCONNECT = 0x4,
-   QUERY_DESC_IDN_STRING   = 0x5,
-   QUERY_DESC_IDN_RFU_1= 0x6,
-   QUERY_DESC_IDN_GEOMETRY = 0x7,
-   QUERY_DESC_IDN_POWER= 0x8,
-   QUERY_DESC_IDN_MAX,
-};
-
 enum desc_header_offset {
QUERY_DESC_LENGTH_OFFSET= 0x00,
QUERY_DESC_DESC_TYPE_OFFSET = 0x01,
@@ -247,19 +229,6 @@ enum bkops_status {
BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL,
 };
 
-/* UTP QUERY Transaction Specific Fields OpCode */
-enum query_opcode {
-   UPIU_QUERY_OPCODE_NOP   = 0x0,
-   UPIU_QUERY_OPCODE_READ_DESC = 0x1,
-   UPIU_QUERY_OPCODE_WRITE_DESC= 0x2,
-   UPIU_QUERY_OPCODE_READ_ATTR = 0x3,
-   UPIU_QUERY_OPCODE_WRITE_ATTR= 0x4,
-   UPIU_QUERY_OPCODE_READ_FLAG = 0x5,
-   UPIU_QUERY_OPCODE_SET_FLAG  = 0x6,
-   UPIU_QUERY_OPCODE_CLEAR_FLAG= 0x7,
-   UPIU_QUERY_OPCODE_TOGGLE_FLAG   = 0x8,
-};
-
 /* Query response result code */
 enum {
QUERY_RESULT_SUCCESS= 0x00,
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5d60a86..cb357f8 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3,7 +3,7 @@
  *
  * This code is based on drivers/scsi/ufs/ufshcd.c
  * Copyright (C) 2011-2013 Samsung India Software Operations
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Authors:
  * Santosh Yaraganavi santosh...@samsung.com
@@ -39,6 +39,7 @@
 
 #include linux/async.h
 #include linux/devfreq.h
+#include scsi/ufs/ioctl.h
 
 #include ufshcd.h
 #include unipro.h
@@ -74,6 +75,9 @@
 /* Interrupt aggregation default timeout, unit: 40us */
 #define INT_AGGR_DEF_TO0x02
 
+/* IOCTL opcode for command - ufs set device read only */
+#define UFS_IOCTL_BLKROSET  BLKROSET
+
 #define ufshcd_toggle_vreg(_dev, _vreg, _on)   \
({  \
int _ret;   \
@@ -1882,7 +1886,7 @@ static inline int ufshcd_read_unit_desc_param(struct 
ufs_hba *hba,
 * Unit descriptors are only available for general purpose LUs (LUN id
 * from 0 to 7) and RPMB Well known LU.
 */
-   if (lun != UFS_UPIU_RPMB_WLUN  (lun = 

[PATCH v3] scsi: NCR5380: use msecs_to_jiffies for conversions

2015-02-03 Thread Nicholas Mc Guire
This is only an API consolidation to make things more readable.
Instances of  var * HZ / 1000  are replaced by  msecs_to_jiffies(var).
In addition some timing constants that assumed HZ 100 were adjusted
to HZ independent settings based on review of the original drivers in 
1.0.31 and 2.2.16.

Signed-off-by: Nicholas Mc Guire hof...@osadl.org
---

v2: the original patch was not taking care of all the dependencies
as reported by Finn Thain fth...@telegraphics.com.au - this
version now uses the suggested config to check the patch.
v3: g_NCR5380.c changes fixed up based on feedback from Michael Schmitz
schmitz...@gmail.com as these settings were from around 1.0.31
kernel (or earlier) where HZ was 100 only - thus the unit here is
actually 10s of microseconds. This was verified by checking the
setting changes against 2.2.16 indicating that it was forgotten in
1998/99.

Converting milliseconds to jiffies by val * HZ / 1000 is technically
ok but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly. This is a minor API cleanup only.

This patch was only compile tested with i386_defconfig + CONFIG_ISA=y
as well as all dependent drivers enabled as modules:
CONFIG_SCSI_LOWLEVEL=y, CONFIG_SCSI_GENERIC_NCR5380=m
CONFIG_SCSI_DMX3191D=m, CONFIG_SCSI_DTC3280=m
CONFIG_SCSI_GENERIC_NCR5380=m, CONFIG_SCSI_GENERIC_NCR5380_MMIO=m
CONFIG_SCSI_PAS16=m, CONFIG_SCSI_T128=m

Patch is against 3.19.0-rc7 (localversion-next = -next-20150203)

 drivers/scsi/NCR5380.c   |   10 +-
 drivers/scsi/g_NCR5380.c |6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 8981701..d15411b 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -474,11 +474,11 @@ static void NCR5380_print_phase(struct Scsi_Host 
*instance)
  */
 #ifndef USLEEP_SLEEP
 /* 20 ms (reasonable hard disk speed) */
-#define USLEEP_SLEEP (20*HZ/1000)
+#define USLEEP_SLEEP msecs_to_jiffies(20)
 #endif
 /* 300 RPM (floppy speed) */
 #ifndef USLEEP_POLL
-#define USLEEP_POLL (200*HZ/1000)
+#define USLEEP_POLL msecs_to_jiffies(200)
 #endif
 #ifndef USLEEP_WAITLONG
 /* RvC: (reasonable time to wait on select error) */
@@ -576,7 +576,7 @@ static int __init __maybe_unused NCR5380_probe_irq(struct 
Scsi_Host *instance,
if ((mask  possible)  (request_irq(i, probe_intr, 0, 
NCR-probe, NULL) == 0))
trying_irqs |= mask;
 
-   timeout = jiffies + (250 * HZ / 1000);
+   timeout = jiffies + msecs_to_jiffies(250);
probe_irq = NO_IRQ;
 
/*
@@ -634,7 +634,7 @@ static void prepare_info(struct Scsi_Host *instance)
 sg_tablesize %d, this_id %d, 
 flags { %s%s%s}, 
 #if defined(USLEEP_POLL)  defined(USLEEP_WAITLONG)
-USLEEP_POLL %d, USLEEP_WAITLONG %d, 
+USLEEP_POLL %lu, USLEEP_WAITLONG %lu, 
 #endif
 options { %s} ,
 instance-hostt-name, instance-io_port, instance-n_io_port,
@@ -1346,7 +1346,7 @@ static int NCR5380_select(struct Scsi_Host *instance, 
struct scsi_cmnd *cmd)
 * selection.
 */
 
-   timeout = jiffies + (250 * HZ / 1000);
+   timeout = jiffies + msecs_to_jiffies(250);
 
/* 
 * XXX very interesting - we're seeing a bounce where the BSY we 
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index f35792f..a11b152 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -57,9 +57,9 @@
  */
 
 /* settings for DTC3181E card with only Mustek scanner attached */
-#define USLEEP_POLL1
-#define USLEEP_SLEEP   20
-#define USLEEP_WAITLONG500
+#define USLEEP_POLLmsecs_to_jiffies(10)
+#define USLEEP_SLEEP   msecs_to_jiffies(200)
+#define USLEEP_WAITLONGmsecs_to_jiffies(5000)
 
 #define AUTOPROBE_IRQ
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1 0/4] Add ioctl and debug utilities to UFS driver

2015-02-03 Thread Gilad Broner
This patch series introduces in the first change a new UFS ioctl,
allowing user-space to send UFS queries and retrieve information from them.
In addition, the other three patches add utilities to support debugging
efforts and supply information that will help analysis of issue:
UFS trace events, dump host controller registers and requests descriptors
on failures, several statistics.

Dolev Raviv (1):
  scsi: ufs: add ioctl interface for query request

Gilad Broner (1):
  scsi: ufs: add trace events and dump prints for debug

Lee Susman (1):
  scsi: ufs: add debugfs for ufs

Sujit Reddy Thumma (1):
  scsi: ufs: inject errors to verify error handling

 drivers/scsi/ufs/Makefile |1 +
 drivers/scsi/ufs/debugfs.c| 1038 +
 drivers/scsi/ufs/debugfs.h|   42 ++
 drivers/scsi/ufs/ufs-qcom.c   |   53 +++
 drivers/scsi/ufs/ufs.h|   53 +--
 drivers/scsi/ufs/ufshcd.c |  964 --
 drivers/scsi/ufs/ufshcd.h |  115 +
 drivers/scsi/ufs/ufshci.h |3 +
 include/linux/ftrace_event.h  |3 +
 include/trace/events/ufs.h|  227 +
 include/uapi/scsi/Kbuild  |1 +
 include/uapi/scsi/ufs/Kbuild  |3 +
 include/uapi/scsi/ufs/ioctl.h |   57 +++
 include/uapi/scsi/ufs/ufs.h   |   66 +++
 lib/Kconfig.debug |   14 +
 15 files changed, 2556 insertions(+), 84 deletions(-)
 create mode 100644 drivers/scsi/ufs/debugfs.c
 create mode 100644 drivers/scsi/ufs/debugfs.h
 create mode 100644 include/trace/events/ufs.h
 create mode 100644 include/uapi/scsi/ufs/Kbuild
 create mode 100644 include/uapi/scsi/ufs/ioctl.h
 create mode 100644 include/uapi/scsi/ufs/ufs.h
-- 
1.8.5.2

-- 
Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel Ooops upon USB disconnect of a Western Digital My Passport 1TB drive

2015-02-03 Thread Athlion
On Mon, Feb 2, 2015 at 7:27 PM, Alan Stern st...@rowland.harvard.edu wrote:

 Had you made any changes to the runtime suspend settings?
 blk_post_runtime_resume wouldn't be called unless the drive had gone
 into runtime suspend.  And even then, it's not likely to be called
 after you unplug the USB cable.

 Alan Stern

I have enabled SCSI ATA Bus power management with this udev rule:
ACTION==add, SUBSYSTEM==scsi_host, KERNEL==host*,
ATTR{link_power_management_policy}=min_power
( And generally almost all of actions herein:
https://wiki.archlinux.org/index.php/Power_saving#Laptop_Mode )

Here's another with dynamic debugging on (and some of the stack trace):

[ 1565.610481] usb usb2: usb wakeup-resume
[ 1565.613019] usb usb2: usb auto-resume
[ 1565.615599] hub 2-0:1.0: hub_resume
[ 1565.617876] usb usb2-port1: status 0507 change 
[ 1565.620125] hub 2-0:1.0: state 7 ports 3 chg  evt 
[ 1565.623471] hub 2-0:1.0: state 7 ports 3 chg  evt 
[ 1565.650219] hub 2-0:1.0: state 7 ports 3 chg  evt 0002
[ 1565.663520] usb 2-1: usb wakeup-resume
[ 1565.665518] usb 2-1: finish resume
[ 1565.667684] hub 2-1:1.0: hub_resume
[ 1565.669812] usb 2-1-port2: status 0101 change 0001
[ 1565.773645] usb usb2-port1: resume, status 0
[ 1565.776031] hub 2-1:1.0: state 7 ports 8 chg 0004 evt 
[ 1565.778664] usb 2-1-port2: status 0101, change , 12 Mb/s
[ 1565.847291] usb 2-1.2: new high-speed USB device number 3 using ehci-pci
[ 1565.860480] usb 2-1-port2: not reset yet, waiting 10ms
[ 1565.945202] usb 2-1.2: default language 0x0409
[ 1565.947882] usb 2-1.2: udev 3, busnum 2, minor = 130
[ 1565.950384] usb 2-1.2: usb_probe_device
[ 1565.952704] usb 2-1.2: configuration #1 chosen from 1 choice
[ 1565.955145] usb 2-1.2: adding 2-1.2:1.0 (config #1, interface 0)
[ 1565.957630] hub 2-1:1.0: state 7 ports 8 chg  evt 0004
[ 1566.005124] usb-storage 2-1.2:1.0: usb_probe_interface
[ 1566.006655] usb-storage 2-1.2:1.0: usb_probe_interface - got id
[ 1566.008169] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[ 1566.010155] scsi host6: usb-storage 2-1.2:1.0
[ 1566.012149] usbcore: registered new interface driver usb-storage
[ 1566.016061] usbcore: registered new interface driver uas
[ 1567.015852] scsi 6:0:0:0: Direct-Access WD   My Passport
0748 1016 PQ: 0 ANSI: 6
[ 1567.018966] scsi 6:0:0:1: Enclosure WD   SES Device
  1016 PQ: 0 ANSI: 6
[ 1567.027072] scsi 6:0:0:1: scsi_runtime_idle
[ 1567.029695] sd 6:0:0:0: [sdb] Spinning up disk...
[ 1567.032764] scsi 6:0:0:1: scsi_runtime_suspend
[ 1568.031907] .ready
[ 1569.060225] sd 6:0:0:0: [sdb] 1953458176 512-byte logical blocks:
(1.00 TB/931 GiB)
[ 1569.063857] sd 6:0:0:0: [sdb] Write Protect is off
[ 1569.065613] ses 6:0:0:1: Attached Enclosure device
[ 1569.068492] sd 6:0:0:0: [sdb] Mode Sense: 47 00 10 08
[ 1569.071598] sd 6:0:0:0: [sdb] No Caching mode page found
[ 1569.073628] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 1569.087891]  sdb: sdb1
[ 1569.093382] sd 6:0:0:0: [sdb] Attached SCSI disk
[ 1615.830142] hub 2-1:1.0: state 7 ports 8 chg  evt 0004
[ 1615.833066] usb 2-1-port2: status 0100, change 0001, 12 Mb/s
[ 1615.835764] usb 2-1.2: USB disconnect, device number 3
[ 1615.838471] usb 2-1.2: unregistering device
[ 1615.841199] usb 2-1.2: unregistering interface 2-1.2:1.0
[ 1615.844996] scsi target6:0:0: scsi_runtime_idle
[ 1615.848746] scsi target6:0:0: scsi_runtime_suspend
[ 1615.868925] scsi target6:0:0: scsi_runtime_resume
[ 1615.870975] ses 6:0:0:1: scsi_runtime_resume
[ 1615.872913] BUG: unable to handle kernel NULL pointer dereference
at 01a0
[ 1615.874896] IP: [812850d5] blk_post_runtime_resume+0x65/0x80
[ 1615.876843] PGD 0
[ 1615.878765] Oops: 0002 [#1] PREEMPT SMP
[ 1615.880734] Modules linked in: ses enclosure uas usb_storage
netconsole joydev mousedev snd_hda_codec_hdmi snd_hda_codec_conexant
snd_hda_codec_generic coretemp intel_rapl x86_pkg_temp_thermal
intel_powerclamp kvm_intel kvm arc4 crct10dif_pclmul iwldvm
crc32_pclmul iTCO_wdt iTCO_vendor_support crc32c_intel mac80211
ghash_clmulni_intel ip6t_REJECT nf_reject_ipv6 aesni_intel xt_hl
aes_x86_64 lrw gf128mul ip6t_rt psmouse iwlwifi glue_helper
ablk_helper cryptd i2c_i801 serio_raw cfg80211 nf_conntrack_ipv6
nf_defrag_ipv6 snd_hda_intel wmi thinkpad_acpi nvram thermal rfkill
ipt_REJECT nf_reject_ipv4 hwmon tpm_tis ac tpm battery
snd_hda_controller snd_hda_codec snd_hwdep evdev snd_pcm mac_hid
xt_limit e1000e snd_timer xt_tcpudp mei_me snd mei ptp soundcore
shpchp pps_core lpc_ich processor xt_addrtype nf_conntrack_ipv4
nf_defrag_ipv4 xt_conntrack at ffd8
[ 1616.064883] IP: [81091500] kthread_data+0x10/0x20
[ 1616.068189] PGD 1814067 PUD 1816067 PMD 0
[ 1616.071462] Oops:  [#2] PREEMPT SMP
[ 1616.074719] Modules linked in: ses enclosure uas usb_storage
netconsole joydev mousedev snd_hda_codec_hdmi snd_hda_codec_conexant
snd_hda_codec_generic coretemp intel_rapl x86_pkg_temp_thermal
intel_powerclamp 

Re: Kernel Ooops upon USB disconnect of a Western Digital My Passport 1TB drive

2015-02-03 Thread Alan Stern
On Tue, 3 Feb 2015, Athlion wrote:

 On Mon, Feb 2, 2015 at 7:27 PM, Alan Stern st...@rowland.harvard.edu wrote:
 
  Had you made any changes to the runtime suspend settings?
  blk_post_runtime_resume wouldn't be called unless the drive had gone
  into runtime suspend.  And even then, it's not likely to be called
  after you unplug the USB cable.
 
  Alan Stern
 
 I have enabled SCSI ATA Bus power management with this udev rule:
 ACTION==add, SUBSYSTEM==scsi_host, KERNEL==host*,
 ATTR{link_power_management_policy}=min_power

That won't have any effect on SCSI over USB, as far as I know.

 ( And generally almost all of actions herein:
 https://wiki.archlinux.org/index.php/Power_saving#Laptop_Mode )
 
 Here's another with dynamic debugging on (and some of the stack trace):
 
 [ 1565.610481] usb usb2: usb wakeup-resume
 [ 1565.613019] usb usb2: usb auto-resume
 [ 1565.615599] hub 2-0:1.0: hub_resume
 [ 1565.617876] usb usb2-port1: status 0507 change 
 [ 1565.620125] hub 2-0:1.0: state 7 ports 3 chg  evt 
 [ 1565.623471] hub 2-0:1.0: state 7 ports 3 chg  evt 
 [ 1565.650219] hub 2-0:1.0: state 7 ports 3 chg  evt 0002
 [ 1565.663520] usb 2-1: usb wakeup-resume
 [ 1565.665518] usb 2-1: finish resume
 [ 1565.667684] hub 2-1:1.0: hub_resume
 [ 1565.669812] usb 2-1-port2: status 0101 change 0001
 [ 1565.773645] usb usb2-port1: resume, status 0
 [ 1565.776031] hub 2-1:1.0: state 7 ports 8 chg 0004 evt 
 [ 1565.778664] usb 2-1-port2: status 0101, change , 12 Mb/s
 [ 1565.847291] usb 2-1.2: new high-speed USB device number 3 using ehci-pci
 [ 1565.860480] usb 2-1-port2: not reset yet, waiting 10ms
 [ 1565.945202] usb 2-1.2: default language 0x0409
 [ 1565.947882] usb 2-1.2: udev 3, busnum 2, minor = 130
 [ 1565.950384] usb 2-1.2: usb_probe_device
 [ 1565.952704] usb 2-1.2: configuration #1 chosen from 1 choice
 [ 1565.955145] usb 2-1.2: adding 2-1.2:1.0 (config #1, interface 0)
 [ 1565.957630] hub 2-1:1.0: state 7 ports 8 chg  evt 0004
 [ 1566.005124] usb-storage 2-1.2:1.0: usb_probe_interface
 [ 1566.006655] usb-storage 2-1.2:1.0: usb_probe_interface - got id
 [ 1566.008169] usb-storage 2-1.2:1.0: USB Mass Storage device detected
 [ 1566.010155] scsi host6: usb-storage 2-1.2:1.0
 [ 1566.012149] usbcore: registered new interface driver usb-storage
 [ 1566.016061] usbcore: registered new interface driver uas
 [ 1567.015852] scsi 6:0:0:0: Direct-Access WD   My Passport
 0748 1016 PQ: 0 ANSI: 6
 [ 1567.018966] scsi 6:0:0:1: Enclosure WD   SES Device
   1016 PQ: 0 ANSI: 6

Your device contains two Logical Units.  One of them is the My Passport
disk drive, and the other is the SES Device enclosure.

 [ 1567.027072] scsi 6:0:0:1: scsi_runtime_idle
 [ 1567.029695] sd 6:0:0:0: [sdb] Spinning up disk...
 [ 1567.032764] scsi 6:0:0:1: scsi_runtime_suspend
 [ 1568.031907] .ready
 [ 1569.060225] sd 6:0:0:0: [sdb] 1953458176 512-byte logical blocks:
 (1.00 TB/931 GiB)
 [ 1569.063857] sd 6:0:0:0: [sdb] Write Protect is off
 [ 1569.065613] ses 6:0:0:1: Attached Enclosure device
 [ 1569.068492] sd 6:0:0:0: [sdb] Mode Sense: 47 00 10 08
 [ 1569.071598] sd 6:0:0:0: [sdb] No Caching mode page found
 [ 1569.073628] sd 6:0:0:0: [sdb] Assuming drive cache: write through
 [ 1569.087891]  sdb: sdb1
 [ 1569.093382] sd 6:0:0:0: [sdb] Attached SCSI disk
 [ 1615.830142] hub 2-1:1.0: state 7 ports 8 chg  evt 0004
 [ 1615.833066] usb 2-1-port2: status 0100, change 0001, 12 Mb/s
 [ 1615.835764] usb 2-1.2: USB disconnect, device number 3
 [ 1615.838471] usb 2-1.2: unregistering device
 [ 1615.841199] usb 2-1.2: unregistering interface 2-1.2:1.0
 [ 1615.844996] scsi target6:0:0: scsi_runtime_idle
 [ 1615.848746] scsi target6:0:0: scsi_runtime_suspend
 [ 1615.868925] scsi target6:0:0: scsi_runtime_resume
 [ 1615.870975] ses 6:0:0:1: scsi_runtime_resume
 [ 1615.872913] BUG: unable to handle kernel NULL pointer dereference
 at 01a0
 [ 1615.874896] IP: [812850d5] blk_post_runtime_resume+0x65/0x80
 [ 1615.876843] PGD 0
 [ 1615.878765] Oops: 0002 [#1] PREEMPT SMP
 [ 1615.880734] Modules linked in: ses enclosure uas usb_storage
 netconsole joydev mousedev snd_hda_codec_hdmi snd_hda_codec_conexant
 snd_hda_codec_generic coretemp intel_rapl x86_pkg_temp_thermal
 intel_powerclamp kvm_intel kvm arc4 crct10dif_pclmul iwldvm
 crc32_pclmul iTCO_wdt iTCO_vendor_support crc32c_intel mac80211   
 ghash_clmulni_intel ip6t_REJECT nf_reject_ipv6 aesni_intel xt_hl
 aes_x86_64 lrw gf128mul ip6t_rt psmouse iwlwifi glue_helper
 ablk_helper cryptd i2c_i801 serio_raw cfg80211 nf_conntrack_ipv6
 nf_defrag_ipv6 snd_hda_intel wmi thinkpad_acpi nvram thermal rfkill
 ipt_REJECT nf_reject_ipv4 hwmon tpm_tis ac tpm battery
 snd_hda_controller snd_hda_codec snd_hwdep evdev snd_pcm mac_hid
 xt_limit e1000e snd_timer xt_tcpudp mei_me snd mei ptp soundcore
 shpchp pps_core lpc_ich processor xt_addrtype nf_conntrack_ipv4
 nf_defrag_ipv4 xt_conntrack at ffd8
 [ 1616.064883] IP: [81091500] 

Re: [PATCH v3] ahci_xgene: Fix the dma state machine lockup for the ATA_CMD_SMART PIO mode command.

2015-02-03 Thread Suman Tripathi
   Ugh, please avoid using HTML when posting to the lists hosted on
vger.kernel.org -- it's configured to ignore such mails AFAIK.
Yeah forgot to set the plain text mode. Sorry for that

 This patch addresses the issue with ATA_CMD_SMART pio mode
 command for enumeration and device detection with ATA devices.
 The X-Gene AHCI controller has an errata in which it cannot clear
 the BSY bit after the PIO setup FIS. The dma state machine enters


 Hum, if this happens after every PIO command (PIO setup FISes are not
 specific to the command, right?), perhaps it would make more sense to record
 the *protocol* used by the last command?


 No it happens for IDENTIFY DEVICE, ATA_CMD_PACKET and ATA_CMD_SMART commands .
 It is actually the commands associated with a BSY bit clearing.


   I don't understand that -- BSY bit is cleared for *every* command,
either at the end of it, or along with setting the DRQ bit for PIO
data transfer.
BSY bit is cleared after the end of these commands by the controller.
So due to the bug it doesn't clear it. When the DMA commands is issued
, it check for the BSY bit cleared or not and finds not cleared and
results in CMFatalErrorUpdate  and hangs.

Ping ?? Any problem with this last posted version  Actually Mark from
redhat reported this issue while using smartctl and we found that
ATA_CMD_SMART also has BSY bit not clearing issue..

On Tue, Feb 3, 2015 at 1:18 AM, Suman Tripathi stripa...@apm.com wrote:
Ugh, please avoid using HTML when posting to the lists hosted on
 vger.kernel.org -- it's configured to ignore such mails AFAIK.
 Yeah forgot to set the plain text mode. Sorry for that

 This patch addresses the issue with ATA_CMD_SMART pio mode
 command for enumeration and device detection with ATA devices.
 The X-Gene AHCI controller has an errata in which it cannot clear
 the BSY bit after the PIO setup FIS. The dma state machine enters


 Hum, if this happens after every PIO command (PIO setup FISes are not
 specific to the command, right?), perhaps it would make more sense to record
 the *protocol* used by the last command?


 No it happens for IDENTIFY DEVICE, ATA_CMD_PACKET and ATA_CMD_SMART commands 
 .
 It is actually the commands associated with a BSY bit clearing.


I don't understand that -- BSY bit is cleared for *every* command,
 either at the end of it, or along with setting the DRQ bit for PIO
 data transfer.
 BSY bit is cleared after the end of these commands by the controller.
 So due to the bug it doesn't clear it. When the DMA commands is issued
 , it check for the BSY bit cleared or not and finds not cleared and
 results in CMFatalErrorUpdate  and hangs.

 CMFatalErrorUpdate state and locks up. It is the same issue as
 in the commit 2a0bdff6b958d1b2523d2754b6cd5e__0ea4053016 (ahci-xgene:
 fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode
 command).


 [...]


 Signed-off-by: Suman Tripathi stripa...@apm.com 
 mailto:stripa...@apm.com
 Reported-by:   Mark Langsdorf mlang...@redhat.com
 mailto:mlang...@redhat.com


 MBR, Sergei

 On Tue, Feb 3, 2015 at 1:14 AM, Sergei Shtylyov
 sergei.shtyl...@cogentembedded.com wrote:
 On 02/02/2015 10:37 PM, Suman Tripathi wrote:

Ugh, please avoid using HTML when posting to the lists hosted on
 vger.kernel.org -- it's configured to ignore such mails AFAIK.

 This patch addresses the issue with ATA_CMD_SMART pio mode
 command for enumeration and device detection with ATA devices.
 The X-Gene AHCI controller has an errata in which it cannot clear
 the BSY bit after the PIO setup FIS. The dma state machine enters


 Hum, if this happens after every PIO command (PIO setup FISes are not
 specific to the command, right?), perhaps it would make more sense to
 record
 the *protocol* used by the last command?


 No it happens for IDENTIFY DEVICE, ATA_CMD_PACKET and ATA_CMD_SMART
 commands .
 It is actually the commands associated with a BSY bit clearing.


I don't understand that -- BSY bit is cleared for *every* command, either
 at the end of it, or along with setting the DRQ bit for PIO data transfer.

 CMFatalErrorUpdate state and locks up. It is the same issue as
 in the commit 2a0bdff6b958d1b2523d2754b6cd5e__0ea4053016
 (ahci-xgene:
 fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode
 command).


 [...]


 Signed-off-by: Suman Tripathi stripa...@apm.com
 mailto:stripa...@apm.com
 Reported-by:   Mark Langsdorf mlang...@redhat.com
 mailto:mlang...@redhat.com


 MBR, Sergei




 --
 Thanks,
 with regards,
 Suman Tripathi



-- 
Thanks,
with regards,
Suman Tripathi
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 3/4] scsi: ufs: add trace events and dump prints for debug

2015-02-03 Thread Steven Rostedt
On Tue,  3 Feb 2015 17:37:19 +0200
Gilad Broner gbro...@codeaurora.org wrote:

 Add trace events to driver to allow monitoring and profilig
 of activities such as PM suspend/resume, hibernate enter/exit,
 clock gating and clock scaling up/down.
 In addition, add UFS host controller register dumps to provide
 detailed information in case of errors to assist in analysis
 of issues.
 
 Signed-off-by: Dolev Raviv dra...@codeaurora.org
 Signed-off-by: Subhash Jadavani subha...@codeaurora.org
 Signed-off-by: Lee Susman lsus...@codeaurora.org
 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 Signed-off-by: Yaniv Gardi yga...@codeaurora.org
 ---
  drivers/scsi/ufs/ufs-qcom.c  |  53 +
  drivers/scsi/ufs/ufshcd.c| 509 
 ---
  drivers/scsi/ufs/ufshcd.h|  49 -
  drivers/scsi/ufs/ufshci.h|   1 +
  include/linux/ftrace_event.h |   3 +
  include/trace/events/ufs.h   | 227 +++



 +static inline void ufshcd_cond_add_cmd_trace(struct ufs_hba *hba,
 + unsigned int tag, const char *str)
 +{
 + if (FTRACE_EVENT_ENABLED(ufshcd_command))

What's this? Not mentioned at all in the change log.

 + ufshcd_add_command_trace(hba, tag, str);
 +}
 +#else



 diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
 index 0bebb5c..54a4a63 100644
 --- a/include/linux/ftrace_event.h
 +++ b/include/linux/ftrace_event.h
 @@ -606,4 +606,7 @@ perf_trace_buf_submit(void *raw_data, int size, int rctx, 
 u64 addr,
  }
  #endif
  
 +#define FTRACE_EVENT_ENABLED(name)   \
 + ((event_##name).flags  (1  (TRACE_EVENT_FL_WAS_ENABLED_BIT)))\
 +
  #endif /* _LINUX_FTRACE_EVENT_H */

NACK!

Please use trace_event_enabled(), for instance,
trace_ufshcd_command_enabled().

This also uses jump_labels and is a nop when it is not enabled.

-- Steve

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] ahci_xgene: Fix the dma state machine lockup for the ATA_CMD_SMART PIO mode command.

2015-02-03 Thread Tejun Heo
On Mon, Feb 02, 2015 at 11:37:19PM +0530, Suman Tripathi wrote:
 This patch addresses the issue with ATA_CMD_SMART pio mode
 command for enumeration and device detection with ATA devices.
 The X-Gene AHCI controller has an errata in which it cannot clear
 the BSY bit after the PIO setup FIS. The dma state machine enters
 CMFatalErrorUpdate state and locks up. It is the same issue as
 in the commit 2a0bdff6b958d1b2523d2754b6cd5e0ea4053016 (ahci-xgene:

The right format is 2a0bdff6b958 (ahci-xgene: fix the dma state
machine lockup for the IDENTIFY DEVICE PIO mode command).

 fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode
 command).
 
 For example :  without this patch it results in READ DMA command failure
 as shown below :
 
  [  126.700072] ata2.00: exception Emask 0x0 SAct 0x0
   SErr 0x0 action 0x6 frozen
  [  126.707089] ata2.00: failed command: READ DMA
  [  126.711426] ata2.00: cmd c8/00:08:00:55:57/00:00:00:00:00/e1 tag 1
 dma 4096 in
  [  126.711426]  res 40/00:ff:00:00:00/00:00:00:00:00/40 Emask
   0x4 (timeout)
  [  126.725956] ata2.00: status: { DRDY }
 
 Signed-off-by: Suman Tripathi stripa...@apm.com
 Reported-by:   Mark Langsdorf mlang...@redhat.com

Applied to libata/for-3.19-fixes.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] csiostor:Use firmware version from cxgb4/t4fw_version.h

2015-02-03 Thread Praveen Madhavan
This patch is to use firmware version macros from t4fw_version.h
and also enables 40g T5 adapter.

Signed-off-by: Praveen Madhavan prave...@chelsio.com
---
 drivers/scsi/csiostor/csio_hw.c  | 6 --
 drivers/scsi/csiostor/csio_hw_chip.h | 6 +-
 drivers/scsi/csiostor/csio_mb.c  | 3 ++-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index c81b06b..2e66f34 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -1372,7 +1372,8 @@ csio_config_device_caps(struct csio_hw *hw)
}
 
/* Validate device capabilities */
-   if (csio_hw_validate_caps(hw, mbp))
+   rv = csio_hw_validate_caps(hw, mbp);
+   if (rv != 0)
goto out;
 
/* Don't config device capabilities if already configured */
@@ -1776,7 +1777,8 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 
*fw_cfg_param)
}
 
/* Validate device capabilities */
-   if (csio_hw_validate_caps(hw, mbp))
+   rv = csio_hw_validate_caps(hw, mbp);
+   if (rv != 0)
goto bye;
/*
 * Note that we're operating with parameters
diff --git a/drivers/scsi/csiostor/csio_hw_chip.h 
b/drivers/scsi/csiostor/csio_hw_chip.h
index a5f624f..b56a11d 100644
--- a/drivers/scsi/csiostor/csio_hw_chip.h
+++ b/drivers/scsi/csiostor/csio_hw_chip.h
@@ -45,11 +45,6 @@
 #define FW_FNAME_T5cxgb4/t5fw.bin
 #define FW_CFG_NAME_T5 cxgb4/t5-config.txt
 
-#define T5FW_VERSION_MAJOR 0x01
-#define T5FW_VERSION_MINOR 0x0B
-#define T5FW_VERSION_MICRO 0x1B
-#define T5FW_VERSION_BUILD 0x00
-
 #define CHELSIO_CHIP_CODE(version, revision) (((version)  4) | (revision))
 #define CHELSIO_CHIP_FPGA  0x100
 #define CHELSIO_CHIP_VERSION(code) (((code)  12)  0xf)
@@ -74,6 +69,7 @@ static inline int csio_is_t5(uint16_t chip)
{ PCI_VENDOR_ID_CHELSIO, (devid), PCI_ANY_ID, PCI_ANY_ID, 0, 0, (idx) }
 
 #include t4fw_api.h
+#include t4fw_version.h
 
 #define FW_VERSION(chip) ( \
FW_HDR_FW_VER_MAJOR_G(chip##FW_VERSION_MAJOR) | \
diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c
index 1132c41..9451787 100644
--- a/drivers/scsi/csiostor/csio_mb.c
+++ b/drivers/scsi/csiostor/csio_mb.c
@@ -327,7 +327,8 @@ csio_mb_caps_config(struct csio_hw *hw, struct csio_mb 
*mbp, uint32_t tmo,
 }
 
 #define CSIO_ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\
- FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_ANEG)
+ FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G |\
+ FW_PORT_CAP_ANEG)
 
 /*
  * csio_mb_port- FW PORT command helper
-- 
2.0.2

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] scsi: Fix max transfer length for 4k disks

2015-02-03 Thread Venkatesh Srinivas
On Thu, Jan 29, 2015 at 1:54 PM, Brian King brk...@linux.vnet.ibm.com wrote:

 The following patch fixes an issue observed with 4k sector disks
 where the max_hw_sectors attribute was getting set too large in
 sd_revalidate_disk. Since sdkp-max_xfer_blocks is in units
 of SCSI logical blocks and queue_max_hw_sectors is in units of
 512 byte blocks, on a 4k sector disk, every time we went through
 sd_revalidate_disk, we were taking the current value of
 queue_max_hw_sectors and increasing it by a factor of 8. Fix
 this by only shifting sdkp-max_xfer_blocks.

 Cc: stablesta...@vger.kernel.org
 Signed-off-by: Brian King brk...@linux.vnet.ibm.com
 ---

  drivers/scsi/sd.c |6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

 diff -puN drivers/scsi/sd.c~sd_revalidate_4k drivers/scsi/sd.c
 --- linux/drivers/scsi/sd.c~sd_revalidate_4k2015-01-29 14:44:23.316171187 
 -0600
 +++ linux-bjking1/drivers/scsi/sd.c 2015-01-29 14:51:05.846126392 -0600
 @@ -2800,9 +2800,11 @@ static int sd_revalidate_disk(struct gen
  */
 sd_set_flush_flag(sdkp);

 -   max_xfer = min_not_zero(queue_max_hw_sectors(sdkp-disk-queue),
 -   sdkp-max_xfer_blocks);
 +   max_xfer = sdkp-max_xfer_blocks;
 max_xfer = ilog2(sdp-sector_size) - 9;
 +
 +   max_xfer = min_not_zero(queue_max_hw_sectors(sdkp-disk-queue),
 +   max_xfer);
 blk_queue_max_hw_sectors(sdkp-disk-queue, max_xfer);
 set_capacity(disk, sdkp-capacity);
 sd_config_write_same(sdkp);

Heh, nice find.

Tested-by: Venkatesh Srinivas venkate...@google.com

-- vs;
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 3/4] bfa:File header and user visible string changes

2015-02-03 Thread anil.gurumurthy
From: Anil Gurumurthy anil.gurumur...@qlogic.com

Signed-off-by: Sudarsana Kalluru sudarsana.kall...@qlogic.com
Signed-off-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfa.h   |2 +-
 drivers/scsi/bfa/bfa_core.c  |2 +-
 drivers/scsi/bfa/bfa_cs.h|2 +-
 drivers/scsi/bfa/bfa_defs.h  |2 +-
 drivers/scsi/bfa/bfa_defs_fcs.h  |2 +-
 drivers/scsi/bfa/bfa_defs_svc.h  |2 +-
 drivers/scsi/bfa/bfa_fc.h|2 +-
 drivers/scsi/bfa/bfa_fcbuild.c   |2 +-
 drivers/scsi/bfa/bfa_fcbuild.h   |2 +-
 drivers/scsi/bfa/bfa_fcpim.c |2 +-
 drivers/scsi/bfa/bfa_fcpim.h |2 +-
 drivers/scsi/bfa/bfa_fcs.c   |2 +-
 drivers/scsi/bfa/bfa_fcs.h   |4 +-
 drivers/scsi/bfa/bfa_fcs_fcpim.c |2 +-
 drivers/scsi/bfa/bfa_fcs_lport.c |4 +-
 drivers/scsi/bfa/bfa_fcs_rport.c |2 +-
 drivers/scsi/bfa/bfa_hw_cb.c |2 +-
 drivers/scsi/bfa/bfa_hw_ct.c |2 +-
 drivers/scsi/bfa/bfa_ioc.c   |4 +-
 drivers/scsi/bfa/bfa_ioc.h   |2 +-
 drivers/scsi/bfa/bfa_ioc_cb.c|2 +-
 drivers/scsi/bfa/bfa_ioc_ct.c|2 +-
 drivers/scsi/bfa/bfa_modules.h   |2 +-
 drivers/scsi/bfa/bfa_plog.h  |2 +-
 drivers/scsi/bfa/bfa_port.c  |2 +-
 drivers/scsi/bfa/bfa_port.h  |2 +-
 drivers/scsi/bfa/bfa_svc.c   |2 +-
 drivers/scsi/bfa/bfa_svc.h   |2 +-
 drivers/scsi/bfa/bfad.c  |   19 --
 drivers/scsi/bfa/bfad_attr.c |   70 +++---
 drivers/scsi/bfa/bfad_bsg.c  |2 +-
 drivers/scsi/bfa/bfad_bsg.h  |2 +-
 drivers/scsi/bfa/bfad_debugfs.c  |2 +-
 drivers/scsi/bfa/bfad_drv.h  |2 +-
 drivers/scsi/bfa/bfad_im.c   |4 +-
 drivers/scsi/bfa/bfad_im.h   |2 +-
 drivers/scsi/bfa/bfi.h   |2 +-
 drivers/scsi/bfa/bfi_ms.h|2 +-
 drivers/scsi/bfa/bfi_reg.h   |4 +-
 39 files changed, 84 insertions(+), 89 deletions(-)

diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h
index 7d0337b..0e119d8 100644
--- a/drivers/scsi/bfa/bfa.h
+++ b/drivers/scsi/bfa/bfa.h
@@ -4,7 +4,7 @@
  * All rights reserved
  * www.qlogic.com
  *
- * Linux driver for Brocade Fibre Channel Host Bus Adapter.
+ * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License (GPL) Version 2 as
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index f157a37..2ea0db4 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -4,7 +4,7 @@
  * All rights reserved
  * www.qlogic.com
  *
- * Linux driver for Brocade Fibre Channel Host Bus Adapter.
+ * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License (GPL) Version 2 as
diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h
index c8bb20a..da9cf65 100644
--- a/drivers/scsi/bfa/bfa_cs.h
+++ b/drivers/scsi/bfa/bfa_cs.h
@@ -4,7 +4,7 @@
  * All rights reserved
  * www.qlogic.com
  *
- * Linux driver for Brocade Fibre Channel Host Bus Adapter.
+ * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License (GPL) Version 2 as
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h
index da4f705..5dc3782 100644
--- a/drivers/scsi/bfa/bfa_defs.h
+++ b/drivers/scsi/bfa/bfa_defs.h
@@ -4,7 +4,7 @@
  * All rights reserved
  * www.qlogic.com
  *
- * Linux driver for Brocade Fibre Channel Host Bus Adapter.
+ * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License (GPL) Version 2 as
diff --git a/drivers/scsi/bfa/bfa_defs_fcs.h b/drivers/scsi/bfa/bfa_defs_fcs.h
index 5185ae3..5815a90 100644
--- a/drivers/scsi/bfa/bfa_defs_fcs.h
+++ b/drivers/scsi/bfa/bfa_defs_fcs.h
@@ -4,7 +4,7 @@
  * All rights reserved
  * www.qlogic.com
  *
- * Linux driver for Brocade Fibre Channel Host Bus Adapter.
+ * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License (GPL) Version 2 as
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h
index fd2fa24..e81707f 100644
--- a/drivers/scsi/bfa/bfa_defs_svc.h
+++ b/drivers/scsi/bfa/bfa_defs_svc.h
@@ -4,7 +4,7 @@
  * All rights reserved
  * www.qlogic.com
  *
- * Linux driver for Brocade Fibre Channel Host Bus Adapter.
+ * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
  *
  * This program is free software; you can 

Re: [PATCH-v3 1/9] vhost/scsi: Convert completion path to use copy_to_iser

2015-02-03 Thread Michael S. Tsirkin


On Tue, Feb 03, 2015 at 06:29:55AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 Required for ANY_LAYOUT support when the incoming virtio-scsi response
 header + fixed size sense buffer payload may span more than a single
 iovec entry.
 
 This changes existing code to save cmd-tvc_resp_iov instead of the
 first single iovec base pointer from vq-iov[out].

Typo in subject: should be copy_to_iter.

 v3 changes:
   - Convert memcpy_toiovecend - copy_to_iser usage

This belongs after ---

 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
 ---
  drivers/vhost/scsi.c | 17 -
  1 file changed, 12 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index 01c01cb..1ad5b0f 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -72,6 +72,8 @@ struct tcm_vhost_cmd {
   int tvc_vq_desc;
   /* virtio-scsi initiator task attribute */
   int tvc_task_attr;
 + /* virtio-scsi response incoming iovecs */
 + int tvc_in_iovs;
   /* virtio-scsi initiator data direction */
   enum dma_data_direction tvc_data_direction;
   /* Expected data transfer length from virtio-scsi header */
 @@ -87,8 +89,8 @@ struct tcm_vhost_cmd {
   struct scatterlist *tvc_sgl;
   struct scatterlist *tvc_prot_sgl;
   struct page **tvc_upages;
 - /* Pointer to response */
 - struct virtio_scsi_cmd_resp __user *tvc_resp;
 + /* Pointer to response header iovec */
 + struct iovec *tvc_resp_iov;
   /* Pointer to vhost_scsi for our device */
   struct vhost_scsi *tvc_vhost;
   /* Pointer to vhost_virtqueue for the cmd */
 @@ -682,6 +684,7 @@ static void vhost_scsi_complete_cmd_work(struct 
 vhost_work *work)
   struct tcm_vhost_cmd *cmd;
   struct llist_node *llnode;
   struct se_cmd *se_cmd;
 + struct iov_iter iov_iter;
   int ret, vq;
  
   bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
 @@ -703,8 +706,11 @@ static void vhost_scsi_complete_cmd_work(struct 
 vhost_work *work)
se_cmd-scsi_sense_length);
   memcpy(v_rsp.sense, cmd-tvc_sense_buf,
  se_cmd-scsi_sense_length);
 - ret = copy_to_user(cmd-tvc_resp, v_rsp, sizeof(v_rsp));
 - if (likely(ret == 0)) {
 +
 + iov_iter_init(iov_iter, WRITE, cmd-tvc_resp_iov,
 +   cmd-tvc_in_iovs, sizeof(v_rsp));
 + ret = copy_to_iter(v_rsp, sizeof(v_rsp), iov_iter);
 + if (likely(ret == sizeof(v_rsp))) {
   struct vhost_scsi_virtqueue *q;
   vhost_add_used(cmd-tvc_vq, cmd-tvc_vq_desc, 0);
   q = container_of(cmd-tvc_vq, struct 
 vhost_scsi_virtqueue, vq);
 @@ -1159,7 +1165,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct 
 vhost_virtqueue *vq)
  
   cmd-tvc_vhost = vs;
   cmd-tvc_vq = vq;
 - cmd-tvc_resp = vq-iov[out].iov_base;
 + cmd-tvc_resp_iov = vq-iov[out];
 + cmd-tvc_in_iovs = in;
  
   pr_debug(vhost_scsi got command opcode: %#02x, lun: %d\n,
   cmd-tvc_cdb[0], cmd-tvc_lun);
 -- 
 1.9.1
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 0/4] bfa: Patches for scsi misc branch

2015-02-03 Thread anil.gurumurthy
Hi James, Christoph,

Re-sending the patches to move user visible strings to a separate patch.
Please apply the following patches to the scsi tree, misc branch  at your
earliest convenience.

Thanks,
Anil

Anil Gurumurthy (4):
  bfa:Updating copyright messages
  bfa:Fix for crash when bfa_itnim is NULL
  bfa:File header and user visible string changes
  bfa:Update driver version to 3.2.25.0

 drivers/scsi/bfa/bfa.h   |7 ++--
 drivers/scsi/bfa/bfa_core.c  |7 ++--
 drivers/scsi/bfa/bfa_cs.h|7 ++--
 drivers/scsi/bfa/bfa_defs.h  |7 ++--
 drivers/scsi/bfa/bfa_defs_fcs.h  |7 ++--
 drivers/scsi/bfa/bfa_defs_svc.h  |7 ++--
 drivers/scsi/bfa/bfa_fc.h|7 ++--
 drivers/scsi/bfa/bfa_fcbuild.c   |7 ++--
 drivers/scsi/bfa/bfa_fcbuild.h   |7 ++--
 drivers/scsi/bfa/bfa_fcpim.c |7 ++--
 drivers/scsi/bfa/bfa_fcpim.h |7 ++--
 drivers/scsi/bfa/bfa_fcs.c   |7 ++--
 drivers/scsi/bfa/bfa_fcs.h   |9 +++--
 drivers/scsi/bfa/bfa_fcs_fcpim.c |7 ++--
 drivers/scsi/bfa/bfa_fcs_lport.c |9 +++--
 drivers/scsi/bfa/bfa_fcs_rport.c |7 ++--
 drivers/scsi/bfa/bfa_hw_cb.c |7 ++--
 drivers/scsi/bfa/bfa_hw_ct.c |7 ++--
 drivers/scsi/bfa/bfa_ioc.c   |9 +++--
 drivers/scsi/bfa/bfa_ioc.h   |7 ++--
 drivers/scsi/bfa/bfa_ioc_cb.c|7 ++--
 drivers/scsi/bfa/bfa_ioc_ct.c|7 ++--
 drivers/scsi/bfa/bfa_modules.h   |7 ++--
 drivers/scsi/bfa/bfa_plog.h  |7 ++--
 drivers/scsi/bfa/bfa_port.c  |7 ++--
 drivers/scsi/bfa/bfa_port.h  |7 ++--
 drivers/scsi/bfa/bfa_svc.c   |7 ++--
 drivers/scsi/bfa/bfa_svc.h   |7 ++--
 drivers/scsi/bfa/bfad.c  |   24 +---
 drivers/scsi/bfa/bfad_attr.c |   75 +++---
 drivers/scsi/bfa/bfad_bsg.c  |7 ++--
 drivers/scsi/bfa/bfad_bsg.h  |7 ++--
 drivers/scsi/bfa/bfad_debugfs.c  |7 ++--
 drivers/scsi/bfa/bfad_drv.h  |9 +++--
 drivers/scsi/bfa/bfad_im.c   |   35 --
 drivers/scsi/bfa/bfad_im.h   |7 ++--
 drivers/scsi/bfa/bfi.h   |7 ++--
 drivers/scsi/bfa/bfi_ms.h|7 ++--
 drivers/scsi/bfa/bfi_reg.h   |9 +++--
 39 files changed, 228 insertions(+), 168 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 1/4] bfa:Updating copyright messages

2015-02-03 Thread anil.gurumurthy
From: Anil Gurumurthy anil.gurumur...@qlogic.com

Signed-off-by: Sudarsana Kalluru sudarsana.kall...@qlogic.com
Signed-off-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfa.h   |5 +++--
 drivers/scsi/bfa/bfa_core.c  |5 +++--
 drivers/scsi/bfa/bfa_cs.h|5 +++--
 drivers/scsi/bfa/bfa_defs.h  |5 +++--
 drivers/scsi/bfa/bfa_defs_fcs.h  |5 +++--
 drivers/scsi/bfa/bfa_defs_svc.h  |5 +++--
 drivers/scsi/bfa/bfa_fc.h|5 +++--
 drivers/scsi/bfa/bfa_fcbuild.c   |5 +++--
 drivers/scsi/bfa/bfa_fcbuild.h   |5 +++--
 drivers/scsi/bfa/bfa_fcpim.c |5 +++--
 drivers/scsi/bfa/bfa_fcpim.h |5 +++--
 drivers/scsi/bfa/bfa_fcs.c   |5 +++--
 drivers/scsi/bfa/bfa_fcs.h   |5 +++--
 drivers/scsi/bfa/bfa_fcs_fcpim.c |5 +++--
 drivers/scsi/bfa/bfa_fcs_lport.c |5 +++--
 drivers/scsi/bfa/bfa_fcs_rport.c |5 +++--
 drivers/scsi/bfa/bfa_hw_cb.c |5 +++--
 drivers/scsi/bfa/bfa_hw_ct.c |5 +++--
 drivers/scsi/bfa/bfa_ioc.c   |5 +++--
 drivers/scsi/bfa/bfa_ioc.h   |5 +++--
 drivers/scsi/bfa/bfa_ioc_cb.c|5 +++--
 drivers/scsi/bfa/bfa_ioc_ct.c|5 +++--
 drivers/scsi/bfa/bfa_modules.h   |5 +++--
 drivers/scsi/bfa/bfa_plog.h  |5 +++--
 drivers/scsi/bfa/bfa_port.c  |5 +++--
 drivers/scsi/bfa/bfa_port.h  |5 +++--
 drivers/scsi/bfa/bfa_svc.c   |5 +++--
 drivers/scsi/bfa/bfa_svc.h   |5 +++--
 drivers/scsi/bfa/bfad.c  |5 +++--
 drivers/scsi/bfa/bfad_attr.c |5 +++--
 drivers/scsi/bfa/bfad_bsg.c  |5 +++--
 drivers/scsi/bfa/bfad_bsg.h  |5 +++--
 drivers/scsi/bfa/bfad_debugfs.c  |5 +++--
 drivers/scsi/bfa/bfad_drv.h  |5 +++--
 drivers/scsi/bfa/bfad_im.c   |5 +++--
 drivers/scsi/bfa/bfad_im.h   |5 +++--
 drivers/scsi/bfa/bfi.h   |5 +++--
 drivers/scsi/bfa/bfi_ms.h|5 +++--
 drivers/scsi/bfa/bfi_reg.h   |5 +++--
 39 files changed, 117 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h
index 4ad7e36..7d0337b 100644
--- a/drivers/scsi/bfa/bfa.h
+++ b/drivers/scsi/bfa/bfa.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
+ * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
+ * Copyright (c) 2014- QLogic Corporation.
  * All rights reserved
- * www.brocade.com
+ * www.qlogic.com
  *
  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  *
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index e3f67b0..f157a37 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
+ * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
+ * Copyright (c) 2014- QLogic Corporation.
  * All rights reserved
- * www.brocade.com
+ * www.qlogic.com
  *
  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  *
diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h
index 91a8aa3..c8bb20a 100644
--- a/drivers/scsi/bfa/bfa_cs.h
+++ b/drivers/scsi/bfa/bfa_cs.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
+ * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
+ * Copyright (c) 2014- QLogic Corporation.
  * All rights reserved
- * www.brocade.com
+ * www.qlogic.com
  *
  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  *
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h
index 877b86d..da4f705 100644
--- a/drivers/scsi/bfa/bfa_defs.h
+++ b/drivers/scsi/bfa/bfa_defs.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
+ * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
+ * Copyright (c) 2014- QLogic Corporation.
  * All rights reserved
- * www.brocade.com
+ * www.qlogic.com
  *
  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  *
diff --git a/drivers/scsi/bfa/bfa_defs_fcs.h b/drivers/scsi/bfa/bfa_defs_fcs.h
index 06f0a16..5185ae3 100644
--- a/drivers/scsi/bfa/bfa_defs_fcs.h
+++ b/drivers/scsi/bfa/bfa_defs_fcs.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
+ * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
+ * Copyright (c) 2014- QLogic Corporation.
  * All rights reserved
- * www.brocade.com
+ * www.qlogic.com
  *
  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  *
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h
index 638f441..fd2fa24 100644
--- a/drivers/scsi/bfa/bfa_defs_svc.h
+++ b/drivers/scsi/bfa/bfa_defs_svc.h
@@ -1,7 +1,8 @@
 /*
- * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
+ * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
+ * Copyright (c) 2014- QLogic Corporation.
  * All rights reserved
- * www.brocade.com
+ * www.qlogic.com
  *
  * Linux driver for 

Re: [PATCH-v3 8/9] vhost/scsi: Drop left-over scsi_tcq.h include

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:30:02AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 With the recent removal of MSG_*_TAG defines in commit 68d81f40,
 vhost-scsi is now using TCM_*_TAG and doesn't depend upon host
 side scsi_tcq.h definitions anymore.
 
 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org

Acked-by: Michael S. Tsirkin m...@redhat.com

 ---
  drivers/vhost/scsi.c | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index 9af93d0..2b4b002 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -38,7 +38,6 @@
  #include linux/miscdevice.h
  #include asm/unaligned.h
  #include scsi/scsi.h
 -#include scsi/scsi_tcq.h
  #include target/target_core_base.h
  #include target/target_core_fabric.h
  #include target/target_core_fabric_configfs.h
 -- 
 1.9.1
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH-v3 9/9] vhost/scsi: Global tcm_vhost - vhost_scsi rename

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:30:03AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 There is a large amount of code that still references the original
 'tcm_vhost' naming conventions, instead of modern 'vhost_scsi'.
 
 Go ahead and do a global rename to make the usage consistent.
 
 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org

Yes, I've been wondering about that.

Acked-by: Michael S. Tsirkin m...@redhat.com

 ---
  drivers/vhost/scsi.c | 662 
 +--
  1 file changed, 331 insertions(+), 331 deletions(-)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index 2b4b002..66f682c 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -51,13 +51,13 @@
  
  #include vhost.h
  
 -#define TCM_VHOST_VERSION  v0.1
 -#define TCM_VHOST_NAMELEN 256
 -#define TCM_VHOST_MAX_CDB_SIZE 32
 -#define TCM_VHOST_DEFAULT_TAGS 256
 -#define TCM_VHOST_PREALLOC_SGLS 2048
 -#define TCM_VHOST_PREALLOC_UPAGES 2048
 -#define TCM_VHOST_PREALLOC_PROT_SGLS 512
 +#define VHOST_SCSI_VERSION  v0.1
 +#define VHOST_SCSI_NAMELEN 256
 +#define VHOST_SCSI_MAX_CDB_SIZE 32
 +#define VHOST_SCSI_DEFAULT_TAGS 256
 +#define VHOST_SCSI_PREALLOC_SGLS 2048
 +#define VHOST_SCSI_PREALLOC_UPAGES 2048
 +#define VHOST_SCSI_PREALLOC_PROT_SGLS 512
  
  struct vhost_scsi_inflight {
   /* Wait for the flush operation to finish */
 @@ -66,7 +66,7 @@ struct vhost_scsi_inflight {
   struct kref kref;
  };
  
 -struct tcm_vhost_cmd {
 +struct vhost_scsi_cmd {
   /* Descriptor from vhost_get_vq_desc() for virt_queue segment */
   int tvc_vq_desc;
   /* virtio-scsi initiator task attribute */
 @@ -82,7 +82,7 @@ struct tcm_vhost_cmd {
   /* The number of scatterlists associated with this cmd */
   u32 tvc_sgl_count;
   u32 tvc_prot_sgl_count;
 - /* Saved unpacked SCSI LUN for tcm_vhost_submission_work() */
 + /* Saved unpacked SCSI LUN for vhost_scsi_submission_work() */
   u32 tvc_lun;
   /* Pointer to the SGL formatted memory from virtio-scsi */
   struct scatterlist *tvc_sgl;
 @@ -95,13 +95,13 @@ struct tcm_vhost_cmd {
   /* Pointer to vhost_virtqueue for the cmd */
   struct vhost_virtqueue *tvc_vq;
   /* Pointer to vhost nexus memory */
 - struct tcm_vhost_nexus *tvc_nexus;
 + struct vhost_scsi_nexus *tvc_nexus;
   /* The TCM I/O descriptor that is accessed via container_of() */
   struct se_cmd tvc_se_cmd;
 - /* work item used for cmwq dispatch to tcm_vhost_submission_work() */
 + /* work item used for cmwq dispatch to vhost_scsi_submission_work() */
   struct work_struct work;
   /* Copy of the incoming SCSI command descriptor block (CDB) */
 - unsigned char tvc_cdb[TCM_VHOST_MAX_CDB_SIZE];
 + unsigned char tvc_cdb[VHOST_SCSI_MAX_CDB_SIZE];
   /* Sense buffer that will be mapped into outgoing status */
   unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER];
   /* Completed commands list, serviced from vhost worker thread */
 @@ -110,53 +110,53 @@ struct tcm_vhost_cmd {
   struct vhost_scsi_inflight *inflight;
  };
  
 -struct tcm_vhost_nexus {
 +struct vhost_scsi_nexus {
   /* Pointer to TCM session for I_T Nexus */
   struct se_session *tvn_se_sess;
  };
  
 -struct tcm_vhost_nacl {
 +struct vhost_scsi_nacl {
   /* Binary World Wide unique Port Name for Vhost Initiator port */
   u64 iport_wwpn;
   /* ASCII formatted WWPN for Sas Initiator port */
 - char iport_name[TCM_VHOST_NAMELEN];
 - /* Returned by tcm_vhost_make_nodeacl() */
 + char iport_name[VHOST_SCSI_NAMELEN];
 + /* Returned by vhost_scsi_make_nodeacl() */
   struct se_node_acl se_node_acl;
  };
  
 -struct tcm_vhost_tpg {
 +struct vhost_scsi_tpg {
   /* Vhost port target portal group tag for TCM */
   u16 tport_tpgt;
   /* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus 
 shutdown */
   int tv_tpg_port_count;
   /* Used for vhost_scsi device reference to tpg_nexus, protected by 
 tv_tpg_mutex */
   int tv_tpg_vhost_count;
 - /* list for tcm_vhost_list */
 + /* list for vhost_scsi_list */
   struct list_head tv_tpg_list;
   /* Used to protect access for tpg_nexus */
   struct mutex tv_tpg_mutex;
   /* Pointer to the TCM VHost I_T Nexus for this TPG endpoint */
 - struct tcm_vhost_nexus *tpg_nexus;
 - /* Pointer back to tcm_vhost_tport */
 - struct tcm_vhost_tport *tport;
 - /* Returned by tcm_vhost_make_tpg() */
 + struct vhost_scsi_nexus *tpg_nexus;
 + /* Pointer back to vhost_scsi_tport */
 + struct vhost_scsi_tport *tport;
 + /* Returned by vhost_scsi_make_tpg() */
   struct se_portal_group se_tpg;
   /* Pointer back to vhost_scsi, protected by tv_tpg_mutex */
   struct vhost_scsi *vhost_scsi;
  };
  
 -struct tcm_vhost_tport {
 +struct 

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 This patch adds ANY_LAYOUT support with a new vqs[].vq.handle_kick()
 callback in vhost_scsi_handle_vqal().
 
 It calculates data_direction + exp_data_len for the new tcm_vhost_cmd
 descriptor by walking both outgoing + incoming iovecs using iov_iter,
 assuming the layout of outgoing request header + T10_PI + Data payload
 comes first.
 
 It also uses copy_from_iter() to copy leading virtio-scsi request header
 that may or may not include SCSI CDB, that returns a re-calculated iovec
 to start of T10_PI or Data SGL memory.
 
 v2 changes:
   - Fix up vhost_scsi_handle_vqal comments
   - Minor vhost_scsi_handle_vqal simplifications
   - Add missing minimum virtio-scsi response buffer size check
   - Fix pi_bytes* error message typo
   - Convert to use vhost_skip_iovec_bytes() common code
   - Add max_niov sanity checks vs. out + in offset into vq
 
 v3 changes:
   - Convert to copy_from_iter usage
   - Update vhost_scsi_handle_vqal comments for iov_iter usage
   - Convert prot_bytes offset to use iov_iter_advance
   - Drop max_niov usage in vhost_scsi_handle_vqal
   - Drop vhost_skip_iovec_bytes in favour of iov_iter
 
 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
 ---
  drivers/vhost/scsi.c | 260 
 +++
  1 file changed, 260 insertions(+)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index 7dfff15..e1fe003 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -1062,6 +1062,266 @@ vhost_scsi_send_bad_target(struct vhost_scsi *vs,
  }
  
  static void
 +vhost_scsi_handle_vqal(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
 +{
 + struct tcm_vhost_tpg **vs_tpg, *tpg;
 + struct virtio_scsi_cmd_req v_req;
 + struct virtio_scsi_cmd_req_pi v_req_pi;
 + struct tcm_vhost_cmd *cmd;
 + struct iov_iter out_iter, in_iter, prot_iter, data_iter;
 + u64 tag;
 + u32 exp_data_len, data_direction;
 + unsigned out, in, i;
 + int head, ret, prot_bytes;
 + size_t req_size, rsp_size = sizeof(struct virtio_scsi_cmd_resp);
 + size_t out_size, in_size;
 + u16 lun;
 + u8 *target, *lunp, task_attr;
 + bool t10_pi = vhost_has_feature(vq, VIRTIO_SCSI_F_T10_PI);
 + void *req, *cdb;
 +
 + mutex_lock(vq-mutex);
 + /*
 +  * We can handle the vq only after the endpoint is setup by calling the
 +  * VHOST_SCSI_SET_ENDPOINT ioctl.
 +  */
 + vs_tpg = vq-private_data;
 + if (!vs_tpg)
 + goto out;
 +
 + vhost_disable_notify(vs-dev, vq);
 +
 + for (;;) {
 + head = vhost_get_vq_desc(vq, vq-iov,
 +  ARRAY_SIZE(vq-iov), out, in,
 +  NULL, NULL);
 + pr_debug(vhost_get_vq_desc: head: %d, out: %u in: %u\n,
 +  head, out, in);
 + /* On error, stop handling until the next kick. */
 + if (unlikely(head  0))
 + break;
 + /* Nothing new?  Wait for eventfd to tell us they refilled. */
 + if (head == vq-num) {
 + if (unlikely(vhost_enable_notify(vs-dev, vq))) {
 + vhost_disable_notify(vs-dev, vq);
 + continue;
 + }
 + break;
 + }
 + /*
 +  * Check for a sane response buffer so we can report early
 +  * errors back to the guest.
 +  */
 + if (unlikely(vq-iov[out].iov_len  rsp_size)) {
 + vq_err(vq, Expecting at least virtio_scsi_cmd_resp
 +  size, got %zu bytes\n, vq-iov[out].iov_len);
 + break;
 + }
 + /*
 +  * Setup pointers and values based upon different virtio-scsi
 +  * request header if T10_PI is enabled in KVM guest.
 +  */
 + if (t10_pi) {
 + req = v_req_pi;
 + req_size = sizeof(v_req_pi);
 + lunp = v_req_pi.lun[0];
 + target = v_req_pi.lun[1];
 + } else {
 + req = v_req;
 + req_size = sizeof(v_req);
 + lunp = v_req.lun[0];
 + target = v_req.lun[1];
 + }
 + /*
 +  * Determine data_direction for ANY_LAYOUT

It's not just for ANY_LAYOUT though, is it?
After patchset is fully applied this will run for
all guests?

 by calculating the
 +  * total outgoing iovec sizes / incoming iovec sizes vs.
 +  * virtio-scsi request / response headers respectively.
 +  *
 +  * FIXME: Not correct for BIDI operation
 + 

Re: [Lsf-pc] [LSF/MM TOPIC] Unifying the LIO and SCST target drivers

2015-02-03 Thread Dr. Greg Wettstein
On Jan 19,  1:21am, Christoph Hellwig wrote:
} Subject: Re: [Lsf-pc] [LSF/MM TOPIC] Unifying the LIO and SCST target driv

Hi, I hope the week is going well for everyone.

I'm a bit behind on e-mail and getting ready for travel but wanted to
reply back to this thread because of our involvement and interest in
this whole situation.

 On Thu, Jan 15, 2015 at 05:13:00PM +0100, Bart Van Assche wrote:
  My goal is to realize this proposal without adding hooks for out-of-tree
  code in the upstream kernel. What I had in mind is to raise the
  abstraction level of the API between LIO core and target drivers a
  little bit (e.g. by using accessor functions where necessary instead of
  accessing structure members directly)

 That's very much a hook, althiugh a week one.
 
 Either way I don't think bringing up a very much political topic
 without even any code to discuss isn't a very valueable use of our time
 slots.

There is code, no one is bothering to look at it or understand the
issues involved.

It takes a six line patch to the in-kernel Qlogic target driver for
SCST to leverage and contribute positively to the state of the
in-kernel driver.  A six line patch, which if we were engaging in
grounded engineering discussions, implements an interface which we
haven't found anyone who suggests is unfounded.

Our bona-fides in all this is that we developed the SCST target
interface driver which allows SCST to sit on top of the in-kernel
Qlogic target driver.  That driver is in use in a number of locations
driving hundreds and hundreds and hundreds of terrabytes of storage.

See the scst-devel and linux-scsi lists and the following:

ftp://ftp.enjellic.com/pub/scst/sqa_driver-1.1.tar.gz

Based on these experiences and building and debugging very complex
converged networks we can state pretty unequivocably that the current
target driver situation is working to no ones advantage.

The in-kernel target driver hasn't seen significant improvement or
work in over a year.  We carry a number of patches and bug fixes to
the driver which we have identified and fixed locally.  We are so
frustrated with the whole situation we don't even bother to push fixes
upstream.  So the notion that holding the in-kernel target driver as a
sacred bastion of purity will lead to a better codebase is ill
founded.

We cherry pick patches back and forther between the in-kernel and
out-of-kernel drivers and can speak pretty authoritatively to the fact
the in-kernel driver is now slipping behind the out-of-tree code.

There is a significant regression, which we believe can lead to
catastrophic data corruption under the right conditions, in the Qlogic
target driver, both in-tree and out-of-tree.  We believe the problem
is in session handling and have provided logs to Qlogic and were told,
'there is a issue and we are looking into it', but haven't heard
anything back.

The simple fact of the matter is that in modern CNA's/HBA's all of
this behavior is ultimately governed by the firmware in the cards.  No
one has access to that but the vendors.  We can make their job in
supporting the whole storage community easier if we are all looking at
and working on the same code, to the extent that is possible.

I can't speak to Infiniband but in the realm of fibre-channel/FCOE the
only problem is political not technical.

This is not an issue of a vendor electing to keep code out of tree.
The decision was made to take LIO into the kernel and there are not
going to be two in-kernel target stacks, so SCST is going to live out
of tree.  Those of us with significant engineering investments are not
going to dump SCST and move to the in tree code, good, bad or
indifferent.

We are willing and have expended the engineering time to make this
situation better.  An engineering based discussion comes down to what
types of legitimate API's the kernel needs to expose.  We do that all
over the kernel, I'm not sure why storage, other then politics, needs
to be any different.

Best wishes for a productive week.

Greg

}-- End of excerpt from Christoph Hellwig

As always,
Dr. G.W. Wettstein, Ph.D.   Enjellic Systems Development, LLC.
4206 N. 19th Ave.   Specializing in information infra-structure
Fargo, ND  58102development.
PH: 701-281-1686
FAX: 701-281-3949   EMAIL: g...@enjellic.com
--
For a successful technology, reality must take precedence over public
 relations, for nature cannot be fooled.
-- Richard Feynmann
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-03 Thread Al Viro
On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote:
 +  * Copy over the virtio-scsi request header, which when
 +  * ANY_LAYOUT is enabled may span multiple iovecs, or a
 +  * single iovec may contain both the header + outgoing
 +  * WRITE payloads.
 +  *
 +  * copy_from_iter() is modifying the iovecs as copies over
 +  * req_size bytes into req, so the returned out_iter.iov[0]
 +  * will contain the correct start + offset of the outgoing
 +  * WRITE payload, if DMA_TO_DEVICE is set.

It does no such thing.  What it does, though, is changing out_iter so
that subsequent copy_from_iter() will return the data you want.  Note
that out_iter.iov[0] will contain the correct _segment_ of that vector,
with the data you want at out_iter.iov_offset bytes from the beginning
of that segment.  .iov may come to point to subsequent segments and .iov_offset
keeps changing, but segments themselves are never changed.

 +  */
 + iov_iter_init(out_iter, READ, vq-iov[0], out,
  WRITE, please - as in this is
the source of some write, we'll be copying _from_ it.  READ would be
destination of some read, we'll be copying into it.

 +  (data_direction == DMA_TO_DEVICE) ?
 +   req_size + exp_data_len : req_size);
 +
 + ret = copy_from_iter(req, req_size, out_iter);

...

 + /*
 +  * Determine start of T10_PI or data payload iovec in ANY_LAYOUT
 +  * mode based upon data_direction.
 +  *
 +  * For DMA_TO_DEVICE, this is iov_out from copy_from_iter()
 +  * with the already recalculated iov_base + iov_len.

ITYM this is out_iter, which is already pointing to the right place

AFAICS, the actual use is correct, it's just that the comments are confused.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 2/4] bfa:Fix for crash when bfa_itnim is NULL

2015-02-03 Thread anil.gurumurthy
From: Anil Gurumurthy anil.gurumur...@qlogic.com

Signed-off-by: Sudarsana Kalluru sudarsana.kall...@qlogic.com
Signed-off-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad_im.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 575efdc..3e4dce7 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -272,6 +272,19 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct 
scsi_cmnd *cmnd,
cmnd-host_scribble = NULL;
cmnd-SCp.Status = 0;
bfa_itnim = bfa_fcs_itnim_get_halitn(itnim-fcs_itnim);
+   /*
+* bfa_itnim can be NULL if the port gets disconnected and the bfa
+* and fcs layers have cleaned up their nexus with the targets and
+* the same has not been cleaned up by the shim
+*/
+   if (bfa_itnim == NULL) {
+   bfa_tskim_free(tskim);
+   BFA_LOG(KERN_ERR, bfad, bfa_log_level,
+   target reset, bfa_itnim is NULL\n);
+   rc = BFA_STATUS_FAILED;
+   goto out;
+   }
+
memset(scsilun, 0, sizeof(scsilun));
bfa_tskim_start(tskim, bfa_itnim, scsilun,
FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO);
@@ -327,6 +340,19 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
cmnd-SCp.ptr = (char *)wq;
cmnd-SCp.Status = 0;
bfa_itnim = bfa_fcs_itnim_get_halitn(itnim-fcs_itnim);
+   /*
+* bfa_itnim can be NULL if the port gets disconnected and the bfa
+* and fcs layers have cleaned up their nexus with the targets and
+* the same has not been cleaned up by the shim
+*/
+   if (bfa_itnim == NULL) {
+   bfa_tskim_free(tskim);
+   BFA_LOG(KERN_ERR, bfad, bfa_log_level,
+   lun reset, bfa_itnim is NULL\n);
+   spin_unlock_irqrestore(bfad-bfad_lock, flags);
+   rc = FAILED;
+   goto out;
+   }
int_to_scsilun(cmnd-device-lun, scsilun);
bfa_tskim_start(tskim, bfa_itnim, scsilun,
FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND 4/4] bfa:Update driver version to 3.2.25.0

2015-02-03 Thread anil.gurumurthy
From: Anil Gurumurthy anil.gurumur...@qlogic.com

Signed-off-by: Sudarsana Kalluru sudarsana.kall...@qlogic.com
Signed-off-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad_drv.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h
index 8001459..f9e8620 100644
--- a/drivers/scsi/bfa/bfad_drv.h
+++ b/drivers/scsi/bfa/bfad_drv.h
@@ -58,7 +58,7 @@
 #ifdef BFA_DRIVER_VERSION
 #define BFAD_DRIVER_VERSIONBFA_DRIVER_VERSION
 #else
-#define BFAD_DRIVER_VERSION3.2.23.0
+#define BFAD_DRIVER_VERSION3.2.25.0
 #endif
 
 #define BFAD_PROTO_NAME FCPI_NAME
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH-v3 0/9] vhost/scsi: Add ANY_LAYOUT + VERSION_1 support

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:29:54AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 Hi MST, Paolo, Al  Co,
 
 Here is -v3 for adding vhost/scsi ANY_LAYOUT + VERSION_1 host feature
 bit support.
 
 It adds a new vhost_virtqueue -handle_kick() callback to determine the
 start of protection and data payloads iovecs past starting virtio-scsi
 request and response headers, based upon data_direction using iov_iter
 primitives.
 
 It assumes request/CDB and response/sense_buffer headers may span more
 than a single iovec using mm/iov_iter.c logic.
 
 It also allows virtio-scsi headers + T10_PI + Data SGL payloads to span
 the same iovec when pinning user-space memory via get_user_pages_fast()
 code.  (Not tested yet)
 
 Based upon Al  HCH's feedback, the patch series has been converted to
 use copy_*_iter() for virtio-scsi header copy.  Also, patch #4 has been
 updated to use iov_iter_npages() for sgl_count, and patch #5 updated to
 use iov_iter_advance() for calculating prot_bytes offset to the start
 of data_iter.
 
 v3 changelog:
   - Convert memcpy_toiovecend - copy_to_iter usage
   - Update vhost_scsi_mapal + friends to use iov_iter
   - Move iov_iter sanity checks into vhost_scsi_calc_sgls
   - Convert vhost_scsi_calc_sgls() to iov_iter_npages()
   - Convert to vhost_scsi_handle_vqal to copy_from_iter usage
   - Update vhost_scsi_handle_vqal comments for iov_iter usage
   - Convert prot_bytes offset to use iov_iter_advance
   - Drop max_niov usage in vhost_scsi_handle_vqal
   - Drop vhost_skip_iovec_bytes in favour of iov_iter
 
 Note the one part that has been left unchanged is vhost_scsi_map_to_sgl()
 into get_user_pages_fast(), for which existing iov_iter_get_pages() code
 will need to allow for a callback to perform the associated scatterlists
 setup from **pages for protection + data payloads.

I'm not sure it has to be a callback: maybe just add
struct scatterlist *sg parameter and use it if set.

 It's functioning against v3.19-rc1 virtio-scsi LLD in T10_PI mode using
 TYPE-1 DIF with ANY_LAYOUT - VERSION_1 guest feature bits enabled, using
 the layout following existing convention with protection/data SGL payloads
 residing within seperate iovecs.
 
 Also included in patch #9 is an over-due change to rename code in scsi.c
 to line up with modern vhost_scsi naming convention.
 
 Please review.
 
 Thank you,
 
 Nicholas Bellinger (9):
   vhost/scsi: Convert completion path to use copy_to_iser
   vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures
   vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len
   vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites
   vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback
   vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits
   vhost/scsi: Drop legacy pre virtio v1.0 !ANY_LAYOUT logic
   vhost/scsi: Drop left-over scsi_tcq.h include
   vhost/scsi: Global tcm_vhost - vhost_scsi rename
 
  drivers/vhost/scsi.c | 1073 
 ++
  1 file changed, 549 insertions(+), 524 deletions(-)
 
 -- 
 1.9.1
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH-v3 4/9] vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:29:58AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 This patch adds ANY_LAYOUT prerequisites logic for accepting a set of
 protection + data payloads via iov_iter.  Also includes helpers for
 calcuating SGLs + invoking vhost_scsi_map_to_sgl() with a known number
 of iovecs.
 
 Required by ANY_LAYOUT processing when struct iovec may be offset into
 the first outgoing virtio-scsi request header.
 
 v2 changes:
   - Clear -tvc_sgl_count for vhost_scsi_mapal failure
   - Make vhost_scsi_mapal + vhost_scsi_calc_sgls accept max_niov
   - Minor cleanups
 
 v3 changes:
   - Update vhost_scsi_mapal + friends to use iov_iter
   - Move iov_iter sanity checks into vhost_scsi_calc_sgls
   - Convert vhost_scsi_calc_sgls() to iov_iter_npages()

I guess if this goes through your tree, you can drop these
when applying, but it's best not to assume this, and put
changelog after ---.

 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
 ---
  drivers/vhost/scsi.c | 93 
 
  1 file changed, 93 insertions(+)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index c3b12b3..7dfff15 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -914,6 +914,99 @@ vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd,
   return 0;
  }
  
 +static int
 +vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls)
 +{
 + int sgl_count = 0;
 +
 + if (!iter || !iter-iov) {
 + pr_err(%s: iter-iov is NULL, but expected bytes: %zu
 + present\n, __func__, bytes);
 + return -EINVAL;
 + }
 +
 + sgl_count = iov_iter_npages(iter, 0x);
 + if (sgl_count  max_sgls) {
 + pr_err(%s: requested sgl_count: %d exceeds pre-allocated
 + max_sgls: %d\n, __func__, sgl_count, max_sgls);
 + return -EINVAL;
 + }
 + return sgl_count;
 +}
 +
 +static int
 +vhost_scsi_iov_to_sgl(struct tcm_vhost_cmd *cmd, bool write,
 +   struct iov_iter *iter, struct scatterlist *sg,
 +   int sg_count)
 +{
 + size_t off = iter-iov_offset;
 + int i, ret;
 +
 + for (i = 0; i  iter-nr_segs; i++) {
 + void __user *base = iter-iov[i].iov_base + off;
 + size_t len = iter-iov[i].iov_len - off;
 +
 + ret = vhost_scsi_map_to_sgl(cmd, base, len, sg, write);
 + if (ret  0) {
 + for (i = 0; i  sg_count; i++) {
 + struct page *page = sg_page(sg[i]);
 + if (page)
 + put_page(page);
 + }
 + return ret;
 + }
 + sg += ret;
 + off = 0;
 + }
 + return 0;
 +}
 +
 +static int
 +vhost_scsi_mapal(struct tcm_vhost_cmd *cmd,
 +  size_t prot_bytes, struct iov_iter *prot_iter,
 +  size_t data_bytes, struct iov_iter *data_iter)
 +{
 + int sgl_count, ret;
 + bool write = (cmd-tvc_data_direction == DMA_FROM_DEVICE);
 +
 + if (prot_bytes) {
 + sgl_count = vhost_scsi_calc_sgls(prot_iter, prot_bytes,
 +  TCM_VHOST_PREALLOC_PROT_SGLS);
 + if (sgl_count  0)
 + return sgl_count;
 +
 + sg_init_table(cmd-tvc_prot_sgl, sgl_count);
 + cmd-tvc_prot_sgl_count = sgl_count;
 + pr_debug(%s prot_sg %p prot_sgl_count %u\n, __func__,
 +  cmd-tvc_prot_sgl, cmd-tvc_prot_sgl_count);
 +
 + ret = vhost_scsi_iov_to_sgl(cmd, write, prot_iter,
 + cmd-tvc_prot_sgl,
 + cmd-tvc_prot_sgl_count);
 + if (ret  0) {
 + cmd-tvc_prot_sgl_count = 0;
 + return ret;
 + }
 + }
 + sgl_count = vhost_scsi_calc_sgls(data_iter, data_bytes,
 +  TCM_VHOST_PREALLOC_SGLS);
 + if (sgl_count  0)
 + return sgl_count;
 +
 + sg_init_table(cmd-tvc_sgl, sgl_count);
 + cmd-tvc_sgl_count = sgl_count;
 + pr_debug(%s data_sg %p data_sgl_count %u\n, __func__,
 +   cmd-tvc_sgl, cmd-tvc_sgl_count);
 +
 + ret = vhost_scsi_iov_to_sgl(cmd, write, data_iter,
 + cmd-tvc_sgl, cmd-tvc_sgl_count);
 + if (ret  0) {
 + cmd-tvc_sgl_count = 0;
 + return ret;
 + }
 + return 0;
 +}
 +
  static void tcm_vhost_submission_work(struct work_struct *work)
  {
   struct tcm_vhost_cmd *cmd =
 -- 
 1.9.1
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

Re: [PATCH-v3 7/9] vhost/scsi: Drop legacy pre virtio v1.0 !ANY_LAYOUT logic

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:30:01AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 With the new ANY_LAYOUT logic in place for vhost_scsi_handle_vqal(),
 there is no longer a reason to keep around the legacy code with
 !ANY_LAYOUT assumptions.
 
 Go ahead and drop the pre virtio 1.0 logic in vhost_scsi_handle_vq()
 and associated helpers.

Will probably be easier to review if you smash this with patch 5,
this way we see both old and new code side by side.

Also, let's rename _vqal to _vq in this patch?

 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
 ---
  drivers/vhost/scsi.c | 340 
 +--
  1 file changed, 1 insertion(+), 339 deletions(-)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index c25fdd7..9af93d0 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -830,93 +830,6 @@ out:
  }
  
  static int
 -vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *cmd,
 -   struct iovec *iov,
 -   int niov,
 -   bool write)
 -{
 - struct scatterlist *sg = cmd-tvc_sgl;
 - unsigned int sgl_count = 0;
 - int ret, i;
 -
 - for (i = 0; i  niov; i++)
 - sgl_count += iov_num_pages(iov[i].iov_base, iov[i].iov_len);
 -
 - if (sgl_count  TCM_VHOST_PREALLOC_SGLS) {
 - pr_err(vhost_scsi_map_iov_to_sgl() sgl_count: %u greater than
 -  preallocated TCM_VHOST_PREALLOC_SGLS: %u\n,
 - sgl_count, TCM_VHOST_PREALLOC_SGLS);
 - return -ENOBUFS;
 - }
 -
 - pr_debug(%s sg %p sgl_count %u\n, __func__, sg, sgl_count);
 - sg_init_table(sg, sgl_count);
 - cmd-tvc_sgl_count = sgl_count;
 -
 - pr_debug(Mapping iovec %p for %u pages\n, iov[0], sgl_count);
 -
 - for (i = 0; i  niov; i++) {
 - ret = vhost_scsi_map_to_sgl(cmd, iov[i].iov_base, 
 iov[i].iov_len,
 - sg, write);
 - if (ret  0) {
 - for (i = 0; i  cmd-tvc_sgl_count; i++) {
 - struct page *page = sg_page(cmd-tvc_sgl[i]);
 - if (page)
 - put_page(page);
 - }
 - cmd-tvc_sgl_count = 0;
 - return ret;
 - }
 - sg += ret;
 - sgl_count -= ret;
 - }
 - return 0;
 -}
 -
 -static int
 -vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd,
 -struct iovec *iov,
 -int niov,
 -bool write)
 -{
 - struct scatterlist *prot_sg = cmd-tvc_prot_sgl;
 - unsigned int prot_sgl_count = 0;
 - int ret, i;
 -
 - for (i = 0; i  niov; i++)
 - prot_sgl_count += iov_num_pages(iov[i].iov_base, 
 iov[i].iov_len);
 -
 - if (prot_sgl_count  TCM_VHOST_PREALLOC_PROT_SGLS) {
 - pr_err(vhost_scsi_map_iov_to_prot() sgl_count: %u greater than
 -  preallocated TCM_VHOST_PREALLOC_PROT_SGLS: %u\n,
 - prot_sgl_count, TCM_VHOST_PREALLOC_PROT_SGLS);
 - return -ENOBUFS;
 - }
 -
 - pr_debug(%s prot_sg %p prot_sgl_count %u\n, __func__,
 -  prot_sg, prot_sgl_count);
 - sg_init_table(prot_sg, prot_sgl_count);
 - cmd-tvc_prot_sgl_count = prot_sgl_count;
 -
 - for (i = 0; i  niov; i++) {
 - ret = vhost_scsi_map_to_sgl(cmd, iov[i].iov_base, 
 iov[i].iov_len,
 - prot_sg, write);
 - if (ret  0) {
 - for (i = 0; i  cmd-tvc_prot_sgl_count; i++) {
 - struct page *page = 
 sg_page(cmd-tvc_prot_sgl[i]);
 - if (page)
 - put_page(page);
 - }
 - cmd-tvc_prot_sgl_count = 0;
 - return ret;
 - }
 - prot_sg += ret;
 - prot_sgl_count -= ret;
 - }
 - return 0;
 -}
 -
 -static int
  vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls)
  {
   int sgl_count = 0;
 @@ -1323,254 +1236,6 @@ out:
   mutex_unlock(vq-mutex);
  }
  
 -static void
 -vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
 -{
 - struct tcm_vhost_tpg **vs_tpg;
 - struct virtio_scsi_cmd_req v_req;
 - struct virtio_scsi_cmd_req_pi v_req_pi;
 - struct tcm_vhost_tpg *tpg;
 - struct tcm_vhost_cmd *cmd;
 - u64 tag;
 - u32 exp_data_len, data_first, data_num, data_direction, prot_first;
 - unsigned out, in, i;
 - int head, ret, data_niov, prot_niov, prot_bytes;
 - size_t req_size;
 - u16 lun;
 - u8 *target, *lunp, task_attr;
 - bool hdr_pi;
 - void *req, *cdb;
 -
 - 

Re: [PATCH-v3 6/9] vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 06:30:00AM +, Nicholas A. Bellinger wrote:
 From: Nicholas Bellinger n...@linux-iscsi.org
 
 Signal support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits
 required for virtio-scsi 1.0 spec layout requirements.
 
 Cc: Michael S. Tsirkin m...@redhat.com
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org

Acked-by: Michael S. Tsirkin m...@redhat.com

I'm hoping someone'll actually test this with a BE guest before
we release this though.

 ---
  drivers/vhost/scsi.c | 9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
 index e1fe003..c25fdd7 100644
 --- a/drivers/vhost/scsi.c
 +++ b/drivers/vhost/scsi.c
 @@ -173,7 +173,9 @@ enum {
  /* Note: can't set VIRTIO_F_VERSION_1 yet, since that implies ANY_LAYOUT. */
  enum {
   VHOST_SCSI_FEATURES = VHOST_FEATURES | (1ULL  VIRTIO_SCSI_F_HOTPLUG) |
 -(1ULL  VIRTIO_SCSI_F_T10_PI)
 +(1ULL  VIRTIO_SCSI_F_T10_PI) |
 +(1ULL  VIRTIO_F_ANY_LAYOUT) |
 +(1ULL  VIRTIO_F_VERSION_1)
  };
  
  #define VHOST_SCSI_MAX_TARGET256
 @@ -1626,7 +1628,10 @@ static void vhost_scsi_handle_kick(struct vhost_work 
 *work)
   poll.work);
   struct vhost_scsi *vs = container_of(vq-dev, struct vhost_scsi, dev);
  
 - vhost_scsi_handle_vq(vs, vq);
 + if (vhost_has_feature(vq, VIRTIO_F_ANY_LAYOUT))
 + vhost_scsi_handle_vqal(vs, vq);
 + else
 + vhost_scsi_handle_vq(vs, vq);
  }
  
  static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index)
 -- 
 1.9.1
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html