Skip to contentSkip to conversation

x86/efi: skip memattr table on kexec boot

PATCH In review Dave Young 2 participants 2 messages Jan 23, 2025

Subsystems (4)
lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 1/1 x86/efi: skip memattr table on kexec boot

efi_memattr_init() added a sanity check to avoid firmware caused corruption. The check is based on efi memmap entry numbers, but kexec only takes the runtime related memmap entries thus this caused many false warnings, see below thread for details:

https://lore.kernel.org/all/[email protected]/

Ard suggests to skip the efi memattr table in kexec, this makes sense because those memattr fixups are not critical.

arch/x86/platform/efi/quirks.c +5 -0
index 846bf49f2508..553f330198f2 100644
@@ -561,6 +561,11 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
 
 		if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID))
 			((efi_config_table_64_t *)p)->table = data->smbios;
+
+		/* Do not bother to play with mem attr table across kexec */
+		if (!efi_guidcmp(guid, EFI_MEMORY_ATTRIBUTES_TABLE_GUID))
+			((efi_config_table_64_t *)p)->table = EFI_INVALID_TABLE_ADDR;
+
 		p += sz;
 	}
 	early_memunmap(tablep, nr_tables * sz);
maintainer
#1 lore raw
Quoted 23 lines · Dave Young

efi_memattr_init() added a sanity check to avoid firmware caused corruption. The check is based on efi memmap entry numbers, but kexec only takes the runtime related memmap entries thus this caused many false warnings, see below thread for details:

https://lore.kernel.org/all/[email protected]/

Ard suggests to skip the efi memattr table in kexec, this makes sense because those memattr fixups are not critical.

arch/x86/platform/efi/quirks.c +0 -0
index 846bf49f2508..553f330198f2 100644
@@ -561,6 +561,11 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
 

arch/x86/platform/efi/quirks.c int __init efi_reuse_config(u64 tables, int nr_tables) · line 571

Quoted 10 lines
arch/x86/platform/efi/quirks.c +5 -0
                if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID))
                        ((efi_config_table_64_t *)p)->table = data->smbios;
+
+               /* Do not bother to play with mem attr table across kexec */
+               if (!efi_guidcmp(guid, EFI_MEMORY_ATTRIBUTES_TABLE_GUID))
+                       ((efi_config_table_64_t *)p)->table = EFI_INVALID_TABLE_ADDR;
+
                p += sz;
        }
        early_memunmap(tablep, nr_tables * sz);

Thanks. I've queued this up now.