Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4806787ooa; Tue, 14 Aug 2018 10:49:05 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyrg1xXv5sgfguQPVZ6n4StbiRYF7eMGhpbI9tjH3nF+e99U2gvuEnOZkmJ6J4o2xkHwrei X-Received: by 2002:a62:129a:: with SMTP id 26-v6mr24411306pfs.102.1534268945143; Tue, 14 Aug 2018 10:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268945; cv=none; d=google.com; s=arc-20160816; b=Ud/0iraqal/BeylPtmwVI/m+vQc0Atawij90Pft54+JqFuNwuBaHdRHQYwSkaKl27O AA1gbobDnf617ffMQY0vDy9UY6q8GscqslTjnkxZ7a32qfRtnovpZVuXsbcTe85phff3 2nliwohtCM2y6JK934GaATWGIl7J8sYhxBWATyBb9VmjwpbxWqdi7gL8wYAgYROwrZf3 mDTSMvSH6Q2Rji88fYFYr5/LNl6Z3mBYrqOgEEKl1nDa47lK3Izwn11gNsaaEEgU+hIZ Skat8jJ3jwwsTMxkye7tPZTPNL60V/PLIMRzYLcFraI5hgvzKHcMwBL0m5i1FkkXGuBJ hLEg== 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=7zqr7tpJf9Q+AV4x5bbGWqpf7bxBrpWeVLJY1FwcZJ4=; b=k5ewVsbl8koiAV+f8iLyuw2S5icASIYYlhFl42zRMAQCNwL9we0LNwgQYUCyRS13GX l+MEOC2yBXkW+EIDRXBl6HdPgpZ/x3ZMdzR1Y2zPNS3wXQk5bLsf4XRhsJTu6+V+IVcv YPd/9ZU9YHrWsk1u1XvOcFnWlTThTppmc6LhP6GIFVs3CzxtWmDL8KovnbUn27BPzYRI XjwQ8+y7upladAe1xPYnp6Ipz3PCYJjkmPCarV3sHqm5+MkeDt+4O1XkLZITCn5YBLrP sh+B+VNK9TU6r30r86EoMZa6Z+Wy78YqcjJYKZuRobkOIONr0YyRcRD0SIH0ZACx0R20 8C1A== 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 x62-v6si21243953pfa.80.2018.08.14.10.48.50; Tue, 14 Aug 2018 10:49:05 -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 S2403833AbeHNUfm (ORCPT + 99 others); Tue, 14 Aug 2018 16:35:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32780 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390379AbeHNUfm (ORCPT ); Tue, 14 Aug 2018 16:35:42 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 525B9CAE; Tue, 14 Aug 2018 17:47:29 +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 , Guenter Roeck Subject: [PATCH 4.4 34/43] x86/bugs: Move the l1tf function and define pr_fmt properly Date: Tue, 14 Aug 2018 19:18:10 +0200 Message-Id: <20180814171519.341265676@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171517.014285600@linuxfoundation.org> References: <20180814171517.014285600@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.4-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: Guenter Roeck 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 @@ -207,32 +207,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; @@ -658,6 +632,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,