diff options
-rw-r--r-- | arch/x86/platform/efi/efi_64.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 319148bd4b05..2f25a363068c 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -269,6 +269,22 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) | |||
269 | efi_scratch.use_pgd = true; | 269 | efi_scratch.use_pgd = true; |
270 | 270 | ||
271 | /* | 271 | /* |
272 | * Certain firmware versions are way too sentimential and still believe | ||
273 | * they are exclusive and unquestionable owners of the first physical page, | ||
274 | * even though they explicitly mark it as EFI_CONVENTIONAL_MEMORY | ||
275 | * (but then write-access it later during SetVirtualAddressMap()). | ||
276 | * | ||
277 | * Create a 1:1 mapping for this page, to avoid triple faults during early | ||
278 | * boot with such firmware. We are free to hand this page to the BIOS, | ||
279 | * as trim_bios_range() will reserve the first page and isolate it away | ||
280 | * from memory allocators anyway. | ||
281 | */ | ||
282 | if (kernel_map_pages_in_pgd(pgd, 0x0, 0x0, 1, _PAGE_RW)) { | ||
283 | pr_err("Failed to create 1:1 mapping for the first page!\n"); | ||
284 | return 1; | ||
285 | } | ||
286 | |||
287 | /* | ||
272 | * When making calls to the firmware everything needs to be 1:1 | 288 | * When making calls to the firmware everything needs to be 1:1 |
273 | * mapped and addressable with 32-bit pointers. Map the kernel | 289 | * mapped and addressable with 32-bit pointers. Map the kernel |
274 | * text and allocate a new stack because we can't rely on the | 290 | * text and allocate a new stack because we can't rely on the |