x86 ACPI: Add support for Always Running APIC timer
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Tue, 7 Apr 2009 01:51:29 +0000 (18:51 -0700)
committerLen Brown <len.brown@intel.com>
Tue, 7 Apr 2009 22:17:51 +0000 (18:17 -0400)
Add support for Always Running APIC timer, CPUID_0x6_EAX_Bit2.
This bit means the APIC timer continues to run even when CPU is
in deep C-states.

The advantage is that we can use LAPIC timer on these CPUs
always, and there is no need for "slow to read and program"
external timers (HPET/PIT) and the timer broadcast logic
and related code in C-state entry and exit.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Len Brown <len.brown@intel.com>
arch/x86/include/asm/cpufeature.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/cpu/addon_cpuid_features.c
drivers/acpi/processor_idle.c

index 0beba0d1468db24bceaa1e81cdf8c652eb5180ee..bb83b1c397aad8d05251db9dcd71880b1967b1f4 100644 (file)
  * CPUID levels like 0x6, 0xA etc
  */
 #define X86_FEATURE_IDA                (7*32+ 0) /* Intel Dynamic Acceleration */
+#define X86_FEATURE_ARAT       (7*32+ 1) /* Always Running APIC Timer */
 
 /* Virtualization flags: Linux defined */
 #define X86_FEATURE_TPR_SHADOW  (8*32+ 0) /* Intel TPR Shadow */
index 098ec84b8c0054d1f0fcff0e02aa357a02b33dd3..f2870920f246a9f1d7e2075c37b65b05de27dbf1 100644 (file)
@@ -431,6 +431,12 @@ static void __cpuinit setup_APIC_timer(void)
 {
        struct clock_event_device *levt = &__get_cpu_var(lapic_events);
 
+       if (cpu_has(&current_cpu_data, X86_FEATURE_ARAT)) {
+               lapic_clockevent.features &= ~CLOCK_EVT_FEAT_C3STOP;
+               /* Make LAPIC timer preferrable over percpu HPET */
+               lapic_clockevent.rating = 150;
+       }
+
        memcpy(levt, &lapic_clockevent, sizeof(*levt));
        levt->cpumask = cpumask_of(smp_processor_id());
 
index 8220ae69849d4aa3e5405a412a6bca2b03c4b958..c965e5212714ee66cfe04e847544e213f44a7b2d 100644 (file)
@@ -31,6 +31,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
 
        static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
                { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
+               { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 },
                { 0, 0, 0, 0 }
        };
 
index 4e6e758bd397f50686b3d951edabb8c93742fd38..6fe121434ffb36ec67a91b45823e3df3d45873c5 100644 (file)
@@ -145,6 +145,9 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
        struct acpi_processor_power *pwr = &pr->power;
        u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2;
 
+       if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT))
+               return;
+
        /*
         * Check, if one of the previous states already marked the lapic
         * unstable