Commit bfc8e3e9 authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/src/26-stable-dev

into intel.com:/home/lenb/src/26-latest-dev
parents c9ac33e4 a22df92c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
...@@ -87,7 +88,6 @@ const struct acpi_dlevel acpi_debug_levels[] = ...@@ -87,7 +88,6 @@ const struct acpi_dlevel acpi_debug_levels[] =
ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES), ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
ACPI_DEBUG_INIT(ACPI_LV_EVENTS), ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
}; };
#define NUM_OF(v) ( sizeof(v)/sizeof(v[0]) )
static int static int
acpi_system_read_debug ( acpi_system_read_debug (
...@@ -100,7 +100,7 @@ acpi_system_read_debug ( ...@@ -100,7 +100,7 @@ acpi_system_read_debug (
{ {
char *p = page; char *p = page;
int size = 0; int size = 0;
int i; unsigned int i;
if (off != 0) if (off != 0)
goto end; goto end;
...@@ -109,7 +109,7 @@ acpi_system_read_debug ( ...@@ -109,7 +109,7 @@ acpi_system_read_debug (
switch ((unsigned long) data) { switch ((unsigned long) data) {
case 0: case 0:
for (i = 0; i < NUM_OF(acpi_debug_layers); i++) { for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
p += sprintf(p, "%-25s\t0x%08lX [%c]\n", p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_layers[i].name, acpi_debug_layers[i].name,
acpi_debug_layers[i].value, acpi_debug_layers[i].value,
...@@ -126,7 +126,7 @@ acpi_system_read_debug ( ...@@ -126,7 +126,7 @@ acpi_system_read_debug (
acpi_dbg_layer); acpi_dbg_layer);
break; break;
case 1: case 1:
for (i = 0; i < NUM_OF(acpi_debug_levels); i++) { for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
p += sprintf(p, "%-25s\t0x%08lX [%c]\n", p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_levels[i].name, acpi_debug_levels[i].name,
acpi_debug_levels[i].value, acpi_debug_levels[i].value,
......
...@@ -60,6 +60,15 @@ module_param(max_cstate, uint, 0644); ...@@ -60,6 +60,15 @@ module_param(max_cstate, uint, 0644);
static unsigned int nocst = 0; static unsigned int nocst = 0;
module_param(nocst, uint, 0000); module_param(nocst, uint, 0000);
/*
* bm_history -- bit-mask with a bit per jiffy of bus-master activity
* 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms
* 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms
* 100 HZ: 0x0000000F: 4 jiffies = 40ms
* reduce history for more aggressive entry into C3
*/
static unsigned int bm_history = (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
module_param(bm_history, uint, 0644);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Power Management Power Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -193,8 +202,18 @@ static void acpi_processor_idle (void) ...@@ -193,8 +202,18 @@ static void acpi_processor_idle (void)
*/ */
if (pr->flags.bm_check) { if (pr->flags.bm_check) {
u32 bm_status = 0; u32 bm_status = 0;
unsigned long diff = jiffies - pr->power.bm_check_timestamp;
if (diff > 32)
diff = 32;
while (diff) {
/* if we didn't get called, assume there was busmaster activity */
diff--;
if (diff)
pr->power.bm_activity |= 0x1;
pr->power.bm_activity <<= 1; pr->power.bm_activity <<= 1;
}
acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS,
&bm_status, ACPI_MTX_DO_NOT_LOCK); &bm_status, ACPI_MTX_DO_NOT_LOCK);
...@@ -213,6 +232,9 @@ static void acpi_processor_idle (void) ...@@ -213,6 +232,9 @@ static void acpi_processor_idle (void)
|| (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01))
pr->power.bm_activity++; pr->power.bm_activity++;
} }
pr->power.bm_check_timestamp = jiffies;
/* /*
* Apply bus mastering demotion policy. Automatically demote * Apply bus mastering demotion policy. Automatically demote
* to avoid a faulty transition. Note that the processor * to avoid a faulty transition. Note that the processor
...@@ -425,7 +447,7 @@ acpi_processor_set_power_policy ( ...@@ -425,7 +447,7 @@ acpi_processor_set_power_policy (
cx->demotion.threshold.ticks = cx->latency_ticks; cx->demotion.threshold.ticks = cx->latency_ticks;
cx->demotion.threshold.count = 1; cx->demotion.threshold.count = 1;
if (cx->type == ACPI_STATE_C3) if (cx->type == ACPI_STATE_C3)
cx->demotion.threshold.bm = 0x0F; cx->demotion.threshold.bm = bm_history;
} }
lower = cx; lower = cx;
...@@ -445,7 +467,7 @@ acpi_processor_set_power_policy ( ...@@ -445,7 +467,7 @@ acpi_processor_set_power_policy (
else else
cx->promotion.threshold.count = 10; cx->promotion.threshold.count = 10;
if (higher->type == ACPI_STATE_C3) if (higher->type == ACPI_STATE_C3)
cx->promotion.threshold.bm = 0x0F; cx->promotion.threshold.bm = bm_history;
} }
higher = cx; higher = cx;
......
...@@ -54,6 +54,7 @@ struct acpi_processor_cx { ...@@ -54,6 +54,7 @@ struct acpi_processor_cx {
struct acpi_processor_power { struct acpi_processor_power {
struct acpi_processor_cx *state; struct acpi_processor_cx *state;
unsigned long bm_check_timestamp;
u32 default_state; u32 default_state;
u32 bm_activity; u32 bm_activity;
int count; int count;
......
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