From 8156a7560be93ce563f45b3ce1f643f63f9e2126 Mon Sep 17 00:00:00 2001
From: Tj <linux@iam.tj>
Date: Thu, 11 Apr 2024 12:37:46 +0100
Subject: [PATCH] efi/x86: add param keep_efi_e820
Add a command-line option to retain all e820 mappings.
Commit 07eab0901ede8b in v6.2 added logic to remove e820 EFI MMIO
regions larger than 256KiB. This caused a regression that affects
Lenovo Legion 9i and possibly others.
Fixes: 07eab0901ede8b ("efi/x86: Remove EfiMemoryMappedIO from E820
map")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218444
Signed-off-by: Tj <linux@iam.tj>
Tested-by: Mateusz Kaduk <mateusz.kaduk@gmail.com>
---
arch/x86/platform/efi/efi.c | 11 +++++++++++
1 file changed, 11 insertions(+)
@@ -103,6 +103,14 @@ static const unsigned long * const efi_tables[] = {
u64 efi_setup; /* efi setup_data physical address */
+static int keep_efi_e820 __initdata;
+static int __init setup_keep_efi_e820(char *arg)
+{
+ keep_efi_e820 = 1;
+ return 0;
+}
+early_param("keep_efi_e820", setup_keep_efi_e820);
+
static int add_efi_memmap __initdata;
static int __init setup_add_efi_memmap(char *arg)
{
@@ -333,6 +341,9 @@ static void __init efi_remove_e820_mmio(void)
u64 size, start, end;
int i = 0;
+ if (keep_efi_e820)
+ return;
+
for_each_efi_memory_desc(md) {
if (md->type == EFI_MEMORY_MAPPED_IO) {
size = md->num_pages << EFI_PAGE_SHIFT;
--
2.39.2