All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stanacar, Stefan" <stefan.stanacar-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Baluta,
	Daniel" <daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org"
	<matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
Cc: "linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Abbas,
	Mohamed" <mohamed.abbas-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Gumbel,
	Matthew K"
	<matthew.k.gumbel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Musca,
	Constantin"
	<constantin.musca-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Purdila,
	Octavian"
	<octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v2] efi: Introduce EFI bootloader control driver
Date: Fri, 18 Mar 2016 19:18:17 +0000	[thread overview]
Message-ID: <1458328697.16385.21.camel@intel.com> (raw)
In-Reply-To: <20160318161505.GU2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>

On Fri, 2016-03-18 at 16:15 +0000, Matt Fleming wrote:
> On Fri, 18 Mar, at 12:11:50PM, Daniel Baluta wrote:
> > 
> > From: Matt Gumbel <matthew.k.gumbel@intel.com>
> > 
> > This driver intercepts system reboot requests and populates the
> > LoaderEntryOneShot EFI variable with the user-supplied reboot
> > argument. EFI bootloaders such as Gummiboot will consume this
> > variable and use it to control which OS is booted next.
> > 
> > We use this with Android where reboot() tells the kernel that
> > we want to boot into recovery or other non-default OS environment.
> > 
> > It is the bootloader's job to guard against this variable being
> > uninitialzed or containing invalid data, and just boot normally
> > if that is the case.
> > 
> > Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
> > Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
> > Signed-off-by: Constantin Musca <constantin.musca@intel.com>
> > Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
> > ---
> > Changes since v1:
> > 	* updated Makefile after changing source name from efibc.c ->
> > efi-bc.c
> > 	to comply with naming rules in drivers/firmware/efi/
> > 
> >  drivers/firmware/efi/Kconfig  |  11 ++
> >  drivers/firmware/efi/Makefile |   1 +
> >  drivers/firmware/efi/efi-bc.c | 251
> > ++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 263 insertions(+)
> >  create mode 100644 drivers/firmware/efi/efi-bc.c
> Why does this require a driver? Why is it not possible to solve this
> problem by creating the variable in userspace before invoking
> reboot(2)?


Hi Matt,

It is possible, but that means modifying those userspace apps :)
There are reboot implementations that do "reboot <reason>", such as
Android's reboot command [1] and Upstart's reboot replacement [2], which
pass the reason as an argument to the reboot syscall. 
Probably your first question will be - "Why don't you modify those
apps?" Well, I don't see platform-agnostic way how those could be
modified to pass the reason to the bootloader, regardless of platform or
bootloader.

Other non-EFI platforms use a driver as well:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/dri
vers/soc/tegra/pmc.c#n382



[1] https://android.googlesource.com/platform/system/core/+/master/libcu
tils/android_reboot.c#228

[2] https://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:
/util/reboot.c#L259


Cheers,
Stefan

WARNING: multiple messages have this Message-ID (diff)
From: "Stanacar, Stefan" <stefan.stanacar@intel.com>
To: "Baluta, Daniel" <daniel.baluta@intel.com>,
	"matt@codeblueprint.co.uk" <matt@codeblueprint.co.uk>
Cc: "linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Abbas, Mohamed" <mohamed.abbas@intel.com>,
	"Gumbel, Matthew K" <matthew.k.gumbel@intel.com>,
	"Musca, Constantin" <constantin.musca@intel.com>,
	"Purdila, Octavian" <octavian.purdila@intel.com>
Subject: Re: [PATCH v2] efi: Introduce EFI bootloader control driver
Date: Fri, 18 Mar 2016 19:18:17 +0000	[thread overview]
Message-ID: <1458328697.16385.21.camel@intel.com> (raw)
In-Reply-To: <20160318161505.GU2619@codeblueprint.co.uk>

On Fri, 2016-03-18 at 16:15 +0000, Matt Fleming wrote:
> On Fri, 18 Mar, at 12:11:50PM, Daniel Baluta wrote:
> > 
> > From: Matt Gumbel <matthew.k.gumbel@intel.com>
> > 
> > This driver intercepts system reboot requests and populates the
> > LoaderEntryOneShot EFI variable with the user-supplied reboot
> > argument. EFI bootloaders such as Gummiboot will consume this
> > variable and use it to control which OS is booted next.
> > 
> > We use this with Android where reboot() tells the kernel that
> > we want to boot into recovery or other non-default OS environment.
> > 
> > It is the bootloader's job to guard against this variable being
> > uninitialzed or containing invalid data, and just boot normally
> > if that is the case.
> > 
> > Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
> > Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
> > Signed-off-by: Constantin Musca <constantin.musca@intel.com>
> > Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
> > ---
> > Changes since v1:
> > 	* updated Makefile after changing source name from efibc.c ->
> > efi-bc.c
> > 	to comply with naming rules in drivers/firmware/efi/
> > 
> >  drivers/firmware/efi/Kconfig  |  11 ++
> >  drivers/firmware/efi/Makefile |   1 +
> >  drivers/firmware/efi/efi-bc.c | 251
> > ++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 263 insertions(+)
> >  create mode 100644 drivers/firmware/efi/efi-bc.c
> Why does this require a driver? Why is it not possible to solve this
> problem by creating the variable in userspace before invoking
> reboot(2)?


Hi Matt,

It is possible, but that means modifying those userspace apps :)
There are reboot implementations that do "reboot <reason>", such as
Android's reboot command [1] and Upstart's reboot replacement [2], which
pass the reason as an argument to the reboot syscall. 
Probably your first question will be - "Why don't you modify those
apps?" Well, I don't see platform-agnostic way how those could be
modified to pass the reason to the bootloader, regardless of platform or
bootloader.

Other non-EFI platforms use a driver as well:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/dri
vers/soc/tegra/pmc.c#n382



[1] https://android.googlesource.com/platform/system/core/+/master/libcu
tils/android_reboot.c#228

[2] https://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:
/util/reboot.c#L259


Cheers,
Stefan

  parent reply	other threads:[~2016-03-18 19:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18 10:11 [PATCH v2] efi: Introduce EFI bootloader control driver Daniel Baluta
2016-03-18 10:11 ` Daniel Baluta
     [not found] ` <1458295910-26557-1-git-send-email-daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-18 11:22   ` kbuild test robot
2016-03-18 11:22     ` kbuild test robot
2016-03-18 12:46   ` kbuild test robot
2016-03-18 12:46     ` kbuild test robot
2016-03-18 16:15   ` Matt Fleming
2016-03-18 16:15     ` Matt Fleming
     [not found]     ` <20160318161505.GU2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-18 19:18       ` Stanacar, Stefan [this message]
2016-03-18 19:18         ` Stanacar, Stefan
2016-03-24 14:47         ` Matt Fleming
     [not found]           ` <20160324144741.GA4328-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-24 16:15             ` Stanacar, Stefan
2016-03-24 16:15               ` Stanacar, Stefan
     [not found]               ` <1458836156.14677.9.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-29 12:53                 ` Matt Fleming
2016-03-29 12:53                   ` Matt Fleming

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=1458328697.16385.21.camel@intel.com \
    --to=stefan.stanacar-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=constantin.musca-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org \
    --cc=matthew.k.gumbel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=mohamed.abbas-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.