From: Hemant Kumar <hemantk@codeaurora.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
jhugo@codeaurora.org, bbhatt@codeaurora.org
Subject: Re: [PATCH v1 3/5] bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed
Date: Tue, 12 May 2020 17:28:45 -0700 [thread overview]
Message-ID: <5e9a15ed-4bad-744a-af07-b28c3bcc47c4@codeaurora.org> (raw)
In-Reply-To: <20200512065349.GE4928@Mani-XPS-13-9360>
Hi Mani,
On 5/11/20 11:53 PM, Manivannan Sadhasivam wrote:
> On Mon, May 11, 2020 at 07:03:07PM -0700, Hemant Kumar wrote:
>> 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>
>> ---
>> 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 9ec9b36..467c0ba 100644
>> --- a/drivers/bus/mhi/core/main.c
>> +++ b/drivers/bus/mhi/core/main.c
>> @@ -369,22 +369,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);
>
> write_lock is only used for protecting 'mhi_cntrl->ee' but here we are not
> updating it if reg access is not valid. So there is no reason to hold this lock.
Original code is using write_lock to protect pm_state as well as
mhi_cntrl->ee. This patch is keeping the lock same as original code.
Just if condition logic is negated here due to that write_unlock_irq is
added under if condition.
>
>> + goto exit_intvec;
>> }
>>
>> + state = mhi_get_mhi_state(mhi_cntrl);
>> + ee = mhi_cntrl->ee;
>> + mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl);
>
> But it is needed here.
>
> Thanks,
> Mani
>
>> + 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);
>> }
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2020-05-13 0:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 2:03 [PATCH v1 0/5] MHI Misc Fixes Hemant Kumar
2020-05-12 2:03 ` [PATCH v1 1/5] bus: mhi: core: Remove the system error worker thread Hemant Kumar
2020-05-12 6:46 ` Manivannan Sadhasivam
2020-05-12 2:03 ` [PATCH v1 2/5] bus: mhi: core: Handle disable transitions in state worker Hemant Kumar
2020-05-12 6:47 ` Manivannan Sadhasivam
2020-05-12 2:03 ` [PATCH v1 3/5] bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed Hemant Kumar
2020-05-12 6:53 ` Manivannan Sadhasivam
2020-05-13 0:28 ` Hemant Kumar [this message]
2020-05-13 7:04 ` Manivannan Sadhasivam
2020-05-13 18:39 ` Hemant Kumar
2020-05-13 7:58 ` Manivannan Sadhasivam
2020-05-12 2:03 ` [PATCH v1 4/5] bus: mhi: core: Do not process SYS_ERROR if RDDM is supported Hemant Kumar
2020-05-12 6:55 ` Manivannan Sadhasivam
2020-05-12 2:03 ` [PATCH v1 5/5] bus: mhi: core: Handle write lock properly in mhi_pm_m0_transition Hemant Kumar
2020-05-12 6:57 ` Manivannan Sadhasivam
2020-05-12 7:04 ` [PATCH v1 0/5] MHI Misc Fixes Manivannan Sadhasivam
2020-05-13 10:35 ` 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=5e9a15ed-4bad-744a-af07-b28c3bcc47c4@codeaurora.org \
--to=hemantk@codeaurora.org \
--cc=bbhatt@codeaurora.org \
--cc=jhugo@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.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