Received: by 10.223.185.116 with SMTP id b49csp671992wrg; Wed, 14 Feb 2018 05:18:25 -0800 (PST) X-Google-Smtp-Source: AH8x227ZKfQv6LZZ7siD8jxmIoD+fjgsHy5UDBqZa7tEmn1yR3ydVRbuXD0u06RSktcVE+e7aFNM X-Received: by 2002:a17:902:6b87:: with SMTP id p7-v6mr2469173plk.9.1518614305591; Wed, 14 Feb 2018 05:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518614305; cv=none; d=google.com; s=arc-20160816; b=gKGJ2FUi2DUQYyQ5CqdRMi6h/dXTtSfptavLwz85XzZkoPx3qFzOazCP3kM8FXaUeF duIYU+U5/G288CrnFzKGqyBPSEruSgrXD+GJXLaU+dP45ksaIVJQHkp1VciUsErexx0R BdIodnZzPQUuRwfB7qRexs+jtJlCoIU0q3uK/1MtP3fzsv5nEh6v1H5DVTZUURUme5fA UOFxBDZHXYMmwXm9zEocTjEg/L4PAU42qGh/pDOqQWbKdFtHsOhDBWgqg6brohFHWbLL CsRofTWUn7iFTgn8UNRbM0bg+w/KmtU2E2ibZT1w5NBqfVdzR7hwQa9uIJRPnCElShME IXcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=Mlco5CV/8XF7aNOqjzhleGMithf/jv2ulMhDuu5EUhk=; b=0pkkeyOQkRkXAF2htTgMQD4IhoUyxtSimnYJexehrLxjh3rHUuc+6/nEcjX2NgR9nQ FscPxSbUVgy7uBTlVBpALfHTOWlp26BdzkHtLKyL02Hyy2j6NNX6RR7fx7RF9Z7mAwvk hLZJrehnsSf45Bree1QE7sn8FaMivrT8wbdygAfipgQTrwzXBCv+AMFY93niyjO2J3Ig giBFvdmok4dd1sUb3aiGR56y7WRSWyNo57XWl5ZT5M+9X513Wfh9rVZOjpL6sSt2Ojgz ml2qkTKwBO9XcOgFNWXE7a9lHFRNLJv1sXJjehbZOTSKOdaiIy9/ouWTZLpt7Ydpvl5l MzaA== 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 c83si951232pfd.185.2018.02.14.05.18.10; Wed, 14 Feb 2018 05:18:25 -0800 (PST) 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 S967850AbeBNNQR (ORCPT + 99 others); Wed, 14 Feb 2018 08:16:17 -0500 Received: from terminus.zytor.com ([198.137.202.136]:49865 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967717AbeBNNQQ (ORCPT ); Wed, 14 Feb 2018 08:16:16 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1ED5rQF027055; Wed, 14 Feb 2018 05:05:53 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1ED5qbS027051; Wed, 14 Feb 2018 05:05:52 -0800 Date: Wed, 14 Feb 2018 05:05:52 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: "tip-bot for Kirill A. Shutemov" Message-ID: Cc: kirill.shutemov@linux.intel.com, luto@amacapital.net, peterz@infradead.org, torvalds@linux-foundation.org, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, bp@suse.de, tglx@linutronix.de Reply-To: luto@amacapital.net, kirill.shutemov@linux.intel.com, hpa@zytor.com, torvalds@linux-foundation.org, peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@suse.de In-Reply-To: <20180214111656.88514-5-kirill.shutemov@linux.intel.com> References: <20180214111656.88514-5-kirill.shutemov@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm: Introduce 'pgtable_l5_enabled' Git-Commit-ID: e626e6bb0dfaca41487241d49ce0ae827716101a 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 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e626e6bb0dfaca41487241d49ce0ae827716101a Gitweb: https://git.kernel.org/tip/e626e6bb0dfaca41487241d49ce0ae827716101a Author: Kirill A. Shutemov AuthorDate: Wed, 14 Feb 2018 14:16:51 +0300 Committer: Ingo Molnar CommitDate: Wed, 14 Feb 2018 13:11:14 +0100 x86/mm: Introduce 'pgtable_l5_enabled' The new flag would indicate what paging mode we are in. Signed-off-by: Kirill A. Shutemov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20180214111656.88514-5-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar --- arch/x86/boot/compressed/kaslr.c | 4 ++++ arch/x86/include/asm/pgtable_32_types.h | 2 ++ arch/x86/include/asm/pgtable_64_types.h | 6 ++++++ arch/x86/kernel/head64.c | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 8199a61..bd69e18 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -46,6 +46,10 @@ #define STATIC #include +#ifdef CONFIG_X86_5LEVEL +unsigned int pgtable_l5_enabled __ro_after_init = 1; +#endif + extern unsigned long get_cmd_line_ptr(void); /* Simplified build-specific string for starting entropy. */ diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h index 0777e18..e3225e8 100644 --- a/arch/x86/include/asm/pgtable_32_types.h +++ b/arch/x86/include/asm/pgtable_32_types.h @@ -15,6 +15,8 @@ # include #endif +#define pgtable_l5_enabled 0 + #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE - 1)) diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index a0db91a..5e2d724 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -20,6 +20,12 @@ typedef unsigned long pgprotval_t; typedef struct { pteval_t pte; } pte_t; +#ifdef CONFIG_X86_5LEVEL +extern unsigned int pgtable_l5_enabled; +#else +#define pgtable_l5_enabled 0 +#endif + #endif /* !__ASSEMBLY__ */ #define SHARED_KERNEL_PMD 0 diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index bf5c9ba..17d00d1 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -39,6 +39,11 @@ extern pmd_t early_dynamic_pgts[EARLY_DYNAMIC_PAGE_TABLES][PTRS_PER_PMD]; static unsigned int __initdata next_early_pgt; pmdval_t early_pmd_flags = __PAGE_KERNEL_LARGE & ~(_PAGE_GLOBAL | _PAGE_NX); +#ifdef CONFIG_X86_5LEVEL +unsigned int pgtable_l5_enabled __ro_after_init = 1; +EXPORT_SYMBOL(pgtable_l5_enabled); +#endif + #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT unsigned long page_offset_base __ro_after_init = __PAGE_OFFSET_BASE; EXPORT_SYMBOL(page_offset_base);