Commit 99a194fa authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] max_cstate shall limit C-states not C-state-types.

Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 57900764
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <asm/io.h> #include <asm/io.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/processor.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/efi.h> #include <linux/efi.h>
...@@ -1155,7 +1156,7 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); ...@@ -1155,7 +1156,7 @@ __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
* max_cstate is defined in the base kernel so modules can * max_cstate is defined in the base kernel so modules can
* change it w/o depending on the state of the processor module. * change it w/o depending on the state of the processor module.
*/ */
unsigned int max_cstate = ACPI_C_STATES_MAX; unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
EXPORT_SYMBOL(max_cstate); EXPORT_SYMBOL(max_cstate);
...@@ -69,11 +69,12 @@ module_param_named(max_cstate, max_cstate, uint, 0644); ...@@ -69,11 +69,12 @@ module_param_named(max_cstate, max_cstate, uint, 0644);
*/ */
static int no_c2c3(struct dmi_system_id *id) static int no_c2c3(struct dmi_system_id *id)
{ {
if (max_cstate > ACPI_C_STATES_MAX) if (max_cstate > ACPI_PROCESSOR_MAX_POWER)
return 0; return 0;
printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled."
" Override with \"processor.max_cstate=9\"\n", id->ident); " Override with \"processor.max_cstate=%d\"\n", id->ident,
ACPI_PROCESSOR_MAX_POWER + 1);
max_cstate = 1; max_cstate = 1;
...@@ -304,7 +305,8 @@ static void acpi_processor_idle (void) ...@@ -304,7 +305,8 @@ static void acpi_processor_idle (void)
* mastering activity may prevent promotions. * mastering activity may prevent promotions.
* Do not promote above max_cstate. * Do not promote above max_cstate.
*/ */
if (cx->promotion.state && (cx->promotion.state->type <= max_cstate)) { if (cx->promotion.state &&
((cx->promotion.state - pr->power.states) <= max_cstate)) {
if (sleep_ticks > cx->promotion.threshold.ticks) { if (sleep_ticks > cx->promotion.threshold.ticks) {
cx->promotion.count++; cx->promotion.count++;
cx->demotion.count = 0; cx->demotion.count = 0;
...@@ -344,7 +346,7 @@ static void acpi_processor_idle (void) ...@@ -344,7 +346,7 @@ static void acpi_processor_idle (void)
/* /*
* Demote if current state exceeds max_cstate * Demote if current state exceeds max_cstate
*/ */
if (pr->power.state->type > max_cstate) { if ((pr->power.state - pr->power.states) > max_cstate) {
if (cx->demotion.state) if (cx->demotion.state)
next_state = cx->demotion.state; next_state = cx->demotion.state;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment