Skip to content

Commit 33093e1

Browse files
Venki Pallipadilenb
authored andcommitted
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 <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent 3ad0b02 commit 33093e1

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

drivers/idle/Kconfig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL
55
bool
66

77
config I7300_IDLE
8-
tristate "Intel chipset idle power saving driver"
8+
tristate "Intel chipset idle memory power saving driver"
99
select I7300_IDLE_IOAT_CHANNEL
10-
depends on X86_64
10+
depends on X86_64 && EXPERIMENTAL
1111
help
12-
Enable idle power savings with certain Intel server chipsets.
13-
The chipset must have I/O AT support, such as the Intel 7300.
14-
The power savings depends on the type and quantity of DRAM devices.
12+
Enable memory power savings when idle with certain Intel server
13+
chipsets. The chipset must have I/O AT support, such as the
14+
Intel 7300. The power savings depends on the type and quantity of
15+
DRAM devices.
1516

1617
endmenu

drivers/idle/i7300_idle.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#define I7300_IDLE_DRIVER_VERSION "1.55"
3636
#define I7300_PRINT "i7300_idle:"
3737

38+
#define MAX_STOP_RETRIES 10
39+
3840
static int debug;
3941
module_param_named(debug, debug, uint, 0644);
4042
MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
@@ -47,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
4749
* 0 = No throttling
4850
* 1 = Throttle when > 4 activations per eval window (Maximum throttling)
4951
* 2 = Throttle when > 8 activations
50-
* 168 = Throttle when > 168 activations (Minimum throttling)
52+
* 168 = Throttle when > 672 activations (Minimum throttling)
5153
*/
52-
#define MAX_THRTLWLIMIT 168
53-
static uint i7300_idle_thrtlowlm = 1;
54-
module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644);
55-
MODULE_PARM_DESC(thrtlwlimit,
54+
#define MAX_THROTTLE_LOW_LIMIT 168
55+
static uint throttle_low_limit = 1;
56+
module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644);
57+
MODULE_PARM_DESC(throttle_low_limit,
5658
"Value for THRTLOWLM activation field "
5759
"(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)");
5860

@@ -111,9 +113,9 @@ static int i7300_idle_ioat_start(void)
111113
static void i7300_idle_ioat_stop(void)
112114
{
113115
int i;
114-
u8 sts;
116+
u64 sts;
115117

116-
for (i = 0; i < 5; i++) {
118+
for (i = 0; i < MAX_STOP_RETRIES; i++) {
117119
writeb(IOAT_CHANCMD_RESET,
118120
ioat_chanbase + IOAT1_CHANCMD_OFFSET);
119121

@@ -127,9 +129,10 @@ static void i7300_idle_ioat_stop(void)
127129

128130
}
129131

130-
if (i == 5)
131-
dprintk("failed to suspend+reset I/O AT after 5 retries\n");
132-
132+
if (i == MAX_STOP_RETRIES) {
133+
dprintk("failed to stop I/O AT after %d retries\n",
134+
MAX_STOP_RETRIES);
135+
}
133136
}
134137

135138
/* Test I/O AT by copying 1024 byte from 2k to 1k */
@@ -276,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void)
276279
i7300_idle_ioat_stop();
277280

278281
/* 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++) {
280283
writeb(IOAT_CHANCMD_RESET,
281284
ioat_chanbase + IOAT1_CHANCMD_OFFSET);
282285

@@ -390,9 +393,9 @@ static void i7300_idle_start(void)
390393
new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
391394
pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
392395

393-
limit = i7300_idle_thrtlowlm;
394-
if (unlikely(limit > MAX_THRTLWLIMIT))
395-
limit = MAX_THRTLWLIMIT;
396+
limit = throttle_low_limit;
397+
if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT))
398+
limit = MAX_THROTTLE_LOW_LIMIT;
396399

397400
pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit);
398401

@@ -441,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
441444
static ktime_t idle_begin_time;
442445
static int time_init = 1;
443446

444-
if (!i7300_idle_thrtlowlm)
447+
if (!throttle_low_limit)
445448
return 0;
446449

447450
if (unlikely(time_init)) {

0 commit comments

Comments
 (0)