Re: [PATCH v2 1/2] efi/arm: decompressor: deal with HYP mode boot gracefully

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Jun 2020 at 09:58, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> On Mon, 8 Jun 2020 at 12:46, Heinrich Schuchardt <xypron.glpk@xxxxxx> wrote:
> >
> > On 6/8/20 1:08 AM, Ard Biesheuvel wrote:
> > > On Sun, 7 Jun 2020 at 19:24, Heinrich Schuchardt <xypron.glpk@xxxxxx> 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@xxxxxx>
> >
> > 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.



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux