[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207132922.GSZcOFspSGaVluJo92@fat_crate.local>
Date: Wed, 7 Feb 2024 14:29:22 +0100
From: Borislav Petkov <bp@...en8.de>
To: Ard Biesheuvel <ardb+git@...gle.com>
Cc: linux-kernel@...r.kernel.org, Ard Biesheuvel <ardb@...nel.org>,
Kevin Loughlin <kevinloughlin@...gle.com>,
Tom Lendacky <thomas.lendacky@....com>,
Dionna Glaze <dionnaglaze@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Kees Cook <keescook@...omium.org>, Brian Gerst <brgerst@...il.com>,
linux-arch@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v3 06/19] x86/startup_64: Drop global variables keeping
track of LA57 state
On Mon, Jan 29, 2024 at 07:05:09PM +0100, Ard Biesheuvel wrote:
> static inline bool pgtable_l5_enabled(void)
> {
> return __pgtable_l5_enabled;
> }
> #else
> -#define pgtable_l5_enabled() cpu_feature_enabled(X86_FEATURE_LA57)
> +#define pgtable_l5_enabled() !!(native_read_cr4() & X86_CR4_LA57)
> #endif /* USE_EARLY_PGTABLE_L5 */
Can we drop this ifdeffery and simply have __pgtable_l5_enabled always
present and contain the correct value?
So that we don't have an expensive CR4 read hidden in
pgtable_l5_enabled()?
For the sake of simplicity, pgtable_l5_enabled() can be defined outside
of CONFIG_X86_5LEVEL and since both vendors support 5level now, might as
well start dropping the CONFIG ifdeffery slowly...
Other than that - a nice cleanup!
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists