lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ho7jifrda.fsf@baylibre.com>
Date:   Mon, 07 Aug 2023 14:57:05 -0700
From:   Kevin Hilman <khilman@...nel.org>
To:     Dhruva Gole <d-gole@...com>, Andrew Davis <afd@...com>
Cc:     Nishanth Menon <nm@...com>, Tero Kristo <kristo@...nel.org>,
        Santosh Shilimkar <ssantosh@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-pm@...r.kernel.org, Viresh Kumar <viresh.kumar@...aro.org>,
        Praneeth Bajjuri <praneeth@...com>,
        Tony Lindgren <tony@...mide.com>,
        Dave Gerlach <d-gerlach@...com>,
        Vibhore Vardhan <vibhore@...com>, Georgi Vlaev <g-vlaev@...com>
Subject: Re: [PATCH V6 4/4] firmware: ti_sci: Introduce system suspend
 resume support

Dhruva Gole <d-gole@...com> writes:

> On Aug 03, 2023 at 11:00:11 -0500, Andrew Davis wrote:
>> On 8/3/23 10:55 AM, Dhruva Gole wrote:
>> > On Aug 03, 2023 at 10:26:32 -0500, Andrew Davis wrote:
>> > > On 8/3/23 1:42 AM, Dhruva Gole wrote:
>> > > > Introduce system suspend resume calls that will allow the ti_sci
>> > > > driver to support deep sleep low power mode when the user space issues a
>> > > > suspend to mem.
>> > > > 
>> > > > Also, write a ti_sci_prepare_system_suspend call to be used in the driver
>> > > > suspend handler to allow the system to identify the low power mode being
>> > > > entered and if necessary, send TISCI_MSG_PREPARE_SLEEP with information
>> > > > about the mode is being entered and the address for allocated memory for
>> > > > storing the context during Deep Sleep.
>> > > > 
>> > > > We're using "pm_suspend_target_state" to map the kernel's target suspend
>> > > > state to SysFW low power mode. Make sure this is available only when
>> > > > CONFIG_SUSPEND is enabled.
>> > > > 
>> > > > Co-developed-by: Dave Gerlach <d-gerlach@...com>
>> > > > Signed-off-by: Dave Gerlach <d-gerlach@...com>
>> > > > Signed-off-by: Vibhore Vardhan <vibhore@...com>
>> > > > Signed-off-by: Georgi Vlaev <g-vlaev@...com>
>> > > > Signed-off-by: Dhruva Gole <d-gole@...com>
>> > > > ---
>> > > >    drivers/firmware/ti_sci.c | 63 +++++++++++++++++++++++++++++++++++++++
>> > > >    1 file changed, 63 insertions(+)
>> > > > 
>> > [..snip..]
>> > > > +static int ti_sci_suspend(struct device *dev)
>> > > > +{
>> > > > +	struct ti_sci_info *info = dev_get_drvdata(dev);
>> > > > +	int ret;
>> > > > +
>> > > > +	ret = ti_sci_cmd_set_io_isolation(&info->handle, TISCI_MSG_VALUE_IO_ENABLE);
>> > > 
>> > > After this the will the IOs be in isolation? Or does the firmware wait
>> > > until power down begins later?
>> > 
>> >  From what I understand,
>> > IOs will be in isolation immediately
>> > 
>> 
>> That is what I understand too, so then any device that may need to do some
>> external communication for its suspend will not function, this must be the
>> last driver _suspend() the system calls, how do you enforce that?
>
> I will make use of .suspend_noirq callbacks in that case. Does that
> sound better, or is there anything else I may not be aware of?

Using _noirq just moves the problem.  What if other drivers are also
using _noirq callbacks and run after the SCI driver?  You still cannot
guarantee ordering.

It seems to me that the IO isolation stuff is a system-wide operation,
and should probably be handled at the platform suspend_ops level
(e.g. suspend_ops->prepare_late()).   This would ensure that it runs
*after* all the driver hooks (even driver _noirq hooks.) and right
before the full suspend (or s2idle.)

Now, all that being said, I noticed that in v7, you didn't move this to
_noirq, but instead suggested that this be handled by TF-A.  I suppose
that's an option also, but my suggestion above should work also.

Kevin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ