All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: introduce dev_cmd_notify callback
       [not found] <CGME20220727051046epcas2p15481688ac3b7917bed8d06ebfb0a4184@epcas2p1.samsung.com>
@ 2022-07-27  5:09 ` Gyunghoon Kwon
  2022-07-27  5:16   ` Avri Altman
  0 siblings, 1 reply; 4+ messages in thread
From: Gyunghoon Kwon @ 2022-07-27  5:09 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: alim.akhtar, avri.altman, bvanassche, linux-scsi, linux-kernel,
	Gyunghoon Kwon

Some UFS host controller may need to synchronize dev command among
UFS host controllers.

Signed-off-by: Gyunghoon Kwon <goodjob.kwon@samsung.com>
---
 drivers/ufs/core/ufshcd.c |  2 ++
 include/ufs/ufshcd.h      | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index c7b337480e3e..fb642c5e73a3 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3021,8 +3021,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 
 	ufshcd_add_query_upiu_trace(hba, UFS_QUERY_SEND, lrbp->ucd_req_ptr);
 
+	ufshcd_vops_dev_cmd_notify(hba, PRE_CHANGE);
 	ufshcd_send_command(hba, tag);
 	err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
+	ufshcd_vops_dev_cmd_notify(hba, POST_CHANGE);
 	ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR : UFS_QUERY_COMP,
 				    (struct utp_upiu_req *)lrbp->ucd_rsp_ptr);
 
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index a92271421718..376babf71432 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -293,6 +293,7 @@ struct ufs_pwr_mode_info {
  * @config_scaling_param: called to configure clock scaling parameters
  * @program_key: program or evict an inline encryption key
  * @event_notify: called to notify important events
+ * @dev_cmd_notify: called to notify device management request is issued
  */
 struct ufs_hba_variant_ops {
 	const char *name;
@@ -331,6 +332,8 @@ struct ufs_hba_variant_ops {
 			       const union ufs_crypto_cfg_entry *cfg, int slot);
 	void	(*event_notify)(struct ufs_hba *hba,
 				enum ufs_event_type evt, void *data);
+	void	(*dev_cmd_notify)(struct ufs_hba *hba,
+				  enum ufs_notify_change_status);
 };
 
 /* clock gating state  */
@@ -1217,6 +1220,13 @@ static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba)
 	return 0;
 }
 
+static inline void ufshcd_vops_dev_cmd_notify(struct ufs_hba *hba,
+					enum ufs_notify_change_status status)
+{
+	if (hba->vops && hba->vops->dev_cmd_notify)
+		hba->vops->dev_cmd_notify(hba, status);
+}
+
 extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
 
 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] scsi: ufs: introduce dev_cmd_notify callback
  2022-07-27  5:09 ` [PATCH] scsi: ufs: introduce dev_cmd_notify callback Gyunghoon Kwon
@ 2022-07-27  5:16   ` Avri Altman
  2022-07-27 17:54     ` Bart Van Assche
  0 siblings, 1 reply; 4+ messages in thread
From: Avri Altman @ 2022-07-27  5:16 UTC (permalink / raw)
  To: Gyunghoon Kwon, jejb, martin.petersen
  Cc: alim.akhtar, bvanassche, linux-scsi, linux-kernel

> 
> Some UFS host controller may need to synchronize dev command among UFS
> host controllers.
> 
> Signed-off-by: Gyunghoon Kwon <goodjob.kwon@samsung.com>
You need to include at least one implementation of this vop,
Otherwise, its just a piece of dead code.

Thanks,
Avri

> ---
>  drivers/ufs/core/ufshcd.c |  2 ++
>  include/ufs/ufshcd.h      | 10 ++++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> c7b337480e3e..fb642c5e73a3 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3021,8 +3021,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba
> *hba,
> 
>         ufshcd_add_query_upiu_trace(hba, UFS_QUERY_SEND, lrbp-
> >ucd_req_ptr);
> 
> +       ufshcd_vops_dev_cmd_notify(hba, PRE_CHANGE);
>         ufshcd_send_command(hba, tag);
>         err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
> +       ufshcd_vops_dev_cmd_notify(hba, POST_CHANGE);
>         ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR :
> UFS_QUERY_COMP,
>                                     (struct utp_upiu_req *)lrbp->ucd_rsp_ptr);
> 
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index
> a92271421718..376babf71432 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -293,6 +293,7 @@ struct ufs_pwr_mode_info {
>   * @config_scaling_param: called to configure clock scaling parameters
>   * @program_key: program or evict an inline encryption key
>   * @event_notify: called to notify important events
> + * @dev_cmd_notify: called to notify device management request is
> + issued
>   */
>  struct ufs_hba_variant_ops {
>         const char *name;
> @@ -331,6 +332,8 @@ struct ufs_hba_variant_ops {
>                                const union ufs_crypto_cfg_entry *cfg, int slot);
>         void    (*event_notify)(struct ufs_hba *hba,
>                                 enum ufs_event_type evt, void *data);
> +       void    (*dev_cmd_notify)(struct ufs_hba *hba,
> +                                 enum ufs_notify_change_status);
>  };
> 
>  /* clock gating state  */
> @@ -1217,6 +1220,13 @@ static inline int
> ufshcd_vops_phy_initialization(struct ufs_hba *hba)
>         return 0;
>  }
> 
> +static inline void ufshcd_vops_dev_cmd_notify(struct ufs_hba *hba,
> +                                       enum ufs_notify_change_status
> +status) {
> +       if (hba->vops && hba->vops->dev_cmd_notify)
> +               hba->vops->dev_cmd_notify(hba, status); }
> +
>  extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
> 
>  int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
> --
> 2.37.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: ufs: introduce dev_cmd_notify callback
  2022-07-27  5:16   ` Avri Altman
@ 2022-07-27 17:54     ` Bart Van Assche
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2022-07-27 17:54 UTC (permalink / raw)
  To: Avri Altman, Gyunghoon Kwon, jejb, martin.petersen
  Cc: alim.akhtar, linux-scsi, linux-kernel

On 7/26/22 22:16, Avri Altman wrote:
>> Some UFS host controller may need to synchronize dev command among UFS
>> host controllers.
>
> You need to include at least one implementation of this vop,
> Otherwise, its just a piece of dead code.

+1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] scsi: ufs: introduce dev_cmd_notify callback
       [not found] <CGME20220726104752epcas2p25991dabdb0acb21e25f21277f3198b09@epcas2p2.samsung.com>
@ 2022-07-26 10:45 ` Gyunghoon Kwon
  0 siblings, 0 replies; 4+ messages in thread
From: Gyunghoon Kwon @ 2022-07-26 10:45 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: alim.akhtar, avri.altman, linux-scsi, linux-kernel, Gyunghoon Kwon

Some UFS host controller may need to synchronize dev command among
UFS host controllers.

Signed-off-by: Gyunghoon Kwon <goodjob.kwon@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c |  2 ++
 drivers/scsi/ufs/ufshcd.h | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 823ecd99eb2c..02d0350ee1a2 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2942,8 +2942,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 
 	ufshcd_add_query_upiu_trace(hba, UFS_QUERY_SEND, lrbp->ucd_req_ptr);
 
+	ufshcd_vops_dev_cmd_notify(hba, PRE_CHANGE);
 	ufshcd_send_command(hba, tag);
 	err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
+	ufshcd_vops_dev_cmd_notify(hba, POST_CHANGE);
 	ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR : UFS_QUERY_COMP,
 				    (struct utp_upiu_req *)lrbp->ucd_rsp_ptr);
 
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 34c5db101f14..f13b6cdfbe1d 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -320,6 +320,7 @@ struct ufs_pwr_mode_info {
  * @device_reset: called to issue a reset pulse on the UFS device
  * @program_key: program or evict an inline encryption key
  * @event_notify: called to notify important events
+ * @dev_cmd_notify: called to notify device management request is issued
  */
 struct ufs_hba_variant_ops {
 	const char *name;
@@ -357,6 +358,8 @@ struct ufs_hba_variant_ops {
 			       const union ufs_crypto_cfg_entry *cfg, int slot);
 	void	(*event_notify)(struct ufs_hba *hba,
 				enum ufs_event_type evt, void *data);
+	void	(*dev_cmd_notify)(struct ufs_hba *hba,
+			       enum ufs_notify_change_status);
 };
 
 /* clock gating state  */
@@ -1354,6 +1357,13 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
 		hba->vops->config_scaling_param(hba, profile, data);
 }
 
+static inline void ufshcd_vops_dev_cmd_notify(struct ufs_hba *hba,
+					enum ufs_notify_change_status status)
+{
+	if (hba->vops && hba->vops->dev_cmd_notify)
+		hba->vops->dev_cmd_notify(hba, status);
+}
+
 extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
 
 /*
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-27 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220727051046epcas2p15481688ac3b7917bed8d06ebfb0a4184@epcas2p1.samsung.com>
2022-07-27  5:09 ` [PATCH] scsi: ufs: introduce dev_cmd_notify callback Gyunghoon Kwon
2022-07-27  5:16   ` Avri Altman
2022-07-27 17:54     ` Bart Van Assche
     [not found] <CGME20220726104752epcas2p25991dabdb0acb21e25f21277f3198b09@epcas2p2.samsung.com>
2022-07-26 10:45 ` Gyunghoon Kwon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.