x86/mm: Unify pgtable_l5_enabled usage in early boot code
Usually pgtable_l5_enabled is defined using cpu_feature_enabled(). cpu_feature_enabled() is not available in early boot code. We use several different preprocessor tricks to get around it. It's messy. Unify them all. If cpu_feature_enabled() is not yet available, USE_EARLY_PGTABLE_L5 can be defined before all includes. It makes pgtable_l5_enabled rely on __pgtable_l5_enabled variable instead. This approach fits all early users. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: Hugh Dickins <hughd@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180518103528.59260-3-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
committed by
Ingo Molnar
parent
30bbf728ba
commit
ad3fe525b9
@@ -47,7 +47,7 @@
|
||||
#include <linux/decompress/mm.h>
|
||||
|
||||
#ifdef CONFIG_X86_5LEVEL
|
||||
unsigned int pgtable_l5_enabled __ro_after_init;
|
||||
unsigned int __pgtable_l5_enabled;
|
||||
unsigned int pgdir_shift __ro_after_init = 39;
|
||||
unsigned int ptrs_per_p4d __ro_after_init = 1;
|
||||
#endif
|
||||
@@ -734,7 +734,7 @@ void choose_random_location(unsigned long input,
|
||||
|
||||
#ifdef CONFIG_X86_5LEVEL
|
||||
if (__read_cr4() & X86_CR4_LA57) {
|
||||
pgtable_l5_enabled = 1;
|
||||
__pgtable_l5_enabled = 1;
|
||||
pgdir_shift = 48;
|
||||
ptrs_per_p4d = 512;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user