diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2018-05-18 13:35:23 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-05-19 11:56:57 +0200 |
commit | ad3fe525b9507d8d750d60e8e5dd8e0c0836fb99 (patch) | |
tree | 9300eaefdeea98b308a87a2ca2995ea0a5fa89b9 /arch/x86/include | |
parent | 30bbf728ba91b1e8b0e539126cd105ad7e2fa16a (diff) | |
download | linux-stable-ad3fe525b9507d8d750d60e8e5dd8e0c0836fb99.tar.gz linux-stable-ad3fe525b9507d8d750d60e8e5dd8e0c0836fb99.tar.bz2 linux-stable-ad3fe525b9507d8d750d60e8e5dd8e0c0836fb99.zip |
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>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/pgtable_64_types.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index adb47552e6bb..c14a4116a693 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -22,12 +22,19 @@ typedef struct { pteval_t pte; } pte_t; #ifdef CONFIG_X86_5LEVEL extern unsigned int __pgtable_l5_enabled; -#ifndef pgtable_l5_enabled + +#ifdef USE_EARLY_PGTABLE_L5 +/* + * cpu_feature_enabled() is not available in early boot code. + * Use variable instead. + */ +#define pgtable_l5_enabled __pgtable_l5_enabled +#else #define pgtable_l5_enabled cpu_feature_enabled(X86_FEATURE_LA57) -#endif +#endif /* USE_EARLY_PGTABLE_L5 */ #else #define pgtable_l5_enabled 0 -#endif +#endif /* CONFIG_X86_5LEVEL */ extern unsigned int pgdir_shift; extern unsigned int ptrs_per_p4d; |