aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2016-03-29 11:42:02 -0400
committerIngo Molnar <mingo@kernel.org>2016-03-31 07:35:09 -0400
commitc109bf95992b391bb40bc37c5d309d13fead99b5 (patch)
treec6a67c2c137ccb47ca806e914eeb5defb8a25363
parent054efb6467f84490bdf92afab6d9dbd5102e620a (diff)
x86/cpufeature: Remove cpu_has_pge
Use static_cpu_has() in __flush_tlb_all() due to the time-sensitivity of this one. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1459266123-21878-10-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/cpufeature.h1
-rw-r--r--arch/x86/include/asm/tlbflush.h2
-rw-r--r--arch/x86/kernel/cpu/intel.c6
-rw-r--r--arch/x86/kernel/cpu/mtrr/cyrix.c4
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c4
-rw-r--r--arch/x86/mm/init.c2
-rw-r--r--arch/x86/xen/enlighten.c2
-rw-r--r--drivers/lguest/x86/core.c2
8 files changed, 11 insertions, 12 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 5e02bc2e8444..f97b53417d44 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -121,7 +121,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
121#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU) 121#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
122#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE) 122#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE)
123#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC) 123#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)
124#define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE)
125#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) 124#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
126#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) 125#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
127#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) 126#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index c24b4224d439..3628e6c5ebf4 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -181,7 +181,7 @@ static inline void __native_flush_tlb_single(unsigned long addr)
181 181
182static inline void __flush_tlb_all(void) 182static inline void __flush_tlb_all(void)
183{ 183{
184 if (cpu_has_pge) 184 if (static_cpu_has(X86_FEATURE_PGE))
185 __flush_tlb_global(); 185 __flush_tlb_global();
186 else 186 else
187 __flush_tlb(); 187 __flush_tlb();
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 1dba36fe73e5..f71a34944b56 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -152,9 +152,9 @@ static void early_init_intel(struct cpuinfo_x86 *c)
152 * the TLB when any changes are made to any of the page table entries. 152 * the TLB when any changes are made to any of the page table entries.
153 * The operating system must reload CR3 to cause the TLB to be flushed" 153 * The operating system must reload CR3 to cause the TLB to be flushed"
154 * 154 *
155 * As a result cpu_has_pge() in arch/x86/include/asm/tlbflush.h should 155 * As a result, boot_cpu_has(X86_FEATURE_PGE) in arch/x86/include/asm/tlbflush.h
156 * be false so that __flush_tlb_all() causes CR3 insted of CR4.PGE 156 * should be false so that __flush_tlb_all() causes CR3 insted of CR4.PGE
157 * to be modified 157 * to be modified.
158 */ 158 */
159 if (c->x86 == 5 && c->x86_model == 9) { 159 if (c->x86 == 5 && c->x86_model == 9) {
160 pr_info("Disabling PGE capability bit\n"); 160 pr_info("Disabling PGE capability bit\n");
diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c b/arch/x86/kernel/cpu/mtrr/cyrix.c
index f8c81ba0b465..b1086f79e57e 100644
--- a/arch/x86/kernel/cpu/mtrr/cyrix.c
+++ b/arch/x86/kernel/cpu/mtrr/cyrix.c
@@ -137,7 +137,7 @@ static void prepare_set(void)
137 u32 cr0; 137 u32 cr0;
138 138
139 /* Save value of CR4 and clear Page Global Enable (bit 7) */ 139 /* Save value of CR4 and clear Page Global Enable (bit 7) */
140 if (cpu_has_pge) { 140 if (boot_cpu_has(X86_FEATURE_PGE)) {
141 cr4 = __read_cr4(); 141 cr4 = __read_cr4();
142 __write_cr4(cr4 & ~X86_CR4_PGE); 142 __write_cr4(cr4 & ~X86_CR4_PGE);
143 } 143 }
@@ -170,7 +170,7 @@ static void post_set(void)
170 write_cr0(read_cr0() & ~X86_CR0_CD); 170 write_cr0(read_cr0() & ~X86_CR0_CD);
171 171
172 /* Restore value of CR4 */ 172 /* Restore value of CR4 */
173 if (cpu_has_pge) 173 if (boot_cpu_has(X86_FEATURE_PGE))
174 __write_cr4(cr4); 174 __write_cr4(cr4);
175} 175}
176 176
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 19f57360dfd2..f1bed301bdb2 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -741,7 +741,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
741 wbinvd(); 741 wbinvd();
742 742
743 /* Save value of CR4 and clear Page Global Enable (bit 7) */ 743 /* Save value of CR4 and clear Page Global Enable (bit 7) */
744 if (cpu_has_pge) { 744 if (boot_cpu_has(X86_FEATURE_PGE)) {
745 cr4 = __read_cr4(); 745 cr4 = __read_cr4();
746 __write_cr4(cr4 & ~X86_CR4_PGE); 746 __write_cr4(cr4 & ~X86_CR4_PGE);
747 } 747 }
@@ -771,7 +771,7 @@ static void post_set(void) __releases(set_atomicity_lock)
771 write_cr0(read_cr0() & ~X86_CR0_CD); 771 write_cr0(read_cr0() & ~X86_CR0_CD);
772 772
773 /* Restore value of CR4 */ 773 /* Restore value of CR4 */
774 if (cpu_has_pge) 774 if (boot_cpu_has(X86_FEATURE_PGE))
775 __write_cr4(cr4); 775 __write_cr4(cr4);
776 raw_spin_unlock(&set_atomicity_lock); 776 raw_spin_unlock(&set_atomicity_lock);
777} 777}
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 14377e98f279..05ff46a9c261 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -166,7 +166,7 @@ static void __init probe_page_size_mask(void)
166 cr4_set_bits_and_update_boot(X86_CR4_PSE); 166 cr4_set_bits_and_update_boot(X86_CR4_PSE);
167 167
168 /* Enable PGE if available */ 168 /* Enable PGE if available */
169 if (cpu_has_pge) { 169 if (boot_cpu_has(X86_FEATURE_PGE)) {
170 cr4_set_bits_and_update_boot(X86_CR4_PGE); 170 cr4_set_bits_and_update_boot(X86_CR4_PGE);
171 __supported_pte_mask |= _PAGE_GLOBAL; 171 __supported_pte_mask |= _PAGE_GLOBAL;
172 } else 172 } else
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 880862c7d9dd..055f48ddb03c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1472,7 +1472,7 @@ static void xen_pvh_set_cr_flags(int cpu)
1472 if (cpu_has_pse) 1472 if (cpu_has_pse)
1473 cr4_set_bits_and_update_boot(X86_CR4_PSE); 1473 cr4_set_bits_and_update_boot(X86_CR4_PSE);
1474 1474
1475 if (cpu_has_pge) 1475 if (boot_cpu_has(X86_FEATURE_PGE))
1476 cr4_set_bits_and_update_boot(X86_CR4_PGE); 1476 cr4_set_bits_and_update_boot(X86_CR4_PGE);
1477} 1477}
1478 1478
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 6a4cd771a2be..65f22debf3c6 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -599,7 +599,7 @@ void __init lguest_arch_host_init(void)
599 * doing this. 599 * doing this.
600 */ 600 */
601 get_online_cpus(); 601 get_online_cpus();
602 if (cpu_has_pge) { /* We have a broader idea of "global". */ 602 if (boot_cpu_has(X86_FEATURE_PGE)) { /* We have a broader idea of "global". */
603 /* Remember that this was originally set (for cleanup). */ 603 /* Remember that this was originally set (for cleanup). */
604 cpu_had_pge = 1; 604 cpu_had_pge = 1;
605 /* 605 /*