diff options
| -rwxr-xr-x | drivers/idle/intel_idle.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 54f0fb4cd5d2..82c9a58b3ab0 100755 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
| @@ -79,7 +79,7 @@ static struct cpuidle_driver intel_idle_driver = { | |||
| 79 | static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1; | 79 | static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1; |
| 80 | static int power_policy = 7; /* 0 = max perf; 15 = max powersave */ | 80 | static int power_policy = 7; /* 0 = max perf; 15 = max powersave */ |
| 81 | 81 | ||
| 82 | static unsigned int substates; | 82 | static unsigned int mwait_substates; |
| 83 | static int (*choose_substate)(int); | 83 | static int (*choose_substate)(int); |
| 84 | 84 | ||
| 85 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ | 85 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ |
| @@ -184,7 +184,8 @@ static int choose_tunable_substate(int cstate) | |||
| 184 | power_policy &= 0xF; /* valid range: 0-15 */ | 184 | power_policy &= 0xF; /* valid range: 0-15 */ |
| 185 | cstate &= 7; /* valid range: 0-7 */ | 185 | cstate &= 7; /* valid range: 0-7 */ |
| 186 | 186 | ||
| 187 | num_substates = (substates >> ((cstate) * 4)) & MWAIT_SUBSTATE_MASK; | 187 | num_substates = (mwait_substates >> ((cstate) * 4)) |
| 188 | & MWAIT_SUBSTATE_MASK; | ||
| 188 | 189 | ||
| 189 | if (num_substates <= 1) | 190 | if (num_substates <= 1) |
| 190 | return 0; | 191 | return 0; |
| @@ -259,7 +260,7 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) | |||
| 259 | */ | 260 | */ |
| 260 | static int intel_idle_probe(void) | 261 | static int intel_idle_probe(void) |
| 261 | { | 262 | { |
| 262 | unsigned int eax, ebx, ecx, edx; | 263 | unsigned int eax, ebx, ecx; |
| 263 | 264 | ||
| 264 | if (max_cstate == 0) { | 265 | if (max_cstate == 0) { |
| 265 | pr_debug(PREFIX "disabled\n"); | 266 | pr_debug(PREFIX "disabled\n"); |
| @@ -275,17 +276,13 @@ static int intel_idle_probe(void) | |||
| 275 | if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) | 276 | if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) |
| 276 | return -ENODEV; | 277 | return -ENODEV; |
| 277 | 278 | ||
| 278 | cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); | 279 | cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates); |
| 279 | 280 | ||
| 280 | if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || | 281 | if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || |
| 281 | !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) | 282 | !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) |
| 282 | return -ENODEV; | 283 | return -ENODEV; |
| 283 | #ifdef DEBUG | ||
| 284 | if (substates == 0) /* can over-ride via modparam */ | ||
| 285 | #endif | ||
| 286 | substates = edx; | ||
| 287 | 284 | ||
| 288 | pr_debug(PREFIX "MWAIT substates: 0x%x\n", substates); | 285 | pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates); |
| 289 | 286 | ||
| 290 | if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ | 287 | if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ |
| 291 | lapic_timer_reliable_states = 0xFFFFFFFF; | 288 | lapic_timer_reliable_states = 0xFFFFFFFF; |
| @@ -376,7 +373,7 @@ static int intel_idle_cpuidle_devices_init(void) | |||
| 376 | } | 373 | } |
| 377 | 374 | ||
| 378 | /* does the state exist in CPUID.MWAIT? */ | 375 | /* does the state exist in CPUID.MWAIT? */ |
| 379 | num_substates = (substates >> ((cstate) * 4)) | 376 | num_substates = (mwait_substates >> ((cstate) * 4)) |
| 380 | & MWAIT_SUBSTATE_MASK; | 377 | & MWAIT_SUBSTATE_MASK; |
| 381 | if (num_substates == 0) | 378 | if (num_substates == 0) |
| 382 | continue; | 379 | continue; |
| @@ -452,9 +449,6 @@ module_exit(intel_idle_exit); | |||
| 452 | 449 | ||
| 453 | module_param(power_policy, int, 0644); | 450 | module_param(power_policy, int, 0644); |
| 454 | module_param(max_cstate, int, 0444); | 451 | module_param(max_cstate, int, 0444); |
| 455 | #ifdef DEBUG | ||
| 456 | module_param(substates, int, 0444); | ||
| 457 | #endif | ||
| 458 | 452 | ||
| 459 | MODULE_AUTHOR("Len Brown <len.brown@intel.com>"); | 453 | MODULE_AUTHOR("Len Brown <len.brown@intel.com>"); |
| 460 | MODULE_DESCRIPTION("Cpuidle driver for Intel Hardware v" INTEL_IDLE_VERSION); | 454 | MODULE_DESCRIPTION("Cpuidle driver for Intel Hardware v" INTEL_IDLE_VERSION); |
