aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2014-01-18 06:48:15 -0500
committerMatt Fleming <matt.fleming@intel.com>2014-03-04 11:17:17 -0500
commit11cc851254b4bc3bd4430be8db2a41469303a427 (patch)
tree490cfc91f4a07ae31e9cbef87c2a64dad742e2e0 /arch
parentef6bea6ddf0e76077d0798e57b374015b23a837e (diff)
x86/efi: Dump the EFI page table
This is very useful for debugging issues with the recently added pagetable switching code for EFI virtual mode. Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/Kconfig.debug9
-rw-r--r--arch/x86/include/asm/efi.h1
-rw-r--r--arch/x86/platform/efi/efi.c1
-rw-r--r--arch/x86/platform/efi/efi_32.c1
-rw-r--r--arch/x86/platform/efi/efi_64.c9
5 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 321a52ccf63a..61bd2ad94281 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -81,6 +81,15 @@ config X86_PTDUMP
81 kernel. 81 kernel.
82 If in doubt, say "N" 82 If in doubt, say "N"
83 83
84config EFI_PGT_DUMP
85 bool "Dump the EFI pagetable"
86 depends on EFI && X86_PTDUMP
87 ---help---
88 Enable this if you want to dump the EFI page table before
89 enabling virtual mode. This can be used to debug miscellaneous
90 issues with the mapping of the EFI runtime regions into that
91 table.
92
84config DEBUG_RODATA 93config DEBUG_RODATA
85 bool "Write protect kernel read-only data structures" 94 bool "Write protect kernel read-only data structures"
86 default y 95 default y
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index a7a8bd89024e..4afd3b3b658f 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -133,6 +133,7 @@ extern void efi_setup_page_tables(void);
133extern void __init old_map_region(efi_memory_desc_t *md); 133extern void __init old_map_region(efi_memory_desc_t *md);
134extern void __init runtime_code_page_mkexec(void); 134extern void __init runtime_code_page_mkexec(void);
135extern void __init efi_runtime_mkexec(void); 135extern void __init efi_runtime_mkexec(void);
136extern void __init efi_dump_pagetable(void);
136 137
137struct efi_setup_data { 138struct efi_setup_data {
138 u64 fw_vendor; 139 u64 fw_vendor;
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 876dc5b9e4a3..37f20d71ec4b 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1021,6 +1021,7 @@ void __init efi_enter_virtual_mode(void)
1021 1021
1022 efi_setup_page_tables(); 1022 efi_setup_page_tables();
1023 efi_sync_low_kernel_mappings(); 1023 efi_sync_low_kernel_mappings();
1024 efi_dump_pagetable();
1024 1025
1025 if (!efi_setup) { 1026 if (!efi_setup) {
1026 status = phys_efi_set_virtual_address_map( 1027 status = phys_efi_set_virtual_address_map(
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 0b74cdf7f816..39496ae3928a 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -41,6 +41,7 @@ static unsigned long efi_rt_eflags;
41 41
42void efi_sync_low_kernel_mappings(void) {} 42void efi_sync_low_kernel_mappings(void) {}
43void efi_setup_page_tables(void) {} 43void efi_setup_page_tables(void) {}
44void __init efi_dump_pagetable(void) {}
44 45
45void __init efi_map_region(efi_memory_desc_t *md) 46void __init efi_map_region(efi_memory_desc_t *md)
46{ 47{
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 0c2a234fef1e..e05c69b46f05 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -242,3 +242,12 @@ void __init efi_runtime_mkexec(void)
242 if (__supported_pte_mask & _PAGE_NX) 242 if (__supported_pte_mask & _PAGE_NX)
243 runtime_code_page_mkexec(); 243 runtime_code_page_mkexec();
244} 244}
245
246void __init efi_dump_pagetable(void)
247{
248#ifdef CONFIG_EFI_PGT_DUMP
249 pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
250
251 ptdump_walk_pgd_level(NULL, pgd);
252#endif
253}