aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSai Praneeth <sai.praneeth.prakhya@intel.com>2017-06-02 09:52:06 -0400
committerIngo Molnar <mingo@kernel.org>2017-06-05 11:50:43 -0400
commitac81d3de03f7d8593a94240d057c8e2e8e869897 (patch)
tree69e84000abcc273e186046c16f703060dc2d0fbd
parent5f72cad65cfaac5e40d0de8b7f48ee647af69cd5 (diff)
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: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> Signed-off-by: Matt 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.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/platform/efi/efi.c3
-rw-r--r--arch/x86/platform/efi/efi_32.c9
-rw-r--r--arch/x86/platform/efi/efi_64.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 43b96f5f78ba..f084d8718ac4 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1014,7 +1014,6 @@ static void __init __efi_enter_virtual_mode(void)
1014 * necessary relocation fixups for the new virtual addresses. 1014 * necessary relocation fixups for the new virtual addresses.
1015 */ 1015 */
1016 efi_runtime_update_mappings(); 1016 efi_runtime_update_mappings();
1017 efi_dump_pagetable();
1018 1017
1019 /* clean DUMMY object */ 1018 /* clean DUMMY object */
1020 efi_delete_dummy_variable(); 1019 efi_delete_dummy_variable();
@@ -1029,6 +1028,8 @@ void __init efi_enter_virtual_mode(void)
1029 kexec_enter_virtual_mode(); 1028 kexec_enter_virtual_mode();
1030 else 1029 else
1031 __efi_enter_virtual_mode(); 1030 __efi_enter_virtual_mode();
1031
1032 efi_dump_pagetable();
1032} 1033}
1033 1034
1034/* 1035/*
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 3481268da3d0..52f7faa1538f 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -44,7 +44,14 @@ int __init efi_alloc_page_tables(void)
44} 44}
45 45
46void efi_sync_low_kernel_mappings(void) {} 46void efi_sync_low_kernel_mappings(void) {}
47void __init efi_dump_pagetable(void) {} 47
48void __init efi_dump_pagetable(void)
49{
50#ifdef CONFIG_EFI_PGT_DUMP
51 ptdump_walk_pgd_level(NULL, swapper_pg_dir);
52#endif
53}
54
48int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) 55int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
49{ 56{
50 return 0; 57 return 0;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index eb8dff15a7f6..8ff1f95627f9 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -589,7 +589,10 @@ void __init efi_runtime_update_mappings(void)
589void __init efi_dump_pagetable(void) 589void __init efi_dump_pagetable(void)
590{ 590{
591#ifdef CONFIG_EFI_PGT_DUMP 591#ifdef CONFIG_EFI_PGT_DUMP
592 ptdump_walk_pgd_level(NULL, efi_pgd); 592 if (efi_enabled(EFI_OLD_MEMMAP))
593 ptdump_walk_pgd_level(NULL, swapper_pg_dir);
594 else
595 ptdump_walk_pgd_level(NULL, efi_pgd);
593#endif 596#endif
594} 597}
595 598