Commit 28e3ace7 authored by Borislav Petkov's avatar Borislav Petkov

x86/mm: Convert some slow-path static_cpu_has() callers to boot_cpu_has()

Using static_cpu_has() is pointless on those paths, convert them to the
boot_cpu_has() variant.

No functional changes.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Link: https://lkml.kernel.org/r/20190330112022.28888-5-bp@alien8.de
parent 67e87d43
...@@ -577,7 +577,7 @@ void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd) ...@@ -577,7 +577,7 @@ void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd)
void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool user) void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool user)
{ {
#ifdef CONFIG_PAGE_TABLE_ISOLATION #ifdef CONFIG_PAGE_TABLE_ISOLATION
if (user && static_cpu_has(X86_FEATURE_PTI)) if (user && boot_cpu_has(X86_FEATURE_PTI))
pgd = kernel_to_user_pgdp(pgd); pgd = kernel_to_user_pgdp(pgd);
#endif #endif
ptdump_walk_pgd_level_core(m, pgd, false, false); ptdump_walk_pgd_level_core(m, pgd, false, false);
...@@ -590,7 +590,7 @@ void ptdump_walk_user_pgd_level_checkwx(void) ...@@ -590,7 +590,7 @@ void ptdump_walk_user_pgd_level_checkwx(void)
pgd_t *pgd = INIT_PGD; pgd_t *pgd = INIT_PGD;
if (!(__supported_pte_mask & _PAGE_NX) || if (!(__supported_pte_mask & _PAGE_NX) ||
!static_cpu_has(X86_FEATURE_PTI)) !boot_cpu_has(X86_FEATURE_PTI))
return; return;
pr_info("x86/mm: Checking user space page tables\n"); pr_info("x86/mm: Checking user space page tables\n");
......
...@@ -190,7 +190,7 @@ static void pgd_dtor(pgd_t *pgd) ...@@ -190,7 +190,7 @@ static void pgd_dtor(pgd_t *pgd)
* when PTI is enabled. We need them to map the per-process LDT into the * when PTI is enabled. We need them to map the per-process LDT into the
* user-space page-table. * user-space page-table.
*/ */
#define PREALLOCATED_USER_PMDS (static_cpu_has(X86_FEATURE_PTI) ? \ #define PREALLOCATED_USER_PMDS (boot_cpu_has(X86_FEATURE_PTI) ? \
KERNEL_PGD_PTRS : 0) KERNEL_PGD_PTRS : 0)
#define MAX_PREALLOCATED_USER_PMDS KERNEL_PGD_PTRS #define MAX_PREALLOCATED_USER_PMDS KERNEL_PGD_PTRS
...@@ -292,7 +292,7 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp) ...@@ -292,7 +292,7 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp)
#ifdef CONFIG_PAGE_TABLE_ISOLATION #ifdef CONFIG_PAGE_TABLE_ISOLATION
if (!static_cpu_has(X86_FEATURE_PTI)) if (!boot_cpu_has(X86_FEATURE_PTI))
return; return;
pgdp = kernel_to_user_pgdp(pgdp); pgdp = kernel_to_user_pgdp(pgdp);
......
...@@ -626,7 +626,7 @@ void pti_set_kernel_image_nonglobal(void) ...@@ -626,7 +626,7 @@ void pti_set_kernel_image_nonglobal(void)
*/ */
void __init pti_init(void) void __init pti_init(void)
{ {
if (!static_cpu_has(X86_FEATURE_PTI)) if (!boot_cpu_has(X86_FEATURE_PTI))
return; return;
pr_info("enabled\n"); pr_info("enabled\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment