From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] arm64: psci: Add support to call cpu_suspend with deepest C state.
Date: Thu, 30 Oct 2014 10:46:30 +0000 [thread overview]
Message-ID: <20141030104630.GC17843@red-moon> (raw)
In-Reply-To: <1414641338-25279-3-git-send-email-amit.daniel@samsung.com>
On Thu, Oct 30, 2014 at 03:55:38AM +0000, Amit Daniel Kachhap wrote:
> This feature will be useful for system suspend/resume which may
> intend to invoke cpu_suspend with deepest possible C state level.
We are working on defining system states in the PSCI specification,
but it is not set in stone yet (Cc'ed Charles).
I guess you are posting this code because you have already an
implementation that supports system suspend/resume, so I am
taking an immediate action to come up with an API suitable
for that asap.
On a side note I do not necessarily like this magic idle index
logic, I prefer adding an API for that, that translates the call
into whatever is required by the back-end (ie PSCI) implementation.
Thanks,
Lorenzo
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
> arch/arm64/include/asm/psci.h | 2 ++
> arch/arm64/kernel/psci.c | 8 ++++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/arch/arm64/include/asm/psci.h b/arch/arm64/include/asm/psci.h
> index e5312ea..487e52b 100644
> --- a/arch/arm64/include/asm/psci.h
> +++ b/arch/arm64/include/asm/psci.h
> @@ -14,6 +14,8 @@
> #ifndef __ASM_PSCI_H
> #define __ASM_PSCI_H
>
> +#define CPU_PSCI_IDLE_INDEX_MAX 0xff
> +
> int psci_init(void);
>
> #endif /* __ASM_PSCI_H */
> diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
> index 4ebc146..a761513 100644
> --- a/arch/arm64/kernel/psci.c
> +++ b/arch/arm64/kernel/psci.c
> @@ -70,6 +70,7 @@ enum psci_function {
> static DEFINE_PER_CPU_READ_MOSTLY(struct psci_power_state *, psci_power_state);
>
> static u32 psci_function_id[PSCI_FN_MAX];
> +static u32 cpu_psci_idle_state_count;
>
> static int psci_to_linux_errno(int errno)
> {
> @@ -239,6 +240,8 @@ static int __maybe_unused cpu_psci_cpu_init_idle(struct device_node *cpu_node,
> if (!count)
> return -ENODEV;
>
> + cpu_psci_idle_state_count = count;
> +
> psci_states = kcalloc(count, sizeof(*psci_states), GFP_KERNEL);
> if (!psci_states)
> return -ENOMEM;
> @@ -521,6 +524,11 @@ static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
> {
> int ret;
> struct psci_power_state *state = __get_cpu_var(psci_power_state);
> +
> + /* Check and select the deepest idle state */
> + if (index == CPU_PSCI_IDLE_INDEX_MAX)
> + index = cpu_psci_idle_state_count;
> +
> /*
> * idle state index 0 corresponds to wfi, should never be called
> * from the cpu_suspend operations.
> --
> 1.9.1
>
>
next prev parent reply other threads:[~2014-10-30 10:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 3:55 [PATCH 1/3] arm64: psci: warn if psci_power_state variable is not initialised Amit Daniel Kachhap
2014-10-30 3:55 ` [PATCH 2/3] arm64: psci: fix cpu_suspend to check idle state type for index Amit Daniel Kachhap
2014-10-30 10:19 ` Lorenzo Pieralisi
2014-10-30 11:31 ` amit daniel kachhap
2014-10-30 3:55 ` [PATCH 3/3] arm64: psci: Add support to call cpu_suspend with deepest C state Amit Daniel Kachhap
2014-10-30 10:46 ` Lorenzo Pieralisi [this message]
2014-10-30 11:22 ` amit daniel kachhap
2014-12-01 8:08 ` amit daniel kachhap
2014-12-15 18:34 ` Lorenzo Pieralisi
2014-10-30 10:29 ` [PATCH 1/3] arm64: psci: warn if psci_power_state variable is not initialised Lorenzo Pieralisi
2014-10-30 11:35 ` Amit Kachhap
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=20141030104630.GC17843@red-moon \
--to=lorenzo.pieralisi@arm.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).