Re: [PATCH] x86/efi: Don't unmap EFI boot services code/data regions for EFI_OLD_MEMMAP and EFI_MIXED_MODE

From: Ingo Molnar
Date: Tue Dec 25 2018 - 04:51:15 EST



* Prakhya, Sai Praneeth <sai.praneeth.prakhya@xxxxxxxxx> wrote:

> > > > + /*
> > > > + * To Do: Remove this check after adding functionality to unmap EFI
> > boot
> > > > + * services code/data regions from direct mapping area because
> > > > + * "efi=old_map" maps EFI regions in swapper_pg_dir.
> > > > + */
> > > > + if (efi_enabled(EFI_OLD_MEMMAP))
> > > > + return;
> > > > +
> > > > + /*
> > > > + * EFI mixed mode has all RAM mapped to access arguments while
> > making
> > > > + * EFI runtime calls, hence don't unmap EFI boot services code/data
> > > > + * regions.
> > > > + */
> > > > + if (!efi_is_native() && IS_ENABLED(CONFIG_EFI_MIXED))
> >
> > AFAIK efi_is_native() can only return false is CONFIG_EFI_MIXED is set, so this
> > expression can be simplified.
>
> Makes sense.
> efi_is_native() returns true for 32-bit machines running 32-bit firmware.

Forgot to mention that I performed this simplification in the commit I
applied:

+ /*
+ * To Do: Remove this check after adding functionality to unmap EFI boot
+ * services code/data regions from direct mapping area because
+ * "efi=old_map" maps EFI regions in swapper_pg_dir.
+ */
+ if (efi_enabled(EFI_OLD_MEMMAP))
+ return;
+
+ /*
+ * EFI mixed mode has all RAM mapped to access arguments while making
+ * EFI runtime calls, hence don't unmap EFI boot services code/data
+ * regions.
+ */
+ if (!efi_is_native())
+ return;

Thanks,

Ingo