All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Claudiu.Beznea@microchip.com
Cc: linux-kernel@vger.kernel.org, Ludovic.Desroches@microchip.com,
	linux-arm-kernel@lists.infradead.org, wenyou.yang@atmel.com
Subject: Re: [PATCH v2 2/3] ARM: at91: pm: add per soc validation of pm modes
Date: Tue, 4 Aug 2020 17:56:36 +0200	[thread overview]
Message-ID: <20200804155636.GC10725@piout.net> (raw)
In-Reply-To: <5c00c0f9-dc73-fb8d-aef8-88f4bc923295@microchip.com>

On 04/08/2020 15:45:40+0000, Claudiu.Beznea@microchip.com wrote:
> 
> 
> On 04.08.2020 18:08, Alexandre Belloni wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > On 04/08/2020 15:00:38+0000, Claudiu.Beznea@microchip.com wrote:
> >>
> >>
> >> On 04.08.2020 14:42, Alexandre Belloni wrote:
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> Hello,
> >>>
> >>> On 04/08/2020 14:07:37+0300, Claudiu Beznea wrote:
> >>>>  void __init at91rm9200_pm_init(void)
> >>>>  {
> >>>> +     static const int modes[] __initconst = {
> >>>
> >>> You don't need that to be static as it is now local to the function.
> >>>
> >>>> +             AT91_PM_STANDBY, AT91_PM_ULP0
> >>>> +     };
> >>>> +
> >>>>       if (!IS_ENABLED(CONFIG_SOC_AT91RM9200))
> >>>>               return;
> >>>>
> >>>> +     at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
> >>>
> >>> For rm9200 and at91sam9, I would not allow changing the pm_modes and
> >>> simply enforce standby_mode = AT91_PM_STANDBY and suspend_mode =
> >>> AT91_PM_ULP0.I don't think you have any user that ever changed that
> >>> behaviour also that avoids increasing the boot time for those slow SoCs.
> >>
> >> OK, but bootargs is parsed at a moment when there is no information about
> >> the machine that is running the code. And enforcing this in *_pm_init()
> >> functions for rm9200 and at91sam9 may change suspend and standby mode that
> >> user selected. If there is no user up to this moment there is still the
> >> possibility of being one in the future.
> >>
> > 
> > So let's prevent users from doing that. Unused arguments are silently
> > ignored which is exactly what we want to do.
> 
> Can you share what are you thinking about? You want to not parse
> atmel.pm_modes for this machines?
> 

Well, as you said, when parsing we don't know on which machine we are
running so let's keep parsing it anyway.

> > You won't make me believe
> > there is actually a use case for swapping the standby and suspend
> > meanings.
> What i want to say is this:
> bootargs contains atmel.pm_modes=ulp0,standby
> 
> this leads to
> standby_mode=ulp0
> suspend_mode=standby
> 
> But you want in code to force
> standby_mode=standby
> suspend_mode=ulp0
> 
> The question is: is this what you are thinking this should be done?
> 

Yes, I think we need to enforce standby_mode=standby and
suspend_mode=ulp0 for rm9200 and at91sam9. This is how it always have
been.

You have two ways of doing that:

Etiher you enforce the values after parsing, in at91rm9200_pm_init and
at91sam9_pm_init. Or, when parsing your store the values in a different
location than soc_pm.data and update soc_pm.data only in sama5_pm_init,
sama5d2_pm_init and sam9x60_pm_init. I feel like the first solution is
easier.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Claudiu.Beznea@microchip.com
Cc: Nicolas.Ferre@microchip.com, Ludovic.Desroches@microchip.com,
	wenyou.yang@atmel.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] ARM: at91: pm: add per soc validation of pm modes
Date: Tue, 4 Aug 2020 17:56:36 +0200	[thread overview]
Message-ID: <20200804155636.GC10725@piout.net> (raw)
In-Reply-To: <5c00c0f9-dc73-fb8d-aef8-88f4bc923295@microchip.com>

On 04/08/2020 15:45:40+0000, Claudiu.Beznea@microchip.com wrote:
> 
> 
> On 04.08.2020 18:08, Alexandre Belloni wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > On 04/08/2020 15:00:38+0000, Claudiu.Beznea@microchip.com wrote:
> >>
> >>
> >> On 04.08.2020 14:42, Alexandre Belloni wrote:
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> Hello,
> >>>
> >>> On 04/08/2020 14:07:37+0300, Claudiu Beznea wrote:
> >>>>  void __init at91rm9200_pm_init(void)
> >>>>  {
> >>>> +     static const int modes[] __initconst = {
> >>>
> >>> You don't need that to be static as it is now local to the function.
> >>>
> >>>> +             AT91_PM_STANDBY, AT91_PM_ULP0
> >>>> +     };
> >>>> +
> >>>>       if (!IS_ENABLED(CONFIG_SOC_AT91RM9200))
> >>>>               return;
> >>>>
> >>>> +     at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
> >>>
> >>> For rm9200 and at91sam9, I would not allow changing the pm_modes and
> >>> simply enforce standby_mode = AT91_PM_STANDBY and suspend_mode =
> >>> AT91_PM_ULP0.I don't think you have any user that ever changed that
> >>> behaviour also that avoids increasing the boot time for those slow SoCs.
> >>
> >> OK, but bootargs is parsed at a moment when there is no information about
> >> the machine that is running the code. And enforcing this in *_pm_init()
> >> functions for rm9200 and at91sam9 may change suspend and standby mode that
> >> user selected. If there is no user up to this moment there is still the
> >> possibility of being one in the future.
> >>
> > 
> > So let's prevent users from doing that. Unused arguments are silently
> > ignored which is exactly what we want to do.
> 
> Can you share what are you thinking about? You want to not parse
> atmel.pm_modes for this machines?
> 

Well, as you said, when parsing we don't know on which machine we are
running so let's keep parsing it anyway.

> > You won't make me believe
> > there is actually a use case for swapping the standby and suspend
> > meanings.
> What i want to say is this:
> bootargs contains atmel.pm_modes=ulp0,standby
> 
> this leads to
> standby_mode=ulp0
> suspend_mode=standby
> 
> But you want in code to force
> standby_mode=standby
> suspend_mode=ulp0
> 
> The question is: is this what you are thinking this should be done?
> 

Yes, I think we need to enforce standby_mode=standby and
suspend_mode=ulp0 for rm9200 and at91sam9. This is how it always have
been.

You have two ways of doing that:

Etiher you enforce the values after parsing, in at91rm9200_pm_init and
at91sam9_pm_init. Or, when parsing your store the values in a different
location than soc_pm.data and update soc_pm.data only in sama5_pm_init,
sama5d2_pm_init and sam9x60_pm_init. I feel like the first solution is
easier.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2020-08-04 15:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 11:07 [PATCH v2 0/3] AT91 PM improvements Claudiu Beznea
2020-08-04 11:07 ` Claudiu Beznea
2020-08-04 11:07 ` [PATCH v2 1/3] ARM: at91: pm: add support for ULP0 fast wakeup Claudiu Beznea
2020-08-04 11:07   ` Claudiu Beznea
2020-08-04 11:07 ` [PATCH v2 2/3] ARM: at91: pm: add per soc validation of pm modes Claudiu Beznea
2020-08-04 11:07   ` Claudiu Beznea
2020-08-04 11:42   ` Alexandre Belloni
2020-08-04 11:42     ` Alexandre Belloni
2020-08-04 15:00     ` Claudiu.Beznea
2020-08-04 15:00       ` Claudiu.Beznea
2020-08-04 15:08       ` Alexandre Belloni
2020-08-04 15:08         ` Alexandre Belloni
2020-08-04 15:45         ` Claudiu.Beznea
2020-08-04 15:45           ` Claudiu.Beznea
2020-08-04 15:56           ` Alexandre Belloni [this message]
2020-08-04 15:56             ` Alexandre Belloni
2020-08-04 11:07 ` [PATCH v2 3/3] ARM: at91: pm: of_node_put() after its usage Claudiu Beznea
2020-08-04 11:07   ` Claudiu Beznea

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=20200804155636.GC10725@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wenyou.yang@atmel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.