Re: [PATCH v1 1/8] ufs: add some vendor specific operations

2016-10-06 Thread Subhash Jadavani

On 2016-10-06 22:04, Kiwoong Kim wrote:

Hi, Subhash.


Hi Kim,

On 2016-10-06 18:38, Kiwoong Kim wrote:
> Hi, Subhash.
>
> Thank for your comments.
> I added my opinions below.
>
> Regards
>
>> Hi Kim,
>>
>>
>> On 2016-10-06 01:17, Kiwoong Kim wrote:
>> > Some UFS host controller may need to require some sequences before
>> > used clocks are turned on or off.
>> > e.g) control internal gates in UFS host
>>
>>
>> I believe we are doing couple of other things as well other than
>> clock control in this patch, such as hibern8 notify, *nexus_t*
>> notify. You might want to separate each in different patches. Also,
>> please find more

are you going to divide this patch?


Yes.



>> additional below.
>>
>> >
>> > Signed-off-by: Kiwoong Kim 
>> > ---
>> >  drivers/scsi/ufs/ufshcd.c |   15 +--
>> >  drivers/scsi/ufs/ufshcd.h |   37
+
>> >  2 files changed, 50 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> > index 05c7456..82c9a40 100644
>> > --- a/drivers/scsi/ufs/ufshcd.c
>> > +++ b/drivers/scsi/ufs/ufshcd.c
>> > @@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct
>> > Scsi_Host *host, struct scsi_cmnd *cmd)
>> >
>> >   /* issue command to the controller */
>> >   spin_lock_irqsave(hba->host->host_lock, flags);
>> > + ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
>> >   ufshcd_send_command(hba, tag);
>> >  out_unlock:
>> >   spin_unlock_irqrestore(hba->host->host_lock, flags); @@

-1683,6

>> > +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
>> >   /* Make sure descriptors are ready before ringing the

doorbell */

>> >   wmb();
>> >   spin_lock_irqsave(hba->host->host_lock, flags);
>> > + ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
>>
>> what does "next_t_xfer_req" means? why do we need this? and do you
>> think
>> it may be useful/needed for non-exynos UFS host controllers as well?
>
> Exynos UFS controller has  a logic to determine which slot owns
> received
> UPIU,
> to handle it properly.
> This only run when software set a exynos-specific SFR to bitwise-1.
> If the controller sends non-dependent request, such as NOP,
> software would set the SFR to 0 because it don't need to determine.

Ok, this is very specific to your controller. But i guess still the
callback names should be generic enough so that it may be used by 
other

host controller drivers if required in future.
Can we think of different name? something like notify_cmd_issue?


Okay, that's good.

Also, why do we need to pass whole pointer to pass scsi command 
pointer?
what all scsi cmnd parameters will be used by exynos driver? may be 
your

full patch series might give more idea?


I get it. How about using (void *) type pointer as an additional 
argument

To pass anything away to platform-specific driver ?


Should be ok.




Thank you
Regards




>
> An answer of your question depends on whether other controllers
> has a logic to function that.
>
>>
>>
>>
>> >   ufshcd_send_command(hba, tag);
>> >   spin_unlock_irqrestore(hba->host->host_lock, flags);
>> >
>> > @@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct
>> > ufs_hba *hba)
>> >   int ret;
>> >   struct uic_command uic_cmd = {0};
>> >
>> > + ufshcd_vops_hibern8_notify(hba, true, PRE_CHANGE);
>> > +
>> >   uic_cmd.command = UIC_CMD_DME_HIBER_ENTER;
>> >   ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
>> >
>> > @@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(struct
>> > ufs_hba *hba)
>> >*/
>> >   if (ufshcd_link_recovery(hba))
>> >   ret = -ENOLINK;
>> > - }
>> > + } else
>> > + ufshcd_vops_hibern8_notify(hba, true, POST_CHANGE);
>> >
>> >   return ret;
>> >  }
>> > @@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct
>> > ufs_hba *hba)
>> >   struct uic_command uic_cmd = {0};
>> >   int ret;
>> >
>> > + ufshcd_vops_hibern8_notify(hba, false, PRE_CHANGE);
>> > +
>> >   uic_cmd.command = UIC_CMD_DME_HIBER_EXIT;
>> >   ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
>> >   if (ret) {
>> >   dev_err(hba->dev, "%s: hibern8 exit failed. ret =

%d\n",

>> >   __func__, ret);
>> >   ret = ufshcd_link_recovery(hba);
>> > - }
>> > + } else
>> > + ufshcd_vops_hibern8_notify(hba, false, POST_CHANGE);
>> >
>> >   return ret;
>> >  }
>> > @@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba
>> > *hba, int lun_id, int task_id,
>> >   task_req_upiup->input_param2 = cpu_to_be32(task_id);
>> >
>> >   /* send command to the controller */
>> > + ufshcd_vops_set_nexus_t_task_mgmt(hba, free_slot,

tm_function);


Same as above, we need to think of more generic name?



Thanks,
Subhash

>>
>>
>> Same question as "next_t_xfer_req". what does "next_t_task_mgmt"
>> means?
>> why do we need this? and do you think it may be useful/needed for
>> non-exynos UFS host controllers as well?
>
> Please refer to what I 

RE: [PATCH v1 1/8] ufs: add some vendor specific operations

2016-10-06 Thread Kiwoong Kim
Hi, Subhash.

> Hi Kim,
> 
> On 2016-10-06 18:38, Kiwoong Kim wrote:
> > Hi, Subhash.
> >
> > Thank for your comments.
> > I added my opinions below.
> >
> > Regards
> >
> >> Hi Kim,
> >>
> >>
> >> On 2016-10-06 01:17, Kiwoong Kim wrote:
> >> > Some UFS host controller may need to require some sequences before
> >> > used clocks are turned on or off.
> >> > e.g) control internal gates in UFS host
> >>
> >>
> >> I believe we are doing couple of other things as well other than
> >> clock control in this patch, such as hibern8 notify, *nexus_t*
> >> notify. You might want to separate each in different patches. Also,
> >> please find more
> 
> are you going to divide this patch?

Yes.

> 
> >> additional below.
> >>
> >> >
> >> > Signed-off-by: Kiwoong Kim 
> >> > ---
> >> >  drivers/scsi/ufs/ufshcd.c |   15 +--
> >> >  drivers/scsi/ufs/ufshcd.h |   37
> +
> >> >  2 files changed, 50 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> >> > index 05c7456..82c9a40 100644
> >> > --- a/drivers/scsi/ufs/ufshcd.c
> >> > +++ b/drivers/scsi/ufs/ufshcd.c
> >> > @@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct
> >> > Scsi_Host *host, struct scsi_cmnd *cmd)
> >> >
> >> >  /* issue command to the controller */
> >> >  spin_lock_irqsave(hba->host->host_lock, flags);
> >> > +ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
> >> >  ufshcd_send_command(hba, tag);
> >> >  out_unlock:
> >> >  spin_unlock_irqrestore(hba->host->host_lock, flags); @@
-1683,6
> >> > +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
> >> >  /* Make sure descriptors are ready before ringing the
doorbell */
> >> >  wmb();
> >> >  spin_lock_irqsave(hba->host->host_lock, flags);
> >> > +ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
> >>
> >> what does "next_t_xfer_req" means? why do we need this? and do you
> >> think
> >> it may be useful/needed for non-exynos UFS host controllers as well?
> >
> > Exynos UFS controller has  a logic to determine which slot owns
> > received
> > UPIU,
> > to handle it properly.
> > This only run when software set a exynos-specific SFR to bitwise-1.
> > If the controller sends non-dependent request, such as NOP,
> > software would set the SFR to 0 because it don't need to determine.
> 
> Ok, this is very specific to your controller. But i guess still the
> callback names should be generic enough so that it may be used by other
> host controller drivers if required in future.
> Can we think of different name? something like notify_cmd_issue?

Okay, that's good.

> Also, why do we need to pass whole pointer to pass scsi command pointer?
> what all scsi cmnd parameters will be used by exynos driver? may be your
> full patch series might give more idea?

I get it. How about using (void *) type pointer as an additional argument
To pass anything away to platform-specific driver ?

Thank you
Regards

> 
> 
> >
> > An answer of your question depends on whether other controllers
> > has a logic to function that.
> >
> >>
> >>
> >>
> >> >  ufshcd_send_command(hba, tag);
> >> >  spin_unlock_irqrestore(hba->host->host_lock, flags);
> >> >
> >> > @@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct
> >> > ufs_hba *hba)
> >> >  int ret;
> >> >  struct uic_command uic_cmd = {0};
> >> >
> >> > +ufshcd_vops_hibern8_notify(hba, true, PRE_CHANGE);
> >> > +
> >> >  uic_cmd.command = UIC_CMD_DME_HIBER_ENTER;
> >> >  ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
> >> >
> >> > @@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(struct
> >> > ufs_hba *hba)
> >> >   */
> >> >  if (ufshcd_link_recovery(hba))
> >> >  ret = -ENOLINK;
> >> > -}
> >> > +} else
> >> > +ufshcd_vops_hibern8_notify(hba, true, POST_CHANGE);
> >> >
> >> >  return ret;
> >> >  }
> >> > @@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct
> >> > ufs_hba *hba)
> >> >  struct uic_command uic_cmd = {0};
> >> >  int ret;
> >> >
> >> > +ufshcd_vops_hibern8_notify(hba, false, PRE_CHANGE);
> >> > +
> >> >  uic_cmd.command = UIC_CMD_DME_HIBER_EXIT;
> >> >  ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
> >> >  if (ret) {
> >> >  dev_err(hba->dev, "%s: hibern8 exit failed. ret =
%d\n",
> >> >  __func__, ret);
> >> >  ret = ufshcd_link_recovery(hba);
> >> > -}
> >> > +} else
> >> > +ufshcd_vops_hibern8_notify(hba, false, POST_CHANGE);
> >> >
> >> >  return ret;
> >> >  }
> >> > @@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba
> >> > *hba, int lun_id, int task_id,
> >> >  task_req_upiup->input_param2 = 

Re: [PATCH v1 1/8] ufs: add some vendor specific operations

2016-10-06 Thread Subhash Jadavani

Hi Kim,

On 2016-10-06 18:38, Kiwoong Kim wrote:

Hi, Subhash.

Thank for your comments.
I added my opinions below.

Regards


Hi Kim,


On 2016-10-06 01:17, Kiwoong Kim wrote:
> Some UFS host controller may need to require some sequences before
> used clocks are turned on or off.
> e.g) control internal gates in UFS host


I believe we are doing couple of other things as well other than clock
control in this patch, such as hibern8 notify, *nexus_t* notify. You 
might

want to separate each in different patches. Also, please find more


are you going to divide this patch?


additional below.

>
> Signed-off-by: Kiwoong Kim 
> ---
>  drivers/scsi/ufs/ufshcd.c |   15 +--
>  drivers/scsi/ufs/ufshcd.h |   37 +
>  2 files changed, 50 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 05c7456..82c9a40 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host
> *host, struct scsi_cmnd *cmd)
>
>/* issue command to the controller */
>spin_lock_irqsave(hba->host->host_lock, flags);
> +  ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
>ufshcd_send_command(hba, tag);
>  out_unlock:
>spin_unlock_irqrestore(hba->host->host_lock, flags);
> @@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba
> *hba,
>/* Make sure descriptors are ready before ringing the doorbell */
>wmb();
>spin_lock_irqsave(hba->host->host_lock, flags);
> +  ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);

what does "next_t_xfer_req" means? why do we need this? and do you 
think

it may be useful/needed for non-exynos UFS host controllers as well?


Exynos UFS controller has  a logic to determine which slot owns 
received

UPIU,
to handle it properly.
This only run when software set a exynos-specific SFR to bitwise-1.
If the controller sends non-dependent request, such as NOP,
software would set the SFR to 0 because it don't need to determine.


Ok, this is very specific to your controller. But i guess still the 
callback names should be generic enough so that it may be used by other 
host controller drivers if required in future.

Can we think of different name? something like notify_cmd_issue?
Also, why do we need to pass whole pointer to pass scsi command pointer? 
what all scsi cmnd parameters will be used by exynos driver? may be your 
full patch series might give more idea?





An answer of your question depends on whether other controllers
has a logic to function that.





>ufshcd_send_command(hba, tag);
>spin_unlock_irqrestore(hba->host->host_lock, flags);
>
> @@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct
> ufs_hba *hba)
>int ret;
>struct uic_command uic_cmd = {0};
>
> +  ufshcd_vops_hibern8_notify(hba, true, PRE_CHANGE);
> +
>uic_cmd.command = UIC_CMD_DME_HIBER_ENTER;
>ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
>
> @@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(struct
> ufs_hba *hba)
> */
>if (ufshcd_link_recovery(hba))
>ret = -ENOLINK;
> -  }
> +  } else
> +  ufshcd_vops_hibern8_notify(hba, true, POST_CHANGE);
>
>return ret;
>  }
> @@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct
> ufs_hba *hba)
>struct uic_command uic_cmd = {0};
>int ret;
>
> +  ufshcd_vops_hibern8_notify(hba, false, PRE_CHANGE);
> +
>uic_cmd.command = UIC_CMD_DME_HIBER_EXIT;
>ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
>if (ret) {
>dev_err(hba->dev, "%s: hibern8 exit failed. ret = %d\n",
>__func__, ret);
>ret = ufshcd_link_recovery(hba);
> -  }
> +  } else
> +  ufshcd_vops_hibern8_notify(hba, false, POST_CHANGE);
>
>return ret;
>  }
> @@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba
> *hba, int lun_id, int task_id,
>task_req_upiup->input_param2 = cpu_to_be32(task_id);
>
>/* send command to the controller */
> +  ufshcd_vops_set_nexus_t_task_mgmt(hba, free_slot, tm_function);


Same as above, we need to think of more generic name?



Thanks,
Subhash




Same question as "next_t_xfer_req". what does "next_t_task_mgmt" 
means?

why do we need this? and do you think it may be useful/needed for
non-exynos UFS host controllers as well?


Please refer to what I mentioned above.




>__set_bit(free_slot, >outstanding_tasks);
>
>/* Make sure descriptors are ready before ringing the task doorbell
> */
> @@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> *hba, bool on,
>if (!head || list_empty(head))
>goto out;
>
> +  ufshcd_vops_pre_setup_clocks(hba, on);
> +

I don't think we need a different op for this, we can simply use the
existing op and add one more argument to it to indicate
PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH 

[RESEND PATCH v3] scsi: ufshcd: fix possible unclocked register access

2016-10-06 Thread Subhash Jadavani
Vendor specific setup_clocks callback may require the clocks managed
by ufshcd driver to be ON. So if the vendor specific setup_clocks callback
is called while the required clocks are turned off, it could result into
unclocked register access.

To prevent possible unclock register access, this change adds one more
argument to setup_clocks callback to let it know whether it is called
pre/post the clock changes by core driver.

Signed-off-by: Subhash Jadavani 
---
Changes from v2:
* Added one more argument to setup_clocks callback, this should address
  Kiwoong Kim's comments on v2.

Changes from v1:
* Don't call ufshcd_vops_setup_clocks() again for clock off
---
 drivers/scsi/ufs/ufs-qcom.c | 10 ++
 drivers/scsi/ufs/ufshcd.c   | 17 -
 drivers/scsi/ufs/ufshcd.h   |  8 +---
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 3aedf73..3c4f602 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1094,10 +1094,12 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba)
  * ufs_qcom_setup_clocks - enables/disable clocks
  * @hba: host controller instance
  * @on: If true, enable clocks else disable them.
+ * @status: PRE_CHANGE or POST_CHANGE notify
  *
  * Returns 0 on success, non-zero on failure.
  */
-static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on)
+static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
+enum ufs_notify_change_status status)
 {
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
int err;
@@ -,7 +1113,7 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, 
bool on)
if (!host)
return 0;
 
-   if (on) {
+   if (on && (status == POST_CHANGE)) {
err = ufs_qcom_phy_enable_iface_clk(host->generic_phy);
if (err)
goto out;
@@ -1130,7 +1132,7 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, 
bool on)
if (vote == host->bus_vote.min_bw_vote)
ufs_qcom_update_bus_bw_vote(host);
 
-   } else {
+   } else if (!on && (status == PRE_CHANGE)) {
 
/* M-PHY RMMI interface clocks can be turned off */
ufs_qcom_phy_disable_iface_clk(host->generic_phy);
@@ -1254,7 +1256,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
ufs_qcom_set_caps(hba);
ufs_qcom_advertise_quirks(hba);
 
-   ufs_qcom_setup_clocks(hba, true);
+   ufs_qcom_setup_clocks(hba, true, POST_CHANGE);
 
if (hba->dev->id < MAX_UFS_QCOM_HOSTS)
ufs_qcom_hosts[hba->dev->id] = host;
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..571a2f6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5389,6 +5389,10 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, 
bool on,
if (!head || list_empty(head))
goto out;
 
+   ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE);
+   if (ret)
+   return ret;
+
list_for_each_entry(clki, head, list) {
if (!IS_ERR_OR_NULL(clki->clk)) {
if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
@@ -5410,7 +5414,10 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, 
bool on,
}
}
 
-   ret = ufshcd_vops_setup_clocks(hba, on);
+   ret = ufshcd_vops_setup_clocks(hba, on, POST_CHANGE);
+   if (ret)
+   return ret;
+
 out:
if (ret) {
list_for_each_entry(clki, head, list) {
@@ -5500,8 +5507,6 @@ static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
if (!hba->vops)
return;
 
-   ufshcd_vops_setup_clocks(hba, false);
-
ufshcd_vops_setup_regulators(hba, false);
 
ufshcd_vops_exit(hba);
@@ -5905,10 +5910,6 @@ disable_clks:
if (ret)
goto set_link_active;
 
-   ret = ufshcd_vops_setup_clocks(hba, false);
-   if (ret)
-   goto vops_resume;
-
if (!ufshcd_is_link_active(hba))
ufshcd_setup_clocks(hba, false);
else
@@ -5925,8 +5926,6 @@ disable_clks:
ufshcd_hba_vreg_set_lpm(hba);
goto out;
 
-vops_resume:
-   ufshcd_vops_resume(hba, pm_op);
 set_link_active:
ufshcd_vreg_set_hpm(hba);
if (ufshcd_is_link_hibern8(hba) && !ufshcd_uic_hibern8_exit(hba))
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 430bef1..afff7f4 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -273,7 +273,8 @@ struct ufs_hba_variant_ops {
u32 (*get_ufs_hci_version)(struct ufs_hba *);
int (*clk_scale_notify)(struct ufs_hba *, bool,
enum ufs_notify_change_status);
-   int (*setup_clocks)(struct ufs_hba *, bool);
+   int 

[PATCH v3] scsi: ufshcd: fix possible unclocked register access

2016-10-06 Thread Subhash Jadavani
Vendor specific setup_clocks callback may require the clocks managed
by ufshcd driver to be ON. So if the vendor specific setup_clocks callback
is called while the required clocks are turned off, it could result into
unclocked register access.

To prevent possible unclock register access, this change adds one more
argument to setup_clocks callback to let it know whether it is called
pre/post the clock changes by core driver.

Signed-off-by: Subhash Jadavani 
---
 drivers/scsi/ufs/ufs-qcom.c | 10 ++
 drivers/scsi/ufs/ufshcd.c   | 17 -
 drivers/scsi/ufs/ufshcd.h   |  8 +---
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 3aedf73..3c4f602 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1094,10 +1094,12 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba)
  * ufs_qcom_setup_clocks - enables/disable clocks
  * @hba: host controller instance
  * @on: If true, enable clocks else disable them.
+ * @status: PRE_CHANGE or POST_CHANGE notify
  *
  * Returns 0 on success, non-zero on failure.
  */
-static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on)
+static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
+enum ufs_notify_change_status status)
 {
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
int err;
@@ -,7 +1113,7 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, 
bool on)
if (!host)
return 0;
 
-   if (on) {
+   if (on && (status == POST_CHANGE)) {
err = ufs_qcom_phy_enable_iface_clk(host->generic_phy);
if (err)
goto out;
@@ -1130,7 +1132,7 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, 
bool on)
if (vote == host->bus_vote.min_bw_vote)
ufs_qcom_update_bus_bw_vote(host);
 
-   } else {
+   } else if (!on && (status == PRE_CHANGE)) {
 
/* M-PHY RMMI interface clocks can be turned off */
ufs_qcom_phy_disable_iface_clk(host->generic_phy);
@@ -1254,7 +1256,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
ufs_qcom_set_caps(hba);
ufs_qcom_advertise_quirks(hba);
 
-   ufs_qcom_setup_clocks(hba, true);
+   ufs_qcom_setup_clocks(hba, true, POST_CHANGE);
 
if (hba->dev->id < MAX_UFS_QCOM_HOSTS)
ufs_qcom_hosts[hba->dev->id] = host;
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..571a2f6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5389,6 +5389,10 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, 
bool on,
if (!head || list_empty(head))
goto out;
 
+   ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE);
+   if (ret)
+   return ret;
+
list_for_each_entry(clki, head, list) {
if (!IS_ERR_OR_NULL(clki->clk)) {
if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
@@ -5410,7 +5414,10 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, 
bool on,
}
}
 
-   ret = ufshcd_vops_setup_clocks(hba, on);
+   ret = ufshcd_vops_setup_clocks(hba, on, POST_CHANGE);
+   if (ret)
+   return ret;
+
 out:
if (ret) {
list_for_each_entry(clki, head, list) {
@@ -5500,8 +5507,6 @@ static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
if (!hba->vops)
return;
 
-   ufshcd_vops_setup_clocks(hba, false);
-
ufshcd_vops_setup_regulators(hba, false);
 
ufshcd_vops_exit(hba);
@@ -5905,10 +5910,6 @@ disable_clks:
if (ret)
goto set_link_active;
 
-   ret = ufshcd_vops_setup_clocks(hba, false);
-   if (ret)
-   goto vops_resume;
-
if (!ufshcd_is_link_active(hba))
ufshcd_setup_clocks(hba, false);
else
@@ -5925,8 +5926,6 @@ disable_clks:
ufshcd_hba_vreg_set_lpm(hba);
goto out;
 
-vops_resume:
-   ufshcd_vops_resume(hba, pm_op);
 set_link_active:
ufshcd_vreg_set_hpm(hba);
if (ufshcd_is_link_hibern8(hba) && !ufshcd_uic_hibern8_exit(hba))
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 430bef1..afff7f4 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -273,7 +273,8 @@ struct ufs_hba_variant_ops {
u32 (*get_ufs_hci_version)(struct ufs_hba *);
int (*clk_scale_notify)(struct ufs_hba *, bool,
enum ufs_notify_change_status);
-   int (*setup_clocks)(struct ufs_hba *, bool);
+   int (*setup_clocks)(struct ufs_hba *, bool,
+   enum ufs_notify_change_status);
int (*setup_regulators)(struct ufs_hba *, bool);
int (*hce_enable_notify)(struct 

RE: [PATCH v1 1/8] ufs: add some vendor specific operations

2016-10-06 Thread Kiwoong Kim
Hi, Subhash.

Thank for your comments.
I added my opinions below.

Regards

> Hi Kim,
> 
> 
> On 2016-10-06 01:17, Kiwoong Kim wrote:
> > Some UFS host controller may need to require some sequences before
> > used clocks are turned on or off.
> > e.g) control internal gates in UFS host
> 
> 
> I believe we are doing couple of other things as well other than clock
> control in this patch, such as hibern8 notify, *nexus_t* notify. You might
> want to separate each in different patches. Also, please find more
> additional below.
> 
> >
> > Signed-off-by: Kiwoong Kim 
> > ---
> >  drivers/scsi/ufs/ufshcd.c |   15 +--
> >  drivers/scsi/ufs/ufshcd.h |   37 +
> >  2 files changed, 50 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 05c7456..82c9a40 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host
> > *host, struct scsi_cmnd *cmd)
> >
> > /* issue command to the controller */
> > spin_lock_irqsave(hba->host->host_lock, flags);
> > +   ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
> > ufshcd_send_command(hba, tag);
> >  out_unlock:
> > spin_unlock_irqrestore(hba->host->host_lock, flags);
> > @@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba
> > *hba,
> > /* Make sure descriptors are ready before ringing the doorbell */
> > wmb();
> > spin_lock_irqsave(hba->host->host_lock, flags);
> > +   ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
> 
> what does "next_t_xfer_req" means? why do we need this? and do you think
> it may be useful/needed for non-exynos UFS host controllers as well?

Exynos UFS controller has  a logic to determine which slot owns received
UPIU,
to handle it properly.
This only run when software set a exynos-specific SFR to bitwise-1.
If the controller sends non-dependent request, such as NOP,
software would set the SFR to 0 because it don't need to determine.

An answer of your question depends on whether other controllers
has a logic to function that.

> 
> 
> 
> > ufshcd_send_command(hba, tag);
> > spin_unlock_irqrestore(hba->host->host_lock, flags);
> >
> > @@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct
> > ufs_hba *hba)
> > int ret;
> > struct uic_command uic_cmd = {0};
> >
> > +   ufshcd_vops_hibern8_notify(hba, true, PRE_CHANGE);
> > +
> > uic_cmd.command = UIC_CMD_DME_HIBER_ENTER;
> > ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
> >
> > @@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(struct
> > ufs_hba *hba)
> >  */
> > if (ufshcd_link_recovery(hba))
> > ret = -ENOLINK;
> > -   }
> > +   } else
> > +   ufshcd_vops_hibern8_notify(hba, true, POST_CHANGE);
> >
> > return ret;
> >  }
> > @@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct
> > ufs_hba *hba)
> > struct uic_command uic_cmd = {0};
> > int ret;
> >
> > +   ufshcd_vops_hibern8_notify(hba, false, PRE_CHANGE);
> > +
> > uic_cmd.command = UIC_CMD_DME_HIBER_EXIT;
> > ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
> > if (ret) {
> > dev_err(hba->dev, "%s: hibern8 exit failed. ret = %d\n",
> > __func__, ret);
> > ret = ufshcd_link_recovery(hba);
> > -   }
> > +   } else
> > +   ufshcd_vops_hibern8_notify(hba, false, POST_CHANGE);
> >
> > return ret;
> >  }
> > @@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba
> > *hba, int lun_id, int task_id,
> > task_req_upiup->input_param2 = cpu_to_be32(task_id);
> >
> > /* send command to the controller */
> > +   ufshcd_vops_set_nexus_t_task_mgmt(hba, free_slot, tm_function);
> 
> 
> Same question as "next_t_xfer_req". what does "next_t_task_mgmt" means?
> why do we need this? and do you think it may be useful/needed for
> non-exynos UFS host controllers as well?

Please refer to what I mentioned above.

> 
> 
> > __set_bit(free_slot, >outstanding_tasks);
> >
> > /* Make sure descriptors are ready before ringing the task doorbell
> > */
> > @@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> > *hba, bool on,
> > if (!head || list_empty(head))
> > goto out;
> >
> > +   ufshcd_vops_pre_setup_clocks(hba, on);
> > +
> 
> I don't think we need a different op for this, we can simply use the
> existing op and add one more argument to it to indicate
> PRE_CHANGE/POST_CHANGE. If you agree with my response to "[PATCH v2]
> scsi: ufshcd: fix possible unclocked register access" patch, i can
> update send out v3 of my patch and then you can rebase your patch series
> on top of my patch.

Okay, I agree with you. Then I assume that you would do that
and will change the patch.

> 
> 
> > list_for_each_entry(clki, head, list) {
> > if 

Re: [PATCH v2] scsi: ufshcd: fix possible unclocked register access

2016-10-06 Thread Subhash Jadavani

On 2016-10-06 18:16, Kiwoong Kim wrote:

Hi, Subhash.


Thanks Kim for the response.

On 2016-10-06 03:28, Kiwoong Kim wrote:
> Hi, Subhash.
>
> Some UFS host controllers may need to call the vendor specific
> callback before and after controlling by clock control framework,
> regardless of whether available clocks are turned on or off.

Are you suggesting to call ufshcd_vops_setup_clocks() 2 times, one 
before
the on/off by ufshcd core driver and one after the on/off? If yes, 
then we

also have add 3rd argument clarifying if this is PRE_CHANGE or

POST_CHANGE.


>
> Is there any special reason to limit to invoke the callback
> only when the clocks are turned on or not?
>
> Besides, the callback is acknowledged from core driver
> because 2nd argument is whether the clocks are turned on or not.
>
> If you have any other idea, please let me know.

This is my suggestion:
1. Add 3rd argument to setup_clocks ops to let the vendor callback
function know if this is called PRE_CHANGE or POST_CHANGE.
2. If #1 is in place, call setup_clocks 2 times, one with PRE_CHANGE
argument before making any clock changes in core driver, 2nd with
POST_CHANGE argument after making the clock changes to core driver.


Yes, that's exactly the same what I mean.


Thanks, Will send out new version adding that.



Thanks




Let me know if this would work or not.

Thanks,
Subhash

>
> Thanks
> Regards
>
>> Vendor specific setup_clocks callback may require the clocks managed
>> by ufshcd driver to be ON. So if the vendor specific setup_clocks
>> callback
>> is called while the required clocks are turned off, it could result
>> into
>> unclocked register access.
>>
>> To prevent possible unclock register access, this change makes sure
>> that
>> required clocks remain enabled before calling into vendor specific
>> setup_clocks callback.
>>
>> Signed-off-by: Subhash Jadavani 
>> ---
>> Changes from v2:
>> * Don't call ufshcd_vops_setup_clocks() again for clock off
>> ---
>>  drivers/scsi/ufs/ufshcd.c | 22 +-
>>  1 file changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index 05c7456..c1a77d3 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -5389,6 +5389,17 @@ static int __ufshcd_setup_clocks(struct ufs_hba
>> *hba, bool on,
>>if (!head || list_empty(head))
>>goto out;
>>
>> +  /*
>> +   * vendor specific setup_clocks ops may depend on clocks managed by
>> +   * this standard driver hence call the vendor specific setup_clocks
>> +   * before disabling the clocks managed here.
>> +   */
>> +  if (!on) {
>> +  ret = ufshcd_vops_setup_clocks(hba, on);
>> +  if (ret)
>> +  return ret;
>> +  }
>> +
>>list_for_each_entry(clki, head, list) {
>>if (!IS_ERR_OR_NULL(clki->clk)) {
>>if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
>> @@ -5410,7 +5421,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba
>> *hba, bool on,
>>}
>>}
>>
>> -  ret = ufshcd_vops_setup_clocks(hba, on);
>> +  /*
>> +   * vendor specific setup_clocks ops may depend on clocks managed by
>> +   * this standard driver hence call the vendor specific setup_clocks
>> +   * after enabling the clocks managed here.
>> +   */
>> +  if (on) {
>> +  ret = ufshcd_vops_setup_clocks(hba, on);
>> +  if (ret)
>> +  return ret;
>> +  }
>>  out:
>>if (ret) {
>>list_for_each_entry(clki, head, list) {
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
>> Forum,
>> a Linux Foundation Collaborative Project
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-scsi"
>> in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> --
> 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

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



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


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

RE: [PATCH v1 0/8] Support for Exynos specific UFS driver

2016-10-06 Thread Kiwoong Kim
Hi, Subhash

You're right.
I submitted one of  patches first to link to the previous summary mail
thread,
but it failed. I'll try it again.

Thank you
Regards

> Hi Kim,
> 
> 
> On 2016-10-06 01:12, Kiwoong Kim wrote:
> > This series of patches introduce support for Exynos specific UFS
> > driver.
> > An original version of this has been applied on mass production of
> > commercial mobile devices.
> >
> >  Documentation/devicetree/bindings/ufs/ufs-exynos.txt |   93 +
> >  drivers/scsi/ufs/Kconfig  |   10 +
> >  drivers/scsi/ufs/Makefile |1 +
> >  drivers/scsi/ufs/mphy.h|   38
> > +
> >  drivers/scsi/ufs/ufs-exynos.c| 2084
> > 
> >  drivers/scsi/ufs/ufs-exynos.h|  621
> > ++
> >  drivers/scsi/ufs/ufshcd.c |  146
> > +-
> >  drivers/scsi/ufs/ufshcd.h |   62 +
> >  drivers/scsi/ufs/ufshci.h |   14
> > +-
> >  drivers/scsi/ufs/unipro.h |   24 +
> >  10 files changed, 3073 insertions(+), 20 deletions(-)  create mode
> > 100644 Documentation/devicetree/bindings/ufs/ufs-exynos.txt
> >  create mode 100644 drivers/scsi/ufs/mphy.h  create mode 100644
> > drivers/scsi/ufs/ufs-exynos.c  create mode 100644
> > drivers/scsi/ufs/ufs-exynos.h
> 
> This supposed to be 8-patch series but i only patch #1 (subject: [PATCH
> v1 1/8] ufs: add some vendor specific operations) on mailing list. Can you
> please send out the full patch series?
> 
> --
> 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


--
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: fix race between clock gating and devfreq scaling work

2016-10-06 Thread Subhash Jadavani
UFS devfreq clock scaling work may require clocks to be ON if it need to
execute some UFS commands hence it may request for clock hold before
issuing the command. But if UFS clock gating work is already running in
parallel, ungate work would end up waiting for the clock gating work to
finish and as clock gating work would also wait for the clock scaling work
to finish, we would enter in deadlock state. Here is the call trace during
this deadlock state:

Workqueue: devfreq_wq devfreq_monitor
__switch_to
__schedule
schedule
schedule_timeout
wait_for_common
wait_for_completion
flush_work
ufshcd_hold
ufshcd_send_uic_cmd
ufshcd_dme_get_attr
ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div
ufs_qcom_clk_scale_notify
ufshcd_scale_clks
ufshcd_devfreq_target
update_devfreq
devfreq_monitor
process_one_work
worker_thread
kthread
ret_from_fork

Workqueue: events ufshcd_gate_work
__switch_to
__schedule
schedule
schedule_preempt_disabled
__mutex_lock_slowpath
mutex_lock
devfreq_monitor_suspend
devfreq_simple_ondemand_handler
devfreq_suspend_device
ufshcd_gate_work
process_one_work
worker_thread
kthread
ret_from_fork

Workqueue: events ufshcd_ungate_work
__switch_to
__schedule
schedule
schedule_timeout
wait_for_common
wait_for_completion
flush_work
__cancel_work_timer
cancel_delayed_work_sync
ufshcd_ungate_work
process_one_work
worker_thread
kthread
ret_from_fork

This change fixes this deadlock by doing this in devfreq work (devfreq_wq):
Try cancelling clock gating work. If we are able to cancel gating work
or it wasn't scheduled, hold the clock reference count until scaling is
in progress. If gate work is already running in parallel, let's skip
the frequecy scaling at this time and it will be retried once next scaling
window expires.

Signed-off-by: Subhash Jadavani 
---
 drivers/scsi/ufs/ufshcd.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..4011887 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6324,15 +6324,47 @@ static int ufshcd_devfreq_target(struct device *dev,
 {
int err = 0;
struct ufs_hba *hba = dev_get_drvdata(dev);
+   bool release_clk_hold = false;
+   unsigned long irq_flags;
 
if (!ufshcd_is_clkscaling_enabled(hba))
return -EINVAL;
 
+   spin_lock_irqsave(hba->host->host_lock, irq_flags);
+   if (ufshcd_eh_in_progress(hba)) {
+   spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
+   return 0;
+   }
+
+   if (ufshcd_is_clkgating_allowed(hba) &&
+   (hba->clk_gating.state != CLKS_ON)) {
+   if (cancel_delayed_work(>clk_gating.gate_work)) {
+   /* hold the vote until the scaling work is completed */
+   hba->clk_gating.active_reqs++;
+   release_clk_hold = true;
+   hba->clk_gating.state = CLKS_ON;
+   } else {
+   /*
+* Clock gating work seems to be running in parallel
+* hence skip scaling work to avoid deadlock between
+* current scaling work and gating work.
+*/
+   spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
+   return 0;
+   }
+   }
+   spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
+
if (*freq == UINT_MAX)
err = ufshcd_scale_clks(hba, true);
else if (*freq == 0)
err = ufshcd_scale_clks(hba, false);
 
+   spin_lock_irqsave(hba->host->host_lock, irq_flags);
+   if (release_clk_hold)
+   __ufshcd_release(hba);
+   spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
+
return err;
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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


RE: [PATCH v2] scsi: ufshcd: fix possible unclocked register access

2016-10-06 Thread Kiwoong Kim
Hi, Subhash.

> Thanks Kim for the response.
> 
> On 2016-10-06 03:28, Kiwoong Kim wrote:
> > Hi, Subhash.
> >
> > Some UFS host controllers may need to call the vendor specific
> > callback before and after controlling by clock control framework,
> > regardless of whether available clocks are turned on or off.
> 
> Are you suggesting to call ufshcd_vops_setup_clocks() 2 times, one before
> the on/off by ufshcd core driver and one after the on/off? If yes, then we
> also have add 3rd argument clarifying if this is PRE_CHANGE or
POST_CHANGE.
> 
> >
> > Is there any special reason to limit to invoke the callback
> > only when the clocks are turned on or not?
> >
> > Besides, the callback is acknowledged from core driver
> > because 2nd argument is whether the clocks are turned on or not.
> >
> > If you have any other idea, please let me know.
> 
> This is my suggestion:
> 1. Add 3rd argument to setup_clocks ops to let the vendor callback
> function know if this is called PRE_CHANGE or POST_CHANGE.
> 2. If #1 is in place, call setup_clocks 2 times, one with PRE_CHANGE
> argument before making any clock changes in core driver, 2nd with
> POST_CHANGE argument after making the clock changes to core driver.

Yes, that's exactly the same what I mean.

Thanks


> 
> Let me know if this would work or not.
> 
> Thanks,
> Subhash
> 
> >
> > Thanks
> > Regards
> >
> >> Vendor specific setup_clocks callback may require the clocks managed
> >> by ufshcd driver to be ON. So if the vendor specific setup_clocks
> >> callback
> >> is called while the required clocks are turned off, it could result
> >> into
> >> unclocked register access.
> >>
> >> To prevent possible unclock register access, this change makes sure
> >> that
> >> required clocks remain enabled before calling into vendor specific
> >> setup_clocks callback.
> >>
> >> Signed-off-by: Subhash Jadavani 
> >> ---
> >> Changes from v2:
> >> * Don't call ufshcd_vops_setup_clocks() again for clock off
> >> ---
> >>  drivers/scsi/ufs/ufshcd.c | 22 +-
> >>  1 file changed, 21 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> >> index 05c7456..c1a77d3 100644
> >> --- a/drivers/scsi/ufs/ufshcd.c
> >> +++ b/drivers/scsi/ufs/ufshcd.c
> >> @@ -5389,6 +5389,17 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> >> *hba, bool on,
> >>if (!head || list_empty(head))
> >>goto out;
> >>
> >> +  /*
> >> +   * vendor specific setup_clocks ops may depend on clocks managed by
> >> +   * this standard driver hence call the vendor specific setup_clocks
> >> +   * before disabling the clocks managed here.
> >> +   */
> >> +  if (!on) {
> >> +  ret = ufshcd_vops_setup_clocks(hba, on);
> >> +  if (ret)
> >> +  return ret;
> >> +  }
> >> +
> >>list_for_each_entry(clki, head, list) {
> >>if (!IS_ERR_OR_NULL(clki->clk)) {
> >>if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
> >> @@ -5410,7 +5421,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> >> *hba, bool on,
> >>}
> >>}
> >>
> >> -  ret = ufshcd_vops_setup_clocks(hba, on);
> >> +  /*
> >> +   * vendor specific setup_clocks ops may depend on clocks managed by
> >> +   * this standard driver hence call the vendor specific setup_clocks
> >> +   * after enabling the clocks managed here.
> >> +   */
> >> +  if (on) {
> >> +  ret = ufshcd_vops_setup_clocks(hba, on);
> >> +  if (ret)
> >> +  return ret;
> >> +  }
> >>  out:
> >>if (ret) {
> >>list_for_each_entry(clki, head, list) {
> >> --
> >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> >> Forum,
> >> a Linux Foundation Collaborative Project
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-scsi"
> >> in
> >> the body of a message to majord...@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> > --
> > 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
> 
> --
> 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


--
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 09/12] scsi/ncr5380: Pass hostdata pointer to register polling routines

2016-10-06 Thread Finn Thain
Pass a NCR5380_hostdata struct pointer to the board-specific routines
instead of a Scsi_Host struct pointer. This reduces pointer chasing in
the PIO and PDMA fast paths. The old way was a mistake because it is
slow and the board-specific code is not concerned with the mid-layer.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.c  | 33 -
 drivers/scsi/NCR5380.h  |  6 +++---
 drivers/scsi/mac_scsi.c | 10 +-
 3 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index eb40561..3f2bfd2 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -178,7 +178,7 @@ static inline void initialize_SCp(struct scsi_cmnd *cmd)
 
 /**
  * NCR5380_poll_politely2 - wait for two chip register values
- * @instance: controller to poll
+ * @hostdata: host private data
  * @reg1: 5380 register to poll
  * @bit1: Bitmask to check
  * @val1: Expected value
@@ -195,12 +195,11 @@ static inline void initialize_SCp(struct scsi_cmnd *cmd)
  * Returns 0 if either or both event(s) occurred otherwise -ETIMEDOUT.
  */
 
-static int NCR5380_poll_politely2(struct Scsi_Host *instance,
+static int NCR5380_poll_politely2(struct NCR5380_hostdata *hostdata,
   unsigned int reg1, u8 bit1, u8 val1,
   unsigned int reg2, u8 bit2, u8 val2,
   unsigned long wait)
 {
-   struct NCR5380_hostdata *hostdata = shost_priv(instance);
unsigned long n = hostdata->poll_loops;
unsigned long deadline = jiffies + wait;
 
@@ -561,7 +560,7 @@ static int NCR5380_maybe_reset_bus(struct Scsi_Host 
*instance)
case 3:
case 5:
shost_printk(KERN_ERR, instance, "SCSI bus busy, 
waiting up to five seconds\n");
-   NCR5380_poll_politely(instance,
+   NCR5380_poll_politely(hostdata,
  STATUS_REG, SR_BSY, 0, 5 * HZ);
break;
case 2:
@@ -1076,7 +1075,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host 
*instance,
 */
 
spin_unlock_irq(>lock);
-   err = NCR5380_poll_politely2(instance, MODE_REG, MR_ARBITRATE, 0,
+   err = NCR5380_poll_politely2(hostdata, MODE_REG, MR_ARBITRATE, 0,
INITIATOR_COMMAND_REG, ICR_ARBITRATION_PROGRESS,
   ICR_ARBITRATION_PROGRESS, HZ);
spin_lock_irq(>lock);
@@ -1202,7 +1201,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host 
*instance,
 * selection.
 */
 
-   err = NCR5380_poll_politely(instance, STATUS_REG, SR_BSY, SR_BSY,
+   err = NCR5380_poll_politely(hostdata, STATUS_REG, SR_BSY, SR_BSY,
msecs_to_jiffies(250));
 
if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == (SR_SEL | SR_IO)) {
@@ -1248,7 +1247,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host 
*instance,
 
/* Wait for start of REQ/ACK handshake */
 
-   err = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, HZ);
+   err = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, HZ);
spin_lock_irq(>lock);
if (err < 0) {
shost_printk(KERN_ERR, instance, "select: REQ timeout\n");
@@ -1338,7 +1337,7 @@ static int NCR5380_transfer_pio(struct Scsi_Host 
*instance,
 * valid
 */
 
-   if (NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 
HZ) < 0)
+   if (NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, 
HZ) < 0)
break;
 
dsprintk(NDEBUG_HANDSHAKE, instance, "REQ asserted\n");
@@ -1383,7 +1382,7 @@ static int NCR5380_transfer_pio(struct Scsi_Host 
*instance,
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_ACK);
}
 
-   if (NCR5380_poll_politely(instance,
+   if (NCR5380_poll_politely(hostdata,
  STATUS_REG, SR_REQ, 0, 5 * HZ) < 0)
break;
 
@@ -1483,7 +1482,7 @@ static int do_abort(struct Scsi_Host *instance)
 * the target sees, so we just handshake.
 */
 
-   rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 10 * 
HZ);
+   rc = NCR5380_poll_politely(hostdata, STATUS_REG, SR_REQ, SR_REQ, 10 * 
HZ);
if (rc < 0)
goto timeout;
 
@@ -1494,7 +1493,7 @@ static int do_abort(struct Scsi_Host *instance)
if (tmp != PHASE_MSGOUT) {
NCR5380_write(INITIATOR_COMMAND_REG,
  ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
-   rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * 
HZ);
+   

[PATCH v2 06/12] scsi/ncr5380: Improve hostdata struct member alignment and cache-ability

2016-10-06 Thread Finn Thain
Re-order struct members so that hot data lies at the beginning of the
struct and cold data at the end. Improve the comments while we're here.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.h | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index f0eea44..ceafa0c 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -219,27 +219,27 @@
 #define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
 
 struct NCR5380_hostdata {
-   NCR5380_implementation_fields;  /* implementation specific */
-   struct Scsi_Host *host; /* Host backpointer */
-   unsigned char id_mask, id_higher_mask;  /* 1 << id, all bits greater */
-   unsigned char busy[8];  /* index = target, bit = lun */
-   int dma_len;/* requested length of DMA */
-   unsigned char last_message; /* last message OUT */
-   struct scsi_cmnd *connected;/* currently connected cmnd */
-   struct scsi_cmnd *selecting;/* cmnd to be connected */
-   struct list_head unissued;  /* waiting to be issued */
-   struct list_head autosense; /* priority issue queue */
-   struct list_head disconnected;  /* waiting for reconnect */
-   spinlock_t lock;/* protects this struct */
-   int flags;
-   struct scsi_eh_save ses;
-   struct scsi_cmnd *sensing;
+   NCR5380_implementation_fields;  /* Board-specific data */
+   unsigned long poll_loops;   /* Register polling limit */
+   spinlock_t lock;/* Protects this struct */
+   struct scsi_cmnd *connected;/* Currently connected cmnd */
+   struct list_head disconnected;  /* Waiting for reconnect */
+   struct Scsi_Host *host; /* SCSI host backpointer */
+   struct workqueue_struct *work_q;/* SCSI host work queue */
+   struct work_struct main_task;   /* Work item for main loop */
+   int flags;  /* Board-specific quirks */
+   int dma_len;/* Requested length of DMA */
+   int read_overruns;  /* Transfer size reduction for DMA erratum */
+   struct list_head unissued;  /* Waiting to be issued */
+   struct scsi_cmnd *selecting;/* Cmnd to be connected */
+   struct list_head autosense; /* Priority cmnd queue */
+   struct scsi_cmnd *sensing;  /* Cmnd needing autosense */
+   struct scsi_eh_save ses;/* Cmnd state saved for EH */
+   unsigned char busy[8];  /* Index = target, bit = lun */
+   unsigned char id_mask;  /* 1 << Host ID */
+   unsigned char id_higher_mask;   /* All bits above id_mask */
+   unsigned char last_message; /* Last Message Out */
char info[256];
-   int read_overruns;/* number of bytes to cut from a
-  * transfer to handle chip overruns */
-   struct work_struct main_task;
-   struct workqueue_struct *work_q;
-   unsigned long poll_loops;   /* register polling limit */
 };
 
 #ifdef __KERNEL__
-- 
2.7.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 07/12] scsi/ncr5380: Store IO ports and addresses in host private data

2016-10-06 Thread Finn Thain
The various 5380 drivers inconsistently store register pointers
either in the Scsi_Host struct "legacy crap" area or in special,
board-specific members of the NCR5380_hostdata struct. Uniform
use of the latter struct makes for simpler and faster code (see
the following patches) and helps to reduce use of the
NCR5380_implementation_fields macro.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.c  |  8 +++---
 drivers/scsi/NCR5380.h  |  5 
 drivers/scsi/arm/cumana_1.c | 60 
 drivers/scsi/arm/oak.c  | 23 
 drivers/scsi/dmx3191d.c | 14 +++---
 drivers/scsi/g_NCR5380.c| 67 +++--
 drivers/scsi/g_NCR5380.h|  6 ++--
 drivers/scsi/mac_scsi.c | 27 ++
 drivers/scsi/sun3_scsi.c|  5 +++-
 9 files changed, 118 insertions(+), 97 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 25ee5be..82fd37d 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -437,14 +437,14 @@ static void prepare_info(struct Scsi_Host *instance)
struct NCR5380_hostdata *hostdata = shost_priv(instance);
 
snprintf(hostdata->info, sizeof(hostdata->info),
-"%s, io_port 0x%lx, n_io_port %d, "
-"base 0x%lx, irq %d, "
+"%s, irq %d, "
+"io_port 0x%lx, base 0x%lx, "
 "can_queue %d, cmd_per_lun %d, "
 "sg_tablesize %d, this_id %d, "
 "flags { %s%s%s}, "
 "options { %s} ",
-instance->hostt->name, instance->io_port, instance->n_io_port,
-instance->base, instance->irq,
+instance->hostt->name, instance->irq,
+hostdata->io_port, hostdata->base,
 instance->can_queue, instance->cmd_per_lun,
 instance->sg_tablesize, instance->this_id,
 hostdata->flags & FLAG_DMA_FIXUP ? "DMA_FIXUP " : "",
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index ceafa0c..02f20ff 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -220,6 +220,8 @@
 
 struct NCR5380_hostdata {
NCR5380_implementation_fields;  /* Board-specific data */
+   u8 __iomem *io; /* Remapped 5380 address */
+   u8 __iomem *pdma_io;/* Remapped PDMA address */
unsigned long poll_loops;   /* Register polling limit */
spinlock_t lock;/* Protects this struct */
struct scsi_cmnd *connected;/* Currently connected cmnd */
@@ -230,6 +232,8 @@ struct NCR5380_hostdata {
int flags;  /* Board-specific quirks */
int dma_len;/* Requested length of DMA */
int read_overruns;  /* Transfer size reduction for DMA erratum */
+   unsigned long io_port;  /* Device IO port */
+   unsigned long base; /* Device base address */
struct list_head unissued;  /* Waiting to be issued */
struct scsi_cmnd *selecting;/* Cmnd to be connected */
struct list_head autosense; /* Priority cmnd queue */
@@ -239,6 +243,7 @@ struct NCR5380_hostdata {
unsigned char id_mask;  /* 1 << Host ID */
unsigned char id_higher_mask;   /* All bits above id_mask */
unsigned char last_message; /* Last Message Out */
+   unsigned long region_size;  /* Size of address/port range */
char info[256];
 };
 
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index f616756..88db281 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -27,9 +27,7 @@
 #define NCR5380_info   cumanascsi_info
 
 #define NCR5380_implementation_fields  \
-   unsigned ctrl;  \
-   void __iomem *base; \
-   void __iomem *dma
+   unsigned ctrl
 
 #include "../NCR5380.h"
 
@@ -42,17 +40,18 @@ static inline int cumanascsi_pwrite(struct Scsi_Host *host,
 unsigned char *addr, int len)
 {
   unsigned long *laddr;
-  void __iomem *dma = priv(host)->dma + 0x2000;
+  u8 __iomem *base = priv(host)->io;
+  u8 __iomem *dma = priv(host)->pdma_io + 0x2000;
 
   if(!len) return 0;
 
-  writeb(0x02, priv(host)->base + CTRL);
+  writeb(0x02, base + CTRL);
   laddr = (unsigned long *)addr;
   while(len >= 32)
   {
 unsigned int status;
 unsigned long v;
-status = readb(priv(host)->base + STAT);
+status = readb(base + STAT);
 if(status & 0x80)
   goto end;
 if(!(status & 0x40))
@@ -71,12 +70,12 @@ static inline int cumanascsi_pwrite(struct Scsi_Host *host,
   }
 
   addr = (unsigned char 

[PATCH v2 11/12] scsi/ncr5380: Use correct types for DMA routines

2016-10-06 Thread Finn Thain
Apply prototypes to get consistent function signatures for the DMA
functions implemented in the board-specific drivers. To avoid using
macros to alter actual parameters, some of those functions are reworked
slightly.

This is a step toward the goal of passing the board-specific routines
to the core driver using an ops struct (as in a platform driver or
library module).

This also helps fix some inconsistent types: where the core driver uses
ints (cmd->SCp.this_residual and hostdata->dma_len) for keeping track of
transfers, certain board-specific routines used unsigned long.

While we are fixing these function signatures, pass the hostdata pointer
to DMA routines instead of a Scsi_Host pointer, for shorter and faster
code.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.c  | 74 +
 drivers/scsi/NCR5380.h  | 25 +++
 drivers/scsi/arm/cumana_1.c | 26 ++--
 drivers/scsi/arm/oak.c  | 13 
 drivers/scsi/atari_scsi.c   | 45 +++
 drivers/scsi/dmx3191d.c |  8 ++---
 drivers/scsi/g_NCR5380.c| 13 +++-
 drivers/scsi/g_NCR5380.h|  5 ++-
 drivers/scsi/mac_scsi.c | 36 +++---
 drivers/scsi/sun3_scsi.c| 45 +++
 10 files changed, 176 insertions(+), 114 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 3f2bfd2..72ac31cd 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -121,9 +121,10 @@
  *
  * Either real DMA *or* pseudo DMA may be implemented
  *
- * NCR5380_dma_write_setup(instance, src, count) - initialize
- * NCR5380_dma_read_setup(instance, dst, count) - initialize
- * NCR5380_dma_residual(instance); - residual count
+ * NCR5380_dma_xfer_len   - determine size of DMA/PDMA transfer
+ * NCR5380_dma_send_setup - execute DMA/PDMA from memory to 5380
+ * NCR5380_dma_recv_setup - execute DMA/PDMA from 5380 to memory
+ * NCR5380_dma_residual   - residual byte count
  *
  * The generic driver is initialized by calling NCR5380_init(instance),
  * after setting the appropriate host specific fields and ID.  If the
@@ -871,7 +872,7 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
NCR5380_read(RESET_PARITY_INTERRUPT_REG);
 
-   transferred = hostdata->dma_len - NCR5380_dma_residual(instance);
+   transferred = hostdata->dma_len - NCR5380_dma_residual(hostdata);
hostdata->dma_len = 0;
 
data = (unsigned char **)>connected->SCp.ptr;
@@ -1578,9 +1579,9 @@ static int NCR5380_transfer_dma(struct Scsi_Host 
*instance,
 * starting the NCR. This is also the cleaner way for the TT.
 */
if (p & SR_IO)
-   result = NCR5380_dma_recv_setup(instance, d, c);
+   result = NCR5380_dma_recv_setup(hostdata, d, c);
else
-   result = NCR5380_dma_send_setup(instance, d, c);
+   result = NCR5380_dma_send_setup(hostdata, d, c);
}
 
/*
@@ -1612,9 +1613,9 @@ static int NCR5380_transfer_dma(struct Scsi_Host 
*instance,
 * NCR access, else the DMA setup gets trashed!
 */
if (p & SR_IO)
-   result = NCR5380_dma_recv_setup(instance, d, c);
+   result = NCR5380_dma_recv_setup(hostdata, d, c);
else
-   result = NCR5380_dma_send_setup(instance, d, c);
+   result = NCR5380_dma_send_setup(hostdata, d, c);
}
 
/* On failure, NCR5380_dma__setup() returns a negative int. */
@@ -1754,22 +1755,26 @@ static void NCR5380_information_transfer(struct 
Scsi_Host *instance)
NCR5380_dprint_phase(NDEBUG_INFORMATION, 
instance);
}
 #ifdef CONFIG_SUN3
-   if (phase == PHASE_CMDOUT) {
-   void *d;
-   unsigned long count;
+   if (phase == PHASE_CMDOUT &&
+   sun3_dma_setup_done != cmd) {
+   int count;
 
if (!cmd->SCp.this_residual && 
cmd->SCp.buffers_residual) {
-   count = cmd->SCp.buffer->length;
-   d = sg_virt(cmd->SCp.buffer);
-   } else {
-   count = cmd->SCp.this_residual;
-   d = cmd->SCp.ptr;
+   ++cmd->SCp.buffer;
+   --cmd->SCp.buffers_residual;
+   cmd->SCp.this_residual = 
cmd->SCp.buffer->length;
+   

[PATCH v2 10/12] scsi/ncr5380: Expedite register polling

2016-10-06 Thread Finn Thain
Avoid the call to NCR5380_poll_politely2() when possible. The call is
easily short-circuited on the PIO fast path, using the inline wrapper.
This requires that the NCR5380_read macro be made available before
any #include "NCR5380.h" so a few declarations have to be moved too.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.h  | 3 +++
 drivers/scsi/arm/cumana_1.c | 4 
 drivers/scsi/atari_scsi.c   | 6 +++---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 4682baa..b2c560c 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -310,6 +310,9 @@ static inline int NCR5380_poll_politely(struct 
NCR5380_hostdata *hostdata,
 unsigned int reg, u8 bit, u8 val,
 unsigned long wait)
 {
+   if ((NCR5380_read(reg) & bit) == val)
+   return 0;
+
return NCR5380_poll_politely2(hostdata, reg, bit, val,
reg, bit, val, wait);
 }
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index ae1d4c6..fb7600d 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -29,6 +29,10 @@
 #define NCR5380_implementation_fields  \
unsigned ctrl
 
+struct NCR5380_hostdata;
+static u8 cumanascsi_read(struct NCR5380_hostdata *, unsigned int);
+static void cumanascsi_write(struct NCR5380_hostdata *, unsigned int, u8);
+
 #include "../NCR5380.h"
 
 #define CTRL   0x16fc
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index aed69ac..f77c311 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -57,6 +57,9 @@
 
 #define NCR5380_implementation_fields   /* none */
 
+static u8 (*atari_scsi_reg_read)(unsigned int);
+static void (*atari_scsi_reg_write)(unsigned int, u8);
+
 #define NCR5380_read(reg)   atari_scsi_reg_read(reg)
 #define NCR5380_write(reg, value)   atari_scsi_reg_write(reg, value)
 
@@ -126,9 +129,6 @@ static inline unsigned long SCSI_DMA_GETADR(void)
 
 static void atari_scsi_fetch_restbytes(void);
 
-static u8 (*atari_scsi_reg_read)(unsigned int);
-static void (*atari_scsi_reg_write)(unsigned int, u8);
-
 static unsigned long   atari_dma_residual, atari_dma_startaddr;
 static short   atari_dma_active;
 /* pointer to the dribble buffer */
-- 
2.7.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 12/12] scsi/ncr5380: Suppress unhelpful "interrupt without IRQ bit" message

2016-10-06 Thread Finn Thain
If a NCR5380 host instance ends up on a shared interrupt line then
this printk will be a problem. It is already a problem on some Mac
models: when testing mac_scsi on a PowerBook 180 I found that PDMA
transfers (but not PIO transfers) cause the message to be logged.

These spurious interrupts don't appear to come from the DRQ signal from
the 5380. And they don't happen at all on the Mac LC III. A comment in
the NetBSD source code mentions this mystery. Testing seems to show
that we can safely ignore these interrupts.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 72ac31cd..0c3c7e6 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -995,7 +995,7 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, 
void *dev_id)
}
handled = 1;
} else {
-   shost_printk(KERN_NOTICE, instance, "interrupt without IRQ 
bit\n");
+   dsprintk(NDEBUG_INTR, instance, "interrupt without IRQ bit\n");
 #ifdef SUN3_SCSI_VME
dregs->csr |= CSR_DMA_ENABLE;
 #endif
-- 
2.7.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 05/12] scsi/ncr5380: Increase register polling limit

2016-10-06 Thread Finn Thain
If NCR5380_poll_politely() is called under irq lock, the polling time
limit is clamped to avoid a spike in interrupt latency. When not under
irq lock, the same polling time limit acts as the worst case delay
between schedule() calls.

During PDMA (under irq lock) I've found that the 10 ms time limit is
sometimes too short, and leads to the error message,
sd 0:0:0:0: [sda] tag#1 macscsi_pread: !REQ and !ACK

This particular target identifies itself as a QUANTUM DAYTONA514S. It
seems to be slower to assert ACK than the other targets I've tested.
This patch solves the problem by increasing the polling timeout.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
When irqs are disabled, this change will make no difference unless the
driver or target happens to suffer from timeout errors. In the irqs
enabled case, this patch may delay the next call to schedule() by an
additional 5 ms (in all 5380 drivers). Normally that would only happen
for a target selection timeout during a SCSI bus scan, which should not
bother anyone too much.
---
 drivers/scsi/NCR5380.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index cbb29d6..f0eea44 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -253,7 +253,7 @@ struct NCR5380_cmd {
 #define NCR5380_PIO_CHUNK_SIZE 256
 
 /* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA 
*/
-#define NCR5380_REG_POLL_TIME  10
+#define NCR5380_REG_POLL_TIME  15
 
 static inline struct scsi_cmnd *NCR5380_to_scmd(struct NCR5380_cmd *ncmd_ptr)
 {
-- 
2.7.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 02/12] scsi/cumana_1: Remove unused cumanascsi_setup() function

2016-10-06 Thread Finn Thain
Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/arm/cumana_1.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index 8e9cfe8..f616756 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -33,10 +33,6 @@
 
 #include "../NCR5380.h"
 
-void cumanascsi_setup(char *str, int *ints)
-{
-}
-
 #define CTRL   0x16fc
 #define STAT   0x2004
 #define L(v)   (((v)<<16)|((v) & 0x))
-- 
2.7.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 01/12] scsi/g_NCR5380: Merge g_NCR5380 and g_NCR5380_mmio drivers

2016-10-06 Thread Finn Thain
From: Ondrej Zary 

Merge the port-mapped IO and memory-mapped IO support (with the help of
ioport_map) into the g_NCR5380 module and delete g_NCR5380_mmio.

Signed-off-by: Ondrej Zary 
Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 MAINTAINERS   |   1 -
 drivers/scsi/Kconfig  |  32 +-
 drivers/scsi/Makefile |   1 -
 drivers/scsi/g_NCR5380.c  | 252 --
 drivers/scsi/g_NCR5380.h  |  33 ++
 drivers/scsi/g_NCR5380_mmio.c |  10 --
 6 files changed, 134 insertions(+), 195 deletions(-)
 delete mode 100644 drivers/scsi/g_NCR5380_mmio.c

diff --git a/MAINTAINERS b/MAINTAINERS
index f0ee7a6..29ffef5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8048,7 +8048,6 @@ F:drivers/scsi/arm/oak.c
 F: drivers/scsi/atari_scsi.*
 F: drivers/scsi/dmx3191d.c
 F: drivers/scsi/g_NCR5380.*
-F: drivers/scsi/g_NCR5380_mmio.c
 F: drivers/scsi/mac_scsi.*
 F: drivers/scsi/sun3_scsi.*
 F: drivers/scsi/sun3_scsi_vme.c
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 3e2bdb9..98451fe 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -743,40 +743,18 @@ config SCSI_ISCI
  control unit found in the Intel(R) C600 series chipset.
 
 config SCSI_GENERIC_NCR5380
-   tristate "Generic NCR5380/53c400 SCSI PIO support"
+   tristate "Generic NCR5380/53c400 SCSI ISA card support"
depends on ISA && SCSI
select SCSI_SPI_ATTRS
---help---
- This is a driver for the old NCR 53c80 series of SCSI controllers
- on boards using PIO. Most boards such as the Trantor T130 fit this
- category, along with a large number of ISA 8bit controllers shipped
- for free with SCSI scanners. If you have a PAS16, T128 or DMX3191
- you should select the specific driver for that card rather than
- generic 5380 support.
-
- It is explained in section 3.8 of the SCSI-HOWTO, available from
- .  If it doesn't work out
- of the box, you may have to change some settings in
- .
+ This is a driver for old ISA card SCSI controllers based on a
+ NCR 5380, 53C80, 53C400, 53C400A, or DTC 436 device.
+ Most boards such as the Trantor T130 fit this category, as do
+ various 8-bit and 16-bit ISA cards bundled with SCSI scanners.
 
  To compile this driver as a module, choose M here: the
  module will be called g_NCR5380.
 
-config SCSI_GENERIC_NCR5380_MMIO
-   tristate "Generic NCR5380/53c400 SCSI MMIO support"
-   depends on ISA && SCSI
-   select SCSI_SPI_ATTRS
-   ---help---
- This is a driver for the old NCR 53c80 series of SCSI controllers
- on boards using memory mapped I/O. 
- It is explained in section 3.8 of the SCSI-HOWTO, available from
- .  If it doesn't work out
- of the box, you may have to change some settings in
- .
-
- To compile this driver as a module, choose M here: the
- module will be called g_NCR5380_mmio.
-
 config SCSI_IPS
tristate "IBM ServeRAID support"
depends on PCI && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 38d938d..2ac1b9f 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -74,7 +74,6 @@ obj-$(CONFIG_SCSI_ISCI)   += isci/
 obj-$(CONFIG_SCSI_IPS) += ips.o
 obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o
 obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
-obj-$(CONFIG_SCSI_GENERIC_NCR5380_MMIO) += g_NCR5380_mmio.o
 obj-$(CONFIG_SCSI_NCR53C406A)  += NCR53c406a.o
 obj-$(CONFIG_SCSI_NCR_D700)+= 53c700.o NCR_D700.o
 obj-$(CONFIG_SCSI_NCR_Q720)+= NCR_Q720_mod.o
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index cbf0103..4d7a9de 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -64,9 +64,9 @@ static int card[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 module_param_array(card, int, NULL, 0);
 MODULE_PARM_DESC(card, "card type (0=NCR5380, 1=NCR53C400, 2=NCR53C400A, 
3=DTC3181E, 4=HP C2502)");
 
+MODULE_ALIAS("g_NCR5380_mmio");
 MODULE_LICENSE("GPL");
 
-#ifndef SCSI_G_NCR5380_MEM
 /*
  * Configure I/O address of 53C400A or DTC436 by writing magic numbers
  * to ports 0x779 and 0x379.
@@ -88,40 +88,35 @@ static void magic_configure(int idx, u8 irq, u8 magic[])
cfg = 0x80 | idx | (irq << 4);
outb(cfg, 0x379);
 }
-#endif
+
+static unsigned int ncr_53c400a_ports[] = {
+   0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
+};
+static unsigned int dtc_3181e_ports[] = {
+   0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
+};
+static u8 ncr_53c400a_magic[] = {  /* 53C400A & DTC436 */
+   0x59, 0xb9, 0xc5, 0xae, 0xa6
+};

[PATCH v2 08/12] scsi/ncr5380: Use correct types for device register accessors

2016-10-06 Thread Finn Thain
For timeout values adopt unsigned long, which is the type of jiffies etc.

For chip register values and bit masks pass u8, which is the return type
of readb, inb etc.

For device register offsets adopt unsigned int, as it is suitable for
adding to base addresses.

Pass the NCR5380_hostdata pointer to the board-specific routines instead
of the Scsi_Host pointer. The board-specific code is concerned with
hardware and not with SCSI protocol or the mid-layer.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/NCR5380.c  | 10 --
 drivers/scsi/NCR5380.h  |  7 +--
 drivers/scsi/arm/cumana_1.c | 20 +++-
 drivers/scsi/arm/oak.c  |  6 ++
 drivers/scsi/atari_scsi.c   | 16 
 drivers/scsi/dmx3191d.c |  6 ++
 drivers/scsi/g_NCR5380.h|  8 ++--
 drivers/scsi/mac_scsi.c | 22 ++
 drivers/scsi/sun3_scsi.c| 32 +---
 9 files changed, 49 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 82fd37d..eb40561 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -196,8 +196,9 @@ static inline void initialize_SCp(struct scsi_cmnd *cmd)
  */
 
 static int NCR5380_poll_politely2(struct Scsi_Host *instance,
-  int reg1, int bit1, int val1,
-  int reg2, int bit2, int val2, int wait)
+  unsigned int reg1, u8 bit1, u8 val1,
+  unsigned int reg2, u8 bit2, u8 val2,
+  unsigned long wait)
 {
struct NCR5380_hostdata *hostdata = shost_priv(instance);
unsigned long n = hostdata->poll_loops;
@@ -284,6 +285,7 @@ mrs[] = {
 
 static void NCR5380_print(struct Scsi_Host *instance)
 {
+   struct NCR5380_hostdata *hostdata = shost_priv(instance);
unsigned char status, data, basr, mr, icr, i;
 
data = NCR5380_read(CURRENT_SCSI_DATA_REG);
@@ -333,6 +335,7 @@ static struct {
 
 static void NCR5380_print_phase(struct Scsi_Host *instance)
 {
+   struct NCR5380_hostdata *hostdata = shost_priv(instance);
unsigned char status;
int i;
 
@@ -1316,6 +1319,7 @@ static int NCR5380_transfer_pio(struct Scsi_Host 
*instance,
unsigned char *phase, int *count,
unsigned char **data)
 {
+   struct NCR5380_hostdata *hostdata = shost_priv(instance);
unsigned char p = *phase, tmp;
int c = *count;
unsigned char *d = *data;
@@ -1438,6 +1442,7 @@ static int NCR5380_transfer_pio(struct Scsi_Host 
*instance,
 
 static void do_reset(struct Scsi_Host *instance)
 {
+   struct NCR5380_hostdata __maybe_unused *hostdata = shost_priv(instance);
unsigned long flags;
 
local_irq_save(flags);
@@ -1460,6 +1465,7 @@ static void do_reset(struct Scsi_Host *instance)
 
 static int do_abort(struct Scsi_Host *instance)
 {
+   struct NCR5380_hostdata *hostdata = shost_priv(instance);
unsigned char *msgptr, phase, tmp;
int len;
int rc;
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 02f20ff..c2d8b78 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -302,10 +302,13 @@ static void NCR5380_reselect(struct Scsi_Host *instance);
 static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd 
*);
 static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char 
*phase, int *count, unsigned char **data);
 static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char 
*phase, int *count, unsigned char **data);
-static int NCR5380_poll_politely2(struct Scsi_Host *, int, int, int, int, int, 
int, int);
+static int NCR5380_poll_politely2(struct Scsi_Host *,
+  unsigned int, u8, u8,
+  unsigned int, u8, u8, unsigned long);
 
 static inline int NCR5380_poll_politely(struct Scsi_Host *instance,
-   int reg, int bit, int val, int wait)
+unsigned int reg, u8 bit, u8 val,
+unsigned long wait)
 {
return NCR5380_poll_politely2(instance, reg, bit, val,
reg, bit, val, wait);
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index 88db281..ae1d4c6 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -14,8 +14,8 @@
 #include 
 
 #define priv(host) ((struct NCR5380_hostdata 
*)(host)->hostdata)
-#define NCR5380_read(reg)  cumanascsi_read(instance, reg)
-#define NCR5380_write(reg, value)  cumanascsi_write(instance, reg, value)
+#define NCR5380_read(reg)  cumanascsi_read(hostdata, reg)
+#define NCR5380_write(reg, value)  

[PATCH v2 04/12] scsi/ncr5380: Simplify register polling limit

2016-10-06 Thread Finn Thain
When polling a device register under irq lock the polling loop terminates
after a given number of jiffies. Make this timeout independent of the HZ
setting.

All 5380 drivers benefit from this patch, which optimizes the PIO fast
path, because they all use PIO transfers (for phases other than DATA IN
and DATA OUT). Some cards support only PIO transfers (even for DATA
phases). CPU cycles are scarce on some of these systems, so a small
improvement here makes a big difference.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
This patch eliminates a call to jiffies_to_usecs from the fast path.
For g_NCR5380 it also eliminates a mul instruction and an imul instruction.
For ARM drivers like oak, this change eliminates an __aeabi_uidiv call.
---
 drivers/scsi/NCR5380.c | 10 --
 drivers/scsi/NCR5380.h |  5 -
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index db27390..25ee5be 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -200,13 +200,9 @@ static int NCR5380_poll_politely2(struct Scsi_Host 
*instance,
   int reg2, int bit2, int val2, int wait)
 {
struct NCR5380_hostdata *hostdata = shost_priv(instance);
+   unsigned long n = hostdata->poll_loops;
unsigned long deadline = jiffies + wait;
-   unsigned long n;
 
-   /* Busy-wait for up to 10 ms */
-   n = min(1U, jiffies_to_usecs(wait));
-   n *= hostdata->accesses_per_ms;
-   n /= 2000;
do {
if ((NCR5380_read(reg1) & bit1) == val1)
return 0;
@@ -482,6 +478,7 @@ static int NCR5380_init(struct Scsi_Host *instance, int 
flags)
struct NCR5380_hostdata *hostdata = shost_priv(instance);
int i;
unsigned long deadline;
+   unsigned long accesses_per_ms;
 
instance->max_lun = 7;
 
@@ -530,7 +527,8 @@ static int NCR5380_init(struct Scsi_Host *instance, int 
flags)
++i;
cpu_relax();
} while (time_is_after_jiffies(deadline));
-   hostdata->accesses_per_ms = i / 256;
+   accesses_per_ms = i / 256;
+   hostdata->poll_loops = NCR5380_REG_POLL_TIME * accesses_per_ms / 2;
 
return 0;
 }
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 965d923..cbb29d6 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -239,7 +239,7 @@ struct NCR5380_hostdata {
   * transfer to handle chip overruns */
struct work_struct main_task;
struct workqueue_struct *work_q;
-   unsigned long accesses_per_ms;  /* chip register accesses per ms */
+   unsigned long poll_loops;   /* register polling limit */
 };
 
 #ifdef __KERNEL__
@@ -252,6 +252,9 @@ struct NCR5380_cmd {
 
 #define NCR5380_PIO_CHUNK_SIZE 256
 
+/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA 
*/
+#define NCR5380_REG_POLL_TIME  10
+
 static inline struct scsi_cmnd *NCR5380_to_scmd(struct NCR5380_cmd *ncmd_ptr)
 {
return ((struct scsi_cmnd *)ncmd_ptr) - 1;
-- 
2.7.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 03/12] scsi/atari_scsi: Make device register accessors re-enterant

2016-10-06 Thread Finn Thain
This patch fixes an old bug: accesses to device registers from the
interrupt handler (after reselection, DMA completion etc.) could mess
up a device register access elsewhere, if the latter takes place outside
of an irq lock (during selection etc.).

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/atari_scsi.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index a59ad94..862f30c 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -670,14 +670,26 @@ static void atari_scsi_tt_reg_write(unsigned char reg, 
unsigned char value)
 
 static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
 {
-   dma_wd.dma_mode_status= (u_short)(0x88 + reg);
-   return (u_char)dma_wd.fdc_acces_seccount;
+   unsigned long flags;
+   unsigned char result;
+
+   reg += 0x88;
+   local_irq_save(flags);
+   dma_wd.dma_mode_status = (u_short)reg;
+   result = (u_char)dma_wd.fdc_acces_seccount;
+   local_irq_restore(flags);
+   return result;
 }
 
 static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
 {
-   dma_wd.dma_mode_status = (u_short)(0x88 + reg);
+   unsigned long flags;
+
+   reg += 0x88;
+   local_irq_save(flags);
+   dma_wd.dma_mode_status = (u_short)reg;
dma_wd.fdc_acces_seccount = (u_short)value;
+   local_irq_restore(flags);
 }
 
 
-- 
2.7.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 00/12] Fixes, cleanup and g_NCR5380_mmio/g_NCR5380 merger

2016-10-06 Thread Finn Thain
This patch series has fixes for compatibility, reliability and
performance issues and some cleanup. It also includes a new version
of Ondrej Zary's patch that merges g_NCR5380_mmio into g_NCR5380.

I've tested this patch series on a Powerbook 180. If someone would
test some of the other platforms that would be very helpful. All
drivers were compile-tested.

Changes since v1:
- rebased on 4.9/scsi-queue
- added reviewed-by tags
- tweaked the order of struct members in patch 7/12


Finn Thain (12):
  scsi/g_NCR5380: Merge g_NCR5380 and g_NCR5380_mmio drivers
  scsi/cumana_1: Remove unused cumanascsi_setup() function
  scsi/atari_scsi: Make device register accessors re-enterant
  scsi/ncr5380: Simplify register polling limit
  scsi/ncr5380: Increase register polling limit
  scsi/ncr5380: Improve hostdata struct member alignment and
cache-ability
  scsi/ncr5380: Store IO ports and addresses in host private data
  scsi/ncr5380: Use correct types for device register accessors
  scsi/ncr5380: Pass hostdata pointer to register polling routines
  scsi/ncr5380: Expedite register polling
  scsi/ncr5380: Use correct types for DMA routines
  scsi/ncr5380: Suppress unhelpful "interrupt without IRQ bit" message

 MAINTAINERS   |   1 -
 drivers/scsi/Kconfig  |  32 +
 drivers/scsi/Makefile |   1 -
 drivers/scsi/NCR5380.c| 137 +++-
 drivers/scsi/NCR5380.h|  87 +
 drivers/scsi/arm/cumana_1.c   |  98 +++---
 drivers/scsi/arm/oak.c|  34 +++--
 drivers/scsi/atari_scsi.c |  77 ++-
 drivers/scsi/dmx3191d.c   |  20 +--
 drivers/scsi/g_NCR5380.c  | 290 --
 drivers/scsi/g_NCR5380.h  |  32 +
 drivers/scsi/g_NCR5380_mmio.c |  10 --
 drivers/scsi/mac_scsi.c   |  83 +---
 drivers/scsi/sun3_scsi.c  |  80 ++--
 14 files changed, 495 insertions(+), 487 deletions(-)
 delete mode 100644 drivers/scsi/g_NCR5380_mmio.c

-- 
2.7.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 v1 0/8] Support for Exynos specific UFS driver

2016-10-06 Thread Subhash Jadavani

Hi Kim,


On 2016-10-06 01:12, Kiwoong Kim wrote:
This series of patches introduce support for Exynos specific UFS 
driver.

An original version of this has been applied on mass production
of commercial mobile devices.

 Documentation/devicetree/bindings/ufs/ufs-exynos.txt |   93 +
 drivers/scsi/ufs/Kconfig  |   10 +
 drivers/scsi/ufs/Makefile |1 +
 drivers/scsi/ufs/mphy.h|   38 
+

 drivers/scsi/ufs/ufs-exynos.c| 2084

 drivers/scsi/ufs/ufs-exynos.h|  621 
++
 drivers/scsi/ufs/ufshcd.c |  146 
+-

 drivers/scsi/ufs/ufshcd.h |   62 +
 drivers/scsi/ufs/ufshci.h |   14 
+-

 drivers/scsi/ufs/unipro.h |   24 +
 10 files changed, 3073 insertions(+), 20 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/ufs/ufs-exynos.txt

 create mode 100644 drivers/scsi/ufs/mphy.h
 create mode 100644 drivers/scsi/ufs/ufs-exynos.c
 create mode 100644 drivers/scsi/ufs/ufs-exynos.h


This supposed to be 8-patch series but i only patch #1 (subject: [PATCH 
v1 1/8] ufs: add some vendor specific operations) on mailing list. Can 
you please send out the full patch series?


--
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: fcoe: fix off-by-one array size comparison

2016-10-06 Thread Colin King
From: Colin Ian King 

Fix an off-by-one array size comparison that is comparing one too many
items in an array and hence will causing an out-of-bounds array read
on array fcoe_port_speed_mapping.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/fcoe/fcoe_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fcoe/fcoe_transport.c 
b/drivers/scsi/fcoe/fcoe_transport.c
index c164eec..375c536 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -110,7 +110,7 @@ static inline u32 eth2fc_speed(u32 eth_port_speed)
 {
int i;
 
-   for (i = 0; i <= ARRAY_SIZE(fcoe_port_speed_mapping); i++) {
+   for (i = 0; i < ARRAY_SIZE(fcoe_port_speed_mapping); i++) {
if (fcoe_port_speed_mapping[i].eth_port_speed == eth_port_speed)
return fcoe_port_speed_mapping[i].fc_port_speed;
}
-- 
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


[Bug 176701] New: hdparm security erase gets aborted by SML

2016-10-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=176701

Bug ID: 176701
   Summary: hdparm security erase gets aborted by SML
   Product: SCSI Drivers
   Version: 2.5
Kernel Version: 4.4
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Other
  Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org
  Reporter: i...@media-clone.com
Regression: No

The security erase command sent by hdparm with ATA pass through using ioctl
SG_IO gets aborted after a few minutes. It seems that the SCSI level thinks
that the task got stuck and aborts it.

dmesg output:

[ 1229.996993] sd 2:0:0:0: attempting task abort! scmd(880215289200)
[ 1229.997005] sd 2:0:0:0: [sdb] tag#1 CDB: ATA command pass through(16) 85 06
20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[ 1229.997011] scsi target2:0:0: handle(0x0009),
sas_address(0x443322110100), phy(1)
[ 1229.997015] scsi target2:0:0: enclosure_logical_id(0x500605b0080c87d0),
slot(2)
[ 1230.036462] sd 2:0:0:0: task abort: SUCCESS scmd(880215289200)
[ 1230.196445] sd 2:0:0:0: tag#0 CDB: Test Unit Ready 00 00 00 00 00 00
[ 1230.196447] mpt2sas_cm0: sas_address(0x443322110100), phy(1)
[ 1230.196448] mpt2sas_cm0:
enclosure_logical_id(0x500605b0080c87d0),slot(2)
[ 1230.196449] mpt2sas_cm0: handle(0x0009), ioc_status(success)(0x),
smid(1)
[ 1230.196449] mpt2sas_cm0: request_len(0), underflow(0), resid(0)
[ 1230.196450] mpt2sas_cm0: tag(65535), transfer_count(0),
sc->result(0x)
[ 1230.196451] mpt2sas_cm0: scsi_status(check condition)(0x02),
scsi_state(autosense valid )(0x01)
[ 1230.196452] mpt2sas_cm0: [sense_key,asc,ascq]: [0x06,0x29,0x00],
count(18)
[ 1823.036119] sd 2:0:0:0: tag#0 CDB: Test Unit Ready 00 00 00 00 00 00
[ 1823.036121] mpt2sas_cm0: sas_address(0x443322110100), phy(1)
[ 1823.036122] mpt2sas_cm0:
enclosure_logical_id(0x500605b0080c87d0),slot(2)
[ 1823.036123] mpt2sas_cm0: handle(0x0009), ioc_status(success)(0x),
smid(1)
[ 1823.036123] mpt2sas_cm0: request_len(0), underflow(0), resid(0)
[ 1823.036124] mpt2sas_cm0: tag(65535), transfer_count(0),
sc->result(0x)
[ 1823.036125] mpt2sas_cm0: scsi_status(check condition)(0x02),
scsi_state(autosense valid )(0x01)
[ 1823.036126] mpt2sas_cm0: [sense_key,asc,ascq]: [0x06,0x29,0x00],
count(18)

-

hdparm output:

user@user-MS-7887:~$ sudo hdparm --security-set-pass xxx /dev/sdb
security_password: "xxx"

/dev/sdb:
 Issuing SECURITY_SET_PASS command, password="xxx", user=user, mode=high
user@user-MS-7887:~$ sudo hdparm --security-erase xxx /dev/sdb
security_password: "xxx"

/dev/sdb:
 Issuing SECURITY_ERASE command, password="xxx", user=user
The running kernel lacks CONFIG_IDE_TASK_IOCTL support for this device.
SECURITY_ERASE: Invalid argument
user@user-MS-7887:~$ sudo hdparm --verbose --security-erase xxx /dev/sdb
security_password: "xxx"

/dev/sdb:
 Issuing SECURITY_ERASE command, password="xxx", user=user
outgoing cdb:  85 08 0e 00 00 00 01 00 00 00 00 00 00 40 ec 00
SG_IO: ATA_16 status=0x0, host_status=0x0, driver_status=0x0
SG_IO: sb[]:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00
incoming_data:  7a 42 ff 3f 37 c8 10 00 00 00 00 00 3f 00 00 00 00 00 00 00 20
20 20 20 57 20 2d 44 43 57 33 43 33 46 54 4b 54 50 31 33 00 00 00 00 00 00 31
30 30 2e 41 31 31 30 44 57 20 43 44 57 30 31 5a 45 58 45 30 2d 42 30 35 4e 30
41 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 10 80 00 40 00
2f 01 40 00 00 00 00 07 00 ff 3f 10 00 3f 00 10 fc fb 00 00 01 ff ff ff 0f 00
00 07 00 03 00 78 00 78 00 78 00 78 00 00 00 00 00 00 00 00 00 00 00 00 00 1f
00 0e 97 06 00 44 00 44 00 fe 03 1f 00 6b 74 61 7d 23 41 6b 74 41 bc 23 41 7f
40 3f 00 3f 00 00 00 fe ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 6d 70
74 00 00 00 00 00 00 00 00 03 60 00 00 01 50 e2 4e 7a b6 f8 7e 00 00 00 00 00
00 00 00 00 00 00 00 00 00 18 40 18 40 00 00 00 00 00 00 00 00 00 00 00 00 00
00 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 35 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 1c 00
00 00 00 00 00 00 00 7e 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 01 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a5 ef
SG_IO: desc[]:  00 00
  ATA_16 stat=00 

Donation of £1.5 Million Pounds!!

2016-10-06 Thread guillermo . bossano17
My wife and I have awarded you with a donation of £1.5 million Pounds
from part of our Jackpot Lottery of 161,653,000 Million Pounds, send your
name,address, phone for claims.

View http://www.bbc.co.uk/news/uk-scotland-glasgow-west-18801698

We await your earliest response and God Bless you.

Best of luck.

Chris Colin & Weir

Reply E-mail:colinswei...@qq.com
--
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] scsi: ufshcd: fix possible unclocked register access

2016-10-06 Thread Kiwoong Kim
Hi, Subhash.

Some UFS host controllers may need to call the vendor specific callback
before and after controlling by clock control framework,
regardless of whether available clocks are turned on or off.

Is there any special reason to limit to invoke the callback
only when the clocks are turned on or not?
Besides, the callback is acknowledged from core driver
because 2nd argument is whether the clocks are turned on or not.

If you have any other idea, please let me know.

Thanks
Regards

> Vendor specific setup_clocks callback may require the clocks managed
> by ufshcd driver to be ON. So if the vendor specific setup_clocks callback
> is called while the required clocks are turned off, it could result into
> unclocked register access.
> 
> To prevent possible unclock register access, this change makes sure that
> required clocks remain enabled before calling into vendor specific
> setup_clocks callback.
> 
> Signed-off-by: Subhash Jadavani 
> ---
> Changes from v2:
> * Don't call ufshcd_vops_setup_clocks() again for clock off
> ---
>  drivers/scsi/ufs/ufshcd.c | 22 +-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 05c7456..c1a77d3 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -5389,6 +5389,17 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> *hba, bool on,
>   if (!head || list_empty(head))
>   goto out;
> 
> + /*
> +  * vendor specific setup_clocks ops may depend on clocks managed by
> +  * this standard driver hence call the vendor specific setup_clocks
> +  * before disabling the clocks managed here.
> +  */
> + if (!on) {
> + ret = ufshcd_vops_setup_clocks(hba, on);
> + if (ret)
> + return ret;
> + }
> +
>   list_for_each_entry(clki, head, list) {
>   if (!IS_ERR_OR_NULL(clki->clk)) {
>   if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
> @@ -5410,7 +5421,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> *hba, bool on,
>   }
>   }
> 
> - ret = ufshcd_vops_setup_clocks(hba, on);
> + /*
> +  * vendor specific setup_clocks ops may depend on clocks managed by
> +  * this standard driver hence call the vendor specific setup_clocks
> +  * after enabling the clocks managed here.
> +  */
> + if (on) {
> + ret = ufshcd_vops_setup_clocks(hba, on);
> + if (ret)
> + return ret;
> + }
>  out:
>   if (ret) {
>   list_for_each_entry(clki, head, list) {
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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


[PATCH v1 0/8] Support for Exynos specific UFS driver

2016-10-06 Thread Kiwoong Kim
This series of patches introduce support for Exynos specific UFS driver.
An original version of this has been applied on mass production
of commercial mobile devices.

 Documentation/devicetree/bindings/ufs/ufs-exynos.txt |   93 +
 drivers/scsi/ufs/Kconfig  |   10 +
 drivers/scsi/ufs/Makefile |1 +
 drivers/scsi/ufs/mphy.h|   38 +
 drivers/scsi/ufs/ufs-exynos.c| 2084 

 drivers/scsi/ufs/ufs-exynos.h|  621 ++
 drivers/scsi/ufs/ufshcd.c |  146 +-
 drivers/scsi/ufs/ufshcd.h |   62 +
 drivers/scsi/ufs/ufshci.h |   14 +-
 drivers/scsi/ufs/unipro.h |   24 +
 10 files changed, 3073 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-exynos.txt
 create mode 100644 drivers/scsi/ufs/mphy.h
 create mode 100644 drivers/scsi/ufs/ufs-exynos.c
 create mode 100644 drivers/scsi/ufs/ufs-exynos.h

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


[PATCH v1 1/8] ufs: add some vendor specific operations

2016-10-06 Thread Kiwoong Kim
Some UFS host controller may need to require some sequences
before used clocks are turned on or off.
e.g) control internal gates in UFS host

Signed-off-by: Kiwoong Kim 
---
 drivers/scsi/ufs/ufshcd.c |   15 +--
 drivers/scsi/ufs/ufshcd.h |   37 +
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 05c7456..82c9a40 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1474,6 +1474,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, 
struct scsi_cmnd *cmd)
 
/* issue command to the controller */
spin_lock_irqsave(hba->host->host_lock, flags);
+   ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
ufshcd_send_command(hba, tag);
 out_unlock:
spin_unlock_irqrestore(hba->host->host_lock, flags);
@@ -1683,6 +1684,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
/* Make sure descriptors are ready before ringing the doorbell */
wmb();
spin_lock_irqsave(hba->host->host_lock, flags);
+   ufshcd_vops_set_nexus_t_xfer_req(hba, tag, lrbp->cmd);
ufshcd_send_command(hba, tag);
spin_unlock_irqrestore(hba->host->host_lock, flags);
 
@@ -2651,6 +2653,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
int ret;
struct uic_command uic_cmd = {0};
 
+   ufshcd_vops_hibern8_notify(hba, true, PRE_CHANGE);
+
uic_cmd.command = UIC_CMD_DME_HIBER_ENTER;
ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
 
@@ -2664,7 +2668,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 */
if (ufshcd_link_recovery(hba))
ret = -ENOLINK;
-   }
+   } else
+   ufshcd_vops_hibern8_notify(hba, true, POST_CHANGE);
 
return ret;
 }
@@ -2687,13 +2692,16 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
struct uic_command uic_cmd = {0};
int ret;
 
+   ufshcd_vops_hibern8_notify(hba, false, PRE_CHANGE);
+
uic_cmd.command = UIC_CMD_DME_HIBER_EXIT;
ret = ufshcd_uic_pwr_ctrl(hba, _cmd);
if (ret) {
dev_err(hba->dev, "%s: hibern8 exit failed. ret = %d\n",
__func__, ret);
ret = ufshcd_link_recovery(hba);
-   }
+   } else
+   ufshcd_vops_hibern8_notify(hba, false, POST_CHANGE);
 
return ret;
 }
@@ -4312,6 +4320,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int 
lun_id, int task_id,
task_req_upiup->input_param2 = cpu_to_be32(task_id);
 
/* send command to the controller */
+   ufshcd_vops_set_nexus_t_task_mgmt(hba, free_slot, tm_function);
__set_bit(free_slot, >outstanding_tasks);
 
/* Make sure descriptors are ready before ringing the task doorbell */
@@ -5389,6 +5398,8 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, 
bool on,
if (!head || list_empty(head))
goto out;
 
+   ufshcd_vops_pre_setup_clocks(hba, on);
+
list_for_each_entry(clki, head, list) {
if (!IS_ERR_OR_NULL(clki->clk)) {
if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 430bef1..b97f7c2 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -252,6 +252,7 @@ struct ufs_pwr_mode_info {
  * @exit: called to cleanup everything done in init
  * @get_ufs_hci_version: called to get UFS HCI version
  * @clk_scale_notify: notifies that clks are scaled up/down
+ * @pre_setup_clocks: called before controlling used clocks
  * @setup_clocks: called before touching any of the controller registers
  * @setup_regulators: called before accessing the host controller
  * @hce_enable_notify: called before and after HCE enable bit is set to allow
@@ -261,6 +262,9 @@ struct ufs_pwr_mode_info {
  * @pwr_change_notify: called before and after a power mode change
  * is carried out to allow vendor spesific capabilities
  * to be set.
+ * @set_nexus_t_xfer_req:
+ * @set_nexus_t_task_mgmt:
+ * @hibern8_notify:
  * @suspend: called during host controller PM callback
  * @resume: called during host controller PM callback
  * @dbg_register_dump: used to dump controller debug information
@@ -273,6 +277,7 @@ struct ufs_hba_variant_ops {
u32 (*get_ufs_hci_version)(struct ufs_hba *);
int (*clk_scale_notify)(struct ufs_hba *, bool,
enum ufs_notify_change_status);
+   int (*pre_setup_clocks)(struct ufs_hba *, bool);
int (*setup_clocks)(struct ufs_hba *, bool);
int (*setup_regulators)(struct ufs_hba *, bool);
int (*hce_enable_notify)(struct ufs_hba *,
@@ -283,6 +288,10 @@ struct ufs_hba_variant_ops {
enum 

[GIT PULL] first round of SCSI updates for the 4.8+ merge window

2016-10-06 Thread James Bottomley
This update includes the usual round of major driver updates (hpsa,
be2iscsi, hisi_sas, zfcp, cxlflash).  There's a new incarnation of hpsa
called smartpqi for which a driver is added, there's some cleanup work
of the ibm vscsi target and updates to libfc, plus a whole host of
minor fixes and updates and finally the removal of several ISA drivers
which seem not to have been used for years.

The patch is available here:

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

The short changelog is:

Baoyou Xie (10):
  scsi: mvsas: Mark symbols static where possible
  scsi: pm8001: Mark symbols static where possible
  scsi: lpfc: Mark symbols static where possible
  scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up
  scsi: bnx2fc: Mark symbols static where possible
  scsi: aacraid: mark aac_src_select_comm() static
  scsi: ufs: Add missing header dependencies for tc-dwc-g210
  scsi: pmcraid: mark symbols static where possible
  scsi: qla4xxx: Mark symbols static where possible
  scsi: move function declarations to scsi_priv.h

Bhaktipriya Shridhar (2):
  scsi: mpt: Remove deprecated create_singlethread_workqueue
  scsi: mptfc: Remove deprecated create_singlethread_workqueue

Borislav Petkov (1):
  scsi: arcmsr: Simplify user_len checking

Brian King (4):
  scsi: ibmvfc: Fix I/O hang when port is not mapped
  scsi: ipr: Remove redundant messages at adapter init time
  scsi: ipr: Don't log unnecessary 9084 error details
  scsi: ipr: Add asynchronous error notification

Bryant G. Ly (4):
  scsi: ibmvscsis: Fixed unused variable
  scsi: ibmvscsis: Fixed a bug reported by Dan Carpenter
  scsi: ibmvscsis: Code cleanup of print statements
  scsi: ibmvscsis: Properly deregister target sessions

Calvin Owens (4):
  mpt3sas: Fix warnings exposed by W=1
  mpt3sas: Eliminate dead sleep_flag code
  mpt3sas: Eliminate conditional locking in mpt3sas_scsih_issue_tm()
  mpt3sas: Ensure the connector_name string is NUL-terminated

Christoph Hellwig (10):
  scsi: dtc: remove from tree
  scsi: t128: remove from tree
  scsi: pas16: remove from tree
  scsi: u14-34f: remove from tree
  scsi: ultrastor: remove from tree
  scsi: in2000: remove from tree
  scsi: wd7000: remove from tree
  scsi: sd: Move DIF protection types to t10-pi.h
  scsi: qla2xxx: Use struct t10_pi_tuple
  scsi: scsi_debug: Use struct t10_pi_tuple instead of struct sd_dif_tuple

Christophe JAILLET (4):
  scsi: bnx2fc: Simplify code
  scsi: be2iscsi: Fix error return code
  scsi: megaraid_sas: Fix the search of first memory bar
  scsi: aic94xx: Add missing error code assignment before test

Colin Ian King (3):
  scsi: megaraid_sas: add in missing white space in error message text
  scsi: bfa: Do not dereference port before it is null checked
  scsi: qla2xxx: fix spelling mistake "retyring" -> "retrying"

Dan Carpenter (2):
  scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer()
  qla2xxx: small cleanup in qla2x00_wait_for_hba_ready()

Daniel Wagner (3):
  scsi: virtio_scsi: Use complete() instead complete_all()
  scsi: sym53c8xx_2: Use complete() instead complete_all()
  scsi: csiostor: Fix completion usage

Don Brace (5):
  scsi: hpsa: correct call to hpsa_do_reset
  scsi: hpsa: Check for null devices in ioaccel submission patch
  scsi: hpsa: Check for null device pointers
  scsi: hpsa: Determine device external status earlier
  scsi: smartpqi: add smartpqi.txt

Finn Thain (3):
  scsi: ncr5380: Improve interrupt latency during PIO tranfers
  scsi: ncr5380: Avoid a compiler warning
  scsi: Documentation/scsi: Remove nodisconnect parameter

Hannes Reinecke (4):
  scsi: libfc: do not send ABTS when resetting exchanges
  scsi: libfc: reset exchange manager during LOGO handling
  scsi: libfc: send LOGO for PLOGI failure
  scsi: libfc: Issue PRLI after a PRLO has been received

Heiner Kallweit (1):
  scsi: configure runtime pm before calling device_add in 
scsi_add_host_with_dma

Jitendra Bhivare (31):
  scsi: be2iscsi: Add missing unlock for mbox_lock
  scsi: be2iscsi: Remove redundant iscsi_wrb desc memset
  MAINTAINERS: Update be2iscsi contact info
  scsi: be2iscsi: Update the driver version
  scsi: be2iscsi: Update copyright information
  scsi: be2iscsi: Fix queue and connection parameters
  scsi: be2iscsi: Fix bad WRB index error
  scsi: be2iscsi: Fix async PDU handling path
  scsi: be2iscsi: Add FUNCTION_RESET during driver unload
  scsi: be2iscsi: Fail the sessions immediately after TPE
  scsi: be2iscsi: Add TPE recovery feature
  scsi: be2iscsi: Add V1 of EPFW cleanup IOCTL
  scsi: be2iscsi: Fix POST check and reset sequence
  scsi: be2iscsi: Move functions to right files
  scsi: be2iscsi: Add IOCTL to check UER