Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4780918ooa; Tue, 14 Aug 2018 10:27:11 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyr4XiKruhQbC1KFlDbdqkP70y+I3SSVaIFiA7QQ5f8uQku+U8b1ypFPLDQbVq1zlOVEJRd X-Received: by 2002:a17:902:904c:: with SMTP id w12-v6mr21449386plz.95.1534267631634; Tue, 14 Aug 2018 10:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534267631; cv=none; d=google.com; s=arc-20160816; b=E2oI7D75Tg9JBCOmw03qM7kKXXFhf9Gk3Kx/86vTyfcZ7Ssdp0RCZf7/9tR/5FjZQ7 ZYfrrpama6CNXZxiVTjTanTEQl8AucvlgbyRlZ69osLL+p7bhgfuslIMpHxiTj3KQeD/ mUO783cwgo43Lb0EgCsaxHnX2bA7y6lAvSDsrv1saHfQxCtfI767nM+e9kbicsupLFMq kVRtHIECywOu7LCQ5BXFif539Ki7aOdSEupI5No2+c0ofUNtDKsIYhD0fRY3nP3yTSOs aG9FsJpLK/5BHPIV6XGP3glMfAGB2OynZANrK+Yl7RiB6eb2ZXBXtkYcqqC2uHMrltcF ZcrQ== 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=Ju/6UlNK6h5Ozy+tfP4Iv85EVahfJ8wPGBCU5wn/3I8=; b=zUNgyowq6qqUz8GGSMvJ5Q2hu6cCoSTh8iivIUKAWMqILduS/gHCFTA6I00WOBvfZk uHVv17RXjSIupXDSl0nCFv9SV4L0otIT/laXxYwJflvL5CrInxTnxwhIsDt2bTBzDg45 1mP6DqKkWdWYJ/DsLWf6gBK1d6TiXYv9MdJb88Bw6Gx5BXWUat909wnqPpxWX4ebHjJ5 gOb8ttT5dFEBmQsjCmNU25cuNyZ01aSFkgrffqXAXeYsX7lXnIm7OkWG4yWKNsb/1z1s jTJGL54NBoJtjSCCKfuWg3i4RK3Bv0QUUMWSHcCc0v+yKvxUSDreoSWKzkqjqSvQce/X WNmg== 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 bd3-v6si16684596plb.155.2018.08.14.10.26.33; Tue, 14 Aug 2018 10:27:11 -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 S2387888AbeHNUMZ (ORCPT + 99 others); Tue, 14 Aug 2018 16:12:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51300 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387747AbeHNUMZ (ORCPT ); Tue, 14 Aug 2018 16:12:25 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 759C7CBA; Tue, 14 Aug 2018 17:24:19 +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 Subject: [PATCH 4.18 13/79] x86/bugs: Move the l1tf function and define pr_fmt properly Date: Tue, 14 Aug 2018 19:16:32 +0200 Message-Id: <20180814171337.315271087@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171336.799314117@linuxfoundation.org> References: <20180814171336.799314117@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Konrad Rzeszutek Wilk 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: 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 @@ -211,32 +211,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__mapped_any(half_pa, ULLONG_MAX - half_pa, E820_TYPE_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; @@ -660,6 +634,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__mapped_any(half_pa, ULLONG_MAX - half_pa, E820_TYPE_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,