From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 4/5] ARM: psci: Add support for system reboot and poweroff
Date: Wed, 16 Oct 2013 17:17:24 -0500 [thread overview]
Message-ID: <525F1074.8000208@gmail.com> (raw)
In-Reply-To: <1381942954-22388-5-git-send-email-anup.patel@linaro.org>
On 10/16/2013 12:02 PM, Anup Patel wrote:
> We have PSCI SYSTEM_OFF and SYSTEM_RESET function call emulation
> available when running as Guest using KVM ARM.
>
> This patch implements system reboot and poweroff using PSCI
> SYSTEM_OFF and SYSTEM_RESET.
I've done a similar patch [1] which also needs binding documentation to
go with it. The last version of which there is no agreement on is here [2].
Rob
[1] http://www.spinics.net/lists/arm-kernel/msg262217.html
[2] http://www.spinics.net/lists/devicetree/msg05348.html
>
>
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> ---
> arch/arm/kernel/psci.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
> index 4693188..30d9d65 100644
> --- a/arch/arm/kernel/psci.c
> +++ b/arch/arm/kernel/psci.c
> @@ -17,11 +17,13 @@
>
> #include <linux/init.h>
> #include <linux/of.h>
> +#include <linux/pm.h>
>
> #include <asm/compiler.h>
> #include <asm/errno.h>
> #include <asm/opcodes-sec.h>
> #include <asm/opcodes-virt.h>
> +#include <asm/system_misc.h>
> #include <asm/psci.h>
>
> struct psci_operations psci_ops;
> @@ -33,6 +35,8 @@ enum psci_function {
> PSCI_FN_CPU_ON,
> PSCI_FN_CPU_OFF,
> PSCI_FN_MIGRATE,
> + PSCI_FN_SYSTEM_OFF,
> + PSCI_FN_SYSTEM_RESET,
> PSCI_FN_MAX,
> };
>
> @@ -153,6 +157,28 @@ static int psci_migrate(unsigned long cpuid)
> return psci_to_linux_errno(err);
> }
>
> +static void psci_power_off(void)
> +{
> + int err;
> + u32 fn;
> +
> + fn = psci_function_id[PSCI_FN_SYSTEM_OFF];
> + err = invoke_psci_fn(fn, 0, 0, 0);
> + if (err)
> + pr_warning("%s: failed\n", __func__);
> +}
> +
> +static void psci_restart(enum reboot_mode reboot_mode, const char *cmd)
> +{
> + int err;
> + u32 fn;
> +
> + fn = psci_function_id[PSCI_FN_SYSTEM_RESET];
> + err = invoke_psci_fn(fn, 0, 0, 0);
> + if (err)
> + pr_warning("%s: failed\n", __func__);
> +}
> +
> static const struct of_device_id psci_of_match[] __initconst = {
> { .compatible = "arm,psci", },
> {},
> @@ -204,6 +230,16 @@ void __init psci_init(void)
> psci_ops.migrate = psci_migrate;
> }
>
> + if (!of_property_read_u32(np, "system_off", &id)) {
> + psci_function_id[PSCI_FN_SYSTEM_OFF] = id;
> + pm_power_off = psci_power_off;
> + }
> +
> + if (!of_property_read_u32(np, "system_reset", &id)) {
> + psci_function_id[PSCI_FN_SYSTEM_RESET] = id;
> + arm_pm_restart = psci_restart;
> + }
> +
> out_put_node:
> of_node_put(np);
> return;
>
next prev parent reply other threads:[~2013-10-16 22:17 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 17:02 [RFC PATCH 0/5] PSCI system off and reset for KVM ARM/ARM64 Anup Patel
2013-10-16 17:02 ` [RFC PATCH 1/5] ARM/ARM64: KVM: Update user space API header for PSCI emulation Anup Patel
2013-10-16 20:30 ` Christoffer Dall
2013-10-17 6:25 ` Anup Patel
2013-10-16 22:11 ` Christoffer Dall
2013-10-17 6:45 ` Anup Patel
2013-10-17 8:47 ` Marc Zyngier
2013-10-17 11:10 ` Anup Patel
2013-10-17 11:21 ` Marc Zyngier
2013-10-17 11:30 ` Anup Patel
2013-10-17 11:49 ` Alexander Graf
2013-10-17 11:55 ` Marc Zyngier
2013-10-17 12:01 ` Alexander Graf
2013-10-17 19:04 ` Christoffer Dall
2013-10-17 22:06 ` Alexander Graf
2013-10-17 22:24 ` Christoffer Dall
2013-10-17 22:26 ` Alexander Graf
2013-10-18 3:34 ` Christoffer Dall
2013-10-17 15:32 ` Anup Patel
2013-10-17 11:52 ` Marc Zyngier
2013-10-16 17:02 ` [RFC PATCH 2/5] ARM/ARM64: KVM: Forward PSCI SYSTEM_OFF and SYSTEM_RESET to user space Anup Patel
2013-10-16 22:22 ` Christoffer Dall
2013-10-17 5:52 ` Anup Patel
2013-10-17 8:37 ` Marc Zyngier
2013-10-17 9:10 ` Peter Maydell
2013-10-17 9:21 ` Marc Zyngier
2013-10-17 9:31 ` Peter Maydell
2013-10-17 18:34 ` Christoffer Dall
2013-10-18 4:18 ` Anup Patel
2013-10-17 11:07 ` Anup Patel
2013-10-17 11:13 ` Marc Zyngier
2013-10-17 11:13 ` Anup Patel
2013-10-17 18:29 ` Christoffer Dall
2013-10-16 17:02 ` [RFC PATCH 3/5] KVM: Add documentation for KVM_EXIT_PSCI exit reason Anup Patel
2013-10-16 17:02 ` [RFC PATCH 4/5] ARM: psci: Add support for system reboot and poweroff Anup Patel
2013-10-16 22:17 ` Rob Herring [this message]
2013-10-17 5:08 ` Anup Patel
2013-10-17 9:50 ` Marc Zyngier
2013-10-16 17:02 ` [RFC PATCH 5/5] ARM64: " Anup Patel
2013-10-16 17:08 ` [RFC PATCH 0/5] PSCI system off and reset for KVM ARM/ARM64 Anup Patel
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=525F1074.8000208@gmail.com \
--to=robherring2@gmail.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).