提交 11cc8512 编写于 作者: B Borislav Petkov 提交者: Matt Fleming

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: NBorislav Petkov <bp@suse.de>
Tested-by: NToshi Kani <toshi.kani@hp.com>
Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
上级 ef6bea6d
...@@ -81,6 +81,15 @@ config X86_PTDUMP ...@@ -81,6 +81,15 @@ config X86_PTDUMP
kernel. kernel.
If in doubt, say "N" If in doubt, say "N"
config EFI_PGT_DUMP
bool "Dump the EFI pagetable"
depends on EFI && X86_PTDUMP
---help---
Enable this if you want to dump the EFI page table before
enabling virtual mode. This can be used to debug miscellaneous
issues with the mapping of the EFI runtime regions into that
table.
config DEBUG_RODATA config DEBUG_RODATA
bool "Write protect kernel read-only data structures" bool "Write protect kernel read-only data structures"
default y default y
......
...@@ -133,6 +133,7 @@ extern void efi_setup_page_tables(void); ...@@ -133,6 +133,7 @@ extern void efi_setup_page_tables(void);
extern void __init old_map_region(efi_memory_desc_t *md); extern void __init old_map_region(efi_memory_desc_t *md);
extern void __init runtime_code_page_mkexec(void); extern void __init runtime_code_page_mkexec(void);
extern void __init efi_runtime_mkexec(void); extern void __init efi_runtime_mkexec(void);
extern void __init efi_dump_pagetable(void);
struct efi_setup_data { struct efi_setup_data {
u64 fw_vendor; u64 fw_vendor;
......
...@@ -1021,6 +1021,7 @@ void __init efi_enter_virtual_mode(void) ...@@ -1021,6 +1021,7 @@ void __init efi_enter_virtual_mode(void)
efi_setup_page_tables(); efi_setup_page_tables();
efi_sync_low_kernel_mappings(); efi_sync_low_kernel_mappings();
efi_dump_pagetable();
if (!efi_setup) { if (!efi_setup) {
status = phys_efi_set_virtual_address_map( status = phys_efi_set_virtual_address_map(
......
...@@ -41,6 +41,7 @@ static unsigned long efi_rt_eflags; ...@@ -41,6 +41,7 @@ static unsigned long efi_rt_eflags;
void efi_sync_low_kernel_mappings(void) {} void efi_sync_low_kernel_mappings(void) {}
void efi_setup_page_tables(void) {} void efi_setup_page_tables(void) {}
void __init efi_dump_pagetable(void) {}
void __init efi_map_region(efi_memory_desc_t *md) void __init efi_map_region(efi_memory_desc_t *md)
{ {
......
...@@ -242,3 +242,12 @@ void __init efi_runtime_mkexec(void) ...@@ -242,3 +242,12 @@ void __init efi_runtime_mkexec(void)
if (__supported_pte_mask & _PAGE_NX) if (__supported_pte_mask & _PAGE_NX)
runtime_code_page_mkexec(); runtime_code_page_mkexec();
} }
void __init efi_dump_pagetable(void)
{
#ifdef CONFIG_EFI_PGT_DUMP
pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
ptdump_walk_pgd_level(NULL, pgd);
#endif
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册