* [PATCH] bus: mhi: Early MHI resume failure in non M3 state
@ 2021-03-05 16:14 Loic Poulain
2021-03-05 17:26 ` Bhaumik Bhatt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Loic Poulain @ 2021-03-05 16:14 UTC (permalink / raw)
To: manivannan.sadhasivam, hemantk; +Cc: linux-arm-msm, jhugo, Loic Poulain
MHI suspend/resume are symmetric and balanced procedures. If device is
not in M3 state on a resume, that means something happened behind our
back. In this case resume is aborded and error reported, to let the
controller handling the situation.
This is mainly requested for system wide suspend-resume operation in
PCI context which may lead to power-down/reset of the controller which
will then lose its MHI context. In such cases, PCI driver is supposed
to recover and reinitialize the device.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
drivers/bus/mhi/core/pm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 0cd6445..725a0b2 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -916,6 +916,9 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state))
return -EIO;
+ if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3)
+ return -EINVAL;
+
/* Notify clients about exiting LPM */
list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
mutex_lock(&itr->mutex);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bus: mhi: Early MHI resume failure in non M3 state
2021-03-05 16:14 [PATCH] bus: mhi: Early MHI resume failure in non M3 state Loic Poulain
@ 2021-03-05 17:26 ` Bhaumik Bhatt
2021-03-10 13:58 ` Manivannan Sadhasivam
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
2 siblings, 0 replies; 4+ messages in thread
From: Bhaumik Bhatt @ 2021-03-05 17:26 UTC (permalink / raw)
To: Loic Poulain; +Cc: manivannan.sadhasivam, hemantk, linux-arm-msm, jhugo
On 2021-03-05 08:14 AM, Loic Poulain wrote:
> MHI suspend/resume are symmetric and balanced procedures. If device is
> not in M3 state on a resume, that means something happened behind our
> back. In this case resume is aborded and error reported, to let the
s/aborded/aborted
> controller handling the situation.
>
> This is mainly requested for system wide suspend-resume operation in
> PCI context which may lead to power-down/reset of the controller which
> will then lose its MHI context. In such cases, PCI driver is supposed
> to recover and reinitialize the device.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> drivers/bus/mhi/core/pm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index 0cd6445..725a0b2 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -916,6 +916,9 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
> if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state))
> return -EIO;
>
> + if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3)
> + return -EINVAL;
> +
> /* Notify clients about exiting LPM */
> list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
> mutex_lock(&itr->mutex);
We've had this check internally in the past but instead of reading the
register,
we just used if (mhi_cntrl->pm_state != MHI_PM_M3) to panic.
I like this version better. No reason why we shouldn't attempt to access
the
link due to read_reg being defined in the controller.
Reviewed-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Thanks,
Bhaumik
---
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bus: mhi: Early MHI resume failure in non M3 state
2021-03-05 16:14 [PATCH] bus: mhi: Early MHI resume failure in non M3 state Loic Poulain
2021-03-05 17:26 ` Bhaumik Bhatt
@ 2021-03-10 13:58 ` Manivannan Sadhasivam
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-10 13:58 UTC (permalink / raw)
To: Loic Poulain; +Cc: hemantk, linux-arm-msm, jhugo
On Fri, Mar 05, 2021 at 05:14:01PM +0100, Loic Poulain wrote:
> MHI suspend/resume are symmetric and balanced procedures. If device is
> not in M3 state on a resume, that means something happened behind our
> back. In this case resume is aborded and error reported, to let the
> controller handling the situation.
>
Will fix the spelling mistakes while applying. Please try to avoid them...
> This is mainly requested for system wide suspend-resume operation in
> PCI context which may lead to power-down/reset of the controller which
> will then lose its MHI context. In such cases, PCI driver is supposed
> to recover and reinitialize the device.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Thanks,
Mani
> ---
> drivers/bus/mhi/core/pm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index 0cd6445..725a0b2 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -916,6 +916,9 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
> if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state))
> return -EIO;
>
> + if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3)
> + return -EINVAL;
> +
> /* Notify clients about exiting LPM */
> list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
> mutex_lock(&itr->mutex);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bus: mhi: Early MHI resume failure in non M3 state
2021-03-05 16:14 [PATCH] bus: mhi: Early MHI resume failure in non M3 state Loic Poulain
2021-03-05 17:26 ` Bhaumik Bhatt
2021-03-10 13:58 ` Manivannan Sadhasivam
@ 2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-05-26 19:03 UTC (permalink / raw)
To: Loic Poulain; +Cc: linux-arm-msm
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
On Fri, 5 Mar 2021 17:14:01 +0100 you wrote:
> MHI suspend/resume are symmetric and balanced procedures. If device is
> not in M3 state on a resume, that means something happened behind our
> back. In this case resume is aborded and error reported, to let the
> controller handling the situation.
>
> This is mainly requested for system wide suspend-resume operation in
> PCI context which may lead to power-down/reset of the controller which
> will then lose its MHI context. In such cases, PCI driver is supposed
> to recover and reinitialize the device.
>
> [...]
Here is the summary with links:
- bus: mhi: Early MHI resume failure in non M3 state
https://git.kernel.org/qcom/c/020d3b26c07a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-26 19:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 16:14 [PATCH] bus: mhi: Early MHI resume failure in non M3 state Loic Poulain
2021-03-05 17:26 ` Bhaumik Bhatt
2021-03-10 13:58 ` Manivannan Sadhasivam
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
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).