x86/efi: Introduce EFI_BOOT_SERVICES_WARN

There may exist buggy implementations of UEFI firmaware that access the
EFI_BOOT_SERVICES_* memory regions after the call to ExitBootServices()
(e.g., when calling SetVirtualAddressMap()). This is in direct violation
of the UEFI specification.

If selected, this debug option will print a warning message if the UEFI
firmware tries to access the aforementioned memory regions. Along with
the warning, the EFI platform code will fixup the page fault so that the
firmware can proceed further.

If not selected, EFI_BOOT_SERVICES_CODE/DATA memory regions will be
mapped along with the runtime memory regions so that the buggy firmware
does not cause any page faults when trying to accessing such memory
regions. This is the approach from Matthew Garrett in commit 916f676f8dc0
("x86, efi: Retain boot service code until after switching to virtual
mode").

However, firmware developers are less likely to find and avoid such
illegal access as the kernel silently works around their bug.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2 files changed