Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4799052ooa; Tue, 14 Aug 2018 10:42:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxavs36GaHcRDxnLisOTK7JpjNWelq3M5cfhkpG1/MudwH5oChWYa9KYOIZcLIiaEdEcz4g X-Received: by 2002:a65:5545:: with SMTP id t5-v6mr22173102pgr.157.1534268552009; Tue, 14 Aug 2018 10:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268551; cv=none; d=google.com; s=arc-20160816; b=djZCoWZiJ2nhkOMU4UrHCinRRdwJvoXTZqAvKjRVsYMhf8IVIiN4Inxa8YcfsTK2ls E6J21q8OhZLprNoIVsuffUnaJRAVA7UxO2xvnUIXIWaNECTJcWRoTpt1hkbChOBmnZbP I0F1PZvEQon5nWUtd2nGRtOdwweyC0O+0l1tzZoOGixzUHd2+hGA6TH+NUxZDd0ci3AP cOwl+peBqyqSIWuduzSCWekkR0cotV0gMuxt2GOvuit9eSV7fZCyyUTz7WppY8gc8utx sJiV+NnbUFS2ITa8zxBCr5Y2n4tfnNP/3TCrsBrblREb26nECszbubVudTPeR7aR3jEh qZUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=A6TUeNnJ4SRWx87t+U10svulB2EzYHMgUTBr99Eu9FI=; b=dZ4cVchOVQJAk9hceI5rlxyfUZ2Zp12Qmfm+hIh2WfoGGgG7kuk20KKVxA+kFLt1RF Ayr1n4A8JiMoPxVx0AIW+OZeINcoxCmPS6sZ5oeyk7SRBQ7ixCJ2Amzi/XYZ613UZn6q kXjhlRrJSNSNoKfkszG653t/AMp9nt/6Uk1zeADhqgkxxirQ5xbSfyMQrU/WTFGqONjb UMxVZq4BQcFA0jy+iSATmkSTsDPLywX/ZC9OoUVgZRTWVhDw8a11/mCnSOdBkW5XVTLW 1O4dWVaoUHnzo87C8c5khJcEcyr0lJFYPUu3lg0Bo3pK0lbE+68X9P0TUSLiXX7Vngnm 2f6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15-v6si21371730pgh.593.2018.08.14.10.42.17; Tue, 14 Aug 2018 10:42:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389874AbeHNU3A (ORCPT + 99 others); Tue, 14 Aug 2018 16:29:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58896 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732016AbeHNU27 (ORCPT ); Tue, 14 Aug 2018 16:28:59 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BADF9D4A; Tue, 14 Aug 2018 17:40:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Rzeszutek Wilk , Thomas Gleixner , David Woodhouse Subject: [PATCH 4.9 036/107] x86/bugs: Move the l1tf function and define pr_fmt properly Date: Tue, 14 Aug 2018 19:16:59 +0200 Message-Id: <20180814171522.953595668@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171520.883143803@linuxfoundation.org> References: <20180814171520.883143803@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Konrad Rzeszutek Wilk commit 56563f53d3066afa9e63d6c997bf67e76a8b05c0 upstream The pr_warn in l1tf_select_mitigation would have used the prior pr_fmt which was defined as "Spectre V2 : ". Move the function to be past SSBD and also define the pr_fmt. Fixes: 17dbca119312 ("x86/speculation/l1tf: Add sysfs reporting for l1tf") Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Thomas Gleixner Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/bugs.c | 55 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 26 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -208,32 +208,6 @@ static void x86_amd_ssb_disable(void) wrmsrl(MSR_AMD64_LS_CFG, msrval); } -static void __init l1tf_select_mitigation(void) -{ - u64 half_pa; - - if (!boot_cpu_has_bug(X86_BUG_L1TF)) - return; - -#if CONFIG_PGTABLE_LEVELS == 2 - pr_warn("Kernel not compiled for PAE. No mitigation for L1TF\n"); - return; -#endif - - /* - * This is extremely unlikely to happen because almost all - * systems have far more MAX_PA/2 than RAM can be fit into - * DIMM slots. - */ - half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT; - if (e820_any_mapped(half_pa, ULLONG_MAX - half_pa, E820_RAM)) { - pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n"); - return; - } - - setup_force_cpu_cap(X86_FEATURE_L1TF_PTEINV); -} - #ifdef RETPOLINE static bool spectre_v2_bad_module; @@ -659,6 +633,35 @@ void x86_spec_ctrl_setup_ap(void) x86_amd_ssb_disable(); } +#undef pr_fmt +#define pr_fmt(fmt) "L1TF: " fmt +static void __init l1tf_select_mitigation(void) +{ + u64 half_pa; + + if (!boot_cpu_has_bug(X86_BUG_L1TF)) + return; + +#if CONFIG_PGTABLE_LEVELS == 2 + pr_warn("Kernel not compiled for PAE. No mitigation for L1TF\n"); + return; +#endif + + /* + * This is extremely unlikely to happen because almost all + * systems have far more MAX_PA/2 than RAM can be fit into + * DIMM slots. + */ + half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT; + if (e820_any_mapped(half_pa, ULLONG_MAX - half_pa, E820_RAM)) { + pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n"); + return; + } + + setup_force_cpu_cap(X86_FEATURE_L1TF_PTEINV); +} +#undef pr_fmt + #ifdef CONFIG_SYSFS static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr,