linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: linux-efi <linux-efi@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Marc Zyngier <maz@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Chen-Yu Tsai <wens@csie.org>
Subject: Re: [PATCH v2 1/2] efi/arm: decompressor: deal with HYP mode boot gracefully
Date: Fri, 12 Jun 2020 00:18:43 +0200	[thread overview]
Message-ID: <CAMj1kXFjuMy6+amsMmmepkNATCec4vsxeiVVFq9CFZ64wbmGaA@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXGLoKDLJAihThkkcYwNpr12inneEB3dMOqvcZFm9oR5_w@mail.gmail.com>

On Tue, 9 Jun 2020 at 09:58, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Mon, 8 Jun 2020 at 12:46, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > On 6/8/20 1:08 AM, Ard Biesheuvel wrote:
> > > On Sun, 7 Jun 2020 at 19:24, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > >>
> > >> On 6/7/20 3:58 PM, Ard Biesheuvel wrote:
> > >>> EFI on ARM only supports short descriptors, and given that it mandates
> > >>> that the MMU and caches are on, it is implied that booting in HYP mode
> > >>> is not supported.
> > >>>
> > >>> However, implementations of EFI exist (i.e., U-Boot) that ignore this
> > >>> requirement, which is not entirely unreasonable, given that it makes
> > >>> HYP mode inaccessible to the operating system.
> > >>>
> > >>> So let's make sure that we can deal with this condition gracefully.
> > >>> We already tolerate booting the EFI stub with the caches off (even
> > >>> though this violates the EFI spec as well), and so we should deal
> > >>> with HYP mode boot with MMU and caches either on or off.
> > >>>
> > >>> - When the MMU and caches are on, we can ignore the HYP stub altogether,
> > >>>   since we can carry on executing at HYP. We do need to ensure that we
> > >>>   disable the MMU at HYP before entering the kernel proper.
> > >>>
> > >>> - When the MMU and caches are off, we have to drop to SVC mode so that
> > >>>   we can set up the page tables using short descriptors. In this case,
> > >>>   we need to install the HYP stub as usual, so that we can return to HYP
> > >>>   mode before handing over to the kernel proper.
> ...
> >
> > Hello Ard,
> >
> > thanks for supplying a branch for testing:
> > https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=efi-arm-hyp-mode
> >
> > The OrangePi PC boots fine with this branch. PSCI is enabled. Rebooting
> > the system works fine. See log below.
> >
> > With the patch 2/2 you add an output line for the exceptions level and
> > the MMU status. Above you state "We already tolerate booting the EFI
> > stub with the caches off." This relates to a workaround in U-Boot
> > accomodating old GRUB versions (CONFIG_EFI_GRUB_ARM32_WORKAROUND=y).
> >
> > Would a further diagnostic line showing if D-cache and I-cache is
> > enabled make sense?
> >
> > Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> >
> > Loading Linux 5.7.0-armmp-lpae+ ...
> > Loading initial ramdisk ...
> > EFI stub: Running in HYP mode with MMU enabled
>
> BTW is this with or without the GRUB hack?
>

I've given this a spin myself on a RPi4 running 32-bit U-boot, and
everything works as expected, both with and without the GRUB hack
enabled.

Russell, given that this only affects code inside #ifdef
CONFIG_EFI_STUB, do you have any objections to me taking this as a fix
via the EFI tree? I have a set of fixes I need to queue up and send
out anyway, and I intend to do so early next week.

  reply	other threads:[~2020-06-11 22:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07 13:58 [PATCH v2 0/2] efi/arm: deal with HYP mode boot Ard Biesheuvel
2020-06-07 13:58 ` [PATCH v2 1/2] efi/arm: decompressor: deal with HYP mode boot gracefully Ard Biesheuvel
2020-06-07 17:24   ` Heinrich Schuchardt
2020-06-07 23:08     ` Ard Biesheuvel
2020-06-08  3:49       ` Chen-Yu Tsai
2020-06-08 10:46       ` Heinrich Schuchardt
2020-06-08 10:59         ` Ard Biesheuvel
2020-06-09  7:58         ` Ard Biesheuvel
2020-06-11 22:18           ` Ard Biesheuvel [this message]
2020-06-11 22:38             ` Russell King - ARM Linux admin
2020-06-11 22:39               ` Ard Biesheuvel
2020-06-11 22:43                 ` Russell King - ARM Linux admin
2020-06-11 23:17                   ` Ard Biesheuvel
2020-06-07 13:58 ` [PATCH v2 2/2] efi/arm: libstub: print boot mode and MMU state at boot Ard Biesheuvel

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=CAMj1kXFjuMy6+amsMmmepkNATCec4vsxeiVVFq9CFZ64wbmGaA@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maz@kernel.org \
    --cc=wens@csie.org \
    --cc=xypron.glpk@gmx.de \
    /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).