Commit ac81d3de authored by Sai Praneeth's avatar Sai Praneeth Committed by Ingo Molnar

x86/efi: Extend CONFIG_EFI_PGT_DUMP support to x86_32 and kexec as well

CONFIG_EFI_PGT_DUMP=y, as the name suggests, dumps EFI page tables to the
kernel log during kernel boot.

This feature is very useful while debugging page faults/null pointer
dereferences to EFI related addresses.

Presently, this feature is limited only to x86_64, so let's extend it to
other EFI configurations like kexec kernel, efi=old_map and to x86_32 as well.

This doesn't effect normal boot path because this config option should
be used only for debug purposes.
Signed-off-by: default avatarSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-13-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 5f72cad6
...@@ -1014,7 +1014,6 @@ static void __init __efi_enter_virtual_mode(void) ...@@ -1014,7 +1014,6 @@ static void __init __efi_enter_virtual_mode(void)
* necessary relocation fixups for the new virtual addresses. * necessary relocation fixups for the new virtual addresses.
*/ */
efi_runtime_update_mappings(); efi_runtime_update_mappings();
efi_dump_pagetable();
/* clean DUMMY object */ /* clean DUMMY object */
efi_delete_dummy_variable(); efi_delete_dummy_variable();
...@@ -1029,6 +1028,8 @@ void __init efi_enter_virtual_mode(void) ...@@ -1029,6 +1028,8 @@ void __init efi_enter_virtual_mode(void)
kexec_enter_virtual_mode(); kexec_enter_virtual_mode();
else else
__efi_enter_virtual_mode(); __efi_enter_virtual_mode();
efi_dump_pagetable();
} }
/* /*
......
...@@ -44,7 +44,14 @@ int __init efi_alloc_page_tables(void) ...@@ -44,7 +44,14 @@ int __init efi_alloc_page_tables(void)
} }
void efi_sync_low_kernel_mappings(void) {} void efi_sync_low_kernel_mappings(void) {}
void __init efi_dump_pagetable(void) {}
void __init efi_dump_pagetable(void)
{
#ifdef CONFIG_EFI_PGT_DUMP
ptdump_walk_pgd_level(NULL, swapper_pg_dir);
#endif
}
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{ {
return 0; return 0;
......
...@@ -589,6 +589,9 @@ void __init efi_runtime_update_mappings(void) ...@@ -589,6 +589,9 @@ void __init efi_runtime_update_mappings(void)
void __init efi_dump_pagetable(void) void __init efi_dump_pagetable(void)
{ {
#ifdef CONFIG_EFI_PGT_DUMP #ifdef CONFIG_EFI_PGT_DUMP
if (efi_enabled(EFI_OLD_MEMMAP))
ptdump_walk_pgd_level(NULL, swapper_pg_dir);
else
ptdump_walk_pgd_level(NULL, efi_pgd); ptdump_walk_pgd_level(NULL, efi_pgd);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment