From fa7bee867db1913560435a7486d17d95500a62dc Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Thu, 19 Jan 2023 14:04:00 -0500 Subject: efi: Warn if trying to reserve memory under Xen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Doing so cannot work and should never happen. Signed-off-by: Demi Marie Obenour Tested-by: Marek Marczykowski-Górecki Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 19c1191e6210..d4023ea1ccff 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -541,6 +541,10 @@ void __init __weak efi_arch_mem_reserve(phys_addr_t addr, u64 size) {} */ void __init efi_mem_reserve(phys_addr_t addr, u64 size) { + /* efi_mem_reserve() does not work under Xen */ + if (WARN_ON_ONCE(efi_enabled(EFI_PARAVIRT))) + return; + if (!memblock_is_region_reserved(addr, size)) memblock_reserve(addr, size); -- cgit v1.2.3-58-ga151