linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: gregkh@linuxfoundation.org
Cc: hemantk@codeaurora.org, jhugo@codeaurora.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: [RESEND PATCH 11/14] bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed
Date: Thu, 21 May 2020 22:32:46 +0530	[thread overview]
Message-ID: <20200521170249.21795-12-manivannan.sadhasivam@linaro.org> (raw)
In-Reply-To: <20200521170249.21795-1-manivannan.sadhasivam@linaro.org>

From: Hemant Kumar <hemantk@codeaurora.org>

Driver continues handling of BHI interrupt even if MHI register access
is not allowed. By doing so it calls the status call back and performs
early notification for the MHI client. This is not needed when MHI
register access is not allowed. Hence skip the handling in this case and
return. Also add debug log to print device state, local EE and device EE
when reg access is valid.

Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/bus/mhi/core/main.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index e5f6500e89fd..7429189840b0 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -368,22 +368,29 @@ irqreturn_t mhi_irq_handler(int irq_number, void *dev)
 	return IRQ_HANDLED;
 }
 
-irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *dev)
+irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *priv)
 {
-	struct mhi_controller *mhi_cntrl = dev;
+	struct mhi_controller *mhi_cntrl = priv;
+	struct device *dev = &mhi_cntrl->mhi_dev->dev;
 	enum mhi_state state = MHI_STATE_MAX;
 	enum mhi_pm_state pm_state = 0;
 	enum mhi_ee_type ee = 0;
 
 	write_lock_irq(&mhi_cntrl->pm_lock);
-	if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) {
-		state = mhi_get_mhi_state(mhi_cntrl);
-		ee = mhi_cntrl->ee;
-		mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl);
+	if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) {
+		write_unlock_irq(&mhi_cntrl->pm_lock);
+		goto exit_intvec;
 	}
 
+	state = mhi_get_mhi_state(mhi_cntrl);
+	ee = mhi_cntrl->ee;
+	mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl);
+	dev_dbg(dev, "local ee:%s device ee:%s dev_state:%s\n",
+		TO_MHI_EXEC_STR(mhi_cntrl->ee), TO_MHI_EXEC_STR(ee),
+		TO_MHI_STATE_STR(state));
+
 	if (state == MHI_STATE_SYS_ERR) {
-		dev_dbg(&mhi_cntrl->mhi_dev->dev, "System error detected\n");
+		dev_dbg(dev, "System error detected\n");
 		pm_state = mhi_tryset_pm_state(mhi_cntrl,
 					       MHI_PM_SYS_ERR_DETECT);
 	}
-- 
2.17.1


  parent reply	other threads:[~2020-05-21 17:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 17:02 [RESEND PATCH 00/14] MHI patches for v5.8 Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 01/14] bus: mhi: core: Refactor mhi queue APIs Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 02/14] bus: mhi: core: Cache intmod from mhi event to mhi channel Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 03/14] bus: mhi: core: Add range check for channel id received in event ring Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 04/14] bus: mhi: core: Read transfer length from an event properly Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 05/14] bus: mhi: core: Handle firmware load using state worker Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 06/14] bus: mhi: core: Return appropriate error codes for AMSS load failure Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 07/14] bus: mhi: core: Improve debug logs for loading firmware Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 08/14] bus: mhi: core: Ensure non-zero session or sequence ID values are used Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 09/14] bus: mhi: core: Remove the system error worker thread Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 10/14] bus: mhi: core: Handle disable transitions in state worker Manivannan Sadhasivam
2020-05-21 17:02 ` Manivannan Sadhasivam [this message]
2020-05-21 17:02 ` [RESEND PATCH 12/14] bus: mhi: core: Do not process SYS_ERROR if RDDM is supported Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 13/14] bus: mhi: core: Handle write lock properly in mhi_pm_m0_transition Manivannan Sadhasivam
2020-05-21 17:02 ` [RESEND PATCH 14/14] bus: mhi: core: Handle syserr during power_up Manivannan Sadhasivam

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=20200521170249.21795-12-manivannan.sadhasivam@linaro.org \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hemantk@codeaurora.org \
    --cc=jhugo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.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).