On 6/3/2024 10:31 AM, Mike Rapoport wrote:diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
On Mon, Jun 03, 2024 at 04:46:39PM +0200, Borislav Petkov wrote:Yes, something similar as above, as efi_mem_reserve() is used to reserve boot service memory and is not necessary for kexec boot.
On Mon, Jun 03, 2024 at 09:01:49AM -0500, Kalra, Ashish wrote:I think Ashish suggested rather
If we skip efi_arch_mem_reserve() (which should probably be anyway skippedAre you saying that we should simply do
for kexec case), then for kexec boot, EFI memmap is memremapped in the same
virtual address as the first kernel and not the allocated memblock address.
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index fdf07dd6f459..410cb0743289 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -577,6 +577,9 @@ void __init efi_mem_reserve(phys_addr_t addr, u64 size)
if (WARN_ON_ONCE(efi_enabled(EFI_PARAVIRT)))
return;
+ if (kexec_in_progress)
+ return;
+
if (!memblock_is_region_reserved(addr, size))
memblock_reserve(addr, size);
and skip that whole call?
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index fdf07dd6f459..eccc10ab15a4 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -580,6 +580,9 @@ void __init efi_mem_reserve(phys_addr_t addr, u64 size)
if (!memblock_is_region_reserved(addr, size))
memblock_reserve(addr, size);
+ if (kexec_in_progress)
+ return;
+
/*
* Some architectures (x86) reserve all boot services ranges
* until efi_free_boot_services() because of buggy firmware
So, Dave Young (dyoung@xxxxxxxxxx) had suggested that we skip efi_arch_mem_reserve() for kexec by checking the set EFI_MEMORY_RUNTIME attribute as below: