linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
To: Adrian Hunter <adrian.hunter@intel.com>, ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Faiz Abbas <faiz_abbas@ti.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Ritesh Harjani <riteshh@codeaurora.org>,
	Asutosh Das <asutoshd@codeaurora.org>
Subject: Re: [PATCH V2] mmc: sdhci-msm: Disable CQE during SDHC reset
Date: Fri, 6 Mar 2020 15:44:14 +0530	[thread overview]
Message-ID: <cd306623-37a7-318e-8545-4b6a9c3765f4@codeaurora.org> (raw)
In-Reply-To: <460b7cbe-71f5-4bea-673f-2075ee5c5d6a@intel.com>


On 3/5/2020 2:29 PM, Adrian Hunter wrote:
> On 4/03/20 6:50 pm, Veerabhadrarao Badiganti wrote:
>> On 3/4/2020 7:40 PM, Adrian Hunter wrote:
>>> On 4/03/20 3:10 pm, Veerabhadrarao Badiganti wrote:
>>>> Hi Adrian
>>>>
>>>> On 3/4/2020 5:58 PM, Adrian Hunter wrote:
>>>>> On 4/03/20 1:54 pm, Veerabhadrarao Badiganti wrote:
>>>>>> When SDHC gets reset (E.g. in suspend path), CQE also gets reset
>>>>>> and goes to disable state. But s/w state still points it as CQE
>>>>>> is in enabled state. Since s/w and h/w states goes out of sync,
>>>>>> it results in s/w request timeout for subsequent CQE requests.
>>>>>>
>>>>>> To synchronize CQE s/w and h/w state during SDHC reset,
>>>>>> explicitly disable CQE after reset.
>>>>> Shouldn't you be calling cqhci_suspend() / cqhci_resume() in the suspend
>>>>> and
>>>>> resume paths?
>>>> This issue is seen during mmc runtime suspend.  I can add it
>>>> sdhci_msm_runtime_suspend
>>>>
>>>> but sdhci_msm runtime delay is aggressive, its 50ms. It may get invoked very
>>>> frequently.
>>>>
>>>> So Im of the opinion that disabling CQE very often from platform runtime
>>>> suspend is overkill.
>>> It doesn't look like sdhci-msm calls any sdhci.c pm ops, so how does SDHC
>>> get reset?
>> With MMC_CAP_AGGRESSIVE_PM flag enabled, it getting called from
>> mmc_runtime_suspend()
>>
>> Below is the call stack()
>>
>>     sdhci_reset
>>    sdhci_do_reset
>>    sdhci_init
>>    sdhci_set_ios
>>    mmc_set_initial_state
>>    mmc_power_off
>>   _mmc_suspend
>>    mmc_runtime_suspend
>>
> OK, cqhci_suspend does the right thing, but it is not an
> appropriate function for this.  I suggest introducing
> cqhci_deactivate() as below.
>
> From: Adrian Hunter <adrian.hunter@intel.com>
> Date: Thu, 5 Mar 2020 10:42:09 +0200
> Subject: [PATCH] mmc: cqhci: Add cqhci_deactivate()
>
> Host controllers can reset CQHCI either directly or as a consequence of
> host controller reset. Add cqhci_deactivate() which puts the CQHCI
> driver into a state that is consistent with that.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>   drivers/mmc/host/cqhci.c | 6 +++---
>   drivers/mmc/host/cqhci.h | 5 ++++-
>   2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c
> index e2ea2c4b6b94..d8d024a1682b 100644
> --- a/drivers/mmc/host/cqhci.c
> +++ b/drivers/mmc/host/cqhci.c
> @@ -298,16 +298,16 @@ static void __cqhci_disable(struct cqhci_host *cq_host)
>   	cq_host->activated = false;
>   }
>   
> -int cqhci_suspend(struct mmc_host *mmc)
> +int cqhci_deactivate(struct mmc_host *mmc)
>   {
>   	struct cqhci_host *cq_host = mmc->cqe_private;
>   
> -	if (cq_host->enabled)
> +	if (cq_host->enabled && cq_host->activated)
>   		__cqhci_disable(cq_host);
>   
>   	return 0;
>   }
> -EXPORT_SYMBOL(cqhci_suspend);
> +EXPORT_SYMBOL(cqhci_deactivate);
>   
>   int cqhci_resume(struct mmc_host *mmc)
>   {
> diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h
> index def76e9b5cac..8648846a0213 100644
> --- a/drivers/mmc/host/cqhci.h
> +++ b/drivers/mmc/host/cqhci.h
> @@ -230,7 +230,10 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error,
>   		      int data_error);
>   int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, bool dma64);
>   struct cqhci_host *cqhci_pltfm_init(struct platform_device *pdev);
> -int cqhci_suspend(struct mmc_host *mmc);
> +static inline int cqhci_suspend(struct mmc_host *mmc)
> +{
> +	return cqhci_deactivate(mmc);
> +}
>   int cqhci_resume(struct mmc_host *mmc);
>   
>   #endif

Thanks Adrian for the suggestion. Will post this change and my updated fix.

Thanks

Veera

  reply	other threads:[~2020-03-06 10:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 11:50 [PATCH] mmc: sdhci-msm: Disable CQE during SDHC reset Veerabhadrarao Badiganti
2020-03-04 11:54 ` [PATCH V2] " Veerabhadrarao Badiganti
2020-03-04 12:28   ` Adrian Hunter
2020-03-04 13:10     ` Veerabhadrarao Badiganti
2020-03-04 14:10       ` Adrian Hunter
2020-03-04 16:50         ` Veerabhadrarao Badiganti
2020-03-05  8:59           ` Adrian Hunter
2020-03-06 10:14             ` Veerabhadrarao Badiganti [this message]
2020-03-06 14:08 ` [PATCH V3 0/2] Deactivate " Veerabhadrarao Badiganti
2020-03-06 14:08   ` [PATCH V3 1/2] mmc: cqhci: Add cqhci_deactivate() Veerabhadrarao Badiganti
2020-03-06 14:08   ` [PATCH V3 2/2] mmc: sdhci-msm: Deactivate CQE during SDHC reset Veerabhadrarao Badiganti
2020-03-06 14:11     ` Adrian Hunter
2020-03-11 15:34   ` [PATCH V3 0/2] " Ulf Hansson

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=cd306623-37a7-318e-8545-4b6a9c3765f4@codeaurora.org \
    --to=vbadigan@codeaurora.org \
    --cc=adrian.hunter@intel.com \
    --cc=agross@kernel.org \
    --cc=asutoshd@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=faiz_abbas@ti.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=riteshh@codeaurora.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=skomatineni@nvidia.com \
    --cc=ulf.hansson@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;
as well as URLs for NNTP newsgroup(s).