[PATCH 4/4 v4] scsi:stex.c Add S3/S4 support

2014-12-15 Thread Charles Chiou


From f9d84df080c16097218092630db9b5df31d487b5 Mon Sep 17 00:00:00 2001
From: Charles Chiou 
Date: Fri, 7 Nov 2014 10:15:18 +0800
Subject: [PATCH 4/4] scsi:stex.c Add S3/S4 support

Add S3/S4 support, add .suspend and .resume function in pci_driver.

Pegasus need 30~40 seconds to boot up. We don't want to OS wait
in .resume function. Create a thread to handle device boot up.

Signed-off-by: charles.ch...@tw.promise.com
---
 drivers/scsi/stex.c | 65 
-

 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index a536cfb..264dcd8 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -301,6 +301,11 @@ struct st_ccb {
u8 reserved[2];
 };

+struct hba_handshake_workstruct {
+   struct st_hba *hba;
+   struct work_struct handshake_work;
+};
+
 struct st_hba {
void __iomem *mmio_base;/* iomapped PCI memory space */
void *dma_mem;
@@ -328,6 +333,7 @@ struct st_hba {
char work_q_name[20];
struct workqueue_struct *work_q;
struct work_struct reset_work;
+   struct hba_handshake_workstruct *resumework;
wait_queue_head_t reset_waitq;
unsigned int mu_status;
unsigned int cardtype;
@@ -369,6 +375,8 @@ static const char console_inq_page[] =
0x0C,0x20,0x20,0x20,0x20,0x20,0x20,0x20
 };

+
+
 MODULE_AUTHOR("Ed Lin");
 MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers");
 MODULE_LICENSE("GPL");
@@ -630,7 +638,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void 
(*done)(struct scsi_cmnd *))

done(cmd);
return 0;
}
-   if (unlikely(hba->mu_status == MU_STATE_RESETTING))
+   if (unlikely(hba->mu_status != MU_STATE_STARTED))
return SCSI_MLQUEUE_HOST_BUSY;

switch (cmd->cmnd[0]) {
@@ -1397,6 +1405,19 @@ static void stex_reset_work(struct work_struct *work)
stex_do_reset(hba);
 }

+
+static void resume_handshake(struct work_struct *work)
+{
+   struct st_hba *hba;
+   struct hba_handshake_workstruct *hswork;
+
+   hswork = container_of(work, struct hba_handshake_workstruct,
+   handshake_work);
+   hba = hswork->hba;
+   stex_handshake(hba);
+}
+
+
 static int stex_biosparam(struct scsi_device *sdev,
struct block_device *bdev, sector_t capacity, int geom[])
 {
@@ -1620,6 +1641,12 @@ static int stex_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)

goto out_iounmap;
}

+   hba->resumework = kzalloc(sizeof(struct hba_handshake_workstruct),
+   GFP_KERNEL);
+   hba->resumework->hba = hba;
+   INIT_WORK(&hba->resumework->handshake_work, resume_handshake);
+
+
hba->cardtype = (unsigned int) id->driver_data;
ci = &stex_card_info[hba->cardtype];
switch (id->subdevice) {
@@ -1875,6 +1902,40 @@ static void stex_shutdown(struct pci_dev *pdev)
}
 }

+static int stex_choice_sleep_MIC(pm_message_t state)
+{
+   switch (state.event) {
+   case PM_EVENT_SUSPEND:
+   return ST_S3;
+   case PM_EVENT_FREEZE:
+   case PM_EVENT_HIBERNATE:
+   return ST_S4;
+   default:
+   return ST_S4;
+   }
+}
+
+static int stex_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+   struct st_hba *hba = pci_get_drvdata(pdev);
+
+   if (hba->cardtype == st_yel && hba->supports_pm == 1)
+   stex_hba_stop(hba, stex_choice_sleep_MIC(state));
+   else
+   stex_hba_stop(hba, ST_IGNORED);
+   return 0;
+}
+
+
+static int stex_resume(struct pci_dev *pdev)
+{
+   struct st_hba *hba = pci_get_drvdata(pdev);
+   int sts;
+
+   hba->mu_status = MU_STATE_STARTING;
+   sts = schedule_work(&hba->resumework->handshake_work);
+   return 0;
+}
 MODULE_DEVICE_TABLE(pci, stex_pci_tbl);

 static struct pci_driver stex_pci_driver = {
@@ -1883,6 +1944,8 @@ static struct pci_driver stex_pci_driver = {
.probe  = stex_probe,
.remove = stex_remove,
.shutdown   = stex_shutdown,
+   .suspend= stex_suspend,
+   .resume = stex_resume,
 };

 static struct notifier_block stex_reboot_notifier = {
--
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 3/4 v3] scsi:stex.c Add reboot support

2014-12-15 Thread Charles Chiou


From 72f5b5cbda424a254b0e9672bd4d9d249728fcb9 Mon Sep 17 00:00:00 2001
From: Charles Chiou 
Date: Wed, 5 Nov 2014 19:29:46 +0800
Subject: [PATCH 3/4] scsi:stex.c Add reboot support

1. Add reboot support, Pegasus devices should be notified that
   the host is going to shut down/reboot. I register reboot callback
   function to distinct host is going to shut down or to reboot.

2. Pegasus FW shutdown flow is sensitive to host behavior
   (host is going to S3/S4/shut down/reboot). To this end, I add one
   argument in stex_hba_stop to support various stop command.

Signed-off-by: charles.ch...@tw.promise.com
---
 drivers/scsi/stex.c | 46 ++
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 7dc6afe..a536cfb 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -166,6 +167,13 @@ enum {

ST_ADDITIONAL_MEM   = 0x20,
ST_ADDITIONAL_MEM_MIN   = 0x8,
+   PMIC_SHUTDOWN   = 0x0D,
+   PMIC_REUMSE = 0x10,
+   ST_IGNORED  = -1,
+   ST_S3   = 3,
+   ST_S4   = 4,
+   ST_S5   = 5,
+   ST_S6   = 6,
 };

 struct st_sgitem {
@@ -344,6 +352,7 @@ struct st_card_info {
u16 sts_count;
 };

+static int reboot;
 static int msi;
 module_param(msi, int, 0);
 MODULE_PARM_DESC(msi, "Enable Message Signaled Interrupts(0=off, 1=on)");
@@ -364,6 +373,14 @@ MODULE_AUTHOR("Ed Lin");
 MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(ST_DRIVER_VERSION);
+static int stex_reboot_callback(struct notifier_block *self,
+ unsigned long val,
+ void *data)
+{
+   if (val == SYS_RESTART)
+   reboot = 1;
+   return NOTIFY_OK;
+}

 static void stex_gettime(__le64 *time)
 {
@@ -1562,6 +1579,7 @@ static int stex_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)

u32 sts_offset, cp_offset, scratch_offset;
int err;

+   reboot = 0;
err = pci_enable_device(pdev);
if (err)
return err;
@@ -1755,7 +1773,7 @@ out_disable:
return err;
 }

-static void stex_hba_stop(struct st_hba *hba)
+static void stex_hba_stop(struct st_hba *hba, int st_sleep_mic)
 {
struct req_msg *req;
struct st_msg_header *msg_h;
@@ -1771,11 +1789,18 @@ static void stex_hba_stop(struct st_hba *hba)
} else
memset(req, 0, hba->rq_size);

-   if (hba->cardtype == st_yosemite || hba->cardtype == st_yel) {
+   if ((hba->cardtype == st_yosemite || hba->cardtype == st_yel)
+   && st_sleep_mic == ST_IGNORED) {
req->cdb[0] = MGT_CMD;
req->cdb[1] = MGT_CMD_SIGNATURE;
req->cdb[2] = CTLR_CONFIG_CMD;
req->cdb[3] = CTLR_SHUTDOWN;
+   } else if (hba->cardtype == st_yel && st_sleep_mic != ST_IGNORED) {
+   req->cdb[0] = MGT_CMD;
+   req->cdb[1] = MGT_CMD_SIGNATURE;
+   req->cdb[2] = CTLR_CONFIG_CMD;
+   req->cdb[3] = PMIC_SHUTDOWN;
+   req->cdb[4] = st_sleep_mic;
} else {
req->cdb[0] = CONTROLLER_CMD;
req->cdb[1] = CTLR_POWER_STATE_CHANGE;
@@ -1795,10 +1820,12 @@ static void stex_hba_stop(struct st_hba *hba)
while (hba->ccb[tag].req_type & PASSTHRU_REQ_TYPE) {
if (time_after(jiffies, before + ST_INTERNAL_TIMEOUT * HZ)) {
hba->ccb[tag].req_type = 0;
+   hba->mu_status = MU_STATE_STOP;
return;
}
msleep(1);
}
+   hba->mu_status = MU_STATE_STOP;
 }

 static void stex_hba_free(struct st_hba *hba)
@@ -1838,7 +1865,14 @@ static void stex_shutdown(struct pci_dev *pdev)
 {
struct st_hba *hba = pci_get_drvdata(pdev);

-   stex_hba_stop(hba);
+   if (hba->supports_pm == 0)
+   stex_hba_stop(hba, ST_IGNORED);
+   else {
+   if (reboot)
+   stex_hba_stop(hba, ST_S6);
+   else
+   stex_hba_stop(hba, ST_S5);
+   }
 }

 MODULE_DEVICE_TABLE(pci, stex_pci_tbl);
@@ -1851,18 +1885,22 @@ static struct pci_driver stex_pci_driver = {
.shutdown   = stex_shutdown,
 };

+static struct notifier_block stex_reboot_notifier = {
+   stex_reboot_callback, NULL, 0
+};
 static int __init stex_init(void)
 {
printk(KERN_INFO DRV_NAME
": Promi

[PATCH 2/4 v4] scsi:stex.c Add hotplug support

2014-12-15 Thread Charles Chiou


From 901f2c1b2d1ae2991182f0f62cedc70f87ea49bc Mon Sep 17 00:00:00 2001
From: Charles Chiou 
Date: Wed, 5 Nov 2014 17:18:37 +0800
Subject: [PATCH 2/4] scsi:stex.c Add hotplug support

1. Add hotplug support. Pegasus support surprise removal. To this end, I
   use return_abnormal_state function to return DID_NO_CONNECT for all
   commands which sent to driver.

2. Remove stex_hba_stop in stex_remove because we cannot send command to
   device after hotplug.

3. Add new device status:  MU_STATE_STOP, MU_STATE_NOCONNECT
   , MU_STATE_STOP. MU_STATE_STOP is currently not referenced.
   MU_STATE_NOCONNECT represent that device is plugged out
   from the host.

4. Use return_abnormal_function() to substitute part of code
   in stex_do_reset.

Signed-off-by: charles.ch...@tw.promise.com
---
 drivers/scsi/stex.c | 51 
+--

 1 file changed, 33 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 08e7bc8..7dc6afe 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -83,6 +83,8 @@ enum {
MU_STATE_STARTED= 2,
MU_STATE_RESETTING  = 3,
MU_STATE_FAILED = 4,
+   MU_STATE_STOP   = 5,
+   MU_STATE_NOCONNECT  = 6,

MU_MAX_DELAY= 120,
MU_HANDSHAKE_SIGNATURE  = 0x5555,
@@ -544,6 +546,27 @@ stex_ss_send_cmd(struct st_hba *hba, struct req_msg 
*req, u16 tag)

readl(hba->mmio_base + YH2I_REQ); /* flush */
 }

+static void return_abnormal_state(struct st_hba *hba, int status)
+{
+   struct st_ccb *ccb;
+   unsigned long flags;
+   u16 tag;
+
+   spin_lock_irqsave(hba->host->host_lock, flags);
+   for (tag = 0; tag < hba->host->can_queue; tag++) {
+   ccb = &hba->ccb[tag];
+   if (ccb->req == NULL)
+   continue;
+   ccb->req = NULL;
+   if (ccb->cmd) {
+   scsi_dma_unmap(ccb->cmd);
+   ccb->cmd->result = status << 16;
+   ccb->cmd->scsi_done(ccb->cmd);
+   ccb->cmd = NULL;
+   }
+   }
+   spin_unlock_irqrestore(hba->host->host_lock, flags);
+}
 static int
 stex_slave_alloc(struct scsi_device *sdev)
 {
@@ -585,7 +608,11 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void 
(*done)(struct scsi_cmnd *))

id = cmd->device->id;
lun = cmd->device->lun;
hba = (struct st_hba *) &host->hostdata[0];
-
+   if (hba->mu_status == MU_STATE_NOCONNECT) {
+   cmd->result = DID_NO_CONNECT;
+   done(cmd);
+   return 0;
+   }
if (unlikely(hba->mu_status == MU_STATE_RESETTING))
return SCSI_MLQUEUE_HOST_BUSY;

@@ -1287,10 +1314,8 @@ static void stex_ss_reset(struct st_hba *hba)

 static int stex_do_reset(struct st_hba *hba)
 {
-   struct st_ccb *ccb;
unsigned long flags;
unsigned int mu_status = MU_STATE_RESETTING;
-   u16 tag;

spin_lock_irqsave(hba->host->host_lock, flags);
if (hba->mu_status == MU_STATE_STARTING) {
@@ -1324,20 +1349,8 @@ static int stex_do_reset(struct st_hba *hba)
else if (hba->cardtype == st_yel)
stex_ss_reset(hba);

-   spin_lock_irqsave(hba->host->host_lock, flags);
-   for (tag = 0; tag < hba->host->can_queue; tag++) {
-   ccb = &hba->ccb[tag];
-   if (ccb->req == NULL)
-   continue;
-   ccb->req = NULL;
-   if (ccb->cmd) {
-   scsi_dma_unmap(ccb->cmd);
-   ccb->cmd->result = DID_RESET << 16;
-   ccb->cmd->scsi_done(ccb->cmd);
-   ccb->cmd = NULL;
-   }
-   }
-   spin_unlock_irqrestore(hba->host->host_lock, flags);
+
+   return_abnormal_state(hba, DID_RESET);

if (stex_handshake(hba) == 0)
return 0;
@@ -1808,9 +1821,11 @@ static void stex_remove(struct pci_dev *pdev)
 {
struct st_hba *hba = pci_get_drvdata(pdev);

+   hba->mu_status = MU_STATE_NOCONNECT;
+   return_abnormal_state(hba, DID_NO_CONNECT);
scsi_remove_host(hba->host);

-   stex_hba_stop(hba);
+   scsi_block_requests(hba->host);

stex_hba_free(hba);

--
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 1/4 v4] scsi:stex.c Support to Pegasus series.

2014-12-15 Thread Charles Chiou


From 8be76ec282e4e344e88c63d5c1e72c0a8394e703 Mon Sep 17 00:00:00 2001
From: Charles Chiou 
Date: Wed, 5 Nov 2014 14:18:43 +0800
Subject: [PATCH 1/4] scsi:stex.c Support to Pegasus series.

Pegasus is a high performace hardware RAID solution designed to unleash
the raw power of Thunderbolt technology.

1. Add code to distinct SuperTrack and Pegasus series by sub device ID.
   It should support backward compatibility.

2. Change the driver version.

Signed-off-by: charles.ch...@tw.promise.com
---
 drivers/scsi/stex.c | 32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 1aa4bef..08e7bc8 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -1,7 +1,7 @@
 /*
  * SuperTrak EX Series Storage Controller driver for Linux
  *
- * Copyright (C) 2005-2009 Promise Technology Inc.
+ * Copyright (C) 2005-2014 Promise Technology Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -37,11 +37,11 @@
 #include 

 #define DRV_NAME "stex"
-#define ST_DRIVER_VERSION "4.6..4"
-#define ST_VER_MAJOR   4
-#define ST_VER_MINOR   6
-#define ST_OEM 0
-#define ST_BUILD_VER   4
+#define ST_DRIVER_VERSION "5.00..01"
+#define ST_VER_MAJOR   5
+#define ST_VER_MINOR   00
+#define ST_OEM 
+#define ST_BUILD_VER   01

 enum {
/* MU register offset */
@@ -327,6 +327,7 @@ struct st_hba {
u16 rq_count;
u16 rq_size;
u16 sts_count;
+   u8  supports_pm;
 };

 struct st_card_info {
@@ -1590,6 +1591,25 @@ static int stex_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)


hba->cardtype = (unsigned int) id->driver_data;
ci = &stex_card_info[hba->cardtype];
+   switch (id->subdevice) {
+   case 0x4221:
+   case 0x4222:
+   case 0x4223:
+   case 0x4224:
+   case 0x4225:
+   case 0x4226:
+   case 0x4227:
+   case 0x4261:
+   case 0x4262:
+   case 0x4263:
+   case 0x4264:
+   case 0x4265:
+   break;
+   default:
+   if (hba->cardtype == st_yel)
+   hba->supports_pm = 1;
+   }
+
sts_offset = scratch_offset = (ci->rq_count+1) * ci->rq_size;
if (hba->cardtype == st_yel)
sts_offset += (ci->sts_count+1) * sizeof(u32);
--
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] scsi:storvsc enable reading from VPD pages on SPC-2

2014-12-15 Thread Long Li
Thanks Martin for the explanation.

I'll send out another patch.

> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Thursday, December 11, 2014 7:04 PM
> To: Long Li
> Cc: Martin K. Petersen; KY Srinivasan; Haiyang Zhang;
> jbottom...@parallels.com; linux-scsi@vger.kernel.org;
> de...@linuxdriverproject.org; linux-ker...@vger.kernel.org
> Subject: Re: [PATCH] scsi:storvsc enable reading from VPD pages on SPC-2
> 
> > "Long" == Long Li  writes:
> 
> >> Handle the issues or handle WRITE SAME(10/16)?
> 
> Long> With this patch, the SCSI layer will be able to correctly send
> Long> WRITE_SAME_16 to the Hyper-V host. It will not send WRITE_SAME_10:
> Long> it has been disabled in the driver template. Do you want me to
> Long> send another patch with these details?
> 
> no_write_same prevents us from attempting to use WRITE SAME(10/16) to zero
> block ranges.
> 
> This is completely orthogonal to using the WRITE SAME(10/16) commands with
> the UNMAP bit set to discard block ranges. The latter is controlled by the 
> logical
> block provisioning heuristics and is not affected by no_write_same at all.
> 
> --
> Martin K. PetersenOracle Linux Engineering
--
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: T10-PI: Getting failed tag info

2014-12-15 Thread Martin K. Petersen
> "Christoph" == Christoph Hellwig  writes:

Christoph> I really don't like adding new errno codes for all these.

This was mainly done to accommodate Darrick's work on aio extensions. If
these errors were forever trapped inside the kernel I would agree with
you but the plan is to make this generally applicable.

Christoph> I'd much rather have a integrity error field with specific
Christoph> codes in the bio.

My original device qualification code did this. I also had one that
included a field for the offending LBA but that appears to be lost in
the mist of time.

(Patch against a 2.6.3x era kernel so will need some massaging).

diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index ba48f0b..716285a 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -757,6 +757,7 @@ int bio_integrity_clone(struct bio *bio, struct bio 
*bio_src,
bip->bip_vcnt = bip_src->bip_vcnt;
bip->bip_idx = bip_src->bip_idx;
bip->bip_flags = bip_src->bip_flags;
+   bip->bip_completion = bip_src->bip_completion;
 
return 0;
 }
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 1aa9ee4..b4c08b8 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -163,6 +163,21 @@ static inline int bio_has_allocated_vec(struct bio *bio)
 #define bio_get(bio)   atomic_inc(&(bio)->bi_cnt)
 
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
+
+enum bio_integrity_errors {
+   BIP_ERR_NONE = 0,   /* no error */
+   BIP_ERR_CTRL_GUARD, /* controller detected guard tag error */
+   BIP_ERR_CTRL_APP,   /* controller detected app tag error */
+   BIP_ERR_CTRL_REF,   /* controller detected ref tag error */
+   BIP_ERR_DISK_GUARD, /* disk detected guard tag error */
+   BIP_ERR_DISK_APP,   /* disk detected app tag error */
+   BIP_ERR_DISK_REF,   /* disk detected ref tag error */
+};
+
+struct bio_integrity_completion {
+   enum bio_integrity_errors   error;
+};
+
 /*
  * bio integrity payload
  */
@@ -173,13 +188,14 @@ struct bio_integrity_payload {
 
void*bip_buf;   /* generated integrity data */
bio_end_io_t*bip_end_io;/* saved I/O completion fn */
+   struct bio_integrity_completion *bip_completion; /* I/O completion */
 
unsigned intbip_size;
 
unsigned short  bip_slab;   /* slab the bip came from */
unsigned short  bip_vcnt;   /* # of integrity bio_vecs */
unsigned short  bip_idx;/* current bip_vec index */
-   unsigned short  bip_flags;  /* control and status flags */
+   unsigned short  bip_flags;  /* control flags */
 
struct work_struct  bip_work;   /* I/O completion */
struct bio_vec  bip_vec[0]; /* embedded bvec array */

The thing that bugged me about this approach was the shared completion
mask for all clones. I felt that was a bit icky. However, it seemed like
a major hassle to have this be clone-private and have to register endio
handlers for each and every clone to get status bubbled up. That was
something that the switch to errnos handled much more elegantly.
However, if we want to have accurate offset reporting we will need to do
the completion struct thing.

Open to ideas. The many-clones-to-one-completion-status issue isn't
entirely trivial to tackle.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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/2] target: Avoid dropping AllRegistrants reservation during unregister

2014-12-15 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

This patch fixes an issue with AllRegistrants reservations where
an unregister operation by the I_T nexus reservation holder would
incorrectly drop the reservation, instead of waiting until the
last active I_T nexus is unregistered as per SPC-4.

This includes updating __core_scsi3_complete_pro_release() to reset
dev->dev_pr_res_holder with another pr_reg for this special case,
as well as a new 'unreg' parameter to determine when the release
is occuring from an implicit unregister, vs. explicit RELEASE.

It also adds special handling in core_scsi3_free_pr_reg_from_nacl()
to release the left-over pr_res_holder, now that pr_reg is deleted
from pr_reg_list within __core_scsi3_complete_pro_release().

Reported-by: Ilias Tsitsimpis 
Cc: James Bottomley 
Signed-off-by: Nicholas Bellinger 
---
 drivers/target/target_core_pr.c | 87 ++---
 1 file changed, 65 insertions(+), 22 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index c4a8da5..703890c 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -76,7 +76,7 @@ enum preempt_type {
 };
 
 static void __core_scsi3_complete_pro_release(struct se_device *, struct 
se_node_acl *,
-   struct t10_pr_registration *, int);
+ struct t10_pr_registration *, 
int, int);
 
 static sense_reason_t
 target_scsi2_reservation_check(struct se_cmd *cmd)
@@ -1177,7 +1177,7 @@ static int core_scsi3_check_implicit_release(
 *service action with the SERVICE ACTION RESERVATION KEY
 *field set to zero (see 5.7.11.3).
 */
-   __core_scsi3_complete_pro_release(dev, nacl, pr_reg, 0);
+   __core_scsi3_complete_pro_release(dev, nacl, pr_reg, 0, 1);
ret = 1;
/*
 * For 'All Registrants' reservation types, all existing
@@ -1219,7 +1219,8 @@ static void __core_scsi3_free_registration(
 
pr_reg->pr_reg_deve->def_pr_registered = 0;
pr_reg->pr_reg_deve->pr_res_key = 0;
-   list_del(&pr_reg->pr_reg_list);
+   if (!list_empty(&pr_reg->pr_reg_list))
+   list_del(&pr_reg->pr_reg_list);
/*
 * Caller accessing *pr_reg using core_scsi3_locate_pr_reg(),
 * so call core_scsi3_put_pr_reg() to decrement our reference.
@@ -1271,6 +1272,7 @@ void core_scsi3_free_pr_reg_from_nacl(
 {
struct t10_reservation *pr_tmpl = &dev->t10_pr;
struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_res_holder;
+   bool free_reg = false;
/*
 * If the passed se_node_acl matches the reservation holder,
 * release the reservation.
@@ -1278,13 +1280,18 @@ void core_scsi3_free_pr_reg_from_nacl(
spin_lock(&dev->dev_reservation_lock);
pr_res_holder = dev->dev_pr_res_holder;
if ((pr_res_holder != NULL) &&
-   (pr_res_holder->pr_reg_nacl == nacl))
-   __core_scsi3_complete_pro_release(dev, nacl, pr_res_holder, 0);
+   (pr_res_holder->pr_reg_nacl == nacl)) {
+   __core_scsi3_complete_pro_release(dev, nacl, pr_res_holder, 0, 
1);
+   free_reg = true;
+   }
spin_unlock(&dev->dev_reservation_lock);
/*
 * Release any registration associated with the struct se_node_acl.
 */
spin_lock(&pr_tmpl->registration_lock);
+   if (pr_res_holder && free_reg)
+   __core_scsi3_free_registration(dev, pr_res_holder, NULL, 0);
+
list_for_each_entry_safe(pr_reg, pr_reg_tmp,
&pr_tmpl->registration_list, pr_reg_list) {
 
@@ -1307,7 +1314,7 @@ void core_scsi3_free_all_registrations(
if (pr_res_holder != NULL) {
struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl;
__core_scsi3_complete_pro_release(dev, pr_res_nacl,
-   pr_res_holder, 0);
+ pr_res_holder, 0, 0);
}
spin_unlock(&dev->dev_reservation_lock);
 
@@ -2103,13 +2110,13 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 
res_key, u64 sa_res_key,
/*
 * sa_res_key=0 Unregister Reservation Key for registered I_T 
Nexus.
 */
-   pr_holder = core_scsi3_check_implicit_release(
-   cmd->se_dev, pr_reg);
+   type = pr_reg->pr_res_type;
+   pr_holder = core_scsi3_check_implicit_release(cmd->se_dev,
+ pr_reg);
if (pr_holder < 0) {
ret = TCM_RESERVATION_CONFLICT;
goto out;
}
-   type = pr_reg->pr_res_type;
 
spin_lock(&pr_tmpl->registration_lock);
/*
@@ -2383,23 +2390,59 @@ static void __core_

[PATCH 0/2] target: Fixes for AllRegistrants reservation handling

2014-12-15 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

Hi all,

This series addresses two issues raised recently by Ilias wrt
AllRegistrants reservation handling in target code that does not
adhere to SPC-4 specification requirements.

This first is a informational change to PR-IN READ_FULL_STATUS,
that when an AllRegistrants reservation is in place, all active
registrations should be setting R_HOLDER=1 within their respective
descriptors.

The second is a functional change to PR-OUT REGISTER w/ SARK=0
operation, to avoid dropping the AllRegistrants reservation until
the last registered I_T nexus has been released.  It also ensures
that the correct reservation type + scope is retained when the
new reservation is set within __core_scsi3_complete_pro_release()
for this AllRegistrants special case.

Also, thanks to James for the extra SPC-4 clarifications.

Please review.

--nab

Nicholas Bellinger (2):
  target: Fix R_HOLDER bit usage for AllRegistrants
  target: Avoid dropping AllRegistrants reservation during unregister

 drivers/target/target_core_pr.c | 113 +++-
 1 file changed, 88 insertions(+), 25 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


[PATCH 1/2] target: Fix R_HOLDER bit usage for AllRegistrants

2014-12-15 Thread Nicholas A. Bellinger
From: Nicholas Bellinger 

This patch fixes the usage of R_HOLDER bit for an All Registrants
reservation in READ_FULL_STATUS, where only the registration who
issued RESERVE was being reported as having an active reservation.

It changes core_scsi3_pri_read_full_status() to check ahead of the
list walk of active registrations to see if All Registrants is active,
and if so set R_HOLDER bit and scope/type fields for all active
registrations.

Reported-by: Ilias Tsitsimpis 
Cc: James Bottomley 
Signed-off-by: Nicholas Bellinger 
---
 drivers/target/target_core_pr.c | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index f91b6a1..c4a8da5 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -3834,7 +3834,8 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)
unsigned char *buf;
u32 add_desc_len = 0, add_len = 0, desc_len, exp_desc_len;
u32 off = 8; /* off into first Full Status descriptor */
-   int format_code = 0;
+   int format_code = 0, pr_res_type = 0, pr_res_scope = 0;
+   bool all_reg = false;
 
if (cmd->data_length < 8) {
pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u"
@@ -3851,6 +3852,19 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)
buf[2] = ((dev->t10_pr.pr_generation >> 8) & 0xff);
buf[3] = (dev->t10_pr.pr_generation & 0xff);
 
+   spin_lock(&dev->dev_reservation_lock);
+   if (dev->dev_pr_res_holder) {
+   struct t10_pr_registration *pr_holder = dev->dev_pr_res_holder;
+
+   if (pr_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG ||
+   pr_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG) {
+   all_reg = true;
+   pr_res_type = pr_holder->pr_res_type;
+   pr_res_scope = pr_holder->pr_res_scope;
+   }
+   }
+   spin_unlock(&dev->dev_reservation_lock);
+
spin_lock(&pr_tmpl->registration_lock);
list_for_each_entry_safe(pr_reg, pr_reg_tmp,
&pr_tmpl->registration_list, pr_reg_list) {
@@ -3898,14 +3912,20 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd)
 * reservation holder for PR_HOLDER bit.
 *
 * Also, if this registration is the reservation
-* holder, fill in SCOPE and TYPE in the next byte.
+* holder or there is an All Registrants reservation
+* active, fill in SCOPE and TYPE in the next byte.
 */
if (pr_reg->pr_res_holder) {
buf[off++] |= 0x01;
buf[off++] = (pr_reg->pr_res_scope & 0xf0) |
 (pr_reg->pr_res_type & 0x0f);
-   } else
+   } else if (all_reg) {
+   buf[off++] |= 0x01;
+   buf[off++] = (pr_res_scope & 0xf0) |
+(pr_res_type & 0x0f);
+   } else {
off += 2;
+   }
 
off += 4; /* Skip over reserved area */
/*
-- 
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: T10-PI: Getting failed tag info

2014-12-15 Thread Martin K. Petersen
> "Vlad" == Vladislav Bolkhovitin  writes:

>> One thing that needs to be done is to make returning these new errors
>> to userland conditional on !BIP_BLOCK_INTEGRITY. I'll put that on my
>> list.

Vlad> Ever without it this patch is quite valuable.

Well, the concern here is that the new magic errors bubble up to
userland applications that only check for EIO/EINTR.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: T10-PI: Getting failed tag info

2014-12-15 Thread Martin K. Petersen
> "Nic" == Nicholas A Bellinger  writes:

Nic> Also, AFAICT this patch still doesn't set the failed LBA, right..?
Nic> Any thoughts about the most sane way to get the failed LBA
Nic> information back to a caller like IBLOCK performing submission with
Nic> bio + bip..?

That's correct. My original patch did this.

More on that in my response to hch...

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 V5 3/3] scsi: Retry report-luns when reported LU count requres more memory

2014-12-15 Thread Christoph Hellwig
On Fri, Dec 05, 2014 at 02:37:43PM -0500, Rob Evers wrote:
> Update scsi_report_lun_scan to initially always report up to 511 LUs,
> as the previous default max_report_luns did.  Retry in a loop if not
> enough memory is available for the number of LUs reported.  Parameter
> max_report_luns is removed as it is no longer used.
> ---
>  drivers/scsi/scsi_scan.c | 43 ---
>  1 file changed, 12 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index 8db1f6f..ecd8703 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -80,6 +80,7 @@
>  
>  static const char *scsi_null_device_strs = "nullnullnullnull";
>  
> +#define INITIAL_MAX_SCSI_REPORT_LUNS 511

The name seems very verbose.  Given that it's only used once we might
as well just remove it and add a comment about why this number is chosen
instead.


> - length = get_unaligned_be32(lun_data->scsi_lun);
> + if (get_unaligned_be32(lun_data->scsi_lun) +
> + sizeof(struct scsi_lun) > length) {
> + length = get_unaligned_be32(lun_data->scsi_lun) +
> +  sizeof(struct scsi_lun);
> + kfree(lun_data);
> + goto retry;
> + } else
> + length = get_unaligned_be32(lun_data->scsi_lun);

The else won't be reached due to the goto.  Just remove it and one
level of indentation for the next line.

Otherwise looks good:

Reviewed-by: Christoph Hellwig 
--
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 V5 2/3] scsi: Use set/get_unaligned_be32 in report_luns

2014-12-15 Thread Christoph Hellwig
Looks good, but I still need your signoff.

--
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 V5 1/3] scsi: Avoid unnecessary GFP_ATOMIC allocation in scsi_report_lun_scan

2014-12-15 Thread Christoph Hellwig
On Fri, Dec 05, 2014 at 02:37:41PM -0500, Rob Evers wrote:
> Signed-off-by: Rob Evers 

Looks good,

Reviewed-by: Christoph Hellwig 
--
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


[LSF/MM TOPIC] Integrated Unit Attention handling

2014-12-15 Thread Hannes Reinecke
Hi all,

I'd like to discusss 'Integrated Unit Attention handling' at LSF/MM
2015.

Currently we're interpreting some Unit Attention codes and send out
uevents, with the hope that some userspace application will make use
of this.
However, some UAs are easily handled within the kernel directly, eg

- REPORT LUN DATA CHANGED: this could easily trigger a rescan of the
  scsi host driving that LUN.
- INQUIRY DATA CHANGED: Rescan the VPD pages and INQUIRY data itself

When implementing such an integrated UA handling, however, we would
need to revisit the design choice of having the inquiry data fixed
to struct scsi_device. Currently any modification to the inquiry
data requires a complete device removal; this is not really feasible
for integrated event handling.

I'd like to discuss if such an integrated UA handling is desirable
and, if so, if devices should become flexible to have the inquiry
data changed on the fly.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
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 2/4] [SCSI] Blacklist RSOC for Microsoft iSCSI target devices

2014-12-15 Thread Christoph Hellwig
Thanks, applied to core-for-3.19.  Any chance to get reviews for the
other patches?
--
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 4/5] ipr: Set scsi_level correctly for disk arrays

2014-12-15 Thread Christoph Hellwig
On Thu, Dec 04, 2014 at 10:10:49AM -0600, Brian King wrote:
> On 12/04/2014 03:25 AM, Christoph Hellwig wrote:
> > Do you want me to apply this patch ASAP while waiting for the kexec ACK?
> 
> Both patches 1 and 4 can be pulled in while we wait for Eric's ack.

I've applied patches 1 and 4 to drivers-for-3.19.
--
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 0/4] scsi_debug: Unit Attention fixes/enhancements

2014-12-15 Thread Christoph Hellwig
Thanks, applied patch 1 and 2 to drivers-for-3.19, the rest will go
into the 3.20 queue a soon as that opens.
--
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] scsi_debug: improve driver description in Kconfig

2014-12-15 Thread Christoph Hellwig
Thanks, applied to drivers-for-3.19.
--
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] scsi_debug: fix compare and write errors

2014-12-15 Thread Christoph Hellwig
Thanks, applied to drivers-for-3.19.

--
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 qla2xxx] Race in handling rport deletion in Qlogic driver during recovery causes panic

2014-12-15 Thread Christoph Hellwig
Thanks, applied to drivers-for-3.19.
--
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] scsi: fix random memory corruption with scsi-mq + T10 PI

2014-12-15 Thread Christoph Hellwig
Thanks,

applied to drivers-for-3.19.
--
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: UFS RPMB

2014-12-15 Thread Tomas Winkler
Can you be more specific about Linux programming API
Thanks

On Mon, Dec 15, 2014 at 6:19 AM, Kyuho Choi  wrote:
> As i know, SECURITY PROTOCOL IN/OUT are support RPMB access for UFS.
>
> On 12/14/14, Tomas Winkler  wrote:
>> Hi, sorry fore a newbie question.
>> What is the current interface for accessing rpmb LUN in a UFS devices.
>> For emmc one need to issue a raw mmc ioctl command  MMC_IOC_CMD.
>>
>> Thanks
>> Tomas
>> --
>> 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
>>
--
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 v2] drivers: scsi: megaraid: Add "megaraid_sas_internal.h" for internal shared functions using

2014-12-15 Thread Sumit Saxena
>-Original Message-
>From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>Sent: Sunday, December 14, 2014 9:35 PM
>To: megaraidli...@lsi.com; jbottom...@parallels.com; Sumit Saxena
>Cc: linux-scsi@vger.kernel.org; linux-ker...@vger.kernel.org
>Subject: [PATCH v2] drivers: scsi: megaraid: Add "megaraid_sas_internal.h"
>for internal shared functions using
>
>For shared inline functions crossed source files, better to let it as
>"static inline"
>in a header file. For extern functions, better to declare them in header
>file.
>
>Signed-off-by: Chen Gang 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c |  76 +
> drivers/scsi/megaraid/megaraid_sas_fusion.c   |  42 +-
> drivers/scsi/megaraid/megaraid_sas_internal.h | 116
>++
> 3 files changed, 118 insertions(+), 116 deletions(-)  create mode 100644
>drivers/scsi/megaraid/megaraid_sas_internal.h
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index dc27598..474c39b 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -57,6 +57,7 @@
> #include 
> #include "megaraid_sas_fusion.h"
> #include "megaraid_sas.h"
>+#include "megaraid_sas_internal.h"
>
> /*
>  * Number of sectors per IO command
>@@ -127,9 +128,6 @@ static u32 support_device_change;
> /* define lock for aen poll */
> spinlock_t poll_aen_lock;
>
>-void
>-megasas_complete_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd,
>-   u8 alt_status);
> static u32
> megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem
>*regs);  static int @@ -142,23 +140,6 @@ u32
>megasas_build_and_issue_cmd(struct megasas_instance *instance,
>   struct scsi_cmnd *scmd);
> static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
>-megasas_release_fusion(struct megasas_instance *instance); -int -
>megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
>megasas_free_cmds_fusion(struct megasas_instance *instance);
>-u8
>-megasas_get_map_info(struct megasas_instance *instance); -int -
>megasas_sync_map_info(struct megasas_instance *instance); -int -
>wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
>*cmd); -void megasas_reset_reply_desc(struct megasas_instance *instance);
>-u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map,
>-struct LD_LOAD_BALANCE_INFO *lbInfo);
>-int megasas_reset_fusion(struct Scsi_Host *shost); -void
>megasas_fusion_ocr_wq(struct work_struct *work);
>
> void
> megasas_issue_dcmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd) @@ -194,30 +175,6 @@ struct megasas_cmd
>*megasas_get_cmd(struct megasas_instance  }
>
> /**
>- * megasas_return_cmd -   Return a cmd to free command pool
>- * @instance: Adapter soft state
>- * @cmd:  Command packet to be returned to free command
>pool
>- */
>-inline void
>-megasas_return_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd) -{
>-  unsigned long flags;
>-
>-  spin_lock_irqsave(&instance->cmd_pool_lock, flags);
>-
>-  cmd->scmd = NULL;
>-  cmd->frame_count = 0;
>-  if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) &&
>-  (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) &&
>-  (reset_devices))
>-  cmd->frame->hdr.cmd = MFI_CMD_INVALID;
>-  list_add_tail(&cmd->list, &instance->cmd_pool);
>-
>-  spin_unlock_irqrestore(&instance->cmd_pool_lock, flags);
>-}
>-
>-
>-/**
> * The following functions are defined for xscale
> * (deviceid : 1064R, PERC5) controllers
> */
>@@ -830,11 +787,6 @@ static struct megasas_instance_template
>megasas_instance_template_gen2 = {
> *   specific to gen2 (deviceid : 0x78, 0x79) controllers
> */
>
>-/*
>- * Template added for TB (Fusion)
>- */
>-extern struct megasas_instance_template
>megasas_instance_template_fusion;
>-
> /**
>  * megasas_issue_polled - Issues a polling command
>  * @instance: Adapter soft state
>@@ -1311,32 +1263,6 @@ megasas_build_ldio(struct megasas_instance
>*instance, struct scsi_cmnd *scp,  }
>
> /**
>- * megasas_is_ldio -  Checks if the cmd is for logical drive
>- * @scmd: SCSI command
>- *
>- * Called by megasas_queue_command to find out if the command to be
>queued
>- * is a logical drive command
>- */
>-inline int megasas_is_ldio(struct scsi_cmnd *cmd) -{
>-  if (!MEGASAS_IS_LOGICAL(cmd))
>-  return 0;
>-  switch (cmd->cmnd[0]) {
>-  case READ_10:
>-  case WRITE_10:
>-  case READ_12:
>-  case WRITE_12:
>-  case READ_6:
>-  case WRITE_6:
>-  case READ_16:
>-  case WRITE_16:
>-  return 1;
>-  default:
>-  return 0;
>-  }
>-}
>-
>- /**
>  * megasas_dump_pending_frames -  Dumps the frame address of all
>pending cmds
>  *in FW
>  * @i

Re: [Update][PATCH] SCSI / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM

2014-12-15 Thread Christoph Hellwig
On Tue, Dec 09, 2014 at 10:47:47PM +0100, Rafael J. Wysocki wrote:
> Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if
> PM_SLEEP is selected) which is only in linux-next at the moment (via the
> linux-pm tree).
> 
> Please let me know if it is OK to take this one into linux-pm.

Feel free to add it to the linux-pm tree.

Acked-by: Christoph Hellwig 
--
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: T10-PI: Getting failed tag info

2014-12-15 Thread Christoph Hellwig
On Thu, Dec 11, 2014 at 10:12:11PM -0500, Martin K. Petersen wrote:
> block: Add specific data integrity errors
> 
> Introduce a set of error codes that can be used by the block integrity
> subsystem to signal which class of error was encountered by either the
> I/O controller or the storage device.

I really don't like adding new errno codes for all these.  I'd much
rather have a integrity error field with specific codes in the bio.
--
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