Re: [PATCH] arm64: efi: Force the use of SetVirtualAddressMap() on Altra machines

Ard Biesheuvel
2022-11-10T19:21:55Z

On Thu, 10 Nov 2022 at 16:34, Alexandru Elisei <alexandru.elisei@arm.com> wrote:
>
> Hi,
>
> On Thu, Nov 10, 2022 at 03:45:03PM +0100, Ard Biesheuvel wrote:
> > On Thu, 10 Nov 2022 at 15:37, Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> > >
> > > Hi,
> > >
> > > On Thu, Nov 10, 2022 at 10:49:51AM +0100, Ard Biesheuvel wrote:
> > > > Ampere Altra machines are reported to misbehave when the SetTime() EFI
> > > > runtime service is called after ExitBootServices() but before calling
> > > > SetVirtualAddressMap(). Given that the latter is horrid, pointless and
> > > > explicitly documented as optional by the EFI spec, we no longer invoke
> > > > it at boot if the configured size of the VA space guarantees that the
> > > > EFI runtime memory regions can remain mapped 1:1 like they are at boot
> > > > time.
> > > >
> > > > This means that SetTime() calls on Ampere Altra machines issued by the
> > > > rtc-efi driver now trigger a synchronous exception during boot. We can
> > > > now recover from those without bringing down the system entirely, due to
> > > > commit 23715a26c8d81291 ("arm64: efi: Recover from synchronous
> > > > exceptions occurring in firmware"). However, it would be better to avoid
> > > > this completely, given that the firmware appears to remain in a funny
> > > > state after this.
> > > >
> > > > So attempt to identify these machines based on the 'family' field in the
> > > > type #1 SMBIOS record, and call SetVirtualAddressMap() unconditionally
> > > > in that case.
> > >
> > > This works for my machine. Tested with this patch on top of the patch [1] that
> > > disables only the misbehaving services, not runtime services altogether (can
> > > test other configurations, if you feel it's necessary):
> > >
> > > Tested-by: Alexandru Elisei <alexandru.elisei@gmail.com>
> > >
> >
> > Thanks.
> >
> > I take it this means that efibootmgr now works as it should?
>
> Yes, tested GetVariable() (# efibootmgr) and SetVariable() (# efibootmgr -t
> 30). Also tested this patch on top of v6.1-rc4, same results.
>

Excellent news, thank you very much.