Re: [PATCH/RFC v4 2/4] regulator: fixed: add regulator_ops members for suspend/resume
From: Geert Uytterhoeven
Date: Mon Jun 29 2020 - 15:03:33 EST
Hi Sudeep,
On Mon, Jun 29, 2020 at 3:40 PM Sudeep Holla <sudeep.holla@xxxxxxx> wrote:
> On Mon, Jun 29, 2020 at 01:57:56PM +0100, Mark Brown wrote:
> > On Mon, Jun 29, 2020 at 02:42:26AM +0000, Yoshihiro Shimoda wrote:
> > > > From: Mark Brown, Sent: Friday, June 26, 2020 11:39 PM
> > > > According to the changelog this is all about reflecting changes in the
> > > > system state done by firmware but there's no interaction with firmware
> > > > here which means this will be at best fragile. If we need to reflect
> > > > changes in firmware configuration I'd expect there to be some
> > > > interaction with firmware about how it is configured, or at least that
> > > > the configuration would come from the same source.
>
> I agree.
>
> > > I should have described background of previous patch series though,
> > > according to previous discussion [1] the firmware side (like PSCI) is
> > > also fragile unfortunately... So, I thought using regulator-off-in-suspend
> > > in a regulator was better.
>
> Please fix the firmware. You might have bigger problem than this if the
> PSCI firmware is fragile as you state. Better to disable power management
> on the platform if the firmware can't be fixed.
Saying the implementation is "fragile" might be bad wording.
The issue is more with the specification being vague (see more below).
> > > On other hand, Ulf is talking about either adding a property (perhaps like
> > > regulator-off-in-suspend) into a regulator or just adding a new property
> > > into MMC [2]. What do you think about Ulf' comment? I'm thinking
> > > adding a new property "full-pwr-cycle-in-suspend" is the best solution.
> > > This is because using a regulator property and reflecting a state of regulator without
> > > firmware is fragile, as you said.
>
> I haven't followed all the threads, but if it related to the policy you
> want in the Linux, then may be use DT property or something. I don't know.
> But if this is to indicate something based on firmware runtime/configuration,
> then NACK for any approaches unconditionally.
Like "arm,psci-system-suspend-is-power-down"[1]?
> > TBH I worry about a property drifting out of sync with the firmware on
> > systems where the firmware can be updated. Personally my default
> > assumption would always be that we're going to loose power for anything
OK, so that's the "safe" way to handle this: assume power is lost.
> > except the RAM and whatever is needed for wake sources during suspend so
Oh, even wake-up sources may become unpowered[2] ;-)
And thus stop working ;-(
> > I find the discussion a bit surprising but in any case that seems like a
> > better option than trying to shoehorn things in the way the series here
> > did. Like I said in my earlier replies if this is done through the
> > regulator API I'd expect it to be via the suspend interface.
>
> +1. If this platform needs Linux to keep some state on for users in the
> firmware or anything outside Linux, it must resume back in the same state
> as we entered the suspend state from the kernel.
I think you're misunderstanding the issue: this is not related at all
to Linux keeping state for non-Linux users.
This is all about how to know what exactly PSCI is powering down during
SYSTEM_SUSPEND. In this specific case, it is about knowing if the eMMC
is powered down or not, as Linux should follow a specific procedure to
prepare the eMMC for that, and Linux should not if that isn't the case.
I had a quick look at the latest revision of the PSCI specification, and
it doesn't look like anything has changed in that area since my old patch
series from 2017. So it still boils down to: we don't know what a
specific PSCI implementation will do, as basically anything is
compliant, so the only safe thing is to assume the worst.
Or am I missing something?
Thanks!
[1] "[PATCH/RFC 4/6] drivers: firmware: psci: Fix non-PMIC wake-up if
SYSTEM_SUSPEND cuts power"
https://lore.kernel.org/linux-arm-kernel/1487622809-25127-5-git-send-email-geert+renesas@xxxxxxxxx/
[2] [PATCH/RFC 0/6] PSCI: Fix non-PMIC wake-up if SYSTEM_SUSPEND cuts
power
https://lore.kernel.org/linux-arm-kernel/1487622809-25127-1-git-send-email-geert+renesas@xxxxxxxxx/
[3] https://developer.arm.com/architectures/system-architectures/software-standards/psci
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds