public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: catalin.marinas@arm•com (Catalin Marinas)
To: linux-arm-kernel@lists•infradead.org
Subject: [RFC PATCH 05/14] arm64: kernel: cpu_{suspend/resume} implementation
Date: Fri, 30 Aug 2013 18:27:56 +0100	[thread overview]
Message-ID: <20130830172756.GK4650@arm.com> (raw)
In-Reply-To: <1377689766-17642-6-git-send-email-lorenzo.pieralisi@arm.com>

On Wed, Aug 28, 2013 at 12:35:57PM +0100, Lorenzo Pieralisi wrote:
> Kernel subsystems like CPU idle and suspend to RAM require a generic
> mechanism to suspend a processor, save its context and put it into
> a quiescent state. The cpu_{suspend}/{resume} implementation provides
> such a framework through a kernel interface allowing to save/restore
> registers, flush the context to DRAM and suspend/resume to/from
> low-power states where processor context may be lost.
> 
> Different SoCs might require different operations to be carried out
> before a power down request is committed. For this reason the kernel
> allows the caller of cpu_suspend to provide a function pointer (fn in
> the cpu_suspend prototype below),
> 
> int cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
> 
> called suspend finisher, that is executed after the context is saved and
> flushed to DRAM, so that SoC/platform specific operations can be carried out
> before issuing power down commands.
> 
> Context memory is allocated on the stack, whose address is stashed in a
> per-cpu variable to keep track of it and passed to core functions that
> save/restore the registers required by the architecture.
> 
> Even though, upon successful execution, the cpu_suspend function shuts
> down the suspending processor, the warm boot resume mechanism, based
> on the cpu_resume function, makes the resume path operate as a
> cpu_suspend function return, so that cpu_suspend can be treated as a C
> function by the caller, which simplifies coding the PM drivers that rely
> on the cpu_suspend API.
> 
> Upon context save, the minimal amount of memory is flushed to DRAM so
> that it can be retrieved when the MMU is off and caches are not searched.
> 
> The suspend finisher, depending on the required operations (eg CPU vs
> Cluster shutdown) is in charge of flushing the cache hierarchy either
> implicitly (by calling firmware implementations like PSCI) or explicitly
> by executing the required cache maintainance functions.

As we discussed, I would like the finisher argument to cpu_suspend() to be
removed and just use the default cpu_operations.cpu_suspend (currently
smp_operations) which is populated from DT and uses PSCI as the default
finisher. The cpuidle drivers can still pass arguments that would make
their way into the PSCI CPU_SUSPEND call (like how deep to go) but I
would like to avoid each cpuidle driver implementing a finisher that
does the PSCI call.

If PSCI is not available, the cpuidle driver can register a different
cpu_suspend method.

-- 
Catalin

  reply	other threads:[~2013-08-30 17:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 11:35 [RFC PATCH 00/14] arm64: suspend/resume implementation Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 01/14] arm64: kernel: add MPIDR_EL1 accessors macros Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 02/14] arm64: kernel: build MPIDR_EL1 hash function data structure Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 03/14] arm64: kernel: add structure to define cpu context layout Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 04/14] arm64: kernel: suspend/resume registers save/restore Lorenzo Pieralisi
2013-08-30 17:23   ` Catalin Marinas
2013-09-02  9:57     ` Lorenzo Pieralisi
2013-09-02 11:17       ` Catalin Marinas
2013-09-02 16:24         ` Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 05/14] arm64: kernel: cpu_{suspend/resume} implementation Lorenzo Pieralisi
2013-08-30 17:27   ` Catalin Marinas [this message]
2013-09-02 10:05     ` Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 06/14] arm64: add CPU PM infrastructure selection Lorenzo Pieralisi
2013-08-28 11:35 ` [RFC PATCH 07/14] arm64: kernel: implement fpsimd CPU PM notifier Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 08/14] arm: kvm: implement " Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 09/14] arm64: kernel: implement debug monitors CPU PM notifiers Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 10/14] arm64: kernel: refactor code to install/uninstall breakpoints Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 11/14] arm64: kernel: implement HW breakpoints CPU PM notifier Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 12/14] arm64: kernel: add cpu_{suspend}/{resume} build infrastructure Lorenzo Pieralisi
2013-08-30 17:32   ` Catalin Marinas
2013-09-02 10:25     ` Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 13/14] arm64: kernel: add CPU idle call Lorenzo Pieralisi
2013-08-28 11:36 ` [RFC PATCH 14/14] arm64: add CPU power management menu/entries Lorenzo Pieralisi

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=20130830172756.GK4650@arm.com \
    --to=catalin.marinas@arm$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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