linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] efi/arm64: use UEFI for system reset and poweroff
@ 2015-03-06 14:49 Ard Biesheuvel
       [not found] ` <1425653364-12591-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2015-03-06 14:49 UTC (permalink / raw)
  To: mark.rutland-5wv7dgnIgG8, leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	msalter-H+wXaHxf7aLQT0dZR+AlfA,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	linux-efi-u79uwXL29TY76Z2rM5mHXA
  Cc: Ard Biesheuvel

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-5wv7dgnIgG8@public.gmane.org>
Reviewed-by: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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

* Re: [PATCH v2] efi/arm64: use UEFI for system reset and poweroff
       [not found] ` <1425653364-12591-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2015-03-10 14:48   ` Matt Fleming
       [not found]     ` <20150310144857.GE17573-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Fleming @ 2015-03-10 14:48 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: mark.rutland-5wv7dgnIgG8, leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	msalter-H+wXaHxf7aLQT0dZR+AlfA,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

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-5wv7dgnIgG8@public.gmane.org>
> Reviewed-by: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Catalin, are you picking this up?

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] efi/arm64: use UEFI for system reset and poweroff
       [not found]     ` <20150310144857.GE17573-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
@ 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: Matt Fleming
  Cc: Ard Biesheuvel, mark.rutland-5wv7dgnIgG8,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w, will.deacon-5wv7dgnIgG8,
	leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A,
	linux-efi-u79uwXL29TY76Z2rM5mHXA, msalter-H+wXaHxf7aLQT0dZR+AlfA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

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-5wv7dgnIgG8@public.gmane.org>
> > Reviewed-by: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 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
     [not found] ` <1425653364-12591-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-03-10 14:48   ` Matt Fleming
     [not found]     ` <20150310144857.GE17573-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
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).