Commit 33093e18 authored by Venki Pallipadi's avatar Venki Pallipadi Committed by Len Brown

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: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 3ad0b02e
...@@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL ...@@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL
bool bool
config I7300_IDLE config I7300_IDLE
tristate "Intel chipset idle power saving driver" tristate "Intel chipset idle memory power saving driver"
select I7300_IDLE_IOAT_CHANNEL select I7300_IDLE_IOAT_CHANNEL
depends on X86_64 depends on X86_64 && EXPERIMENTAL
help help
Enable idle power savings with certain Intel server chipsets. Enable memory power savings when idle with certain Intel server
The chipset must have I/O AT support, such as the Intel 7300. chipsets. The chipset must have I/O AT support, such as the
The power savings depends on the type and quantity of DRAM devices. Intel 7300. The power savings depends on the type and quantity of
DRAM devices.
endmenu endmenu
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#define I7300_IDLE_DRIVER_VERSION "1.55" #define I7300_IDLE_DRIVER_VERSION "1.55"
#define I7300_PRINT "i7300_idle:" #define I7300_PRINT "i7300_idle:"
#define MAX_STOP_RETRIES 10
static int debug; static int debug;
module_param_named(debug, debug, uint, 0644); module_param_named(debug, debug, uint, 0644);
MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
...@@ -47,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); ...@@ -47,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
* 0 = No throttling * 0 = No throttling
* 1 = Throttle when > 4 activations per eval window (Maximum throttling) * 1 = Throttle when > 4 activations per eval window (Maximum throttling)
* 2 = Throttle when > 8 activations * 2 = Throttle when > 8 activations
* 168 = Throttle when > 168 activations (Minimum throttling) * 168 = Throttle when > 672 activations (Minimum throttling)
*/ */
#define MAX_THRTLWLIMIT 168 #define MAX_THROTTLE_LOW_LIMIT 168
static uint i7300_idle_thrtlowlm = 1; static uint throttle_low_limit = 1;
module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644); module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644);
MODULE_PARM_DESC(thrtlwlimit, MODULE_PARM_DESC(throttle_low_limit,
"Value for THRTLOWLM activation field " "Value for THRTLOWLM activation field "
"(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)");
...@@ -111,9 +113,9 @@ static int i7300_idle_ioat_start(void) ...@@ -111,9 +113,9 @@ static int i7300_idle_ioat_start(void)
static void i7300_idle_ioat_stop(void) static void i7300_idle_ioat_stop(void)
{ {
int i; int i;
u8 sts; u64 sts;
for (i = 0; i < 5; i++) { for (i = 0; i < MAX_STOP_RETRIES; i++) {
writeb(IOAT_CHANCMD_RESET, writeb(IOAT_CHANCMD_RESET,
ioat_chanbase + IOAT1_CHANCMD_OFFSET); ioat_chanbase + IOAT1_CHANCMD_OFFSET);
...@@ -127,9 +129,10 @@ static void i7300_idle_ioat_stop(void) ...@@ -127,9 +129,10 @@ static void i7300_idle_ioat_stop(void)
} }
if (i == 5) if (i == MAX_STOP_RETRIES) {
dprintk("failed to suspend+reset I/O AT after 5 retries\n"); dprintk("failed to stop I/O AT after %d retries\n",
MAX_STOP_RETRIES);
}
} }
/* Test I/O AT by copying 1024 byte from 2k to 1k */ /* 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,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void)
i7300_idle_ioat_stop(); i7300_idle_ioat_stop();
/* Wait for a while for the channel to halt before releasing */ /* Wait for a while for the channel to halt before releasing */
for (i = 0; i < 10; i++) { for (i = 0; i < MAX_STOP_RETRIES; i++) {
writeb(IOAT_CHANCMD_RESET, writeb(IOAT_CHANCMD_RESET,
ioat_chanbase + IOAT1_CHANCMD_OFFSET); ioat_chanbase + IOAT1_CHANCMD_OFFSET);
...@@ -390,9 +393,9 @@ static void i7300_idle_start(void) ...@@ -390,9 +393,9 @@ static void i7300_idle_start(void)
new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
limit = i7300_idle_thrtlowlm; limit = throttle_low_limit;
if (unlikely(limit > MAX_THRTLWLIMIT)) if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT))
limit = MAX_THRTLWLIMIT; limit = MAX_THROTTLE_LOW_LIMIT;
pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit);
...@@ -441,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val, ...@@ -441,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
static ktime_t idle_begin_time; static ktime_t idle_begin_time;
static int time_init = 1; static int time_init = 1;
if (!i7300_idle_thrtlowlm) if (!throttle_low_limit)
return 0; return 0;
if (unlikely(time_init)) { if (unlikely(time_init)) {
......
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