Commit 02c68a02 authored by Len Brown's avatar Len Brown

x86 idle: clarify AMD erratum 400 workaround

The workaround for AMD erratum 400 uses the term "c1e" falsely suggesting:
1. Intel C1E is somehow involved
2. All AMD processors with C1E are involved

Use the string "amd_c1e" instead of simply "c1e" to clarify that
this workaround is specific to AMD's version of C1E.
Use the string "e400" to clarify that the workaround is specific
to AMD processors with Erratum 400.

This patch is text-substitution only, with no functional change.

cc: x86@kernel.org
Acked-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 333c5ae9
...@@ -138,7 +138,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate) ...@@ -138,7 +138,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
boot_cpu_data.x86_model <= 0x05 && boot_cpu_data.x86_model <= 0x05 &&
boot_cpu_data.x86_mask < 0x0A) boot_cpu_data.x86_mask < 0x0A)
return 1; return 1;
else if (c1e_detected) else if (amd_e400_c1e_detected)
return 1; return 1;
else else
return max_cstate; return max_cstate;
......
...@@ -16,6 +16,6 @@ static inline void enter_idle(void) { } ...@@ -16,6 +16,6 @@ static inline void enter_idle(void) { }
static inline void exit_idle(void) { } static inline void exit_idle(void) { }
#endif /* CONFIG_X86_64 */ #endif /* CONFIG_X86_64 */
void c1e_remove_cpu(int cpu); void amd_e400_remove_cpu(int cpu);
#endif /* _ASM_X86_IDLE_H */ #endif /* _ASM_X86_IDLE_H */
...@@ -758,10 +758,10 @@ static inline void __sti_mwait(unsigned long eax, unsigned long ecx) ...@@ -758,10 +758,10 @@ static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
extern void select_idle_routine(const struct cpuinfo_x86 *c); extern void select_idle_routine(const struct cpuinfo_x86 *c);
extern void init_c1e_mask(void); extern void init_amd_e400_c1e_mask(void);
extern unsigned long boot_option_idle_override; extern unsigned long boot_option_idle_override;
extern bool c1e_detected; extern bool amd_e400_c1e_detected;
enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT, enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT,
IDLE_POLL, IDLE_FORCE_MWAIT}; IDLE_POLL, IDLE_FORCE_MWAIT};
......
...@@ -887,7 +887,7 @@ static void vgetcpu_set_mode(void) ...@@ -887,7 +887,7 @@ static void vgetcpu_set_mode(void)
void __init identify_boot_cpu(void) void __init identify_boot_cpu(void)
{ {
identify_cpu(&boot_cpu_data); identify_cpu(&boot_cpu_data);
init_c1e_mask(); init_amd_e400_c1e_mask();
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
sysenter_setup(); sysenter_setup();
enable_sep_cpu(); enable_sep_cpu();
......
...@@ -538,45 +538,45 @@ int mwait_usable(const struct cpuinfo_x86 *c) ...@@ -538,45 +538,45 @@ int mwait_usable(const struct cpuinfo_x86 *c)
return (edx & MWAIT_EDX_C1); return (edx & MWAIT_EDX_C1);
} }
bool c1e_detected; bool amd_e400_c1e_detected;
EXPORT_SYMBOL(c1e_detected); EXPORT_SYMBOL(amd_e400_c1e_detected);
static cpumask_var_t c1e_mask; static cpumask_var_t amd_e400_c1e_mask;
void c1e_remove_cpu(int cpu) void amd_e400_remove_cpu(int cpu)
{ {
if (c1e_mask != NULL) if (amd_e400_c1e_mask != NULL)
cpumask_clear_cpu(cpu, c1e_mask); cpumask_clear_cpu(cpu, amd_e400_c1e_mask);
} }
/* /*
* C1E aware idle routine. We check for C1E active in the interrupt * AMD Erratum 400 aware idle routine. We check for C1E active in the interrupt
* pending message MSR. If we detect C1E, then we handle it the same * pending message MSR. If we detect C1E, then we handle it the same
* way as C3 power states (local apic timer and TSC stop) * way as C3 power states (local apic timer and TSC stop)
*/ */
static void c1e_idle(void) static void amd_e400_idle(void)
{ {
if (need_resched()) if (need_resched())
return; return;
if (!c1e_detected) { if (!amd_e400_c1e_detected) {
u32 lo, hi; u32 lo, hi;
rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
if (lo & K8_INTP_C1E_ACTIVE_MASK) { if (lo & K8_INTP_C1E_ACTIVE_MASK) {
c1e_detected = true; amd_e400_c1e_detected = true;
if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
mark_tsc_unstable("TSC halt in AMD C1E"); mark_tsc_unstable("TSC halt in AMD C1E");
printk(KERN_INFO "System has AMD C1E enabled\n"); printk(KERN_INFO "System has AMD C1E enabled\n");
} }
} }
if (c1e_detected) { if (amd_e400_c1e_detected) {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
if (!cpumask_test_cpu(cpu, c1e_mask)) { if (!cpumask_test_cpu(cpu, amd_e400_c1e_mask)) {
cpumask_set_cpu(cpu, c1e_mask); cpumask_set_cpu(cpu, amd_e400_c1e_mask);
/* /*
* Force broadcast so ACPI can not interfere. * Force broadcast so ACPI can not interfere.
*/ */
...@@ -619,17 +619,17 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) ...@@ -619,17 +619,17 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
pm_idle = mwait_idle; pm_idle = mwait_idle;
} else if (cpu_has_amd_erratum(amd_erratum_400)) { } else if (cpu_has_amd_erratum(amd_erratum_400)) {
/* E400: APIC timer interrupt does not wake up CPU from C1e */ /* E400: APIC timer interrupt does not wake up CPU from C1e */
printk(KERN_INFO "using C1E aware idle routine\n"); printk(KERN_INFO "using AMD E400 aware idle routine\n");
pm_idle = c1e_idle; pm_idle = amd_e400_idle;
} else } else
pm_idle = default_idle; pm_idle = default_idle;
} }
void __init init_c1e_mask(void) void __init init_amd_e400_c1e_mask(void)
{ {
/* If we're using c1e_idle, we need to allocate c1e_mask. */ /* If we're using amd_e400_idle, we need to allocate amd_e400_c1e_mask. */
if (pm_idle == c1e_idle) if (pm_idle == amd_e400_idle)
zalloc_cpumask_var(&c1e_mask, GFP_KERNEL); zalloc_cpumask_var(&amd_e400_c1e_mask, GFP_KERNEL);
} }
static int __init idle_setup(char *str) static int __init idle_setup(char *str)
......
...@@ -1379,7 +1379,7 @@ void play_dead_common(void) ...@@ -1379,7 +1379,7 @@ void play_dead_common(void)
{ {
idle_task_exit(); idle_task_exit();
reset_lazy_tlbstate(); reset_lazy_tlbstate();
c1e_remove_cpu(raw_smp_processor_id()); amd_e400_remove_cpu(raw_smp_processor_id());
mb(); mb();
/* Ack it */ /* Ack it */
......
...@@ -161,7 +161,7 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr, ...@@ -161,7 +161,7 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr,
if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT))
return; return;
if (c1e_detected) if (amd_e400_c1e_detected)
type = ACPI_STATE_C1; type = ACPI_STATE_C1;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment