* [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
@ 2025-03-04 11:46 Arthur Simchaev
2025-03-06 12:50 ` Bean Huo
0 siblings, 1 reply; 7+ messages in thread
From: Arthur Simchaev @ 2025-03-04 11:46 UTC (permalink / raw)
To: martin.petersen
Cc: avri.altman, Avi.Shchislowski, linux-scsi, linux-kernel,
bvanassche, Arthur Simchaev
Eye monitor measurement functionality was added to the M-PHY v5
specification. The measurement of the eye monitor signal for the UFS
device begins when the link enters the hibernate state.
Hence, allow user-layer applications the capability to send the hibern8
enter command through the BSG framework. For completion, allow the
sibling functionality of hibern8 exit as well.
Signed-off-by: Arthur Simchaev <arthur.simchaev@sandisk.com>
---
drivers/ufs/core/ufshcd.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 4e1e214fc5a2..546ab557a77c 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4366,6 +4366,16 @@ int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
goto out;
}
+ if (uic_cmd->command == UIC_CMD_DME_HIBER_ENTER) {
+ ret = ufshcd_uic_hibern8_enter(hba);
+ goto out;
+ }
+
+ if (uic_cmd->command == UIC_CMD_DME_HIBER_EXIT) {
+ ret = ufshcd_uic_hibern8_exit(hba);
+ goto out;
+ }
+
mutex_lock(&hba->uic_cmd_mutex);
ufshcd_add_delay_before_dme_cmd(hba);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
2025-03-04 11:46 [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd Arthur Simchaev
@ 2025-03-06 12:50 ` Bean Huo
2025-03-06 13:04 ` Can Guo
2025-03-07 9:18 ` Arthur Simchaev
0 siblings, 2 replies; 7+ messages in thread
From: Bean Huo @ 2025-03-06 12:50 UTC (permalink / raw)
To: Arthur Simchaev, martin.petersen, quic_mapa, quic_cang
Cc: avri.altman, Avi.Shchislowski, linux-scsi, linux-kernel,
bvanassche
Arthur,
At present, we lack a user-space tool to initiate eye monitor
measurements. Additionally, opening a channel for users in user land to
send MP commands seems unsafe.
Kind regards,
Bean
On Tue, 2025-03-04 at 13:46 +0200, Arthur Simchaev wrote:
> Eye monitor measurement functionality was added to the M-PHY v5
> specification. The measurement of the eye monitor signal for the UFS
> device begins when the link enters the hibernate state.
> Hence, allow user-layer applications the capability to send the
> hibern8
> enter command through the BSG framework. For completion, allow the
> sibling functionality of hibern8 exit as well.
>
> Signed-off-by: Arthur Simchaev <arthur.simchaev@sandisk.com>
> ---
> drivers/ufs/core/ufshcd.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 4e1e214fc5a2..546ab557a77c 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4366,6 +4366,16 @@ int ufshcd_send_bsg_uic_cmd(struct ufs_hba
> *hba, struct uic_command *uic_cmd)
> goto out;
> }
>
> + if (uic_cmd->command == UIC_CMD_DME_HIBER_ENTER) {
> + ret = ufshcd_uic_hibern8_enter(hba);
> + goto out;
> + }
> +
> + if (uic_cmd->command == UIC_CMD_DME_HIBER_EXIT) {
> + ret = ufshcd_uic_hibern8_exit(hba);
> + goto out;
> + }
> +
> mutex_lock(&hba->uic_cmd_mutex);
> ufshcd_add_delay_before_dme_cmd(hba);
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
2025-03-06 12:50 ` Bean Huo
@ 2025-03-06 13:04 ` Can Guo
2025-03-07 9:10 ` Arthur Simchaev
2025-03-26 15:08 ` Arthur Simchaev
2025-03-07 9:18 ` Arthur Simchaev
1 sibling, 2 replies; 7+ messages in thread
From: Can Guo @ 2025-03-06 13:04 UTC (permalink / raw)
To: Bean Huo, Arthur Simchaev, martin.petersen, quic_mapa
Cc: avri.altman, Avi.Shchislowski, linux-scsi, linux-kernel,
bvanassche
Hi Arthur,
On 3/6/2025 8:50 PM, Bean Huo wrote:
> Arthur,
>
> At present, we lack a user-space tool to initiate eye monitor
> measurements. Additionally, opening a channel for users in user land to
> send MP commands seems unsafe.
>
>
> Kind regards,
> Bean
>
> On Tue, 2025-03-04 at 13:46 +0200, Arthur Simchaev wrote:
>> Eye monitor measurement functionality was added to the M-PHY v5
>> specification. The measurement of the eye monitor signal for the UFS
>> device begins when the link enters the hibernate state.
>> Hence, allow user-layer applications the capability to send the
>> hibern8
>> enter command through the BSG framework. For completion, allow the
>> sibling functionality of hibern8 exit as well.
>>
>> Signed-off-by: Arthur Simchaev <arthur.simchaev@sandisk.com>
>> ---
>> drivers/ufs/core/ufshcd.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>> index 4e1e214fc5a2..546ab557a77c 100644
>> --- a/drivers/ufs/core/ufshcd.c
>> +++ b/drivers/ufs/core/ufshcd.c
>> @@ -4366,6 +4366,16 @@ int ufshcd_send_bsg_uic_cmd(struct ufs_hba
>> *hba, struct uic_command *uic_cmd)
>> goto out;
>> }
>>
>> + if (uic_cmd->command == UIC_CMD_DME_HIBER_ENTER) {
>> + ret = ufshcd_uic_hibern8_enter(hba);
>> + goto out;
>> + }
>> +
>> + if (uic_cmd->command == UIC_CMD_DME_HIBER_EXIT) {
>> + ret = ufshcd_uic_hibern8_exit(hba);
>> + goto out;
>> + }
>> +
>> mutex_lock(&hba->uic_cmd_mutex);
>> ufshcd_add_delay_before_dme_cmd(hba);
>>
>> --
>> 2.34.1
I can understand that you want to use hibern8 enter&exit to trigger a
RCT to kick start the EOM,
however there is a better/simpler way to do so: you can trigger a power
mode change to the
same power mode (e.g., from HS-G5 to HS-G5) to trigger a RCT (without
invoking hibern8 enter&exit)
from user layer by dme_set(PA_PWRMODE).
FYI, we have open-sourced Qcom's EOM tool in GitHub and validated the
EOM function on most
UFS4.x devices from UFS vendors, you can find the code for your reference:
https://github.com/quic/ufs-tools/blob/main/ufs-cli/ufs_eom.c#L266
The recent change from Ziqi Chen is to serve the power mode change
purpose I mentioned above:
https://lore.kernel.org/all/20241212144248.990103107@linuxfoudation.org/
Hope above info can help you.
Thanks,
Can Guo.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
2025-03-06 13:04 ` Can Guo
@ 2025-03-07 9:10 ` Arthur Simchaev
2025-03-26 15:08 ` Arthur Simchaev
1 sibling, 0 replies; 7+ messages in thread
From: Arthur Simchaev @ 2025-03-07 9:10 UTC (permalink / raw)
To: Can Guo, Bean Huo, martin.petersen@oracle.com,
quic_mapa@quicinc.com
Cc: Avri Altman, Avi Shchislowski, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, bvanassche@acm.org
> I can understand that you want to use hibern8 enter&exit to trigger a RCT to
> kick start the EOM, however there is a better/simpler way to do so: you can
> trigger a power mode change to the same power mode (e.g., from HS-G5 to
> HS-G5) to trigger a RCT (without invoking hibern8 enter&exit) from user layer
> by dme_set(PA_PWRMODE).
>
> FYI, we have open-sourced Qcom's EOM tool in GitHub and validated the EOM
> function on most UFS4.x devices from UFS vendors, you can find the code for
> your reference:
> https://github.com/quic/ufs-tools/blob/main/ufs-cli/ufs_eom.c#L266
>
> The recent change from Ziqi Chen is to serve the power mode change purpose
> I mentioned above:
> https://lore.kernel.org/all/20241212144248.990103107@linuxfoudation.or
> g/
>
> Hope above info can help you.
>
> Thanks,
> Can Guo.
Thank you, Can.
I am familiar with this very useful tool. In fact, I published the patch due to the tool
In order to extend the debug functionality from the user space.
In my opinion, the hibern8 enter function can be used in a similar manner as the PMC.
For instance, if the host fails to change the power mode to FAST MODE with NO ADAPT.
Regards
Arthur
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
2025-03-06 12:50 ` Bean Huo
2025-03-06 13:04 ` Can Guo
@ 2025-03-07 9:18 ` Arthur Simchaev
2025-03-07 10:38 ` Bean Huo
1 sibling, 1 reply; 7+ messages in thread
From: Arthur Simchaev @ 2025-03-07 9:18 UTC (permalink / raw)
To: Bean Huo, martin.petersen@oracle.com, quic_mapa@quicinc.com,
quic_cang@quicinc.com
Cc: Avri Altman, Avi Shchislowski, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, bvanassche@acm.org
> -----Original Message-----
> From: Bean Huo <huobean@gmail.com>
> Sent: Thursday, March 6, 2025 2:50 PM
> To: Arthur Simchaev <Arthur.Simchaev@sandisk.com>;
> martin.petersen@oracle.com; quic_mapa@quicinc.com;
> quic_cang@quicinc.com
> Cc: Avri Altman <Avri.Altman@sandisk.com>; Avi Shchislowski
> <Avi.Shchislowski@sandisk.com>; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org; bvanassche@acm.org
> Subject: Re: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to
> ufshcd_send_bsg_uic_cmd
>
>
> Arthur,
>
> At present, we lack a user-space tool to initiate eye monitor measurements.
> Additionally, opening a channel for users in user land to send MP commands
> seems unsafe.
>
>
> Kind regards,
> Bean
>
Hi Bean.
Actually, the EOM tool was published two months ago
See the mail from Can Guo. The patch simply extends the UIC debugging functionality from user space.
I think it is quite safe to use hibern8 functionality for debugging purposes.
Regards
Arthur
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
2025-03-07 9:18 ` Arthur Simchaev
@ 2025-03-07 10:38 ` Bean Huo
0 siblings, 0 replies; 7+ messages in thread
From: Bean Huo @ 2025-03-07 10:38 UTC (permalink / raw)
To: Arthur Simchaev, martin.petersen@oracle.com,
quic_mapa@quicinc.com, quic_cang@quicinc.com
Cc: Avri Altman, Avi Shchislowski, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, bvanassche@acm.org
On Fri, 2025-03-07 at 09:18 +0000, Arthur Simchaev wrote:
>
>
> > -----Original Message-----
> > From: Bean Huo <huobean@gmail.com>
> > Sent: Thursday, March 6, 2025 2:50 PM
> > To: Arthur Simchaev <Arthur.Simchaev@sandisk.com>;
> > martin.petersen@oracle.com; quic_mapa@quicinc.com;
> > quic_cang@quicinc.com
> > Cc: Avri Altman <Avri.Altman@sandisk.com>; Avi Shchislowski
> > <Avi.Shchislowski@sandisk.com>; linux-scsi@vger.kernel.org; linux-
> > kernel@vger.kernel.org; bvanassche@acm.org
> > Subject: Re: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to
> > ufshcd_send_bsg_uic_cmd
> >
> >
> > Arthur,
> >
> > At present, we lack a user-space tool to initiate eye monitor
> > measurements.
> > Additionally, opening a channel for users in user land to send MP
> > commands
> > seems unsafe.
> >
> >
> > Kind regards,
> > Bean
> >
>
> Hi Bean.
>
> Actually, the EOM tool was published two months ago
> See the mail from Can Guo. The patch simply extends the UIC debugging
> functionality from user space.
> I think it is quite safe to use hibern8 functionality for debugging
> purposes.
>
> Regards
> Arthur
Great, we will work on that.
Kind regards,
Bean
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
2025-03-06 13:04 ` Can Guo
2025-03-07 9:10 ` Arthur Simchaev
@ 2025-03-26 15:08 ` Arthur Simchaev
1 sibling, 0 replies; 7+ messages in thread
From: Arthur Simchaev @ 2025-03-26 15:08 UTC (permalink / raw)
To: Can Guo, Bean Huo, martin.petersen@oracle.com,
quic_mapa@quicinc.com
Cc: Avri Altman, Avi Shchislowski, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, bvanassche@acm.org
> I can understand that you want to use hibern8 enter&exit to trigger a RCT to
> kick start the EOM, however there is a better/simpler way to do so: you can
> trigger a power mode change to the same power mode (e.g., from HS-G5 to
> HS-G5) to trigger a RCT (without invoking hibern8 enter&exit) from user layer
> by dme_set(PA_PWRMODE).
>
> FYI, we have open-sourced Qcom's EOM tool in GitHub and validated the EOM
> function on most UFS4.x devices from UFS vendors, you can find the code for
> your reference:
> https://github.com/quic/ufs-tools/blob/main/ufs-cli/ufs_eom.c#L266
>
> The recent change from Ziqi Chen is to serve the power mode change purpose
> I mentioned above:
> https://lore.kernel.org/all/20241212144248.990103107@linuxfoudation.or
> g/
>
> Hope above info can help you.
>
> Thanks,
> Can Guo.
Hi Can
Maybe I need reword the commit message. Having h8 from the user space is useful for creating different test cases.
For example, stressing h8 , MPHY enter/exit from hibern8.
Regards
Arthur
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-03-26 15:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 11:46 [PATCH] ufs: core: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd Arthur Simchaev
2025-03-06 12:50 ` Bean Huo
2025-03-06 13:04 ` Can Guo
2025-03-07 9:10 ` Arthur Simchaev
2025-03-26 15:08 ` Arthur Simchaev
2025-03-07 9:18 ` Arthur Simchaev
2025-03-07 10:38 ` Bean Huo
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.