Skip to content

Commit c109bf9

Browse files
suryasaimadhuIngo Molnar
authored andcommitted
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 <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 054efb6 commit c109bf9

File tree

8 files changed

+11
-12
lines changed

8 files changed

+11
-12
lines changed

arch/x86/include/asm/cpufeature.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
121121
#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
122122
#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE)
123123
#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)
124-
#define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE)
125124
#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
126125
#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
127126
#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)

arch/x86/include/asm/tlbflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static inline void __native_flush_tlb_single(unsigned long addr)
181181

182182
static inline void __flush_tlb_all(void)
183183
{
184-
if (cpu_has_pge)
184+
if (static_cpu_has(X86_FEATURE_PGE))
185185
__flush_tlb_global();
186186
else
187187
__flush_tlb();

arch/x86/kernel/cpu/intel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ static void early_init_intel(struct cpuinfo_x86 *c)
152152
* the TLB when any changes are made to any of the page table entries.
153153
* The operating system must reload CR3 to cause the TLB to be flushed"
154154
*
155-
* As a result cpu_has_pge() in arch/x86/include/asm/tlbflush.h should
156-
* be false so that __flush_tlb_all() causes CR3 insted of CR4.PGE
157-
* to be modified
155+
* As a result, boot_cpu_has(X86_FEATURE_PGE) in arch/x86/include/asm/tlbflush.h
156+
* should be false so that __flush_tlb_all() causes CR3 insted of CR4.PGE
157+
* to be modified.
158158
*/
159159
if (c->x86 == 5 && c->x86_model == 9) {
160160
pr_info("Disabling PGE capability bit\n");

arch/x86/kernel/cpu/mtrr/cyrix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void prepare_set(void)
137137
u32 cr0;
138138

139139
/* Save value of CR4 and clear Page Global Enable (bit 7) */
140-
if (cpu_has_pge) {
140+
if (boot_cpu_has(X86_FEATURE_PGE)) {
141141
cr4 = __read_cr4();
142142
__write_cr4(cr4 & ~X86_CR4_PGE);
143143
}
@@ -170,7 +170,7 @@ static void post_set(void)
170170
write_cr0(read_cr0() & ~X86_CR0_CD);
171171

172172
/* Restore value of CR4 */
173-
if (cpu_has_pge)
173+
if (boot_cpu_has(X86_FEATURE_PGE))
174174
__write_cr4(cr4);
175175
}
176176

arch/x86/kernel/cpu/mtrr/generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
741741
wbinvd();
742742

743743
/* Save value of CR4 and clear Page Global Enable (bit 7) */
744-
if (cpu_has_pge) {
744+
if (boot_cpu_has(X86_FEATURE_PGE)) {
745745
cr4 = __read_cr4();
746746
__write_cr4(cr4 & ~X86_CR4_PGE);
747747
}
@@ -771,7 +771,7 @@ static void post_set(void) __releases(set_atomicity_lock)
771771
write_cr0(read_cr0() & ~X86_CR0_CD);
772772

773773
/* Restore value of CR4 */
774-
if (cpu_has_pge)
774+
if (boot_cpu_has(X86_FEATURE_PGE))
775775
__write_cr4(cr4);
776776
raw_spin_unlock(&set_atomicity_lock);
777777
}

arch/x86/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static void __init probe_page_size_mask(void)
166166
cr4_set_bits_and_update_boot(X86_CR4_PSE);
167167

168168
/* Enable PGE if available */
169-
if (cpu_has_pge) {
169+
if (boot_cpu_has(X86_FEATURE_PGE)) {
170170
cr4_set_bits_and_update_boot(X86_CR4_PGE);
171171
__supported_pte_mask |= _PAGE_GLOBAL;
172172
} else

arch/x86/xen/enlighten.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ static void xen_pvh_set_cr_flags(int cpu)
14721472
if (cpu_has_pse)
14731473
cr4_set_bits_and_update_boot(X86_CR4_PSE);
14741474

1475-
if (cpu_has_pge)
1475+
if (boot_cpu_has(X86_FEATURE_PGE))
14761476
cr4_set_bits_and_update_boot(X86_CR4_PGE);
14771477
}
14781478

drivers/lguest/x86/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ void __init lguest_arch_host_init(void)
599599
* doing this.
600600
*/
601601
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". */
603603
/* Remember that this was originally set (for cleanup). */
604604
cpu_had_pge = 1;
605605
/*

0 commit comments

Comments
 (0)