aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_idle.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/processor_idle.c')
-rw-r--r--drivers/acpi/processor_idle.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 6fe121434ffb..f7ca8c55956b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -581,6 +581,11 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
581 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 581 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
582 struct acpi_processor_cx *cx = &pr->power.states[i]; 582 struct acpi_processor_cx *cx = &pr->power.states[i];
583 583
584#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
585 /* TSC could halt in idle, so notify users */
586 if (tsc_halts_in_c(cx->type))
587 mark_tsc_unstable("TSC halts in idle");;
588#endif
584 switch (cx->type) { 589 switch (cx->type) {
585 case ACPI_STATE_C1: 590 case ACPI_STATE_C1:
586 cx->valid = 1; 591 cx->valid = 1;
@@ -657,11 +662,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
657 662
658 seq_printf(seq, "active state: C%zd\n" 663 seq_printf(seq, "active state: C%zd\n"
659 "max_cstate: C%d\n" 664 "max_cstate: C%d\n"
660 "bus master activity: %08x\n"
661 "maximum allowed latency: %d usec\n", 665 "maximum allowed latency: %d usec\n",
662 pr->power.state ? pr->power.state - pr->power.states : 0, 666 pr->power.state ? pr->power.state - pr->power.states : 0,
663 max_cstate, (unsigned)pr->power.bm_activity, 667 max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));
664 pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));
665 668
666 seq_puts(seq, "states:\n"); 669 seq_puts(seq, "states:\n");
667 670
@@ -871,11 +874,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
871 kt2 = ktime_get_real(); 874 kt2 = ktime_get_real();
872 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 875 idle_time = ktime_to_us(ktime_sub(kt2, kt1));
873 876
874#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
875 /* TSC could halt in idle, so notify users */
876 if (tsc_halts_in_c(cx->type))
877 mark_tsc_unstable("TSC halts in idle");;
878#endif
879 sleep_ticks = us_to_pm_timer_ticks(idle_time); 877 sleep_ticks = us_to_pm_timer_ticks(idle_time);
880 878
881 /* Tell the scheduler how much we idled: */ 879 /* Tell the scheduler how much we idled: */
@@ -955,6 +953,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
955 */ 953 */
956 acpi_state_timer_broadcast(pr, cx, 1); 954 acpi_state_timer_broadcast(pr, cx, 1);
957 955
956 kt1 = ktime_get_real();
958 /* 957 /*
959 * disable bus master 958 * disable bus master
960 * bm_check implies we need ARB_DIS 959 * bm_check implies we need ARB_DIS
@@ -976,10 +975,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
976 ACPI_FLUSH_CPU_CACHE(); 975 ACPI_FLUSH_CPU_CACHE();
977 } 976 }
978 977
979 kt1 = ktime_get_real();
980 acpi_idle_do_entry(cx); 978 acpi_idle_do_entry(cx);
981 kt2 = ktime_get_real();
982 idle_time = ktime_to_us(ktime_sub(kt2, kt1));
983 979
984 /* Re-enable bus master arbitration */ 980 /* Re-enable bus master arbitration */
985 if (pr->flags.bm_check && pr->flags.bm_control) { 981 if (pr->flags.bm_check && pr->flags.bm_control) {
@@ -988,12 +984,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
988 c3_cpu_count--; 984 c3_cpu_count--;
989 spin_unlock(&c3_lock); 985 spin_unlock(&c3_lock);
990 } 986 }
987 kt2 = ktime_get_real();
988 idle_time = ktime_to_us(ktime_sub(kt2, kt1));
991 989
992#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
993 /* TSC could halt in idle, so notify users */
994 if (tsc_halts_in_c(ACPI_STATE_C3))
995 mark_tsc_unstable("TSC halts in idle");
996#endif
997 sleep_ticks = us_to_pm_timer_ticks(idle_time); 990 sleep_ticks = us_to_pm_timer_ticks(idle_time);
998 /* Tell the scheduler how much we idled: */ 991 /* Tell the scheduler how much we idled: */
999 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 992 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
@@ -1037,6 +1030,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1037 dev->states[i].desc[0] = '\0'; 1030 dev->states[i].desc[0] = '\0';
1038 } 1031 }
1039 1032
1033 if (max_cstate == 0)
1034 max_cstate = 1;
1035
1040 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { 1036 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
1041 cx = &pr->power.states[i]; 1037 cx = &pr->power.states[i];
1042 state = &dev->states[count]; 1038 state = &dev->states[count];