[PATCH 3/4] isci: make function declaration match implementation

2012-07-11 Thread Dan Williams
From: Dan Carpenter 

Sparse complains that we redeclare this with a different type, because
in the .c file we use an enum and in the .h file we declare the
parameter as a u32.  Probably it's best to use an enum in both places.

Signed-off-by: Dan Carpenter 
Signed-off-by: Dan Williams 
---
 drivers/scsi/isci/remote_node_context.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/remote_node_context.h 
b/drivers/scsi/isci/remote_node_context.h
index a703b9c..c7ee81d 100644
--- a/drivers/scsi/isci/remote_node_context.h
+++ b/drivers/scsi/isci/remote_node_context.h
@@ -212,7 +212,7 @@ enum sci_status sci_remote_node_context_destruct(struct 
sci_remote_node_context
  
scics_sds_remote_node_context_callback callback,
  void *callback_parameter);
 enum sci_status sci_remote_node_context_suspend(struct sci_remote_node_context 
*sci_rnc,
-u32 suspend_type,
+enum 
sci_remote_node_suspension_reasons reason,
 u32 suspension_code);
 enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context 
*sci_rnc,

scics_sds_remote_node_context_callback cb_fn,

--
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 4/4] isci: add a couple __iomem annotations

2012-07-11 Thread Dan Williams
From: Dan Carpenter 

These are __iomem.  Sparse complains if we don't have that.

drivers/scsi/isci/phy.c +149 70: warning:
incorrect type in initializer (different address spaces)

Signed-off-by: Dan Carpenter 
Signed-off-by: Dan Williams 
---
 drivers/scsi/isci/host.c |2 +-
 drivers/scsi/isci/phy.c  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 45385f5..b425ed5 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1973,7 +1973,7 @@ static void sci_controller_afe_initialization(struct 
isci_host *ihost)
}
 
for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) {
-   struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_id];
+   struct scu_afe_transceiver __iomem *xcvr = 
&afe->scu_afe_xcvr[phy_id];
const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id];
int cable_length_long =
is_long_cable(phy_id, cable_selection_mask);
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index ebb8f53..cb87b2e 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -169,7 +169,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
phy_cap.gen1_no_ssc = 1;
if (ihost->oem_parameters.controller.do_enable_ssc) {
struct scu_afe_registers __iomem *afe = 
&ihost->scu_registers->afe;
-   struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_idx];
+   struct scu_afe_transceiver __iomem *xcvr = 
&afe->scu_afe_xcvr[phy_idx];
struct isci_pci_info *pci_info = to_pci_info(ihost->pdev);
bool en_sas = false;
bool en_sata = false;

--
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 2/4] isci: fix COMSAS negation timout workaround for WD SAS drives

2012-07-11 Thread Dan Williams
From: Dave Maurer 

The following patch is a fix for the WD workaround
COMSAS negation timeout change. This patch disables the
OOB SM when the OOB is placed in reset, which allows
the updated COMSAS negation timeout value to take
effect.

Cc: Dan Thompson 
Reported-by: Dan Thompson 
Signed-off-by: Dave Maurer 
Signed-off-by: Dan Williams 
---
 drivers/scsi/isci/phy.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 18f43d4..ebb8f53 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -1205,6 +1205,7 @@ static void scu_link_layer_start_oob(struct isci_phy 
*iphy)
/** Reset OOB sequence - start */
val = readl(&ll->phy_configuration);
val &= ~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) |
+SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE) |
 SCU_SAS_PCFG_GEN_BIT(HARD_RESET));
writel(val, &ll->phy_configuration);
readl(&ll->phy_configuration); /* flush */
@@ -1236,6 +1237,7 @@ static void scu_link_layer_tx_hard_reset(
 * to the starting state. */
phy_configuration_value =
readl(&iphy->link_layer_registers->phy_configuration);
+   phy_configuration_value &= ~(SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE));
phy_configuration_value |=
(SCU_SAS_PCFG_GEN_BIT(HARD_RESET) |
 SCU_SAS_PCFG_GEN_BIT(OOB_RESET));

--
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/4] isci: fix isci_pci_probe() generates warning on efi failure path

2012-07-11 Thread Dan Williams
The oem parameter image embedded in the efi variable is at an offset
from the start of the variable.  However, in the failure path we try to
free the 'orom' pointer which is only valid when the paramaters are
being read from the legacy option-rom space.

Since failure to load the oem parameters is unlikely and we keep the
memory around in the success case just defer all de-allocation to devm.

Cc: 
Reported-by: Don Morris 
Signed-off-by: Dan Williams 
---
 drivers/scsi/isci/init.c   |1 -
 drivers/scsi/isci/probe_roms.c |1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 47e28b5..8870bd3 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -641,7 +641,6 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, 
const struct pci_devic
orom->hdr.version)) {
dev_warn(&pdev->dev,
 "[%d]: invalid oem parameters detected, 
falling back to firmware\n", i);
-   devm_kfree(&pdev->dev, orom);
orom = NULL;
break;
}
diff --git a/drivers/scsi/isci/probe_roms.c b/drivers/scsi/isci/probe_roms.c
index 4d95654..8ac646e 100644
--- a/drivers/scsi/isci/probe_roms.c
+++ b/drivers/scsi/isci/probe_roms.c
@@ -104,7 +104,6 @@ struct isci_orom *isci_request_oprom(struct pci_dev *pdev)
 
if (i >= len) {
dev_err(&pdev->dev, "oprom parse error\n");
-   devm_kfree(&pdev->dev, rom);
rom = NULL;
}
pci_unmap_biosrom(oprom);

--
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


[GIT PATCH 0/4] isci update for 3.6

2012-07-11 Thread Dan Williams
James,

This is the backlog of the libsas indepedent driver changes for 3.6.  Just a
small collection of fixlets.  Please pull, thanks.

--
Dan


The following changes since commit f8f5701bdaf9134b1f90e5044a82c66324d2073f:

  Linux 3.5-rc1 (2012-06-02 18:29:26 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git tags/isci-for-3.6

for you to fetch changes up to 6734092e66011def7875bd67beef889d0fee1cc9:

  isci: add a couple __iomem annotations (2012-07-03 12:09:32 -0700)



isci update for 3.6

1/ Fix the workaround for drives that have a slow response to COMSAS.
   Drives with this problem intermittently take a long time to be
   identified, or fail to be identified altogether.

2/ A minor fix for the efi variable code failure path

3/ A handful of smatch fixups from Dan Carpenter


Dan Carpenter (2):
  isci: make function declaration match implementation
  isci: add a couple __iomem annotations

Dan Williams (1):
  isci: fix isci_pci_probe() generates warning on efi failure path

Dave Maurer (1):
  isci: fix COMSAS negation timout workaround for WD SAS drives

 drivers/scsi/isci/host.c| 2 +-
 drivers/scsi/isci/init.c| 1 -
 drivers/scsi/isci/phy.c | 4 +++-
 drivers/scsi/isci/probe_roms.c  | 1 -
 drivers/scsi/isci/remote_node_context.h | 2 +-
 5 files changed, 5 insertions(+), 5 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


Re: [PATCH 1/1] [SCSI] tcm_qla2xxx: Remove duplicate header file inclusion

2012-07-11 Thread Nicholas A. Bellinger
On Wed, 2012-07-11 at 16:23 +0530, Sachin Kamat wrote:
> Any comments about this patch?
> 

Hi Sachin,

Applied to target-pending.git/for-next, + queued up for-3.6.

Thanks!

--nab

> On 22/06/2012, Sachin Kamat  wrote:
> > ctype.h and string.h header files were included more than once.
> >
> > Signed-off-by: Sachin Kamat 
> > ---
> >  drivers/scsi/qla2xxx/tcm_qla2xxx.c |2 --
> >  1 files changed, 0 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> > b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> > index 6e64314..dd0a0df 100644
> > --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> > +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> > @@ -38,8 +38,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > --
> > 1.7.4.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] virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

2012-07-11 Thread Nicholas A. Bellinger
On Wed, 2012-07-11 at 19:37 +0100, James Bottomley wrote:
> On Fri, 2012-07-06 at 20:15 +, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger 
> > 
> > This patch changes virtio-scsi to use a new virtio_driver->scan() callback
> > so that scsi_scan_host() can be properly invoked once virtio_dev_probe() has
> > set add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK) to signal active virtio-ring
> > operation, instead of from within virtscsi_probe().
> > 
> > This fixes a bug where SCSI LUN scanning for both virtio-scsi-raw and
> > virtio-scsi/tcm_vhost setups was happening before VIRTIO_CONFIG_S_DRIVER_OK
> > had been set, causing VIRTIO_SCSI_S_BAD_TARGET to occur.  This fixes a bug
> > with virtio-scsi/tcm_vhost where LUN scan was not detecting LUNs.
> > 
> > Tested with virtio-scsi-raw + virtio-scsi/tcm_vhost w/ IBLOCK on 3.5-rc2 
> > code.
> > 
> > Reviewed-by: Paolo Bonzini 
> > Cc: Stefan Hajnoczi 
> > Cc: Zhi Yong Wu 
> > Cc: Christoph Hellwig 
> > Cc: Hannes Reinecke 
> > Cc: 
> > Signed-off-by: Nicholas Bellinger 
> > ---
> >  drivers/scsi/virtio_scsi.c |   15 ---
> >  drivers/virtio/virtio.c|5 -
> >  include/linux/virtio.h |1 +
> >  3 files changed, 17 insertions(+), 4 deletions(-)
> 
> This doesn't apply:
> 
> patching file drivers/scsi/virtio_scsi.c
> Hunk #1 succeeded at 677 (offset 196 lines).
> Hunk #2 FAILED at 494.
> Hunk #3 succeeded at 736 (offset 198 lines).
> 1 out of 3 hunks FAILED -- saving rejects to file
> drivers/scsi/virtio_scsi.c.rej
> 
> could you respin against scsi-misc head?
> 

The updated patch is on it's way rebased against scsi.git/misc.

Thanks James!

--
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-v2] virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

2012-07-11 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

This patch changes virtio-scsi to use a new virtio_driver->scan() callback
so that scsi_scan_host() can be properly invoked once virtio_dev_probe() has
set add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK) to signal active virtio-ring
operation, instead of from within virtscsi_probe().

This fixes a bug where SCSI LUN scanning for both virtio-scsi-raw and
virtio-scsi/tcm_vhost setups was happening before VIRTIO_CONFIG_S_DRIVER_OK
had been set, causing VIRTIO_SCSI_S_BAD_TARGET to occur.  This fixes a bug
with virtio-scsi/tcm_vhost where LUN scan was not detecting LUNs.

Tested with virtio-scsi-raw + virtio-scsi/tcm_vhost w/ IBLOCK on 3.5-rc2 code.

(nab: Fix up minor apply fuzz against scsi.git/misc)

Cc: Paolo Bonzini 
Cc: Stefan Hajnoczi 
Cc: Zhi Yong Wu 
Cc: Christoph Hellwig 
Cc: Hannes Reinecke 
Cc: James Bottomley 
Signed-off-by: Nicholas Bellinger 
---
 drivers/scsi/virtio_scsi.c |   15 ---
 drivers/virtio/virtio.c|5 -
 include/linux/virtio.h |1 +
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index ae3bef7..c7030fb 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -571,6 +571,13 @@ static struct virtio_scsi_target_state *virtscsi_alloc_tgt(
return tgt;
 }
 
+static void virtscsi_scan(struct virtio_device *vdev)
+{
+   struct Scsi_Host *shost = (struct Scsi_Host *)vdev->priv;
+
+   scsi_scan_host(shost);
+}
+
 static void virtscsi_remove_vqs(struct virtio_device *vdev)
 {
struct Scsi_Host *sh = virtio_scsi_host(vdev);
@@ -677,9 +684,10 @@ static int __devinit virtscsi_probe(struct virtio_device 
*vdev)
err = scsi_add_host(shost, &vdev->dev);
if (err)
goto scsi_add_host_failed;
-
-   scsi_scan_host(shost);
-
+   /*
+* scsi_scan_host() happens in virtscsi_scan() via virtio_driver->scan()
+* after VIRTIO_CONFIG_S_DRIVER_OK has been set..
+*/
return 0;
 
 scsi_add_host_failed:
@@ -735,6 +743,7 @@ static struct virtio_driver virtio_scsi_driver = {
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtscsi_probe,
+   .scan = virtscsi_scan,
 #ifdef CONFIG_PM
.freeze = virtscsi_freeze,
.restore = virtscsi_restore,
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index f355807..c3b3f7f 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -141,8 +141,11 @@ static int virtio_dev_probe(struct device *_d)
err = drv->probe(dev);
if (err)
add_status(dev, VIRTIO_CONFIG_S_FAILED);
-   else
+   else {
add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
+   if (drv->scan)
+   drv->scan(dev);
+   }
 
return err;
 }
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 8efd28a..a1ba8bb 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -92,6 +92,7 @@ struct virtio_driver {
const unsigned int *feature_table;
unsigned int feature_table_size;
int (*probe)(struct virtio_device *dev);
+   void (*scan)(struct virtio_device *dev);
void (*remove)(struct virtio_device *dev);
void (*config_changed)(struct virtio_device *dev);
 #ifdef CONFIG_PM
-- 
1.7.2.5

--
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


[RFC-v2 4/4] tcm_vhost: Initial merge for vhost level target fabric driver

2012-07-11 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

This patch adds the initial code for tcm_vhost, a Vhost level TCM
fabric driver for virtio SCSI initiators into KVM guest.

This code is currently up and running on v3.5-rc2 host+guest along
with the virtio-scsi vdev->scan() patch to allow a proper
scsi_scan_host() to occur once the tcm_vhost nexus has been established
by the paravirtualized virtio-scsi client here:

virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning
http://marc.info/?l=linux-scsi&m=134160609212542&w=2

Using tcm_vhost requires Zhi's -> Stefan's qemu vhost-scsi tree here:

https://github.com/wuzhy/qemu/tree/vhost-scsi

along with the recent QEMU patch to hw/virtio-scsi.c to set max_target=0
during vhost-scsi operation.

Changelog v1 -> v2:

  Fix tv_cmd completion -> release SGL memory leak
  Fix sparse warnings for static variable usage
  Fix sparse warnings for min() typing + printk format specs
  Convert to cmwq submission for I/O dispatch

Changelog v0 -> v1:

  Merge into single source + header file, and move to drivers/vhost/

Cc: Stefan Hajnoczi 
Cc: Zhi Yong Wu 
Cc: Michael S. Tsirkin 
Cc: Paolo Bonzini 
Cc: Christoph Hellwig 
Cc: Hannes Reinecke 
Cc: Jens Axboe 
Signed-off-by: Nicholas Bellinger 
---
 drivers/vhost/Kconfig |6 +
 drivers/vhost/Makefile|1 +
 drivers/vhost/tcm_vhost.c | 1609 +
 drivers/vhost/tcm_vhost.h |   74 ++
 4 files changed, 1690 insertions(+), 0 deletions(-)
 create mode 100644 drivers/vhost/tcm_vhost.c
 create mode 100644 drivers/vhost/tcm_vhost.h

diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index e4e2fd1..ccbeb6f 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -9,3 +9,9 @@ config VHOST_NET
  To compile this driver as a module, choose M here: the module will
  be called vhost_net.
 
+config TCM_VHOST
+   tristate "TCM_VHOST fabric module (EXPERIMENTAL)"
+   depends on TARGET_CORE && EVENTFD && EXPERIMENTAL && m
+   default n
+   ---help---
+   Say M here to enable the TCM_VHOST fabric module for use with 
virtio-scsi guests
diff --git a/drivers/vhost/Makefile b/drivers/vhost/Makefile
index 72dd020..b10c7b1 100644
--- a/drivers/vhost/Makefile
+++ b/drivers/vhost/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_VHOST_NET) += vhost_net.o
+obj-$(CONFIG_TCM_VHOST) += tcm_vhost.o
 vhost_net-y := vhost.o net.o
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
new file mode 100644
index 000..da0b8ac
--- /dev/null
+++ b/drivers/vhost/tcm_vhost.c
@@ -0,0 +1,1609 @@
+/***
+ * Vhost kernel TCM fabric driver for virtio SCSI initiators
+ *
+ * (C) Copyright 2010-2012 RisingTide Systems LLC.
+ * (C) Copyright 2010-2012 IBM Corp.
+ *
+ * Licensed to the Linux Foundation under the General Public License (GPL) 
version 2.
+ *
+ * Authors: Nicholas A. Bellinger 
+ *  Stefan Hajnoczi 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ /
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include  /* TODO vhost.h currently depends on this */
+#include 
+
+#include "vhost.c"
+#include "vhost.h"
+#include "tcm_vhost.h"
+
+struct vhost_scsi {
+   atomic_t vhost_ref_cnt;
+   struct tcm_vhost_tpg *vs_tpg;
+   struct vhost_dev dev;
+   struct vhost_virtqueue vqs[3];
+
+   struct vhost_work vs_completion_work; /* cmd completion work item */
+   struct list_head vs_completion_list;  /* cmd completion queue */
+   spinlock_t vs_completion_lock;/* protects s_completion_list */
+};
+
+/* Local pointer to allocated TCM configfs fabric module */
+static struct target_fabric_configfs *tcm_vhost_fabric_configfs;
+
+static struct workqueue_struct *tcm_vhost_workqueue;
+
+/* Global spinlock to protect tcm_vhost TPG list for vhost IOCTL access */
+static DEFINE_MUTEX(tcm_vhost_mutex);
+static LIST_HEAD(tcm_vhost_list);
+
+static int tcm_vhost_check_true(struct se_portal_group *se_tpg)
+{
+   return 1;
+}
+
+static int tcm_vhost_check_false(struct se_portal_group *se_tpg)
+{
+   return 0;
+}
+
+static char *tcm_vhost_get_fabric_name(void)
+{
+   return "vhost";
+}
+
+static

[RFC-v2 3/4] vhost: Add vhost_scsi specific defines

2012-07-11 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

This patch adds the initial vhost_scsi_ioctl() callers for 
VHOST_SCSI_SET_ENDPOINT
and VHOST_SCSI_CLEAR_ENDPOINT respectively, and also adds struct 
vhost_vring_target
that is used by tcm_vhost code when locating target ports during qemu setup.

Signed-off-by: Stefan Hajnoczi 
Cc: Zhi Yong Wu 
Cc: Michael S. Tsirkin 
Cc: Paolo Bonzini ,
Signed-off-by: Nicholas A. Bellinger 
---
 include/linux/vhost.h |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/vhost.h b/include/linux/vhost.h
index e847f1e..33b313b 100644
--- a/include/linux/vhost.h
+++ b/include/linux/vhost.h
@@ -24,7 +24,11 @@ struct vhost_vring_state {
 struct vhost_vring_file {
unsigned int index;
int fd; /* Pass -1 to unbind from file. */
+};
 
+struct vhost_vring_target {
+   unsigned char vhost_wwpn[224];
+   unsigned short vhost_tpgt;
 };
 
 struct vhost_vring_addr {
@@ -121,6 +125,11 @@ struct vhost_memory {
  * device.  This can be used to stop the ring (e.g. for migration). */
 #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
 
+/* VHOST_SCSI specific defines */
+
+#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct 
vhost_vring_target)
+#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct 
vhost_vring_target)
+
 /* Feature bits */
 /* Log all write descriptors. Can be changed while device is active. */
 #define VHOST_F_LOG_ALL 26
-- 
1.7.2.5

--
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


[RFC-v2 2/4] vhost: make vhost work queue visible

2012-07-11 Thread Nicholas A. Bellinger
From: Stefan Hajnoczi 

The vhost work queue allows processing to be done in vhost worker thread
context, which uses the owner process mm.  Access to the vring and guest
memory is typically only possible from vhost worker context so it is
useful to allow work to be queued directly by users.

Currently vhost_net only uses the poll wrappers which do not expose the
work queue functions.  However, for tcm_vhost (vhost_scsi) it will be
necessary to queue custom work.

Signed-off-by: Stefan Hajnoczi 
Cc: Zhi Yong Wu 
Cc: Michael S. Tsirkin 
Cc: Paolo Bonzini 
Signed-off-by: Nicholas Bellinger 
---
 drivers/vhost/vhost.c |5 ++---
 drivers/vhost/vhost.h |3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 94dbd25..1aab08b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -64,7 +64,7 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned 
mode, int sync,
return 0;
 }
 
-static void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
+void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
 {
INIT_LIST_HEAD(&work->node);
work->fn = fn;
@@ -137,8 +137,7 @@ void vhost_poll_flush(struct vhost_poll *poll)
vhost_work_flush(poll->dev, &poll->work);
 }
 
-static inline void vhost_work_queue(struct vhost_dev *dev,
-   struct vhost_work *work)
+void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 {
unsigned long flags;
 
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 07b9763..1125af3 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -43,6 +43,9 @@ struct vhost_poll {
struct vhost_dev *dev;
 };
 
+void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
+void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
+
 void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
 unsigned long mask, struct vhost_dev *dev);
 void vhost_poll_start(struct vhost_poll *poll, struct file *file);
-- 
1.7.2.5

--
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


[RFC-v2 1/4] vhost: Separate vhost-net features from vhost features

2012-07-11 Thread Nicholas A. Bellinger
From: Stefan Hajnoczi 

In order for other vhost devices to use the VHOST_FEATURES bits the
vhost-net specific bits need to be moved to their own VHOST_NET_FEATURES
constant.

(Asias: Update drivers/vhost/test.c to use VHOST_NET_FEATURES)

Signed-off-by: Stefan Hajnoczi 
Cc: Zhi Yong Wu 
Cc: Michael S. Tsirkin 
Cc: Paolo Bonzini 
Cc: Asias He 
Signed-off-by: Nicholas A. Bellinger 
---
 drivers/vhost/net.c   |4 ++--
 drivers/vhost/test.c  |4 ++--
 drivers/vhost/vhost.h |3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index f82a739..072cbba 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -823,14 +823,14 @@ static long vhost_net_ioctl(struct file *f, unsigned int 
ioctl,
return -EFAULT;
return vhost_net_set_backend(n, backend.index, backend.fd);
case VHOST_GET_FEATURES:
-   features = VHOST_FEATURES;
+   features = VHOST_NET_FEATURES;
if (copy_to_user(featurep, &features, sizeof features))
return -EFAULT;
return 0;
case VHOST_SET_FEATURES:
if (copy_from_user(&features, featurep, sizeof features))
return -EFAULT;
-   if (features & ~VHOST_FEATURES)
+   if (features & ~VHOST_NET_FEATURES)
return -EOPNOTSUPP;
return vhost_net_set_features(n, features);
case VHOST_RESET_OWNER:
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index 3de00d9..91d6f06 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -261,14 +261,14 @@ static long vhost_test_ioctl(struct file *f, unsigned int 
ioctl,
return -EFAULT;
return vhost_test_run(n, test);
case VHOST_GET_FEATURES:
-   features = VHOST_FEATURES;
+   features = VHOST_NET_FEATURES;
if (copy_to_user(featurep, &features, sizeof features))
return -EFAULT;
return 0;
case VHOST_SET_FEATURES:
if (copy_from_user(&features, featurep, sizeof features))
return -EFAULT;
-   if (features & ~VHOST_FEATURES)
+   if (features & ~VHOST_NET_FEATURES)
return -EOPNOTSUPP;
return vhost_test_set_features(n, features);
case VHOST_RESET_OWNER:
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 8de1fd5..07b9763 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -201,7 +201,8 @@ enum {
VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |
 (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
 (1ULL << VIRTIO_RING_F_EVENT_IDX) |
-(1ULL << VHOST_F_LOG_ALL) |
+(1ULL << VHOST_F_LOG_ALL),
+   VHOST_NET_FEATURES = VHOST_FEATURES |
 (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
 (1ULL << VIRTIO_NET_F_MRG_RXBUF),
 };
-- 
1.7.2.5

--
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


[RFC-v2 0/4] tcm_vhost+cmwq fabric driver code for-3.6

2012-07-11 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

Hi folks,

The following is a RFC-v2 series of tcm_vhost target fabric driver code
currently in-flight for-3.6 mainline code.

After last week's developments along with the help of some new folks, the
changelog v1 -> v2 so far looks like:

*) Fix drivers/vhost/test.c to use VHOST_NET_FEATURES in patch #1 (Asias He)
*) Fix tv_cmd completion -> release SGL memory leak (nab)
*) Fix sparse warnings for static variable usage (Fengguang Wu)
*) Fix sparse warnings for min() typing + printk format specs (Fengguang Wu)
*) Convert to cmwq submission for I/O dispatch (nab + hch)

Also following Paolo's request, a patch for hw/virtio-scsi.c that sets
scsi_host->max_target=0 that removes the need for virtio-scsi LLD to hardcode
VirtIOSCSIConfig->max_id=1 in order to function with tcm_vhost.

Note this series has been pushed into target-pending.git/for-next-merge, and
should be getting picked up for tomorrow's linux-next build.

Please let us know if you have any concerns and/or additional review feedback.

Thank you!

Nicholas Bellinger (2):
  vhost: Add vhost_scsi specific defines
  tcm_vhost: Initial merge for vhost level target fabric driver

Stefan Hajnoczi (2):
  vhost: Separate vhost-net features from vhost features
  vhost: make vhost work queue visible

 drivers/vhost/Kconfig |6 +
 drivers/vhost/Makefile|1 +
 drivers/vhost/net.c   |4 +-
 drivers/vhost/tcm_vhost.c | 1609 +
 drivers/vhost/tcm_vhost.h |   74 ++
 drivers/vhost/test.c  |4 +-
 drivers/vhost/vhost.c |5 +-
 drivers/vhost/vhost.h |6 +-
 include/linux/vhost.h |9 +
 9 files changed, 1710 insertions(+), 8 deletions(-)
 create mode 100644 drivers/vhost/tcm_vhost.c
 create mode 100644 drivers/vhost/tcm_vhost.h

-- 
1.7.2.5

--
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] bfa: squelch lockdep complaint with a spin_lock_init

2012-07-11 Thread Krishna Gudipati
-Original Message-
From: Kyle McMartin [mailto:kmcma...@redhat.com] 
Sent: Wednesday, July 11, 2012 9:43 AM
To: linux-scsi@vger.kernel.org
Cc: hua...@brocade.com; Krishna Gudipati
Subject: [PATCH] bfa: squelch lockdep complaint with a spin_lock_init

Spotted this while looking at another issue...

INFO: trying to register non-static key. 
the code is fine but needs lockdep annotation. 
turning off the locking correctness validator. 
Pid: 298, comm: udevd Not tainted 3.3.0 #1 
Call Trace: 
  [] __lock_acquire+0x1363/0x1bb0 
  [] ? __slab_alloc+0x4a0/0x4fd 
  [] ? native_sched_clock+0x13/0x80 
  [] ? sched_clock+0x9/0x10 
  [] lock_acquire+0xa1/0x1e0 
  [] ? bfa_fcs_lport_aen_post+0x43/0x160 [bfa] 
  [] _raw_spin_lock_irqsave+0x65/0xb0 
  [] ? bfa_fcs_lport_aen_post+0x43/0x160 [bfa] 
  [] bfa_fcs_lport_aen_post+0x43/0x160 [bfa] 
  [] bfa_fcs_lport_init+0x97/0x120 [bfa] 
  [] bfa_fcs_fabric_sm_uninit+0x1cf/0x250 [bfa] 
  [] bfa_fcs_fabric_modinit+0x2a/0xb0 [bfa] 
  [] ? bfa_fcs_fabric_attach+0xf2/0x170 [bfa] 
  [] bfa_fcs_init+0x2a/0x40 [bfa] 
  [] bfad_drv_init+0x107/0x1f0 [bfa] 
  [] bfad_pci_probe+0x277/0x450 [bfa] 
  [] local_pci_probe+0x5c/0xd0 
  [] pci_device_probe+0x111/0x120 
  [] driver_probe_device+0x96/0x2f0 
  [] __driver_attach+0xab/0xb0 
  [] ? driver_probe_device+0x2f0/0x2f0 
  [] bus_for_each_dev+0x55/0x90 
  [] ? 0xa037afff 
  [] driver_attach+0x1e/0x20 
  [] bus_add_driver+0x1b8/0x2b0 
  [] ? 0xa037afff 
  [] driver_register+0x77/0x160 
  [] ? 0xa037afff 
  [] __pci_register_driver+0x73/0xf0 
  [] ? 0xa037afff 
  [] bfad_init+0x83/0x1000 [bfa] 
  [] do_one_initcall+0x12a/0x180 
  [] sys_init_module+0xc0/0x220 
  [] system_call_fastpath+0x16/0x1b 

Signed-off-by: Kyle McMartin 

--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1383,6 +1383,8 @@ bfad_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *pid)
bfa_sm_set_state(bfad, bfad_sm_uninit);
 
spin_lock_init(&bfad->bfad_lock);
+   spin_lock_init(&bfad->bfad_aen_spinlock);
+
pci_set_drvdata(pdev, bfad);
 
bfad->ref_count = 0;

- 

Looks good, thanks for the patch Kyle.

Acked-by: Krishna Gudipati 
--
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 3/5] st: get rid of scsi_tapes array

2012-07-11 Thread Lee Duncan
Kai:

Your added patch looks great, and I see you fixed the documentation as
well. Thanks for your help.


On 07/02/2012 05:16 PM, Lee Duncan wrote:
> 
> On 07/01/2012 01:57 AM, Kai Makisara wrote:
>> On Mon, 21 May 2012, Lee Duncan wrote:
>>
>>> From: Jeff Mahoney 
>>>
>>> st currently allocates an array to store pointers to all of the
>>> scsi_tape objects. It's used to discover available indexes to use as the
>>> base for the minor number selection and later to look up scsi_tape
>>> devices for character devices.
>>>
>>> We switch to using an IDR for minor selection and a pointer from
>>> st_modedef back to scsi_tape for the lookups.
>>>
>>> Signed-off-by: Jeff Mahoney 
>>> Signed-off-by: Lee Duncan 
>>> ---
>>>  drivers/scsi/st.c |  172 
>>> -
>>>  drivers/scsi/st.h |2 +
>>>  2 files changed, 65 insertions(+), 109 deletions(-)
>>>
>> ... patch removed
>>
>> I have finally had time to review and test this patch set. I am sorry this 
>> has taken so long.
>>
>> I have found one change of behaviour and a theoretical problem:
>> The new code does not re-use the tape numbers when freed and re-scanned. 
>> The current code does re-use the freed numbers. Are there any reasons for 
>> this changed behaviour? (The theoretical problem is that the new code 
>> frees the tape structure but leaves the pointer in the idr tree.)
>>
>> The patch at the end of this message (applies after the whole series) is 
>> an attempt to implement re-use of tape numbers. I am not completely sure 
>> that the change is correctly placed but it seems to work.
> 
> 
> Thanks for the review, and good catch. I'll look over your added patch
> and give feedback as soon as I can.
> 
>>
>> Another minor thing is that the documentation should be updated :-)
> 
> Of course.
> 
>>
>> The patch at the end also updates the version code. I am not sure if the 
>> version code is useful, but it should be either updated or removed.
>>
>> Otherwise no problems found. I am ready to ack the patch set after the 
>> re-use thing has been resolved (one way or another).
>>
>> Thanks,
>> Kai
>>

- Lee

--
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] virtio-scsi: Add vdrv->scan for post VIRTIO_CONFIG_S_DRIVER_OK LUN scanning

2012-07-11 Thread James Bottomley
On Fri, 2012-07-06 at 20:15 +, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger 
> 
> This patch changes virtio-scsi to use a new virtio_driver->scan() callback
> so that scsi_scan_host() can be properly invoked once virtio_dev_probe() has
> set add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK) to signal active virtio-ring
> operation, instead of from within virtscsi_probe().
> 
> This fixes a bug where SCSI LUN scanning for both virtio-scsi-raw and
> virtio-scsi/tcm_vhost setups was happening before VIRTIO_CONFIG_S_DRIVER_OK
> had been set, causing VIRTIO_SCSI_S_BAD_TARGET to occur.  This fixes a bug
> with virtio-scsi/tcm_vhost where LUN scan was not detecting LUNs.
> 
> Tested with virtio-scsi-raw + virtio-scsi/tcm_vhost w/ IBLOCK on 3.5-rc2 code.
> 
> Reviewed-by: Paolo Bonzini 
> Cc: Stefan Hajnoczi 
> Cc: Zhi Yong Wu 
> Cc: Christoph Hellwig 
> Cc: Hannes Reinecke 
> Cc: 
> Signed-off-by: Nicholas Bellinger 
> ---
>  drivers/scsi/virtio_scsi.c |   15 ---
>  drivers/virtio/virtio.c|5 -
>  include/linux/virtio.h |1 +
>  3 files changed, 17 insertions(+), 4 deletions(-)

This doesn't apply:

patching file drivers/scsi/virtio_scsi.c
Hunk #1 succeeded at 677 (offset 196 lines).
Hunk #2 FAILED at 494.
Hunk #3 succeeded at 736 (offset 198 lines).
1 out of 3 hunks FAILED -- saving rejects to file
drivers/scsi/virtio_scsi.c.rej

could you respin against scsi-misc head?

Thanks,

James


--
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] bfa: squelch lockdep complaint with a spin_lock_init

2012-07-11 Thread Kyle McMartin
Spotted this while looking at another issue...

INFO: trying to register non-static key. 
the code is fine but needs lockdep annotation. 
turning off the locking correctness validator. 
Pid: 298, comm: udevd Not tainted 3.3.0 #1 
Call Trace: 
  [] __lock_acquire+0x1363/0x1bb0 
  [] ? __slab_alloc+0x4a0/0x4fd 
  [] ? native_sched_clock+0x13/0x80 
  [] ? sched_clock+0x9/0x10 
  [] lock_acquire+0xa1/0x1e0 
  [] ? bfa_fcs_lport_aen_post+0x43/0x160 [bfa] 
  [] _raw_spin_lock_irqsave+0x65/0xb0 
  [] ? bfa_fcs_lport_aen_post+0x43/0x160 [bfa] 
  [] bfa_fcs_lport_aen_post+0x43/0x160 [bfa] 
  [] bfa_fcs_lport_init+0x97/0x120 [bfa] 
  [] bfa_fcs_fabric_sm_uninit+0x1cf/0x250 [bfa] 
  [] bfa_fcs_fabric_modinit+0x2a/0xb0 [bfa] 
  [] ? bfa_fcs_fabric_attach+0xf2/0x170 [bfa] 
  [] bfa_fcs_init+0x2a/0x40 [bfa] 
  [] bfad_drv_init+0x107/0x1f0 [bfa] 
  [] bfad_pci_probe+0x277/0x450 [bfa] 
  [] local_pci_probe+0x5c/0xd0 
  [] pci_device_probe+0x111/0x120 
  [] driver_probe_device+0x96/0x2f0 
  [] __driver_attach+0xab/0xb0 
  [] ? driver_probe_device+0x2f0/0x2f0 
  [] bus_for_each_dev+0x55/0x90 
  [] ? 0xa037afff 
  [] driver_attach+0x1e/0x20 
  [] bus_add_driver+0x1b8/0x2b0 
  [] ? 0xa037afff 
  [] driver_register+0x77/0x160 
  [] ? 0xa037afff 
  [] __pci_register_driver+0x73/0xf0 
  [] ? 0xa037afff 
  [] bfad_init+0x83/0x1000 [bfa] 
  [] do_one_initcall+0x12a/0x180 
  [] sys_init_module+0xc0/0x220 
  [] system_call_fastpath+0x16/0x1b 

Signed-off-by: Kyle McMartin 

--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1383,6 +1383,8 @@ bfad_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *pid)
bfa_sm_set_state(bfad, bfad_sm_uninit);
 
spin_lock_init(&bfad->bfad_lock);
+   spin_lock_init(&bfad->bfad_aen_spinlock);
+
pci_set_drvdata(pdev, bfad);
 
bfad->ref_count = 0;
--
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 v4] virtio-scsi: hotplug support for virtio-scsi

2012-07-11 Thread James Bottomley
On Thu, 2012-07-05 at 11:19 +0200, Paolo Bonzini wrote:
> Il 05/07/2012 11:06, Cong Meng ha scritto:
> > This patch implements the hotplug support for virtio-scsi.
> > When there is a device attached/detached, the virtio-scsi driver will be
> > signaled via event virtual queue and it will add/remove the scsi device 
> > in question automatically.
> > 
> > v2: handle no_event event
> > v3: add handle event dropped, and typo fix
> > v4: Cancel event works when exit. Coding type fix.
> > 
> > Signed-off-by: Sen Wang 
> > Signed-off-by: Cong Meng 
> 
> Reviewed-by: Paolo Bonzini 

Actually, that should be Acked-by, since you're the maintainer of the
driver (it means I reviewed it + I approve it for upstream inclusion).

> > ---
> >  drivers/scsi/virtio_scsi.c  |  127 
> > ++-
> >  include/linux/virtio_scsi.h |9 +++
> >  2 files changed, 135 insertions(+), 1 deletions(-)

The next time, please run checkpatch on this.  You can ignore the
warnings about lines over 80 characters, but the braces issue is worth
paying attention to when that reflects the current style.

James


--
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 RESEND 3/3] usb: storage: update usb devices for write cache quirk in quirk list.

2012-07-11 Thread Amit Sahrawat
Hi James,
Please have a look at the patchset and share your opinion.
If there is anything more to it - please let us know.

Thanks & Regards,
Amit Sahrawat


On Sun, Jul 8, 2012 at 8:35 AM, Namjae Jeon  wrote:
> From: Namjae Jeon 
>
> Update information of Seagate Portable HDD and WD My Passport HDD in
> quirk list.
>
> Signed-off-by: Namjae Jeon 
> Signed-off-by: Pankaj Kumar 
> Signed-off-by: Amit Sahrawat 
> Acked-by: Alan Stern 
> ---
>  drivers/usb/storage/unusual_devs.h |   12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/usb/storage/unusual_devs.h 
> b/drivers/usb/storage/unusual_devs.h
> index 1719886..62a31be 100644
> --- a/drivers/usb/storage/unusual_devs.h
> +++ b/drivers/usb/storage/unusual_devs.h
> @@ -1267,6 +1267,12 @@ UNUSUAL_DEV( 0x0af0, 0xd357, 0x, 0x,
> USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> 0 ),
>
> +/* Reported by Namjae Jeon  */
> +UNUSUAL_DEV(0x0bc2, 0x2300, 0x, 0x,
> +   "Seagate",
> +   "Portable HDD",
> +   USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_WRITE_CACHE),
> +
>  /* Reported by Ben Efros  */
>  UNUSUAL_DEV( 0x0bc2, 0x3010, 0x, 0x,
> "Seagate",
> @@ -1468,6 +1474,12 @@ UNUSUAL_DEV(  0x1058, 0x0704, 0x, 0x,
> USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> US_FL_SANE_SENSE),
>
> +/* Reported by Namjae Jeon  */
> +UNUSUAL_DEV(0x1058, 0x070a, 0x, 0x,
> +   "Western Digital",
> +   "My Passport HDD",
> +   USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_WRITE_CACHE),
> +
>  /* Reported by Fabio Venturi 
>   * The device reports a vendor-specific bDeviceClass.
>   */
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
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: [dm-devel] [RESEND PATCH 3/3] dm mpath: add ability to disable partition creation

2012-07-11 Thread Alasdair G Kergon
On Tue, Jun 26, 2012 at 02:32:05PM -0400, Mike Snitzer wrote:
> The new 'no_partitions' feature serves as a notifier to kpartx to _not_
> create partitions on these multipath devices.
 
This isn't really multipath-specific so doesn't belong in the target.
It could go into dm core, but we already have flags attached to
udev cookies that can turn udev rules on and off and thereby could
allow userspace multipath to control whether or not kpartx creates
partitions on any particular device.

But first I'd like us to explore creating a config file for kpartx and
controlling the behaviour from there.  Activation could then be
triggered by target type, device name, scsi WWID, dm UUID etc. according
to rules in that file.

I think this approach of handling each layer independently gives us the
best chance of ending up with integrated management of arbitrary device
stacks.

Alasdair

--
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


[Bug 15721] mptsas cannot dectect hotplugged harddisks occasionally

2012-07-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=15721


Alan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||a...@lxorguk.ukuu.org.uk
 Resolution||INSUFFICIENT_DATA




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
--
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] aacraid: Series 7 Async. (performance) mode support

2012-07-11 Thread Mahesh Rajashekhara
- Series 7 Async. (performance) mode support added
- New scatter/gather list format for Series 7
- Driver converts s/g list to a firmware suitable list for best performance on 
Series 7, this can be disabled
  with driver parameter "aac_convert_sgl" for testing purposes
- New container read/write command structure for Series 7
- Fast response support for the SCSI pass-through path added
- Async. status response buffer changes

Signed-off-by: Mahesh Rajashekhara 
---
 drivers/scsi/aacraid/aachba.c   |  237 +--
 drivers/scsi/aacraid/aacraid.h  |   74 ++---
 drivers/scsi/aacraid/commctrl.c |2 +
 drivers/scsi/aacraid/comminit.c |   54 +
 drivers/scsi/aacraid/commsup.c  |   22 ++--
 drivers/scsi/aacraid/dpcsup.c   |6 +-
 drivers/scsi/aacraid/linit.c|2 +-
 drivers/scsi/aacraid/src.c  |   64 ++-
 8 files changed, 347 insertions(+), 114 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 5255166..d79457a 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -135,6 +135,8 @@ struct inquiry_data {
 static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* 
sgmap);
 static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* 
psg);
 static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct 
sgmapraw* psg);
+static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct 
aac_raw_io2 *rio2, int sg_max);
+static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, 
int nseg_new);
 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
 #ifdef AAC_DETAILED_STATUS_INFO
 static char *aac_get_status_string(u32 status);
@@ -152,10 +154,14 @@ int aac_commit = -1;
 int startup_timeout = 180;
 int aif_timeout = 120;
 int aac_sync_mode;  /* Only Sync. transfer - disabled */
+int aac_convert_sgl = 1;   /* convert non-conformable s/g list - enabled */
 
 module_param(aac_sync_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(aac_sync_mode, "Force sync. transfer mode"
" 0=off, 1=on");
+module_param(aac_convert_sgl, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(aac_convert_sgl, "Convert non-conformable s/g list"
+   " 0=off, 1=on");
 module_param(nondasd, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices."
" 0=off, 1=on");
@@ -963,25 +969,44 @@ static void io_callback(void *context, struct fib * 
fibptr);
 
 static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, 
u32 count)
 {
-   u16 fibsize;
-   struct aac_raw_io *readcmd;
+   struct aac_dev *dev = fib->dev;
+   u16 fibsize, command;
+
aac_fib_init(fib);
-   readcmd = (struct aac_raw_io *) fib_data(fib);
-   readcmd->block[0] = cpu_to_le32((u32)(lba&0x));
-   readcmd->block[1] = cpu_to_le32((u32)((lba&0xLL)>>32));
-   readcmd->count = cpu_to_le32(count<<9);
-   readcmd->cid = cpu_to_le16(scmd_id(cmd));
-   readcmd->flags = cpu_to_le16(IO_TYPE_READ);
-   readcmd->bpTotal = 0;
-   readcmd->bpComplete = 0;
+   if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 && !dev->sync_mode) {
+   struct aac_raw_io2 *readcmd2;
+   readcmd2 = (struct aac_raw_io2 *) fib_data(fib);
+   memset(readcmd2, 0, sizeof(struct aac_raw_io2));
+   readcmd2->blockLow = cpu_to_le32((u32)(lba&0x));
+   readcmd2->blockHigh = 
cpu_to_le32((u32)((lba&0xLL)>>32));
+   readcmd2->byteCount = cpu_to_le32(count<<9);
+   readcmd2->cid = cpu_to_le16(scmd_id(cmd));
+   readcmd2->flags = cpu_to_le16(RIO2_IO_TYPE_READ);
+   aac_build_sgraw2(cmd, readcmd2, 
dev->scsi_host_ptr->sg_tablesize);
+   command = ContainerRawIo2;
+   fibsize = sizeof(struct aac_raw_io2) +
+   ((le32_to_cpu(readcmd2->sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
+   } else {
+   struct aac_raw_io *readcmd;
+   readcmd = (struct aac_raw_io *) fib_data(fib);
+   readcmd->block[0] = cpu_to_le32((u32)(lba&0x));
+   readcmd->block[1] = 
cpu_to_le32((u32)((lba&0xLL)>>32));
+   readcmd->count = cpu_to_le32(count<<9);
+   readcmd->cid = cpu_to_le16(scmd_id(cmd));
+   readcmd->flags = cpu_to_le16(RIO_TYPE_READ);
+   readcmd->bpTotal = 0;
+   readcmd->bpComplete = 0;
+   aac_build_sgraw(cmd, &readcmd->sg);
+   command = ContainerRawIo;
+   fibsize = sizeof(struct aac_raw_io) +
+   ((le32_to_cpu(readcmd->sg.count)-1) * sizeof(struct 
sgentryraw));
+   }
 
-   aac_build_sgraw(cmd, &readcmd->sg);
-   fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) 
- 1) * sizeof (struct sgentryraw));

Re: 'Device not ready' issue on mpt2sas since 3.1.10

2012-07-11 Thread Matthias Prager
I just tested kernel version 3.4.4 without commit
85ef06d1d252f6a2e73b678591ab71caad4667bb and it also works fine (beware
of commit 62d3c5439c534b0e6c653fc63e6d8c67be3a57b1 as it conflicts with
reverting 85ef06d1d252f6a2e73b678591ab71caad4667bb).

I'm trying to understand why this commit leads to the issue of i/o
failing on spun down drives, in hopes of being able to fix it. Meanwhile
maybe Tejun Heo (author of the commit) or Jens Axboe (the committer) are
able to shed some light on this (I've included them in the CC list).

Matthias
--
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: [RESEND PATCH 2/3] dm mpath: add 'default_hw_handler' feature

2012-07-11 Thread Mike Snitzer
On Wed, Jul 11 2012 at  6:27am -0400,
Alasdair G Kergon  wrote:

> On Wed, Jun 27, 2012 at 08:16:55AM +0200, Hannes Reinecke wrote:
> > On 06/26/2012 08:32 PM, Mike Snitzer wrote:
> > > When specifying the feature 'default_hw_handler' multipath will use
> > > the currently attached hardware handler instead of trying to attach the
> > > one specified during table load.  If no hardware handler is attached the
> > > specified hardware handler will be used.
> > > 
> > > Leverages scsi_dh_attach's ability to increment the scsi_dh's reference
> > > count if the same scsi_dh name is provided when attaching -- currently
> > > attached scsi_dh name is determined with scsi_dh_attached_handler_name.
> > > 
> > > Signed-off-by: Mike Snitzer 
> > > Tested-by: Babu Moger 
> > > Reviewed-by: Chandra Seetharaman 
> > Looks good.
>  
> Maybe, but I'd like to see an inline explanation of what this confusing new
> setting means and a better patch header that provides some motivation for this
> change.
> 
> To my eyes, the word "default" is over-used here.  If I *don't* specify the 
> new
> "default" flag, surely I'll get default behaviour, won't I, by definition?  
> And
> if I do specify it, I'm asking for default behaviour too, so isn't it
> redundant?

"default" is in reference to the hardware handler that will get attached
by the scsi_dh .match().  It has nothing to do with the userspace
multipath-tool's desired handler.
--
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 RESUBMIT 1/3] qla4xxx: remove unnecessary read of PCI_CAP_ID_EXP

2012-07-11 Thread Vikas Chaudhary


-Original Message-
From: Jon Mason 
To: James Bottomley 
Cc: scsi , Ravi Anand ,
Vikas , Dept-Eng iSCSI Driver

Subject: [PATCH RESUBMIT 1/3] qla4xxx: remove unnecessary read of
PCI_CAP_ID_EXP

>The PCIE capability offset is saved during PCI bus walking.  It will
>remove an unnecessary search in the PCI configuration space if this
>value is referenced instead of reacquiring it.
>
>Signed-off-by: Jon Mason 
>Cc: Ravi Anand 
>Cc: Vikas Chaudhary 
>Cc: iscsi-dri...@qlogic.com
>---
> drivers/scsi/qla4xxx/ql4_nx.c |2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
>index 228b670..939d726 100644
>--- a/drivers/scsi/qla4xxx/ql4_nx.c
>+++ b/drivers/scsi/qla4xxx/ql4_nx.c
>@@ -1590,7 +1590,7 @@ qla4_8xxx_start_firmware(struct scsi_qla_host *ha,
>uint32_t image_start)
>   }
>
>   /* Negotiated Link width */
>-  pcie_cap = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP);
>+  pcie_cap = pci_pcie_cap(ha->pdev);
>   pci_read_config_word(ha->pdev, pcie_cap + PCI_EXP_LNKSTA, &lnk);
>   ha->link_width = (lnk >> 4) & 0x3f;

Acked-by: Vikas Chaudhary 



This message and any attached documents contain information from QLogic 
Corporation or its wholly-owned subsidiaries that may be confidential. If you 
are not the intended recipient, you may not read, copy, distribute, or use this 
information. If you have received this transmission in error, please notify the 
sender immediately by reply e-mail and then delete this message.

--
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 RESUBMIT 2/3] qla2xxx: remove unnecessary reads of PCI_CAP_ID_EXP

2012-07-11 Thread Chad Dupuis


On Tue, 10 Jul 2012, Jon Mason wrote:


The PCIE capability offset is saved during PCI bus walking.  It will
remove an unnecessary search in the PCI configuration space if this
value is referenced instead of reacquiring it.  Also, pci_is_pcie is a
better way of determining if the device is PCIE or not (as it uses the
same saved PCIE capability offset).

Signed-off-by: Jon Mason 
Cc: Andrew Vasquez 
Cc: linux-dri...@qlogic.com
---
drivers/scsi/qla2xxx/qla_init.c |4 ++--
drivers/scsi/qla2xxx/qla_nx.c   |4 ++--
drivers/scsi/qla2xxx/qla_os.c   |4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index ca50847..a44653b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -685,7 +685,7 @@ qla24xx_pci_config(scsi_qla_host_t *vha)
  pcix_set_mmrbc(ha->pdev, 2048);

  /* PCIe -- adjust Maximum Read Request Size (2048). */
- if (pci_find_capability(ha->pdev, PCI_CAP_ID_EXP))
+ if (pci_is_pcie(ha->pdev))
  pcie_set_readrq(ha->pdev, 2048);

  pci_disable_rom(ha->pdev);
@@ -721,7 +721,7 @@ qla25xx_pci_config(scsi_qla_host_t *vha)
  pci_write_config_word(ha->pdev, PCI_COMMAND, w);

  /* PCIe -- adjust Maximum Read Request Size (2048). */
- if (pci_find_capability(ha->pdev, PCI_CAP_ID_EXP))
+ if (pci_is_pcie(ha->pdev))
  pcie_set_readrq(ha->pdev, 2048);

  pci_disable_rom(ha->pdev);
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index caf627b..9ce3a8f 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -1620,7 +1620,7 @@ qla82xx_pci_info_str(struct scsi_qla_host *vha, char *str)
  char lwstr[6];
  uint16_t lnk;

- pcie_reg = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP);
+ pcie_reg = pci_pcie_cap(ha->pdev);
  pci_read_config_word(ha->pdev, pcie_reg + PCI_EXP_LNKSTA, &lnk);
  ha->link_width = (lnk >> 4) & 0x3f;

@@ -2528,7 +2528,7 @@ qla82xx_start_firmware(scsi_qla_host_t *vha)
  }

  /* Negotiated Link width */
- pcie_cap = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP);
+ pcie_cap = pci_pcie_cap(ha->pdev);
  pci_read_config_word(ha->pdev, pcie_cap + PCI_EXP_LNKSTA, &lnk);
  ha->link_width = (lnk >> 4) & 0x3f;

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 6d1d873..fb8cd38 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -482,12 +482,12 @@ qla24xx_pci_info_str(struct scsi_qla_host *vha, char *str)
  uint32_t pci_bus;
  int pcie_reg;

- pcie_reg = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP);
+ pcie_reg = pci_pcie_cap(ha->pdev);
  if (pcie_reg) {
  char lwstr[6];
  uint16_t pcie_lstat, lspeed, lwidth;

- pcie_reg += 0x12;
+ pcie_reg += PCI_EXP_LNKCAP;
  pci_read_config_word(ha->pdev, pcie_reg, &pcie_lstat);
  lspeed = pcie_lstat & (BIT_0 | BIT_1 | BIT_2 | BIT_3);
  lwidth = (pcie_lstat &



Looks good, thanks.

Acked-by: Chad Dupuis 

This message and any attached documents contain information from QLogic 
Corporation or its wholly-owned subsidiaries that may be confidential. If you 
are not the intended recipient, you may not read, copy, distribute, or use this 
information. If you have received this transmission in error, please notify the 
sender immediately by reply e-mail and then delete this message.

--
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: 'Device not ready' issue on mpt2sas since 3.1.10

2012-07-11 Thread Matthias Prager
Am 11.07.2012 01:27, schrieb Robert Trace:
> On 07/09/2012 09:51 PM, Robert Trace wrote:
>>
>> Huh..  I just retested this and I'm seeing really random behavior.
> 
> Ok, with a refined test I've been able to reliably reproduce this and I
> bisected it back to commit 85ef06d1d252f6a2e73b678591ab71caad4667bb in
> Linus' tree (introduced between 3.0 and 3.1):
> 
> commit 85ef06d1d252f6a2e73b678591ab71caad4667bb
> Author: Tejun Heo 
> Date:   Fri Jul 1 16:17:47 2011 +0200
> 
> block: flush MEDIA_CHANGE from drivers on close(2)
> 
> Prior to the above commit, sleeping disks will spin up as a result of
> I/O sent to them.  With the above commit, they don't spin up and
> immediately return an I/O failure.
This is good news thank you. I can confirm your findings - omitting
commit 85ef06d1d252f6a2e73b678591ab71caad4667bb solves my initial issue
here (with 3.1.10).

> 
> That's all the further I've gotten so far.  I'll be happy to test any
> patches or suggestions.
> 
> -- Rob
> 


--
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] libfcoe: fix section mismatches

2012-07-11 Thread Heiko Carstens
Fix this warning:

WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x7c):
 Section mismatch in reference from the function init_module()
 to the function .exit.text:fcoe_transport_exit()

libfcoe_init() calls fcoe_transport_exit() which is annotated with
__exit which puts it into the exit section.
If the driver would be compiled into the kernel the exit section
could be discarded at compile time, so all calls to functions which
reside in the exit section would be jumps to random data.

Not really an issue currently since the exit section is currently
only discarded at runtime together with the init section. So this
patch only removes the compile time warning.

Signed-off-by: Heiko Carstens 
---
 drivers/scsi/fcoe/fcoe_sysfs.c |2 +-
 drivers/scsi/fcoe/fcoe_transport.c |4 ++--
 include/scsi/fcoe_sysfs.h  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 2bc1631..7d6c119 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -826,7 +826,7 @@ int __init fcoe_sysfs_setup(void)
return 0;
 }
 
-void __exit fcoe_sysfs_teardown(void)
+void fcoe_sysfs_teardown(void)
 {
bus_unregister(&fcoe_bus_type);
 }
diff --git a/drivers/scsi/fcoe/fcoe_transport.c 
b/drivers/scsi/fcoe/fcoe_transport.c
index b46f43d..ea87f6b 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -502,7 +502,7 @@ static int __init fcoe_transport_init(void)
return 0;
 }
 
-static int __exit fcoe_transport_exit(void)
+static int fcoe_transport_exit(void)
 {
struct fcoe_transport *ft;
 
@@ -832,7 +832,7 @@ module_init(libfcoe_init);
 /**
  * libfcoe_exit() - Tear down libfcoe.ko
  */
-static void __exit libfcoe_exit(void)
+static void libfcoe_exit(void)
 {
fcoe_sysfs_teardown();
fcoe_transport_exit();
diff --git a/include/scsi/fcoe_sysfs.h b/include/scsi/fcoe_sysfs.h
index 604cb9b..8e7a41a 100644
--- a/include/scsi/fcoe_sysfs.h
+++ b/include/scsi/fcoe_sysfs.h
@@ -119,6 +119,6 @@ struct fcoe_fcf_device *fcoe_fcf_device_add(struct 
fcoe_ctlr_device *,
 void fcoe_fcf_device_delete(struct fcoe_fcf_device *);
 
 int __init fcoe_sysfs_setup(void);
-void __exit fcoe_sysfs_teardown(void);
+void fcoe_sysfs_teardown(void);
 
 #endif /* FCOE_SYSFS */
-- 
1.7.10.5

--
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] tcm_qla2xxx: Remove duplicate header file inclusion

2012-07-11 Thread Sachin Kamat
Any comments about this patch?

On 22/06/2012, Sachin Kamat  wrote:
> ctype.h and string.h header files were included more than once.
>
> Signed-off-by: Sachin Kamat 
> ---
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c |2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index 6e64314..dd0a0df 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -38,8 +38,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
>  #include 
>  #include 
>  #include 
> --
> 1.7.4.1
>
>


-- 
With warm regards,
Sachin
--
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: [dm-devel] [RESEND PATCH 2/3] dm mpath: add 'default_hw_handler' feature

2012-07-11 Thread Alasdair G Kergon
On Wed, Jun 27, 2012 at 08:16:55AM +0200, Hannes Reinecke wrote:
> On 06/26/2012 08:32 PM, Mike Snitzer wrote:
> > When specifying the feature 'default_hw_handler' multipath will use
> > the currently attached hardware handler instead of trying to attach the
> > one specified during table load.  If no hardware handler is attached the
> > specified hardware handler will be used.
> > 
> > Leverages scsi_dh_attach's ability to increment the scsi_dh's reference
> > count if the same scsi_dh name is provided when attaching -- currently
> > attached scsi_dh name is determined with scsi_dh_attached_handler_name.
> > 
> > Signed-off-by: Mike Snitzer 
> > Tested-by: Babu Moger 
> > Reviewed-by: Chandra Seetharaman 
> Looks good.
 
Maybe, but I'd like to see an inline explanation of what this confusing new
setting means and a better patch header that provides some motivation for this
change.

To my eyes, the word "default" is over-used here.  If I *don't* specify the new
"default" flag, surely I'll get default behaviour, won't I, by definition?  And
if I do specify it, I'm asking for default behaviour too, so isn't it
redundant?

Alasdair

--
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


[GIT PULL] SCSI fixes for 3.5-rc6

2012-07-11 Thread James Bottomley
This is a set of three fixes for data corruption (libsas task file),
oops causing (NULL in scsi_cmd_to_driver) and driver failure (bnx2i).
The oops caused by the NULL in scsi_cmd_to_driver() manifests in
scsi_eh_send_cmd() and has been seen by several people now.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

Dan Williams (1):
  libsas: fix taskfile corruption in sas_ata_qc_fill_rtf

Eddie Wai (1):
  bnx2i: Removed the reference to the netdev->base_addr

Mark Rustad (1):
  Fix NULL dereferences in scsi_cmd_to_driver

And the diffstat:

 drivers/scsi/aic94xx/aic94xx_task.c |2 +-
 drivers/scsi/bnx2i/bnx2i.h  |1 +
 drivers/scsi/bnx2i/bnx2i_hwi.c  |3 +--
 drivers/scsi/bnx2i/bnx2i_iscsi.c|   10 +-
 drivers/scsi/libsas/sas_ata.c   |   12 ++--
 include/scsi/libsas.h   |6 --
 include/scsi/scsi_cmnd.h|8 +++-
 7 files changed, 25 insertions(+), 17 deletions(-)

With the full diff below.

James

---
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c 
b/drivers/scsi/aic94xx/aic94xx_task.c
index 532d212..393e7ce 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -201,7 +201,7 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb,
 
if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) {
resp->frame_len = le16_to_cpu(*(__le16 *)(r+6));
-   memcpy(&resp->ending_fis[0], r+16, 24);
+   memcpy(&resp->ending_fis[0], r+16, ATA_RESP_FIS_SIZE);
ts->buf_valid_size = sizeof(*resp);
}
}
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 0c53c28..7e77cf6 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -350,6 +350,7 @@ struct bnx2i_hba {
struct pci_dev *pcidev;
struct net_device *netdev;
void __iomem *regview;
+   resource_size_t reg_base;
 
u32 age;
unsigned long cnic_dev_type;
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index ece47e5..86a12b4 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -2724,7 +2724,6 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
goto arm_cq;
}
 
-   reg_base = ep->hba->netdev->base_addr;
if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) &&
(ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) {
config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2);
@@ -2740,7 +2739,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
/* 5709 device in normal node and 5706/5708 devices */
reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num);
 
-   ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off,
+   ep->qp.ctx_base = ioremap_nocache(ep->hba->reg_base + reg_off,
  MB_KERNEL_CTX_SIZE);
if (!ep->qp.ctx_base)
return -ENOMEM;
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index f8d516b..621538b 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -811,13 +811,13 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
bnx2i_identify_device(hba);
bnx2i_setup_host_queue_size(hba, shost);
 
+   hba->reg_base = pci_resource_start(hba->pcidev, 0);
if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) {
-   hba->regview = ioremap_nocache(hba->netdev->base_addr,
-  BNX2_MQ_CONFIG2);
+   hba->regview = pci_iomap(hba->pcidev, 0, BNX2_MQ_CONFIG2);
if (!hba->regview)
goto ioreg_map_err;
} else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) {
-   hba->regview = ioremap_nocache(hba->netdev->base_addr, 4096);
+   hba->regview = pci_iomap(hba->pcidev, 0, 4096);
if (!hba->regview)
goto ioreg_map_err;
}
@@ -884,7 +884,7 @@ cid_que_err:
bnx2i_free_mp_bdt(hba);
 mp_bdt_mem_err:
if (hba->regview) {
-   iounmap(hba->regview);
+   pci_iounmap(hba->pcidev, hba->regview);
hba->regview = NULL;
}
 ioreg_map_err:
@@ -910,7 +910,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
pci_dev_put(hba->pcidev);
 
if (hba->regview) {
-   iounmap(hba->regview);
+   pci_iounmap(hba->pcidev, hba->regview);
hba->regview = NULL;
}
bnx2i_free_mp_bdt(hba);
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 441d88a..d109cc3 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -139,12 +139,12 @@ static void s