linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: kirill.shutemov@linux.intel.com, gorcunov@openvz.org,
	keescook@chromium.org, luto@amacapital.net, willy@infradead.org,
	torvalds@linux-foundation.org, andy.shevchenko@gmail.com,
	bp@suse.de, tglx@linutronix.de, linux-kernel@vger.kernel.org,
	mingo@kernel.org, hpa@zytor.com, ebiederm@xmission.com,
	peterz@infradead.org, jgross@suse.com
Subject: [tip:x86/mm] x86/boot/compressed/64: Describe the logic behind the LA57 check
Date: Mon, 12 Mar 2018 02:27:58 -0700	[thread overview]
Message-ID: <tip-a403d798182f4f7be5e9bab56cfa37e9828fd92a@git.kernel.org> (raw)
In-Reply-To: <20180226180451.86788-2-kirill.shutemov@linux.intel.com>

Commit-ID:  a403d798182f4f7be5e9bab56cfa37e9828fd92a
Gitweb:     https://git.kernel.org/tip/a403d798182f4f7be5e9bab56cfa37e9828fd92a
Author:     Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
AuthorDate: Mon, 26 Feb 2018 21:04:47 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 12 Mar 2018 09:29:24 +0100

x86/boot/compressed/64: Describe the logic behind the LA57 check

The patch explains the LA57 check in more details.

Tested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20180226180451.86788-2-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/boot/compressed/pgtable_64.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c
index 3f1697fcc7a8..45c76eff2718 100644
--- a/arch/x86/boot/compressed/pgtable_64.c
+++ b/arch/x86/boot/compressed/pgtable_64.c
@@ -18,10 +18,22 @@ struct paging_config paging_prepare(void)
 {
 	struct paging_config paging_config = {};
 
-	/* Check if LA57 is desired and supported */
-	if (IS_ENABLED(CONFIG_X86_5LEVEL) && native_cpuid_eax(0) >= 7 &&
-			(native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31))))
+	/*
+	 * Check if LA57 is desired and supported.
+	 *
+	 * There are two parts to the check:
+	 *   - if the kernel supports 5-level paging: CONFIG_X86_5LEVEL=y
+	 *   - if the machine supports 5-level paging:
+	 *     + CPUID leaf 7 is supported
+	 *     + the leaf has the feature bit set
+	 *
+	 * That's substitute for boot_cpu_has() in early boot code.
+	 */
+	if (IS_ENABLED(CONFIG_X86_5LEVEL) &&
+			native_cpuid_eax(0) >= 7 &&
+			(native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31)))) {
 		paging_config.l5_required = 1;
+	}
 
 	return paging_config;
 }

  reply	other threads:[~2018-03-12  9:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 18:04 [PATCH 0/5] x86/boot/compressed/64: Prepare trampoline memory Kirill A. Shutemov
2018-02-26 18:04 ` [PATCH 1/5] x86/boot/compressed/64: Describe the logic behind LA57 check Kirill A. Shutemov
2018-03-12  9:27   ` tip-bot for Kirill A. Shutemov [this message]
2018-03-12 12:40     ` [tip:x86/mm] x86/boot/compressed/64: Describe the logic behind the " Peter Zijlstra
2018-03-12 12:43       ` Kirill A. Shutemov
2018-03-12 13:10         ` Peter Zijlstra
2018-03-12 14:04           ` Kirill A. Shutemov
2018-03-12 14:32             ` Ingo Molnar
2018-03-12 14:50               ` Kirill A. Shutemov
2018-03-12 16:42                 ` Linus Torvalds
2018-03-12 17:06                   ` Andy Lutomirski
2018-03-12 17:12                     ` Linus Torvalds
2018-03-12 17:41                       ` Ingo Molnar
2018-03-12 17:21                     ` Dave Hansen
2018-03-12 14:52               ` Cyrill Gorcunov
2018-02-26 18:04 ` [PATCH 2/5] x86/boot/compressed/64: Find a place for 32-bit trampoline Kirill A. Shutemov
2018-02-26 22:30   ` Borislav Petkov
2018-02-27  8:14     ` Kirill A. Shutemov
2018-03-12  9:28   ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
2018-02-26 18:04 ` [PATCH 3/5] x86/boot/compressed/64: Save and restore trampoline memory Kirill A. Shutemov
2018-03-12  9:29   ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
2018-02-26 18:04 ` [PATCH 4/5] x86/boot/compressed/64: Set up " Kirill A. Shutemov
2018-03-12  9:29   ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
2018-02-26 18:04 ` [PATCH 5/5] x86/boot/compressed/64: Prepare new top-level page table for trampoline Kirill A. Shutemov
2018-03-12  9:30   ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
2018-02-26 19:32 ` [PATCH 0/5] x86/boot/compressed/64: Prepare trampoline memory Borislav Petkov
2018-02-26 20:55   ` Kirill A. Shutemov
2018-02-27  9:32     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-a403d798182f4f7be5e9bab56cfa37e9828fd92a@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bp@suse.de \
    --cc=ebiederm@xmission.com \
    --cc=gorcunov@openvz.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).