u-boot/lib/efi_loader
Ilias Apalodimas 65b38a519b Revert "efi_memory: do not add U-Boot memory to the memory map"
This reverts commit ("commit a68c9ac5d8 ("efi_memory: do not add
U-Boot memory to the memory map").

This code was removed when the EFI subsystem started using LMB calls for
the reservations. In hindsight it unearthed two problems.

The e820 code is adding u-boot memory as EfiReservedMemory while it
should look at what LMB added and decide instead of blindly overwriting
it. The reason this worked is that we marked that code properly late,
when the EFI came up. But now with the LMB changes, the EFI map gets
added first and the e820 code overwrites it.

The second problem is that we never mark SetVirtualAddressMap as runtime
code, which we should according to the spec. Until we fix this the
current hack can't go away, at least for architectures that *need* to
call SVAM.

More specifically x86 currently requires SVAM and sets the NX bit for
pages not marked as *_CODE. So unless we do that late, it will crash
trying to execute from non-executable memory. It's also worth noting
that x86 calls SVAM late in the boot, so this will work until someone
decides to overwrite/use BootServicesCode from the OS.

Notably arm64 disables it explicitly if the VA space is > 48bits, so
doesn't suffer from any of these problems.

This doesn't really deserve a fixes tag, since it brings back a hack to
remedy a situation that was wrong long before that commit, but in case
anyone hits the same bug ...
Simon sent the original revert in the link, but we need a proper
justification for it.

Link: https://lore.kernel.org/u-boot/20241112131830.576864-1-sjg@chromium.org/
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reported-by: Simon Glass <sjg@chromium.org>
2024-11-30 08:37:53 -06:00
..
.gitignore efi_loader: git ignore helloworld_efi.S 2020-01-07 18:08:20 +01:00
boothart.c efi_loader: add an EFI binary to print boot hart ID 2022-12-02 19:17:24 +01:00
capsule_esl.dtsi.in efi_loader: Fix capsule_esl.dtsi.in comment style 2024-06-10 15:05:09 +02:00
dtbdump.c efi_loader: Mark static function in dumpdtb 2024-10-30 21:45:39 +01:00
efi_acpi.c efi_loader: 'EFI using ACPI tables at' should be debug message 2024-04-13 11:03:12 +02:00
efi_bootbin.c efi_loader: Change efi_dp_from_mem() to use size 2024-11-09 09:56:45 +01:00
efi_bootmgr.c efi: Move default filename to a function 2024-11-09 10:00:38 +01:00
efi_boottime.c dm: Add dm_remove_devices_active() for ordered device removal 2024-11-24 15:41:28 -06:00
efi_capsule.c fwu: print a message if empty capsule checks fail 2024-09-19 10:52:50 +03:00
efi_conformance.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_console.c Prepare v2024.10-rc6 2024-09-30 17:48:12 -06:00
efi_device_path.c efi_loader: Change efi_dp_from_mem() to use size 2024-11-09 09:56:45 +01:00
efi_device_path_to_text.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_device_path_utilities.c efi_loader: allow concatenation with contained end node 2024-06-10 11:43:36 +02:00
efi_disk.c efi_loader: Remove unused diskid 2024-10-30 21:46:12 +01:00
efi_dt_fixup.c efi_leader: delete rng-seed if having EFI RNG protocol 2024-10-09 22:04:56 -06:00
efi_esrt.c efi_loader: fix iteration of FMP protocols 2024-01-13 18:17:46 +01:00
efi_fdt.c efi_loader: correct description of efi_get_distro_fdt_name 2024-08-11 07:52:15 +02:00
efi_file.c efi_loader: fix GetInfo and SetInfo 2024-11-01 13:37:58 -06:00
efi_firmware.c efi: add a helper to generate dynamic UUIDs 2024-09-12 17:35:37 +02:00
efi_freestanding.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_gop.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_helper.c efi_loader: Drop sandbox PXE architecture 2024-11-09 10:01:47 +01:00
efi_hii.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_hii_config.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_image_loader.c lib: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
efi_load_initrd.c efi_loader: rename struct efi_initrd_dp to efi_lo_dp_prefix 2024-06-10 11:43:37 +02:00
efi_load_options.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_memory.c Revert "efi_memory: do not add U-Boot memory to the memory map" 2024-11-30 08:37:53 -06:00
efi_net.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_riscv.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_rng.c efi_loader: fix some function descriptions 2024-09-21 10:54:42 +02:00
efi_root_node.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_runtime.c efi_loader: avoid duplicate weak invalidate_icache_all() 2024-06-19 13:10:23 -06:00
efi_setup.c efi_loader: avoid #ifdef in efi_setup.c 2024-10-18 16:17:29 +02:00
efi_signature.c efi_loader: remove redundant hash includes 2024-05-22 08:55:28 -06:00
efi_smbios.c smbios: copy QEMU tables 2024-01-16 17:05:29 -05:00
efi_string.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
efi_tcg2.c efi_loader: simplify efi_tcg2_hash_log_extend_event() 2024-11-23 23:14:15 +01:00
efi_unicode_collation.c efi_loader: fix some function descriptions 2024-09-21 10:54:42 +02:00
efi_var_common.c efi_loader: enable QueryVariableInfo at runtime for file backed variables 2024-05-01 07:40:05 +02:00
efi_var_file.c efi_loader: reduce noisiness if ESP is missing 2024-10-18 16:17:29 +02:00
efi_var_mem.c efi_loader: address coverity report 492766 for dead code 2024-05-01 07:39:27 +02:00
efi_var_seed.S efi_loader: pre-seed UEFI variables 2020-07-16 12:37:02 +02:00
efi_variable.c include: export uuid.h 2024-09-12 17:35:37 +02:00
efi_variable_tee.c efi_loader: enable QueryVariableInfo at runtime for file backed variables 2024-05-01 07:40:05 +02:00
efi_watchdog.c efi_loader: Remove <common.h> 2023-12-21 08:54:37 -05:00
helloworld.c efi_loader: Show FirmwareVendor and FirmwareRevision in helloworld 2024-10-09 22:04:56 -06:00
initrddump.c efi_loader: rename struct efi_initrd_dp to efi_lo_dp_prefix 2024-06-10 11:43:37 +02:00
Kconfig efi_loader: allow EFI_LOADER_BOUNCE_BUFFER on all architectures 2024-11-23 23:36:54 +01:00
Makefile efi_loader: Add a test app 2024-11-09 09:59:41 +01:00
smbiosdump.c efi_loader: Mark static functions in smbiosdump 2024-10-30 21:45:51 +01:00
testapp.c efi_loader: Add a test app 2024-11-09 09:59:41 +01:00