aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenki Pallipadi <venkatesh.pallipadi@intel.com>2008-10-22 19:51:03 -0400
committerLen Brown <len.brown@intel.com>2008-10-24 12:55:14 -0400
commit33093e186c8f80b443fafb1d347a140bdd2b86c6 (patch)
treea70b6a1b145eab648d1c5c92fc2776fb9f572975
parent3ad0b02e4c1d5feba44b8ff48dccd1ba61a826b0 (diff)
i7300_idle: Cleanup based review comments
Cleanup of i7300 idle driver based on review comments from Randy Dunlap, Andi Kleen and Len Brown. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/idle/Kconfig11
-rw-r--r--drivers/idle/i7300_idle.c33
2 files changed, 24 insertions, 20 deletions
diff --git a/drivers/idle/Kconfig b/drivers/idle/Kconfig
index f5b26dd579e4..108264de0ac9 100644
--- a/drivers/idle/Kconfig
+++ b/drivers/idle/Kconfig
@@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL
5 bool 5 bool
6 6
7config I7300_IDLE 7config I7300_IDLE
8 tristate "Intel chipset idle power saving driver" 8 tristate "Intel chipset idle memory power saving driver"
9 select I7300_IDLE_IOAT_CHANNEL 9 select I7300_IDLE_IOAT_CHANNEL
10 depends on X86_64 10 depends on X86_64 && EXPERIMENTAL
11 help 11 help
12 Enable idle power savings with certain Intel server chipsets. 12 Enable memory power savings when idle with certain Intel server
13 The chipset must have I/O AT support, such as the Intel 7300. 13 chipsets. The chipset must have I/O AT support, such as the
14 The power savings depends on the type and quantity of DRAM devices. 14 Intel 7300. The power savings depends on the type and quantity of
15 DRAM devices.
15 16
16endmenu 17endmenu
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c
index 79d47f284cd6..fb176f6ef9f8 100644
--- a/drivers/idle/i7300_idle.c
+++ b/drivers/idle/i7300_idle.c
@@ -35,6 +35,8 @@
35#define I7300_IDLE_DRIVER_VERSION "1.55" 35#define I7300_IDLE_DRIVER_VERSION "1.55"
36#define I7300_PRINT "i7300_idle:" 36#define I7300_PRINT "i7300_idle:"
37 37
38#define MAX_STOP_RETRIES 10
39
38static int debug; 40static int debug;
39module_param_named(debug, debug, uint, 0644); 41module_param_named(debug, debug, uint, 0644);
40MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); 42MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
@@ -47,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
47 * 0 = No throttling 49 * 0 = No throttling
48 * 1 = Throttle when > 4 activations per eval window (Maximum throttling) 50 * 1 = Throttle when > 4 activations per eval window (Maximum throttling)
49 * 2 = Throttle when > 8 activations 51 * 2 = Throttle when > 8 activations
50 * 168 = Throttle when > 168 activations (Minimum throttling) 52 * 168 = Throttle when > 672 activations (Minimum throttling)
51 */ 53 */
52#define MAX_THRTLWLIMIT 168 54#define MAX_THROTTLE_LOW_LIMIT 168
53static uint i7300_idle_thrtlowlm = 1; 55static uint throttle_low_limit = 1;
54module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644); 56module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644);
55MODULE_PARM_DESC(thrtlwlimit, 57MODULE_PARM_DESC(throttle_low_limit,
56 "Value for THRTLOWLM activation field " 58 "Value for THRTLOWLM activation field "
57 "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); 59 "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)");
58 60
@@ -111,9 +113,9 @@ static int i7300_idle_ioat_start(void)
111static void i7300_idle_ioat_stop(void) 113static void i7300_idle_ioat_stop(void)
112{ 114{
113 int i; 115 int i;
114 u8 sts; 116 u64 sts;
115 117
116 for (i = 0; i < 5; i++) { 118 for (i = 0; i < MAX_STOP_RETRIES; i++) {
117 writeb(IOAT_CHANCMD_RESET, 119 writeb(IOAT_CHANCMD_RESET,
118 ioat_chanbase + IOAT1_CHANCMD_OFFSET); 120 ioat_chanbase + IOAT1_CHANCMD_OFFSET);
119 121
@@ -127,9 +129,10 @@ static void i7300_idle_ioat_stop(void)
127 129
128 } 130 }
129 131
130 if (i == 5) 132 if (i == MAX_STOP_RETRIES) {
131 dprintk("failed to suspend+reset I/O AT after 5 retries\n"); 133 dprintk("failed to stop I/O AT after %d retries\n",
132 134 MAX_STOP_RETRIES);
135 }
133} 136}
134 137
135/* Test I/O AT by copying 1024 byte from 2k to 1k */ 138/* Test I/O AT by copying 1024 byte from 2k to 1k */
@@ -276,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void)
276 i7300_idle_ioat_stop(); 279 i7300_idle_ioat_stop();
277 280
278 /* Wait for a while for the channel to halt before releasing */ 281 /* Wait for a while for the channel to halt before releasing */
279 for (i = 0; i < 10; i++) { 282 for (i = 0; i < MAX_STOP_RETRIES; i++) {
280 writeb(IOAT_CHANCMD_RESET, 283 writeb(IOAT_CHANCMD_RESET,
281 ioat_chanbase + IOAT1_CHANCMD_OFFSET); 284 ioat_chanbase + IOAT1_CHANCMD_OFFSET);
282 285
@@ -390,9 +393,9 @@ static void i7300_idle_start(void)
390 new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; 393 new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
391 pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); 394 pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
392 395
393 limit = i7300_idle_thrtlowlm; 396 limit = throttle_low_limit;
394 if (unlikely(limit > MAX_THRTLWLIMIT)) 397 if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT))
395 limit = MAX_THRTLWLIMIT; 398 limit = MAX_THROTTLE_LOW_LIMIT;
396 399
397 pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); 400 pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit);
398 401
@@ -441,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
441 static ktime_t idle_begin_time; 444 static ktime_t idle_begin_time;
442 static int time_init = 1; 445 static int time_init = 1;
443 446
444 if (!i7300_idle_thrtlowlm) 447 if (!throttle_low_limit)
445 return 0; 448 return 0;
446 449
447 if (unlikely(time_init)) { 450 if (unlikely(time_init)) {