aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r--arch/x86/kernel/process.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index cbcf013a0ec6..d401f1d2d06e 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -526,44 +526,10 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
526 return (edx & MWAIT_EDX_C1); 526 return (edx & MWAIT_EDX_C1);
527} 527}
528 528
529/* 529bool c1e_detected;
530 * Check for AMD CPUs, where APIC timer interrupt does not wake up CPU from C1e. 530EXPORT_SYMBOL(c1e_detected);
531 * For more information see
532 * - Erratum #400 for NPT family 0xf and family 0x10 CPUs
533 * - Erratum #365 for family 0x11 (not affected because C1e not in use)
534 */
535static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
536{
537 u64 val;
538 if (c->x86_vendor != X86_VENDOR_AMD)
539 goto no_c1e_idle;
540
541 /* Family 0x0f models < rev F do not have C1E */
542 if (c->x86 == 0x0F && c->x86_model >= 0x40)
543 return 1;
544
545 if (c->x86 == 0x10) {
546 /*
547 * check OSVW bit for CPUs that are not affected
548 * by erratum #400
549 */
550 if (cpu_has(c, X86_FEATURE_OSVW)) {
551 rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
552 if (val >= 2) {
553 rdmsrl(MSR_AMD64_OSVW_STATUS, val);
554 if (!(val & BIT(1)))
555 goto no_c1e_idle;
556 }
557 }
558 return 1;
559 }
560
561no_c1e_idle:
562 return 0;
563}
564 531
565static cpumask_var_t c1e_mask; 532static cpumask_var_t c1e_mask;
566static int c1e_detected;
567 533
568void c1e_remove_cpu(int cpu) 534void c1e_remove_cpu(int cpu)
569{ 535{
@@ -585,12 +551,12 @@ static void c1e_idle(void)
585 u32 lo, hi; 551 u32 lo, hi;
586 552
587 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); 553 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
554
588 if (lo & K8_INTP_C1E_ACTIVE_MASK) { 555 if (lo & K8_INTP_C1E_ACTIVE_MASK) {
589 c1e_detected = 1; 556 c1e_detected = true;
590 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 557 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
591 mark_tsc_unstable("TSC halt in AMD C1E"); 558 mark_tsc_unstable("TSC halt in AMD C1E");
592 printk(KERN_INFO "System has AMD C1E enabled\n"); 559 printk(KERN_INFO "System has AMD C1E enabled\n");
593 set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
594 } 560 }
595 } 561 }
596 562
@@ -639,7 +605,8 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
639 */ 605 */
640 printk(KERN_INFO "using mwait in idle threads.\n"); 606 printk(KERN_INFO "using mwait in idle threads.\n");
641 pm_idle = mwait_idle; 607 pm_idle = mwait_idle;
642 } else if (check_c1e_idle(c)) { 608 } else if (cpu_has_amd_erratum(amd_erratum_400)) {
609 /* E400: APIC timer interrupt does not wake up CPU from C1e */
643 printk(KERN_INFO "using C1E aware idle routine\n"); 610 printk(KERN_INFO "using C1E aware idle routine\n");
644 pm_idle = c1e_idle; 611 pm_idle = c1e_idle;
645 } else 612 } else