From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752481AbdFERV5 (ORCPT ); Mon, 5 Jun 2017 13:21:57 -0400 Received: from terminus.zytor.com ([65.50.211.136]:49711 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751436AbdFERVz (ORCPT ); Mon, 5 Jun 2017 13:21:55 -0400 Date: Mon, 5 Jun 2017 10:16:02 -0700 From: tip-bot for Sai Praneeth Message-ID: Cc: ricardo.neri@intel.com, ard.biesheuvel@linaro.org, mingo@kernel.org, tglx@linutronix.de, sai.praneeth.prakhya@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, matt@codeblueprint.co.uk, bp@alien8.de, ravi.v.shankar@intel.com, peterz@infradead.org Reply-To: matt@codeblueprint.co.uk, peterz@infradead.org, bp@alien8.de, ravi.v.shankar@intel.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, sai.praneeth.prakhya@intel.com, hpa@zytor.com, mingo@kernel.org, ricardo.neri@intel.com, ard.biesheuvel@linaro.org, tglx@linutronix.de In-Reply-To: <20170602135207.21708-13-ard.biesheuvel@linaro.org> References: <20170602135207.21708-13-ard.biesheuvel@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] x86/efi: Extend CONFIG_EFI_PGT_DUMP support to x86_32 and kexec as well Git-Commit-ID: ac81d3de03f7d8593a94240d057c8e2e8e869897 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ac81d3de03f7d8593a94240d057c8e2e8e869897 Gitweb: http://git.kernel.org/tip/ac81d3de03f7d8593a94240d057c8e2e8e869897 Author: Sai Praneeth AuthorDate: Fri, 2 Jun 2017 13:52:06 +0000 Committer: Ingo Molnar CommitDate: Mon, 5 Jun 2017 17:50:43 +0200 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 Signed-off-by: Matt Fleming Cc: Ard Biesheuvel Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Ravi Shankar Cc: Ricardo Neri Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20170602135207.21708-13-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar --- arch/x86/platform/efi/efi.c | 3 ++- arch/x86/platform/efi/efi_32.c | 9 ++++++++- arch/x86/platform/efi/efi_64.c | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 43b96f5..f084d87 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) * necessary relocation fixups for the new virtual addresses. */ efi_runtime_update_mappings(); - efi_dump_pagetable(); /* clean DUMMY object */ efi_delete_dummy_variable(); @@ -1029,6 +1028,8 @@ void __init efi_enter_virtual_mode(void) kexec_enter_virtual_mode(); else __efi_enter_virtual_mode(); + + efi_dump_pagetable(); } /* diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index 3481268..52f7faa 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) } 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) { return 0; diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index eb8dff1..8ff1f95 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) void __init efi_dump_pagetable(void) { #ifdef CONFIG_EFI_PGT_DUMP - ptdump_walk_pgd_level(NULL, efi_pgd); + if (efi_enabled(EFI_OLD_MEMMAP)) + ptdump_walk_pgd_level(NULL, swapper_pg_dir); + else + ptdump_walk_pgd_level(NULL, efi_pgd); #endif }