From: Loic Poulain <loic.poulain@linaro.org>
To: mani@kernel.org, hemantk@codeaurora.org
Cc: bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org,
Loic Poulain <loic.poulain@linaro.org>
Subject: [PATCH] bus: mhi: core: Resume success on SYS_ERR
Date: Mon, 31 May 2021 10:30:13 +0200 [thread overview]
Message-ID: <1622449813-3850-1-git-send-email-loic.poulain@linaro.org> (raw)
When a crash occurs while in suspended state M3/D3hot, the host
only discovers SYS_ERR pm-state change on resume. Handle this
state as valid transition for resume procedure, giving a chance
to the MHI core to manage the state (sbl transition, etc...).
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
drivers/bus/mhi/core/pm.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 704a5e2..e8eae4f 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -898,8 +898,27 @@ 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)
+ if (mhi_get_mhi_state(mhi_cntrl) == MHI_STATE_SYS_ERR) {
+ /* If we are in SYS_ERR state, let MHI stack manages the error
+ * and resume successfully.
+ */
+ dev_warn(dev, "Entered error while suspended\n");
+
+ write_lock_irq(&mhi_cntrl->pm_lock);
+ cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_SYS_ERR_DETECT);
+ write_unlock_irq(&mhi_cntrl->pm_lock);
+
+ if (cur_state == MHI_PM_SYS_ERR_DETECT) {
+ mhi_pm_sys_err_handler(mhi_cntrl);
+ return 0;
+ }
+ }
+
+ if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) {
+ dev_warn(dev, "Is not in M3 state, resume failed %d\n",
+ mhi_get_mhi_state(mhi_cntrl));
return -EINVAL;
+ }
/* Notify clients about exiting LPM */
list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
--
2.7.4
next reply other threads:[~2021-05-31 8:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 8:30 Loic Poulain [this message]
2021-06-02 1:13 ` [PATCH] bus: mhi: core: Resume success on SYS_ERR Bhaumik Bhatt
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=1622449813-3850-1-git-send-email-loic.poulain@linaro.org \
--to=loic.poulain@linaro.org \
--cc=bbhatt@codeaurora.org \
--cc=hemantk@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=mani@kernel.org \
/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).