From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
linux-pm <linux-pm@vger.kernel.org>,
linux-acpi <linux-acpi@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH RFC 2/4] mmc: sdio: Add capability to skip SDIO reset at scan
Date: Tue, 25 Apr 2017 13:51:19 -0500 [thread overview]
Message-ID: <a873b92c-e290-2e9b-d473-e28e9aeb4c0c@ti.com> (raw)
In-Reply-To: <e9dabea2-76bc-8112-93de-c2ad7f2668f3@intel.com>
On 04/25/2017 07:45 AM, Adrian Hunter wrote:
> On 25/04/17 15:24, Ulf Hansson wrote:
>> On 25 April 2017 at 13:20, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>> On 25/04/17 13:46, Ulf Hansson wrote:
>>>> On 25 April 2017 at 09:57, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>>> On 25/04/17 10:52, Ulf Hansson wrote:
>>>>>> +Grygorii Strashko
>>>>>>
>>>>>> On 25 April 2017 at 08:21, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>>>>> On 24/04/17 23:33, Ulf Hansson wrote:
>>>>>>>> On 21 April 2017 at 12:08, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>>>>>>> The SDIO card state might be being preserved during hibernation, for
>>>>>>>>> example a SDIO wifi card supporting WOWLAN. That state will be lost if an
>>>>>>>>> SDIO reset is done. One way to avoid that would be to build mmc core as a
>>>>>>>>> module and simply not load it until after attempting to restore the
>>>>>>>>> hibernation image. However that won't work if the hibernation image is
>>>>>>>>> stored on eMMC which, of course, requires mmc core.
>>>>>>>>
>>>>>>>> I don't follow here. Are you saying the SDIO card is kept powered in
>>>>>>>> hibernation, as to be able to support WOWLAN, right?
>>>>>>>
>>>>>>> Yes
>>>>>>
>>>>>> Okay, makes sense!
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Then, it feels plain wrong the mmc_rescan() tries to re-initialize it.
>>>>>>>> That should never happen, unless something is broken of course.
>>>>>>>
>>>>>>> The thing to note about hibernation is that there is a regular boot in
>>>>>>> between saving the hibernation image and restoring it again. At boot time,
>>>>>>> the kernel knows almost nothing about whether there is a hibernation image
>>>>>>> and whether or not it will be restored. Consequently it becomes difficult
>>>>>>> to avoid mmc_rescan(). As mentioned above, we need mmc_rescan() to
>>>>>>> initialize the eMMC so that the hibernation image can be read.
>>>>>>
>>>>>> What's wrong with using the hibernation callbacks in the struct
>>>>>> dev_pm_ops? We already do this.
>>>>>
>>>>> Here is the scenario. The kernel has just booted. User space wants to try
>>>>> to restore a hibernation image, if there is one. So user space loads the
>>>>> mmc core because the hibernation image is on eMMC. Mmc core does an SDIO
>>>>> reset on the SDIO card and the state is lost. It has little to do with pm
>>>>> callbacks AFAICS.
>>>>
>>>> Ah, now I see what you mean. I thought the problem was during the
>>>> actual restoring of the hibernation image.
>>>>
>>>> Alright, when a boot is triggered by WOWLAN , you want to avoid
>>>> sending the reset command for the SDIO card before the
>>>> re-initialization of the SDIO card starts.
>>>>
>>>> The problem with this approach is that you can't differentiate between
>>>> a cold boot and a boot triggered by WOWLAN, right!? In other words, in
>>>> some cases the reset command may be needed while in other it won't.
>>>
>>> SDIO reset is only needed if the card has not been power-cycled. The
>>> assumption is that the platform takes care of that when needed. e.g. when
>>> rebooting instead of going to S4.
>>>
>>>>
>>>> Maybe you can elaborate more on what exactly what the problem is with
>>>> sending the reset command when the boot is triggered from WOWLAN? Yes,
>>>> the SDIO card loses its context, but how is that a problem?
>>>
>>> The wifi driver expects to find the function in an initialized state.
>>
>> So how does the the wifi driver distinguish this a boot caused by
>> WOWLAN - and not a cold boot?
>
> It doesn't have to. It doesn't get loaded until after the attempt to
> restore the hibernation image. So in the hibernation case it has its
> ->restore() callback.
For this case is a good question of how Kernel wifi card driver state will be
synchronized HW state after restore from Hibernation (first of all wireless state -
scan results, connection state and parameters)? Most probably wifi driver will
need to perform mostly full re-initialization on restore, so...
>If there is no hibernation image, it gets loaded and
> probed.
But in this case, as per you patch, there are will be no SDIO reset so
do you expect that wifi driver will still work?
>
> AFAICT that is the normal way to stop drivers interfering with hibernation
> i.e. don't load them until after the attempt is made to restore the
> hibernation image. We could do that with mmc core too, but for the fact
> that the hibernation image is on eMMC.
>From my experience, it pretty hard to restore HW state which runs by FW, so as
W/A we just unloaded remoteproc, wireless and graphic drivers before hibernation and
reloaded them right after. As I know the same approach often used in x86 world also.
>
>>
>>> Otherwise it would have to re-enable the function and re-do the
>>> function-specific initialization. I don't know if there are other
>>
>> At boot the SDIO func driver becomes probed, when the mmc core finds
>> and SDIO card and then registers a func device for it. Are you saying
>> that the SDIO func driver can take shortcuts when enabling the func
>> device, when the boot is trigger from WOWLAN?
>
> No.
>
>>
>>> consequences. Presumably it will have lost any information about the nature
>>> of the wake-up trigger.
>>
>> How does that matter?
>
> I don't know if it matters.
>
--
regards,
-grygorii
next prev parent reply other threads:[~2017-04-25 18:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 10:08 [PATCH RFC 0/4] mmc: sdio: To support hibernation add capability to skip SDIO reset at scan Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 1/4] mmc: sdio: Keep card runtime resumed while adding function devices Adrian Hunter
2017-04-24 21:03 ` Ulf Hansson
2017-04-25 6:41 ` Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 2/4] mmc: sdio: Add capability to skip SDIO reset at scan Adrian Hunter
2017-04-24 20:33 ` Ulf Hansson
2017-04-25 6:21 ` Adrian Hunter
2017-04-25 7:52 ` Ulf Hansson
2017-04-25 7:57 ` Adrian Hunter
2017-04-25 10:46 ` Ulf Hansson
2017-04-25 11:20 ` Adrian Hunter
2017-04-25 12:24 ` Ulf Hansson
2017-04-25 12:45 ` Adrian Hunter
2017-04-25 18:51 ` Grygorii Strashko [this message]
2017-04-25 19:11 ` Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 3/4] mmc: sdhci-acpi: Set MMC_CAP2_NO_SDIO_RESET if child has wake from S4 (hibernate) Adrian Hunter
2017-04-24 21:52 ` Rafael J. Wysocki
2017-04-25 7:28 ` Adrian Hunter
2017-04-25 11:05 ` Rafael J. Wysocki
2017-04-21 10:08 ` [PATCH RFC 4/4] mmc: sdhci-pci: " Adrian Hunter
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=a873b92c-e290-2e9b-d473-e28e9aeb4c0c@ti.com \
--to=grygorii.strashko@ti.com \
--cc=adrian.hunter@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--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