aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_idle.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/acpi/processor_idle.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/acpi/processor_idle.c')
-rw-r--r--drivers/acpi/processor_idle.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f4428e82b352..431ab11c8c1b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -64,7 +64,6 @@
64#define ACPI_PROCESSOR_CLASS "processor" 64#define ACPI_PROCESSOR_CLASS "processor"
65#define _COMPONENT ACPI_PROCESSOR_COMPONENT 65#define _COMPONENT ACPI_PROCESSOR_COMPONENT
66ACPI_MODULE_NAME("processor_idle"); 66ACPI_MODULE_NAME("processor_idle");
67#define ACPI_PROCESSOR_FILE_POWER "power"
68#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) 67#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY)
69#define C2_OVERHEAD 1 /* 1us */ 68#define C2_OVERHEAD 1 /* 1us */
70#define C3_OVERHEAD 1 /* 1us */ 69#define C3_OVERHEAD 1 /* 1us */
@@ -80,6 +79,13 @@ module_param(bm_check_disable, uint, 0000);
80static unsigned int latency_factor __read_mostly = 2; 79static unsigned int latency_factor __read_mostly = 2;
81module_param(latency_factor, uint, 0644); 80module_param(latency_factor, uint, 0644);
82 81
82static int disabled_by_idle_boot_param(void)
83{
84 return boot_option_idle_override == IDLE_POLL ||
85 boot_option_idle_override == IDLE_FORCE_MWAIT ||
86 boot_option_idle_override == IDLE_HALT;
87}
88
83/* 89/*
84 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. 90 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
85 * For now disable this. Probably a bug somewhere else. 91 * For now disable this. Probably a bug somewhere else.
@@ -155,7 +161,7 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr,
155 if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) 161 if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT))
156 return; 162 return;
157 163
158 if (c1e_detected) 164 if (amd_e400_c1e_detected)
159 type = ACPI_STATE_C1; 165 type = ACPI_STATE_C1;
160 166
161 /* 167 /*
@@ -456,7 +462,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
456 continue; 462 continue;
457 } 463 }
458 if (cx.type == ACPI_STATE_C1 && 464 if (cx.type == ACPI_STATE_C1 &&
459 (idle_halt || idle_nomwait)) { 465 (boot_option_idle_override == IDLE_NOMWAIT)) {
460 /* 466 /*
461 * In most cases the C1 space_id obtained from 467 * In most cases the C1 space_id obtained from
462 * _CST object is FIXED_HARDWARE access mode. 468 * _CST object is FIXED_HARDWARE access mode.
@@ -747,7 +753,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
747 struct acpi_processor *pr; 753 struct acpi_processor *pr;
748 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 754 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
749 755
750 pr = __get_cpu_var(processors); 756 pr = __this_cpu_read(processors);
751 757
752 if (unlikely(!pr)) 758 if (unlikely(!pr))
753 return 0; 759 return 0;
@@ -788,7 +794,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
788 s64 idle_time_ns; 794 s64 idle_time_ns;
789 s64 idle_time; 795 s64 idle_time;
790 796
791 pr = __get_cpu_var(processors); 797 pr = __this_cpu_read(processors);
792 798
793 if (unlikely(!pr)) 799 if (unlikely(!pr))
794 return 0; 800 return 0;
@@ -865,7 +871,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
865 s64 idle_time; 871 s64 idle_time;
866 872
867 873
868 pr = __get_cpu_var(processors); 874 pr = __this_cpu_read(processors);
869 875
870 if (unlikely(!pr)) 876 if (unlikely(!pr))
871 return 0; 877 return 0;
@@ -1013,12 +1019,10 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1013 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 1019 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
1014 state->exit_latency = cx->latency; 1020 state->exit_latency = cx->latency;
1015 state->target_residency = cx->latency * latency_factor; 1021 state->target_residency = cx->latency * latency_factor;
1016 state->power_usage = cx->power;
1017 1022
1018 state->flags = 0; 1023 state->flags = 0;
1019 switch (cx->type) { 1024 switch (cx->type) {
1020 case ACPI_STATE_C1: 1025 case ACPI_STATE_C1:
1021 state->flags |= CPUIDLE_FLAG_SHALLOW;
1022 if (cx->entry_method == ACPI_CSTATE_FFH) 1026 if (cx->entry_method == ACPI_CSTATE_FFH)
1023 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1027 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1024 1028
@@ -1027,16 +1031,13 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1027 break; 1031 break;
1028 1032
1029 case ACPI_STATE_C2: 1033 case ACPI_STATE_C2:
1030 state->flags |= CPUIDLE_FLAG_BALANCED;
1031 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1034 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1032 state->enter = acpi_idle_enter_simple; 1035 state->enter = acpi_idle_enter_simple;
1033 dev->safe_state = state; 1036 dev->safe_state = state;
1034 break; 1037 break;
1035 1038
1036 case ACPI_STATE_C3: 1039 case ACPI_STATE_C3:
1037 state->flags |= CPUIDLE_FLAG_DEEP;
1038 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1040 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1039 state->flags |= CPUIDLE_FLAG_CHECK_BM;
1040 state->enter = pr->flags.bm_check ? 1041 state->enter = pr->flags.bm_check ?
1041 acpi_idle_enter_bm : 1042 acpi_idle_enter_bm :
1042 acpi_idle_enter_simple; 1043 acpi_idle_enter_simple;
@@ -1060,7 +1061,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1060{ 1061{
1061 int ret = 0; 1062 int ret = 0;
1062 1063
1063 if (boot_option_idle_override) 1064 if (disabled_by_idle_boot_param())
1064 return 0; 1065 return 0;
1065 1066
1066 if (!pr) 1067 if (!pr)
@@ -1091,19 +1092,10 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1091 acpi_status status = 0; 1092 acpi_status status = 0;
1092 static int first_run; 1093 static int first_run;
1093 1094
1094 if (boot_option_idle_override) 1095 if (disabled_by_idle_boot_param())
1095 return 0; 1096 return 0;
1096 1097
1097 if (!first_run) { 1098 if (!first_run) {
1098 if (idle_halt) {
1099 /*
1100 * When the boot option of "idle=halt" is added, halt
1101 * is used for CPU IDLE.
1102 * In such case C2/C3 is meaningless. So the max_cstate
1103 * is set to one.
1104 */
1105 max_cstate = 1;
1106 }
1107 dmi_check_system(processor_power_dmi_table); 1099 dmi_check_system(processor_power_dmi_table);
1108 max_cstate = acpi_processor_cstate_check(max_cstate); 1100 max_cstate = acpi_processor_cstate_check(max_cstate);
1109 if (max_cstate < ACPI_C_STATES_MAX) 1101 if (max_cstate < ACPI_C_STATES_MAX)
@@ -1144,7 +1136,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1144int acpi_processor_power_exit(struct acpi_processor *pr, 1136int acpi_processor_power_exit(struct acpi_processor *pr,
1145 struct acpi_device *device) 1137 struct acpi_device *device)
1146{ 1138{
1147 if (boot_option_idle_override) 1139 if (disabled_by_idle_boot_param())
1148 return 0; 1140 return 0;
1149 1141
1150 cpuidle_unregister_device(&pr->power.dev); 1142 cpuidle_unregister_device(&pr->power.dev);