Re: [PATCH] scsi: ufs: add ufs a command complete time stamp

2017-09-26 Thread Zang Leigang
Hi, Subhash

I send a new patch, forget tag a "PATCH V2", pls check.

On Tue, Sep 26, 2017 at 02:39:06PM -0700, Subhash Jadavani wrote:
> On 2017-09-20 03:30, Zang Leigang wrote:
> >Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>
> >
> >diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> >index 794a4600e952..2984f33095be 100644
> >--- a/drivers/scsi/ufs/ufshcd.c
> >+++ b/drivers/scsi/ufs/ufshcd.c
> >@@ -385,6 +385,8 @@ void ufshcd_print_trs(struct ufs_hba *hba,
> >unsigned long bitmap, bool pr_prdt)
> >
> > dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
> > tag, ktime_to_us(lrbp->issue_time_stamp));
> >+dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
> >+tag, ktime_to_us(lrbp->complete_time_stamp));
> > dev_err(hba->dev,
> > "UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
> > tag, (u64)lrbp->utrd_dma_addr);
> >@@ -1746,6 +1748,7 @@ static inline
> > void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
> > {
> > hba->lrb[task_tag].issue_time_stamp = ktime_get();
> >+hba->lrb[task_tag].complete_time_stamp.tv64 = 0UL;
> 
> can we use ktime_set(0, 0)?
> complete_time_stamp = ktime_set(0, 0);

Sure.

> 
> 
> > ufshcd_clk_scaling_start_busy(hba);
> > __set_bit(task_tag, >outstanding_reqs);
> > ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
> >@@ -4627,6 +4630,8 @@ static void __ufshcd_transfer_req_compl(struct
> >ufs_hba *hba,
> > }
> > if (ufshcd_is_clkscaling_supported(hba))
> > hba->clk_scaling.active_reqs--;
> >+
> >+lrbp->complete_time_stamp = ktime_get();
> > }
> >
> > /* clear corresponding bits of completed commands */
> >diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> >index cdc8bd05f7df..67a8f8ef1b06 100644
> >--- a/drivers/scsi/ufs/ufshcd.h
> >+++ b/drivers/scsi/ufs/ufshcd.h
> >@@ -166,6 +166,7 @@ struct ufs_pm_lvl_states {
> >  * @lun: LUN of the command
> >  * @intr_cmd: Interrupt command (doesn't participate in interrupt
> >aggregation)
> >  * @issue_time_stamp: time stamp for debug purposes
> >+ * @complete_time_stamp: time stamp for statistics
> >  * @req_abort_skip: skip request abort task flag
> >  */
> > struct ufshcd_lrb {
> >@@ -189,6 +190,7 @@ struct ufshcd_lrb {
> > u8 lun; /* UPIU LUN id field is only 8-bit wide */
> > bool intr_cmd;
> > ktime_t issue_time_stamp;
> >+ktime_t complete_time_stamp;
> 
> Just a suggestion for short name, s/complete/compl ? or s/complete/cmpl ?

Accept. compl look better.

> 
> >
> > bool req_abort_skip;
> > };
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

-- 
Thanks,
Zang Leigang


本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!


[PATCH] scsi: ufs: add ufs a command complete time stamp

2017-09-26 Thread Zang Leigang
Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 794a460..7e8d583 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -385,6 +385,8 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long 
bitmap, bool pr_prdt)
 
dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
tag, ktime_to_us(lrbp->issue_time_stamp));
+   dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
+   tag, ktime_to_us(lrbp->compl_time_stamp));
dev_err(hba->dev,
"UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
tag, (u64)lrbp->utrd_dma_addr);
@@ -1746,6 +1748,7 @@ static inline
 void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
 {
hba->lrb[task_tag].issue_time_stamp = ktime_get();
+   hba->lrb[task_tag].compl_time_stamp = ktime_set(0, 0);
ufshcd_clk_scaling_start_busy(hba);
__set_bit(task_tag, >outstanding_reqs);
ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
@@ -4627,6 +4630,8 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba 
*hba,
}
if (ufshcd_is_clkscaling_supported(hba))
hba->clk_scaling.active_reqs--;
+
+   lrbp->compl_time_stamp = ktime_get();
}
 
/* clear corresponding bits of completed commands */
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index cdc8bd0..40ea475 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -166,6 +166,7 @@ struct ufs_pm_lvl_states {
  * @lun: LUN of the command
  * @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation)
  * @issue_time_stamp: time stamp for debug purposes
+ * @compl_time_stamp: time stamp for statistics
  * @req_abort_skip: skip request abort task flag
  */
 struct ufshcd_lrb {
@@ -189,6 +190,7 @@ struct ufshcd_lrb {
u8 lun; /* UPIU LUN id field is only 8-bit wide */
bool intr_cmd;
ktime_t issue_time_stamp;
+   ktime_t compl_time_stamp;
 
bool req_abort_skip;
 };
-- 
2.7.4



[PATCH] scsi: ufs: add ufs a command complete time stamp

2017-09-20 Thread Zang Leigang
Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 794a4600e952..2984f33095be 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -385,6 +385,8 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long 
bitmap, bool pr_prdt)
 
dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
tag, ktime_to_us(lrbp->issue_time_stamp));
+   dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
+   tag, ktime_to_us(lrbp->complete_time_stamp));
dev_err(hba->dev,
"UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
tag, (u64)lrbp->utrd_dma_addr);
@@ -1746,6 +1748,7 @@ static inline
 void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
 {
hba->lrb[task_tag].issue_time_stamp = ktime_get();
+   hba->lrb[task_tag].complete_time_stamp.tv64 = 0UL;
ufshcd_clk_scaling_start_busy(hba);
__set_bit(task_tag, >outstanding_reqs);
ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
@@ -4627,6 +4630,8 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba 
*hba,
}
if (ufshcd_is_clkscaling_supported(hba))
hba->clk_scaling.active_reqs--;
+
+   lrbp->complete_time_stamp = ktime_get();
}
 
/* clear corresponding bits of completed commands */
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index cdc8bd05f7df..67a8f8ef1b06 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -166,6 +166,7 @@ struct ufs_pm_lvl_states {
  * @lun: LUN of the command
  * @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation)
  * @issue_time_stamp: time stamp for debug purposes
+ * @complete_time_stamp: time stamp for statistics
  * @req_abort_skip: skip request abort task flag
  */
 struct ufshcd_lrb {
@@ -189,6 +190,7 @@ struct ufshcd_lrb {
u8 lun; /* UPIU LUN id field is only 8-bit wide */
bool intr_cmd;
ktime_t issue_time_stamp;
+   ktime_t complete_time_stamp;
 
bool req_abort_skip;
 };
-- 
2.14.1



[PATCH] scsi: ufs: fix a pclint warning

2017-09-19 Thread Zang Leigang
Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 794a4600e952..deb77535b8c9 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3586,7 +3586,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, 
struct uic_command *cmd)
status = ufshcd_get_upmcrs(hba);
if (status != PWR_LOCAL) {
dev_err(hba->dev,
-   "pwr ctrl cmd 0x%0x failed, host upmcrs:0x%x\n",
+   "pwr ctrl cmd 0x%x failed, host upmcrs:0x%x\n",
cmd->command, status);
ret = (status != PWR_OK) ? status : -1;
}
-- 
2.14.1



[PATCH] scsi: ufs: reqs and tasks were put in the wrong order

2017-08-23 Thread Zang Leigang
Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5bc9dc14e075..794a4600e952 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -438,7 +438,7 @@ static void ufshcd_print_host_state(struct ufs_hba *hba)
 {
dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
dev_err(hba->dev, "lrb in use=0x%lx, outstanding reqs=0x%lx 
tasks=0x%lx\n",
-   hba->lrb_in_use, hba->outstanding_tasks, hba->outstanding_reqs);
+   hba->lrb_in_use, hba->outstanding_reqs, hba->outstanding_tasks);
dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n",
hba->saved_err, hba->saved_uic_err);
dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n",
-- 
2.14.1



Re: [PATCH] scsi: ufs: check link active or not after switch to HS mode

2017-06-28 Thread Zang Leigang
On Wed, Jun 28, 2017 at 04:48:21PM -0700, Subhash Jadavani wrote:
> On 2017-06-24 04:44, Zang Leigang wrote:
> >Some device can successfully link and switch to HS mode. But failed
> >to do more. ufshcd_verify_dev_init can help to find this earlier.
> >
> >Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>
> >
> >diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> >index ffe8d8608818..eb03388fc4bd 100644
> >--- a/drivers/scsi/ufs/ufshcd.c
> >+++ b/drivers/scsi/ufs/ufshcd.c
> >@@ -6373,6 +6373,14 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
> > __func__, ret);
> > goto out;
> > }
> >+
> >+/*
> >+ * Some device lost link after switch to HS mode. Check if
> >+ * connect is established here.
> >+ */
> 
> I have never across such failures. If this issue is limited to
> certain device vendors then I don't think if we want to do send NOP
> unconditionally for all the devices.
> We should probably add quirk for these failed devices and send NOP
> only for such devices.

I have double checked this issue, it's already fixed. This patch doesn't need
any more. Thanks.
> 
> 
> >+ret = ufshcd_verify_dev_init(hba);
> >+if (ret)
> >+goto out;
> > }
> >
> > /* set the state as operational after switching to desired gear */
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

-- 
Thanks,
Zang Leigang


本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!


Re: [PATCH] scsi: ufs: set host_byte to DID_REQUEUE when ocs = OCS_ABORTED

2017-06-28 Thread Zang Leigang
On Wed, Jun 28, 2017 at 04:42:36PM -0700, Subhash Jadavani wrote:
> On 2017-06-24 03:27, Zang Leigang wrote:
> >Host set ocs to OCS_ABORTED when clear a doorbell in err handler.
> 
> OCS field is valid after host controller has cleared the
> corresponding doorbell (UTRLDBR) bit to zero. And here HW would be
> clearing the doorbell bit, not the SW. So I am not sure what do you
> mean in sentence above? Can you please elaborate more on this?
> 
Err handler clear PENDING transfer requests with ufshcd_clear_cmd,
and host set these requests's ocs to 6(OCS_ABORTED). I think it's
better to let these request retry, because an err handler may fix
the err condition.
> 
> >Then scsi_decide_disposition return SUCCESS. This may cause some
> >filesystem panic because a FAILED REQUESET. Requeue and complete is
> >better.
> 
> Why do you think retrying this HW aborted request will succeed next
> time? Are we going to fix some request parameters before retrying?
> If not, it will most likely fail again.
> 
HW aborted request commonly comes from err handler with "ufshcd_clear_cmd",
In fact, I never seen that host aborted a request on host's own initiative.
If err handler successfully re-link and fix the host or device, retry will
most likely success.
> 
> >
> >Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>
> >
> >diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> >index ffe8d8608818..e050dcea1bea 100644
> >--- a/drivers/scsi/ufs/ufshcd.c
> >+++ b/drivers/scsi/ufs/ufshcd.c
> >@@ -4545,8 +4545,6 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba,
> >struct ufshcd_lrb *lrbp)
> > }
> > break;
> > case OCS_ABORTED:
> >-result |= DID_ABORT << 16;
> >-break;
> > case OCS_INVALID_COMMAND_STATUS:
> > result |= DID_REQUEUE << 16;
> > break;
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

-- 
Thanks,
Zang Leigang


本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!


[PATCH] scsi: ufs: check link active or not after switch to HS mode

2017-06-24 Thread Zang Leigang
Some device can successfully link and switch to HS mode. But failed
to do more. ufshcd_verify_dev_init can help to find this earlier.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index ffe8d8608818..eb03388fc4bd 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6373,6 +6373,14 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
__func__, ret);
goto out;
}
+
+   /*
+* Some device lost link after switch to HS mode. Check if
+* connect is established here.
+*/
+   ret = ufshcd_verify_dev_init(hba);
+   if (ret)
+   goto out;
}
 
/* set the state as operational after switching to desired gear */
-- 
2.13.0



[PATCH] scsi: ufs: flush eh_work when eh_work scheduled.

2017-06-24 Thread Zang Leigang
Forget a condition: eh_work scheduled but do not start to work.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e050dcea1bea..a2dff12713fc 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5807,7 +5807,8 @@ static int ufshcd_eh_host_reset_handler(struct scsi_cmnd 
*cmd)
do {
spin_lock_irqsave(hba->host->host_lock, flags);
if (!(work_pending(>eh_work) ||
-   hba->ufshcd_state == UFSHCD_STATE_RESET))
+   hba->ufshcd_state == UFSHCD_STATE_RESET ||
+   hba->ufshcd_state == UFSHCD_STATE_EH_SCHEDULED))
break;
spin_unlock_irqrestore(hba->host->host_lock, flags);
dev_dbg(hba->dev, "%s: reset in progress\n", __func__);
-- 
2.13.0



[PATCH] scsi: ufs: set host_byte to DID_REQUEUE when ocs = OCS_ABORTED

2017-06-24 Thread Zang Leigang
Host set ocs to OCS_ABORTED when clear a doorbell in err handler.
Then scsi_decide_disposition return SUCCESS. This may cause some
filesystem panic because a FAILED REQUESET. Requeue and complete is
better.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index ffe8d8608818..e050dcea1bea 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4545,8 +4545,6 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct 
ufshcd_lrb *lrbp)
}
break;
case OCS_ABORTED:
-   result |= DID_ABORT << 16;
-   break;
case OCS_INVALID_COMMAND_STATUS:
result |= DID_REQUEUE << 16;
break;
-- 
2.13.0



[PATCH] scsi: ufs: introduce a new ufshcd_statea UFSHCD_STATE_EH_SCHEDULED

2016-11-15 Thread Zang Leigang
Add a new ufshcd_state, indicats that an err handler may get to run
immediately. Use UFSHCD_STATE_ERROR here looks not literaly correct.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..59d4130 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -123,6 +123,7 @@ enum {
UFSHCD_STATE_RESET,
UFSHCD_STATE_ERROR,
UFSHCD_STATE_OPERATIONAL,
+   UFSHCD_STATE_EH_SCHEDULED,
 };
 
 /* UFSHCD error handling flags */
@@ -1410,6 +1411,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, 
struct scsi_cmnd *cmd)
switch (hba->ufshcd_state) {
case UFSHCD_STATE_OPERATIONAL:
break;
+   case UFSHCD_STATE_EH_SCHEDULED:
case UFSHCD_STATE_RESET:
err = SCSI_MLQUEUE_HOST_BUSY;
goto out_unlock;
@@ -4158,7 +4160,7 @@ static void ufshcd_check_errors(struct ufs_hba *hba)
/* block commands from scsi mid-layer */
scsi_block_requests(hba->host);
 
-   hba->ufshcd_state = UFSHCD_STATE_ERROR;
+   hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED;
schedule_work(>eh_work);
}
}
-- 
2.9.3

--
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: ufs: remove unnecessary UFSHCD_STATE_ERROR set

2016-11-15 Thread Zang Leigang
Ok, got it.
I will resend a new patch.

On Tue, Nov 15, 2016 at 11:00:12AM -0800, Subhash Jadavani wrote:
> On 2016-11-15 04:25, Zang Leigang wrote:
> >We set ufshcd_state to UFSHCD_STATE_ERROR when an err handler
> >fails. So I think UFSHCD_STATE_ERROR means host not works any more.
> >Set it before schedule eh_work is not correct.
> >
> >Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>
> >
> >diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> >index 05c7456..a7724ad 100644
> >--- a/drivers/scsi/ufs/ufshcd.c
> >+++ b/drivers/scsi/ufs/ufshcd.c
> >@@ -4158,7 +4158,6 @@ static void ufshcd_check_errors(struct
> >ufs_hba *hba)
> > /* block commands from scsi mid-layer */
> > scsi_block_requests(hba->host);
> >
> >-hba->ufshcd_state = UFSHCD_STATE_ERROR;
> 
> But we may still want to stop the new requests from being issued
> (via ufshcd_queuecommand) until error handler (ufshcd_err_handler())
> gets chance to run. May be a new intermediate state like
> UFSHCD_STATE_EH_SCHEDULED should be added and set here, we have to
> check the same in ufshcd_queuecommand() to return busy if
> ufshcd_state is UFSHCD_STATE_EH_SCHEDULED.
> 
> > schedule_work(>eh_work);
> > }
> > }
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: ufs: remove unnecessary UFSHCD_STATE_ERROR set

2016-11-15 Thread Zang Leigang
We set ufshcd_state to UFSHCD_STATE_ERROR when an err handler
fails. So I think UFSHCD_STATE_ERROR means host not works any more.
Set it before schedule eh_work is not correct.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..a7724ad 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4158,7 +4158,6 @@ static void ufshcd_check_errors(struct ufs_hba *hba)
/* block commands from scsi mid-layer */
scsi_block_requests(hba->host);
 
-   hba->ufshcd_state = UFSHCD_STATE_ERROR;
schedule_work(>eh_work);
}
}
-- 
2.9.3

--
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] UFS: Date Segment only need for WRITE DESCRIPTOR

2016-08-25 Thread Zang Leigang
Some device may cause a compatibility issue while receiving a Query UPIU
with Data Segment which does not expected.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>
---
 drivers/scsi/ufs/ufshcd.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f08d41a..9b21d88 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1266,9 +1266,12 @@ static void ufshcd_prepare_utp_query_req_upiu(struct 
ufs_hba *hba,
ucd_req_ptr->header.dword_1 = UPIU_HEADER_DWORD(
0, query->request.query_func, 0, 0);
 
-   /* Data segment length */
-   ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
-   0, 0, len >> 8, (u8)len);
+   /* Data segment length only need for WRITE_DESC */
+   if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
+   ucd_req_ptr->header.dword_2 =
+   UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
+   else
+   ucd_req_ptr->header.dword_2 = 0;
 
/* Copy the Query Request buffer as is */
memcpy(_req_ptr->qr, >request.upiu_req,
-- 
2.9.3

--
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] UFS: Date Segment only need for WRITE DESCRIPTOR

2016-08-25 Thread Zang Leigang
Some device may cause a compatibility issue while receiving a Query UPIU
with Data Segment which does not expected.

Signed-off-by: Zang Leigang <zangleig...@hisilicon.com>
---
 drivers/scsi/ufs/ufshcd.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f08d41a..7292333 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1266,9 +1266,12 @@ static void ufshcd_prepare_utp_query_req_upiu(struct 
ufs_hba *hba,
ucd_req_ptr->header.dword_1 = UPIU_HEADER_DWORD(
0, query->request.query_func, 0, 0);
 
-   /* Data segment length */
-   ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
-   0, 0, len >> 8, (u8)len);
+   /* Data segment length only need for WRITE_DESC */
+   if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE)
+   ucd_req_ptr->header.dword_2 =
+   UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
+   else
+   ucd_req_ptr->header.dword_2 = 0;
 
/* Copy the Query Request buffer as is */
memcpy(_req_ptr->qr, >request.upiu_req,
-- 
2.9.3

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