linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 서호영 <hy50.seo@samsung.com>
To: "'Asutosh Das \(asd\)'" <asutoshd@codeaurora.org>,
	<linux-scsi@vger.kernel.org>, <alim.akhtar@samsung.com>,
	<avri.altman@wdc.com>, <jejb@linux.ibm.com>,
	<martin.petersen@oracle.com>, <beanhuo@micron.com>,
	<cang@codeaurora.org>, <bvanassche@acm.org>,
	<grant.jung@samsung.com>
Subject: RE: [RFC PATCH v2 1/3] scsi: ufs: modify write booster
Date: Tue, 21 Jul 2020 18:26:23 +0900	[thread overview]
Message-ID: <02d401d65f41$003e6390$00bb2ab0$@samsung.com> (raw)
In-Reply-To: <4a4c1753-b78d-30eb-b086-5812b67de31a@codeaurora.org>



> -----Original Message-----
> From: asutoshd=codeaurora.org@mg.codeaurora.org
> [mailto:asutoshd=codeaurora.org@mg.codeaurora.org] On Behalf Of Asutosh
> Das (asd)
> Sent: Tuesday, July 21, 2020 1:47 AM
> To: SEO HOYOUNG; linux-scsi@vger.kernel.org; alim.akhtar@samsung.com;
> avri.altman@wdc.com; jejb@linux.ibm.com; martin.petersen@oracle.com;
> beanhuo@micron.com; cang@codeaurora.org; bvanassche@acm.org;
> grant.jung@samsung.com
> Subject: Re: [RFC PATCH v2 1/3] scsi: ufs: modify write booster
> 
> On 7/20/2020 3:40 AM, SEO HOYOUNG wrote:
> > Add vendor specific functions for WB
> > Use callback additional setting when use write booster.
> >
> > Signed-off-by: SEO HOYOUNG <hy50.seo@samsung.com>
> > ---
> >   drivers/scsi/ufs/ufshcd.c | 23 ++++++++++++++++-----
> >   drivers/scsi/ufs/ufshcd.h | 43 +++++++++++++++++++++++++++++++++++++++
> >   2 files changed, 61 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index efc0a6cbfe22..efa16bf4fd76 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -3306,11 +3306,11 @@ int ufshcd_read_string_desc(struct ufs_hba *hba,
> u8 desc_index,
> >    *
> >    * Return 0 in case of success, non-zero otherwise
> >    */
> > -static inline int ufshcd_read_unit_desc_param(struct ufs_hba *hba,
> > -					      int lun,
> > -					      enum unit_desc_param param_offset,
> > -					      u8 *param_read_buf,
> > -					      u32 param_size)
> > +int ufshcd_read_unit_desc_param(struct ufs_hba *hba,
> > +				int lun,
> > +				enum unit_desc_param param_offset,
> > +				u8 *param_read_buf,
> > +				u32 param_size)
> >   {
> >   	/*
> >   	 * Unit descriptors are only available for general purpose LUs (LUN
> > id @@ -3322,6 +3322,7 @@ static inline int
> ufshcd_read_unit_desc_param(struct ufs_hba *hba,
> >   	return ufshcd_read_desc_param(hba, QUERY_DESC_IDN_UNIT, lun,
> >   				      param_offset, param_read_buf, param_size);
> >   }
> > +EXPORT_SYMBOL_GPL(ufshcd_read_unit_desc_param);
> >
> >   static int ufshcd_get_ref_clk_gating_wait(struct ufs_hba *hba)
> >   {
> > @@ -5257,6 +5258,10 @@ static int ufshcd_wb_ctrl(struct ufs_hba *hba,
> > bool enable)
> >
> >   	if (!(enable ^ hba->wb_enabled))
> >   		return 0;
> > +
> > +	if (!ufshcd_wb_ctrl_vendor(hba, enable))
> > +		return 0;
> > +
> >   	if (enable)
> >   		opcode = UPIU_QUERY_OPCODE_SET_FLAG;
> >   	else
> > @@ -6610,6 +6615,8 @@ static int ufshcd_reset_and_restore(struct ufs_hba
> *hba)
> >   	int err = 0;
> >   	int retries = MAX_HOST_RESET_RETRIES;
> >
> > +	ufshcd_reset_vendor(hba);
> > +
> >   	do {
> >   		/* Reset the attached device */
> >   		ufshcd_vops_device_reset(hba);
> > @@ -6903,6 +6910,9 @@ static void ufshcd_wb_probe(struct ufs_hba *hba,
> u8 *desc_buf)
> >   	if (!(dev_info->d_ext_ufs_feature_sup & UFS_DEV_WRITE_BOOSTER_SUP))
> >   		goto wb_disabled;
> >
> > +	if (!ufshcd_wb_alloc_units_vendor(hba))
> > +		return;
> I didn't understand this check. Have you considered this -
> ufshcd_is_wb_allowed(...).
Ok. I will modify to using this function

> > +
> >   	/*
> >   	 * WB may be supported but not configured while provisioning.
> >   	 * The spec says, in dedicated wb buffer mode, @@ -8260,6 +8270,7
> > @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> >   			/* make sure that auto bkops is disabled */
> >   			ufshcd_disable_auto_bkops(hba);
> >   		}
> > +
> Unnecessary new line, perhaps?
I will remove new line.
> >   		/*
> >   		 * If device needs to do BKOP or WB buffer flush during
> >   		 * Hibern8, keep device power mode as "active power mode"
> > @@ -8273,6 +8284,8 @@ static int ufshcd_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
> >   			ufshcd_wb_need_flush(hba));
> >   	}
> >
> > +	ufshcd_wb_toggle_flush_vendor(hba, pm_op);
> > +
> >   	if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) {
> >   		if ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled)
> ||
> >   		    !ufshcd_is_runtime_pm(pm_op)) { diff --git
> > a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index
> > 656c0691c858..deb9577e0eaa 100644
> > --- a/drivers/scsi/ufs/ufshcd.h
> > +++ b/drivers/scsi/ufs/ufshcd.h
> > @@ -254,6 +254,13 @@ struct ufs_pwr_mode_info {
> >   	struct ufs_pa_layer_attr info;
> >   };
> >
> > +struct ufs_wb_ops {
> > +	int (*wb_toggle_flush_vendor)(struct ufs_hba *hba, enum ufs_pm_op
> pm_op);
> > +	int (*wb_alloc_units_vendor)(struct ufs_hba *hba);
> > +	int (*wb_ctrl_vendor)(struct ufs_hba *hba, bool enable);
> > +	int (*wb_reset_vendor)(struct ufs_hba *hba, bool force); };
> > +
> >   /**
> >    * struct ufs_hba_variant_ops - variant specific callbacks
> >    * @name: variant name
> > @@ -752,6 +759,7 @@ struct ufs_hba {
> >   	struct request_queue	*bsg_queue;
> >   	bool wb_buf_flush_enabled;
> >   	bool wb_enabled;
> > +	struct ufs_wb_ops *wb_ops;
> >   	struct delayed_work rpm_dev_flush_recheck_work;
> >
> >   #ifdef CONFIG_SCSI_UFS_CRYPTO
> > @@ -1004,6 +1012,10 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
> >   			     u8 *desc_buff, int *buff_len,
> >   			     enum query_opcode desc_op);
> >
> > +int ufshcd_read_unit_desc_param(struct ufs_hba *hba,
> > +				int lun, enum unit_desc_param param_offset,
> > +				u8 *param_read_buf, u32 param_size);
> > +
> >   /* Wrapper functions for safely calling variant operations */
> >   static inline const char *ufshcd_get_var_name(struct ufs_hba *hba)
> >   {
> > @@ -1181,4 +1193,35 @@ static inline u8 ufshcd_scsi_to_upiu_lun(unsigned
> int scsi_lun)
> >   int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
> >   		     const char *prefix);
> >
> > +static inline int ufshcd_wb_toggle_flush_vendor(struct ufs_hba *hba,
> > +enum ufs_pm_op pm_op) {
> > +	if (!hba->wb_ops || !hba->wb_ops->wb_toggle_flush_vendor)
> > +		return -1;
> > +
> > +	return hba->wb_ops->wb_toggle_flush_vendor(hba, pm_op); }
> > +
> > +static int ufshcd_wb_alloc_units_vendor(struct ufs_hba *hba) {
> > +	if (!hba->wb_ops || !hba->wb_ops->wb_alloc_units_vendor)
> > +		return -1;
> > +
> > +	return hba->wb_ops->wb_alloc_units_vendor(hba);
> > +}
> > +
> > +static int ufshcd_wb_ctrl_vendor(struct ufs_hba *hba, bool enable) {
> > +	if (!hba->wb_ops || !hba->wb_ops->wb_ctrl_vendor)
> > +		return -1;
> > +
> > +	return hba->wb_ops->wb_ctrl_vendor(hba, enable); }
> > +
> > +static int ufshcd_reset_vendor(struct ufs_hba *hba) {
> > +	if (!hba->wb_ops || !hba->wb_ops->wb_reset_vendor)
> > +		return -1;
> > +
> > +	return hba->wb_ops->wb_reset_vendor(hba, false); }
> >   #endif /* End of Header */
> >
> 
> 
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> Linux Foundation Collaborative Project


  reply	other threads:[~2020-07-21  9:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200720103946epcas2p46e38e8d585d2882d167e5aa548e53217@epcas2p4.samsung.com>
2020-07-20 10:40 ` [RFC PATCH v2 0/3] Support vendor specific operations for WB SEO HOYOUNG
     [not found]   ` <CGME20200720103949epcas2p4a49b245d9cebf0478d42fb6c607fc236@epcas2p4.samsung.com>
2020-07-20 10:40     ` [RFC PATCH v2 1/3] scsi: ufs: modify write booster SEO HOYOUNG
2020-07-20 16:46       ` Asutosh Das (asd)
2020-07-21  9:26         ` 서호영 [this message]
     [not found]   ` <CGME20200720103950epcas2p16278643a6f62b446b653c834de448543@epcas2p1.samsung.com>
2020-07-20 10:40     ` [RFC PATCH v2 2/3] scsi: ufs: modify function call name When ufs reset and restore, need to disable " SEO HOYOUNG
2020-07-21  6:36       ` Avri Altman
     [not found]   ` <CGME20200720103951epcas2p246072985a70a459f0acb31d339298a47@epcas2p2.samsung.com>
2020-07-20 10:40     ` [RFC PATCH v2 3/3] scsi: ufs: add vendor specific write booster To support the fuction of writebooster by vendor. The WB behavior that the vendor wants is slightly different. But we have to support it SEO HOYOUNG
2020-07-20 16:55       ` Asutosh Das (asd)
2020-07-21  9:47         ` 서호영
2020-07-21 16:18           ` Asutosh Das (asd)
2020-07-24  9:42             ` 서호영
2020-07-24 15:57               ` Asutosh Das (asd)
2020-07-21  6:37       ` Avri Altman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='02d401d65f41$003e6390$00bb2ab0$@samsung.com' \
    --to=hy50.seo@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=grant.jung@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).