From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758936AbdKQPb3 (ORCPT ); Fri, 17 Nov 2017 10:31:29 -0500 Received: from terminus.zytor.com ([65.50.211.136]:55507 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751306AbdKQPbT (ORCPT ); Fri, 17 Nov 2017 10:31:19 -0500 Date: Fri, 17 Nov 2017 07:25:45 -0800 From: tip-bot for Tom Lendacky Message-ID: Cc: thomas.lendacky@amd.com, peterz@infradead.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, bp@alien8.de, tomeu@tomeuvizoso.net, mingo@kernel.org, hpa@zytor.com Reply-To: tomeu@tomeuvizoso.net, hpa@zytor.com, mingo@kernel.org, thomas.lendacky@amd.com, bp@alien8.de, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de In-Reply-To: <20171106201753.23059.86674.stgit@tlendack-t1.amdoffice.net> References: <20171106201753.23059.86674.stgit@tlendack-t1.amdoffice.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/boot: Fix boot failure when SMP MP-table is based at 0 Git-Commit-ID: ac5292e9a294618cecb31109d1ba265e3d027ba2 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: ac5292e9a294618cecb31109d1ba265e3d027ba2 Gitweb: https://git.kernel.org/tip/ac5292e9a294618cecb31109d1ba265e3d027ba2 Author: Tom Lendacky AuthorDate: Mon, 6 Nov 2017 14:17:53 -0600 Committer: Thomas Gleixner CommitDate: Fri, 17 Nov 2017 15:30:33 +0100 x86/boot: Fix boot failure when SMP MP-table is based at 0 When crosvm is used to boot a kernel as a VM, the SMP MP-table is found at physical address 0x0. This causes mpf_base to be set to 0 and a subsequent "if (!mpf_base)" check in default_get_smp_config() results in the MP-table not being parsed. Further into the boot this results in an oops when attempting a read_apic_id(). Add a boolean variable that is set to true when the MP-table is found. Use this variable for testing if the MP-table was found so that even a value of 0 for mpf_base will result in continued parsing of the MP-table. Fixes: 5997efb96756 ("x86/boot: Use memremap() to map the MPF and MPC data") Reported-by: Tomeu Vizoso Signed-off-by: Tom Lendacky Signed-off-by: Thomas Gleixner Cc: Peter Zijlstra Cc: Borislav Petkov Cc: regression@leemhuis.info Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20171106201753.23059.86674.stgit@tlendack-t1.amdoffice.net --- arch/x86/kernel/mpparse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 410c5da..3a4b128 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -431,6 +431,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) } static unsigned long mpf_base; +static bool mpf_found; static unsigned long __init get_mpc_size(unsigned long physptr) { @@ -504,7 +505,7 @@ void __init default_get_smp_config(unsigned int early) if (!smp_found_config) return; - if (!mpf_base) + if (!mpf_found) return; if (acpi_lapic && early) @@ -593,6 +594,7 @@ static int __init smp_scan_config(unsigned long base, unsigned long length) smp_found_config = 1; #endif mpf_base = base; + mpf_found = true; pr_info("found SMP MP-table at [mem %#010lx-%#010lx] mapped at [%p]\n", base, base + sizeof(*mpf) - 1, mpf); @@ -858,7 +860,7 @@ static int __init update_mp_table(void) if (!enable_update_mptable) return 0; - if (!mpf_base) + if (!mpf_found) return 0; mpf = early_memremap(mpf_base, sizeof(*mpf));