* [PATCH v2] efi/arm64: use UEFI for system reset and poweroff
@ 2015-03-06 14:49 Ard Biesheuvel
2015-03-10 14:48 ` Matt Fleming
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2015-03-06 14:49 UTC (permalink / raw)
To: linux-arm-kernel
If UEFI Runtime Services are available, they are preferred over direct
PSCI calls or other methods to reset the system.
For the reset case, we need to hook into machine_restart(), as the
arm_pm_restart function pointer may be overwritten by modules.
Tested-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm64/kernel/efi.c | 9 +++++++++
arch/arm64/kernel/process.c | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index b42c7b480e1e..2b8d70164428 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -354,3 +354,12 @@ void efi_virtmap_unload(void)
efi_set_pgd(current->active_mm);
preempt_enable();
}
+
+/*
+ * UpdateCapsule() depends on the system being shutdown via
+ * ResetSystem().
+ */
+bool efi_poweroff_required(void)
+{
+ return efi_enabled(EFI_RUNTIME_SERVICES);
+}
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fde9923af859..c6b1f3b96f45 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <linux/compat.h>
+#include <linux/efi.h>
#include <linux/export.h>
#include <linux/sched.h>
#include <linux/kernel.h>
@@ -150,6 +151,13 @@ void machine_restart(char *cmd)
local_irq_disable();
smp_send_stop();
+ /*
+ * UpdateCapsule() depends on the system being reset via
+ * ResetSystem().
+ */
+ if (efi_enabled(EFI_RUNTIME_SERVICES))
+ efi_reboot(reboot_mode, NULL);
+
/* Now call the architecture specific reboot code. */
if (arm_pm_restart)
arm_pm_restart(reboot_mode, cmd);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] efi/arm64: use UEFI for system reset and poweroff
2015-03-06 14:49 [PATCH v2] efi/arm64: use UEFI for system reset and poweroff Ard Biesheuvel
@ 2015-03-10 14:48 ` Matt Fleming
2015-03-14 11:00 ` Catalin Marinas
0 siblings, 1 reply; 3+ messages in thread
From: Matt Fleming @ 2015-03-10 14:48 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 06 Mar, at 03:49:24PM, Ard Biesheuvel wrote:
> If UEFI Runtime Services are available, they are preferred over direct
> PSCI calls or other methods to reset the system.
>
> For the reset case, we need to hook into machine_restart(), as the
> arm_pm_restart function pointer may be overwritten by modules.
>
> Tested-by: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> arch/arm64/kernel/efi.c | 9 +++++++++
> arch/arm64/kernel/process.c | 8 ++++++++
> 2 files changed, 17 insertions(+)
Looks good to me.
Reviewed-by: Matt Fleming <matt.fleming@intel.com>
Catalin, are you picking this up?
--
Matt Fleming, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] efi/arm64: use UEFI for system reset and poweroff
2015-03-10 14:48 ` Matt Fleming
@ 2015-03-14 11:00 ` Catalin Marinas
0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2015-03-14 11:00 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Mar 10, 2015 at 02:48:57PM +0000, Matt Fleming wrote:
> On Fri, 06 Mar, at 03:49:24PM, Ard Biesheuvel wrote:
> > If UEFI Runtime Services are available, they are preferred over direct
> > PSCI calls or other methods to reset the system.
> >
> > For the reset case, we need to hook into machine_restart(), as the
> > arm_pm_restart function pointer may be overwritten by modules.
> >
> > Tested-by: Mark Rutland <mark.rutland@arm.com>
> > Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > arch/arm64/kernel/efi.c | 9 +++++++++
> > arch/arm64/kernel/process.c | 8 ++++++++
> > 2 files changed, 17 insertions(+)
>
> Looks good to me.
>
> Reviewed-by: Matt Fleming <matt.fleming@intel.com>
>
> Catalin, are you picking this up?
Yes, I will. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-14 11:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-06 14:49 [PATCH v2] efi/arm64: use UEFI for system reset and poweroff Ard Biesheuvel
2015-03-10 14:48 ` Matt Fleming
2015-03-14 11:00 ` Catalin Marinas
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).