diff options
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index cbcf013a0ec6..57d1868a86aa 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -301,8 +301,9 @@ EXPORT_SYMBOL(kernel_thread); | |||
301 | /* | 301 | /* |
302 | * sys_execve() executes a new program. | 302 | * sys_execve() executes a new program. |
303 | */ | 303 | */ |
304 | long sys_execve(char __user *name, char __user * __user *argv, | 304 | long sys_execve(const char __user *name, |
305 | char __user * __user *envp, struct pt_regs *regs) | 305 | const char __user *const __user *argv, |
306 | const char __user *const __user *envp, struct pt_regs *regs) | ||
306 | { | 307 | { |
307 | long error; | 308 | long error; |
308 | char *filename; | 309 | char *filename; |
@@ -526,44 +527,10 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) | |||
526 | return (edx & MWAIT_EDX_C1); | 527 | return (edx & MWAIT_EDX_C1); |
527 | } | 528 | } |
528 | 529 | ||
529 | /* | 530 | bool c1e_detected; |
530 | * Check for AMD CPUs, where APIC timer interrupt does not wake up CPU from C1e. | 531 | EXPORT_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 | */ | ||
535 | static 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 | |||
561 | no_c1e_idle: | ||
562 | return 0; | ||
563 | } | ||
564 | 532 | ||
565 | static cpumask_var_t c1e_mask; | 533 | static cpumask_var_t c1e_mask; |
566 | static int c1e_detected; | ||
567 | 534 | ||
568 | void c1e_remove_cpu(int cpu) | 535 | void c1e_remove_cpu(int cpu) |
569 | { | 536 | { |
@@ -585,12 +552,12 @@ static void c1e_idle(void) | |||
585 | u32 lo, hi; | 552 | u32 lo, hi; |
586 | 553 | ||
587 | rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); | 554 | rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); |
555 | |||
588 | if (lo & K8_INTP_C1E_ACTIVE_MASK) { | 556 | if (lo & K8_INTP_C1E_ACTIVE_MASK) { |
589 | c1e_detected = 1; | 557 | c1e_detected = true; |
590 | if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) | 558 | if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
591 | mark_tsc_unstable("TSC halt in AMD C1E"); | 559 | mark_tsc_unstable("TSC halt in AMD C1E"); |
592 | printk(KERN_INFO "System has AMD C1E enabled\n"); | 560 | printk(KERN_INFO "System has AMD C1E enabled\n"); |
593 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E); | ||
594 | } | 561 | } |
595 | } | 562 | } |
596 | 563 | ||
@@ -639,7 +606,8 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | |||
639 | */ | 606 | */ |
640 | printk(KERN_INFO "using mwait in idle threads.\n"); | 607 | printk(KERN_INFO "using mwait in idle threads.\n"); |
641 | pm_idle = mwait_idle; | 608 | pm_idle = mwait_idle; |
642 | } else if (check_c1e_idle(c)) { | 609 | } else if (cpu_has_amd_erratum(amd_erratum_400)) { |
610 | /* E400: APIC timer interrupt does not wake up CPU from C1e */ | ||
643 | printk(KERN_INFO "using C1E aware idle routine\n"); | 611 | printk(KERN_INFO "using C1E aware idle routine\n"); |
644 | pm_idle = c1e_idle; | 612 | pm_idle = c1e_idle; |
645 | } else | 613 | } else |