[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: fix MWAIT-based idle driver for CPUs without ARAT
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1348554993 -7200 # Node ID b49f7bf52fa92626517386cba89350243b808871 # Parent 8f658b463b78de04c8ba3180d6058acb80d01b95 x86: fix MWAIT-based idle driver for CPUs without ARAT lapic_timer_{on,off} need to get initialized in this case. This in turn requires getting HPET broadcast setup to be carried out earlier (and hence preventing double initialization there). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- diff -r 8f658b463b78 -r b49f7bf52fa9 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Fri Sep 21 17:02:46 2012 +0200 +++ b/xen/arch/x86/acpi/cpu_idle.c Tue Sep 25 08:36:33 2012 +0200 @@ -74,6 +74,29 @@ static void lapic_timer_nop(void) { } void (*__read_mostly lapic_timer_off)(void); void (*__read_mostly lapic_timer_on)(void); +bool_t lapic_timer_init(void) +{ + if ( boot_cpu_has(X86_FEATURE_ARAT) ) + { + lapic_timer_off = lapic_timer_nop; + lapic_timer_on = lapic_timer_nop; + } + else if ( hpet_broadcast_is_available() ) + { + lapic_timer_off = hpet_broadcast_enter; + lapic_timer_on = hpet_broadcast_exit; + } + else if ( pit_broadcast_is_available() ) + { + lapic_timer_off = pit_broadcast_enter; + lapic_timer_on = pit_broadcast_exit; + } + else + return 0; + + return 1; +} + static uint64_t (*__read_mostly tick_to_ns)(uint64_t) = acpi_pm_tick_to_ns; void (*__read_mostly pm_idle_save)(void); @@ -789,25 +812,8 @@ static int check_cx(struct acpi_processo if ( local_apic_timer_c2_ok ) break; case ACPI_STATE_C3: - if ( boot_cpu_has(X86_FEATURE_ARAT) ) - { - lapic_timer_off = lapic_timer_nop; - lapic_timer_on = lapic_timer_nop; - } - else if ( hpet_broadcast_is_available() ) - { - lapic_timer_off = hpet_broadcast_enter; - lapic_timer_on = hpet_broadcast_exit; - } - else if ( pit_broadcast_is_available() ) - { - lapic_timer_off = pit_broadcast_enter; - lapic_timer_on = pit_broadcast_exit; - } - else - { + if ( !lapic_timer_init() ) return -EINVAL; - } /* All the logic here assumes flags.bm_check is same across all CPUs */ if ( bm_check_flag == -1 ) diff -r 8f658b463b78 -r b49f7bf52fa9 xen/arch/x86/cpu/mwait-idle.c --- a/xen/arch/x86/cpu/mwait-idle.c Fri Sep 21 17:02:46 2012 +0200 +++ b/xen/arch/x86/cpu/mwait-idle.c Tue Sep 25 08:36:33 2012 +0200 @@ -56,6 +56,7 @@ #include <xen/softirq.h> #include <xen/trace.h> #include <asm/cpuidle.h> +#include <asm/hpet.h> #include <asm/mwait.h> #include <asm/msr.h> #include <acpi/cpufreq/cpufreq.h> @@ -501,6 +502,12 @@ int __init mwait_idle_init(struct notifi err = mwait_idle_probe(); if (!err) { + if (!boot_cpu_has(X86_FEATURE_ARAT)) + hpet_broadcast_init(); + if (!lapic_timer_init()) + err = -EINVAL; + } + if (!err) { nfb->notifier_call = mwait_idle_cpu_init; mwait_idle_cpu_init(nfb, CPU_UP_PREPARE, NULL); diff -r 8f658b463b78 -r b49f7bf52fa9 xen/arch/x86/hpet.c --- a/xen/arch/x86/hpet.c Fri Sep 21 17:02:46 2012 +0200 +++ b/xen/arch/x86/hpet.c Tue Sep 25 08:36:33 2012 +0200 @@ -495,7 +495,7 @@ void __init hpet_broadcast_init(void) u32 hpet_id, cfg; unsigned int i, n; - if ( hpet_rate == 0 ) + if ( hpet_rate == 0 || hpet_broadcast_is_available() ) return; cfg = hpet_read32(HPET_CFG); diff -r 8f658b463b78 -r b49f7bf52fa9 xen/include/asm-x86/cpuidle.h --- a/xen/include/asm-x86/cpuidle.h Fri Sep 21 17:02:46 2012 +0200 +++ b/xen/include/asm-x86/cpuidle.h Tue Sep 25 08:36:33 2012 +0200 @@ -10,6 +10,7 @@ extern struct acpi_processor_power *proc extern void (*pm_idle_save)(void); +bool_t lapic_timer_init(void); extern void (*lapic_timer_off)(void); extern void (*lapic_timer_on)(void); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |