aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2010-07-27 12:53:35 -0400
committerH. Peter Anvin <hpa@zytor.com>2010-08-02 11:45:56 -0400
commite8c534ec068af1a0845aceda373a9bfd2de62030 (patch)
tree7ee35fd4b0103c04465c1cc5406f036fc07df53e /arch/x86
parent9792db6174d9927700ed288e6d74b9391bf785d1 (diff)
x86: Fix keeping track of AMD C1E
Accomodate the original C1E-aware idle routine to the different times during boot when the BIOS enables C1E. While at it, remove the synthetic CPUID flag in favor of a single global setting which denotes C1E status on the system. [ hpa: changed c1e_enabled to be a bool; clarified cpu bit 3:21 comment ] Signed-off-by: Michal Schmidt <mschmidt@redhat.com> LKML-Reference: <20100727165335.GA11630@aftab> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/acpi.h2
-rw-r--r--arch/x86/include/asm/cpufeature.h2
-rw-r--r--arch/x86/include/asm/processor.h1
-rw-r--r--arch/x86/kernel/process.c8
4 files changed, 8 insertions, 5 deletions
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index aa2c39d968fc..92091de11113 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -134,7 +134,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
134 boot_cpu_data.x86_model <= 0x05 && 134 boot_cpu_data.x86_model <= 0x05 &&
135 boot_cpu_data.x86_mask < 0x0A) 135 boot_cpu_data.x86_mask < 0x0A)
136 return 1; 136 return 1;
137 else if (boot_cpu_has(X86_FEATURE_AMDC1E)) 137 else if (c1e_detected)
138 return 1; 138 return 1;
139 else 139 else
140 return max_cstate; 140 return max_cstate;
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 817aa316b180..0b205b8a4308 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -89,7 +89,7 @@
89#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */ 89#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */
90#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */ 90#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */
91#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */ 91#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
92#define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */ 92 /* 21 available, was AMD_C1E */
93#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */ 93#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */
94#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */ 94#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
95#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */ 95#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index d85637bb9505..325b7bdbebaa 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -762,6 +762,7 @@ extern void init_c1e_mask(void);
762extern unsigned long boot_option_idle_override; 762extern unsigned long boot_option_idle_override;
763extern unsigned long idle_halt; 763extern unsigned long idle_halt;
764extern unsigned long idle_nomwait; 764extern unsigned long idle_nomwait;
765extern bool c1e_detected;
765 766
766/* 767/*
767 * on systems with caches, caches must be flashed as the absolute 768 * on systems with caches, caches must be flashed as the absolute
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 553b02f13094..b944f89c4e6e 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -525,8 +525,10 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
525 return (edx & MWAIT_EDX_C1); 525 return (edx & MWAIT_EDX_C1);
526} 526}
527 527
528bool c1e_detected;
529EXPORT_SYMBOL(c1e_detected);
530
528static cpumask_var_t c1e_mask; 531static cpumask_var_t c1e_mask;
529static int c1e_detected;
530 532
531void c1e_remove_cpu(int cpu) 533void c1e_remove_cpu(int cpu)
532{ 534{
@@ -548,12 +550,12 @@ static void c1e_idle(void)
548 u32 lo, hi; 550 u32 lo, hi;
549 551
550 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); 552 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
553
551 if (lo & K8_INTP_C1E_ACTIVE_MASK) { 554 if (lo & K8_INTP_C1E_ACTIVE_MASK) {
552 c1e_detected = 1; 555 c1e_detected = true;
553 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 556 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
554 mark_tsc_unstable("TSC halt in AMD C1E"); 557 mark_tsc_unstable("TSC halt in AMD C1E");
555 printk(KERN_INFO "System has AMD C1E enabled\n"); 558 printk(KERN_INFO "System has AMD C1E enabled\n");
556 set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
557 } 559 }
558 } 560 }
559 561