Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4543225ybz; Tue, 21 Apr 2020 02:30:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKUlxCoQ3noXQG729S3STmHcsx3z7VU1LURAvZMd63QFjZHhKA12jh/hx+lvSlVf5fOlXn+ X-Received: by 2002:a50:c487:: with SMTP id y7mr1053138edf.312.1587461434749; Tue, 21 Apr 2020 02:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587461434; cv=none; d=google.com; s=arc-20160816; b=Enkres5Uiwr3kFS5eLqDfiE7VqWWRRL7cRX0oLoZ2LD4zRy/GUN6wH4qkUwG9NXQzO Xy+fOR6hWmXjYrBgvNcbTnX80h+9Tx3rLVX/vq3/Gx0jJYzZhKxLP80Scw19dCcLrmza bM9YunFYvM/tWks0Zxh21jSZm1D3uA0FMQcsuaKaRTwnL35r3qc4w4MjdvWP3xADMit0 GJhOYheC+5U/9S7yaHot8pfRuJTQCW3trzNKSa7xB3lEUlKZlM/uTW7cHTzAaG8bbqEB C7AG/bLasUN42gudvd2yvtE5rYjdsg9ZCenpuh/pcgqrprnnsKIxkqJrM10raHLTRIFV DvbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:subject:cc:to:from:date:user-agent:message-id; bh=8g1RETBibwBl79zaARsJ+RrDKIsqtvXK8yc+6xeLKt4=; b=L2xkmsMu1kXUun5nS1QI9N37zVoxPAArcEtmutj8O4Gx+wQYlYTwBVN0a8GTTSlpfT o4fBL+6XATFwd/YcOro3BkuFvgpCVEhAHwc9SIDdGfvI80mUl94lMARO3ATOTrMSu1Em 6UnPGVonCSLF4P9dwr326ztxHTE0NXT+xzigR8zFbUHbJuGplh/WCmfzzE14K3rH550k +3A96BEBumQhw+IzAopK+3GotYs0eop9KG0T7tjsUhF6qFRpDwhZIXzc+8zzh+HU7BUy TXwo46pu2YLkyaoQ/y8IqBYsROovbJ9kl+QfEtiI75B/HXCJwwUxXzqry6gDup9U0s4v O5XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si1239052eds.152.2020.04.21.02.30.11; Tue, 21 Apr 2020 02:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728690AbgDUJ1i (ORCPT + 99 others); Tue, 21 Apr 2020 05:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728612AbgDUJ1Q (ORCPT ); Tue, 21 Apr 2020 05:27:16 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6341EC061A0F for ; Tue, 21 Apr 2020 02:27:16 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jQpBI-00083z-U9; Tue, 21 Apr 2020 11:27:05 +0200 Received: from nanos.tec.linutronix.de (localhost [IPv6:::1]) by nanos.tec.linutronix.de (Postfix) with ESMTP id 7A9531002EE; Tue, 21 Apr 2020 11:27:04 +0200 (CEST) Message-Id: <20200421092559.940978251@linutronix.de> User-Agent: quilt/0.65 Date: Tue, 21 Apr 2020 11:20:39 +0200 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Christoph Hellwig , Kees Cook , Alexandre Chartre , "Peter Zijlstra (Intel)" , Thomas Lendacky , Juergen Gross , Boris Ostrovsky Subject: [patch V2 12/16] x86/tlb: Move cr4_set_bits_and_update_boot() to the usage site References: <20200421092027.591582014@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No point in having this exposed. Signed-off-by: Thomas Gleixner Reviewed-by: Alexandre Chartre Acked-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/tlbflush.h | 14 -------------- arch/x86/mm/init.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -322,23 +322,9 @@ static inline void cr4_clear_bits(unsign local_irq_restore(flags); } -/* - * Save some of cr4 feature set we're using (e.g. Pentium 4MB - * enable and PPro Global page enable), so that any CPU's that boot - * up after us can get the correct flags. This should only be used - * during boot on the boot cpu. - */ extern unsigned long mmu_cr4_features; extern u32 *trampoline_cr4_features; -static inline void cr4_set_bits_and_update_boot(unsigned long mask) -{ - mmu_cr4_features |= mask; - if (trampoline_cr4_features) - *trampoline_cr4_features = mmu_cr4_features; - cr4_set_bits(mask); -} - extern void initialize_tlbstate_and_flush(void); #define TLB_FLUSH_ALL -1UL --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -172,6 +172,19 @@ struct map_range { static int page_size_mask; +/* + * Save some of cr4 feature set we're using (e.g. Pentium 4MB + * enable and PPro Global page enable), so that any CPU's that boot + * up after us can get the correct flags. Invoked on the boot CPU. + */ +static inline void cr4_set_bits_and_update_boot(unsigned long mask) +{ + mmu_cr4_features |= mask; + if (trampoline_cr4_features) + *trampoline_cr4_features = mmu_cr4_features; + cr4_set_bits(mask); +} + static void __init probe_page_size_mask(void) { /*