i7300_idle.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*
  2. * (C) Copyright 2008 Intel Corporation
  3. * Authors:
  4. * Andy Henroid <andrew.d.henroid@intel.com>
  5. * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
  6. */
  7. /*
  8. * Save DIMM power on Intel 7300-based platforms when all CPUs/cores
  9. * are idle, using the DIMM thermal throttling capability.
  10. *
  11. * This driver depends on the Intel integrated DMA controller (I/O AT).
  12. * If the driver for I/O AT (drivers/dma/ioatdma*) is also enabled,
  13. * this driver should work cooperatively.
  14. */
  15. /* #define DEBUG */
  16. #include <linux/module.h>
  17. #include <linux/pci.h>
  18. #include <linux/gfp.h>
  19. #include <linux/sched.h>
  20. #include <linux/notifier.h>
  21. #include <linux/cpumask.h>
  22. #include <linux/ktime.h>
  23. #include <linux/delay.h>
  24. #include <linux/debugfs.h>
  25. #include <linux/stop_machine.h>
  26. #include <linux/i7300_idle.h>
  27. #include <asm/idle.h>
  28. #include "../dma/ioat/hw.h"
  29. #include "../dma/ioat/registers.h"
  30. #define I7300_IDLE_DRIVER_VERSION "1.55"
  31. #define I7300_PRINT "i7300_idle:"
  32. #define MAX_STOP_RETRIES 10
  33. static int debug;
  34. module_param_named(debug, debug, uint, 0644);
  35. MODULE_PARM_DESC(debug, "Enable debug printks in this driver");
  36. static int forceload;
  37. module_param_named(forceload, forceload, uint, 0644);
  38. MODULE_PARM_DESC(debug, "Enable driver testing on unvalidated i5000");
  39. #define dprintk(fmt, arg...) \
  40. do { if (debug) printk(KERN_INFO I7300_PRINT fmt, ##arg); } while (0)
  41. /*
  42. * Value to set THRTLOW to when initiating throttling
  43. * 0 = No throttling
  44. * 1 = Throttle when > 4 activations per eval window (Maximum throttling)
  45. * 2 = Throttle when > 8 activations
  46. * 168 = Throttle when > 672 activations (Minimum throttling)
  47. */
  48. #define MAX_THROTTLE_LOW_LIMIT 168
  49. static uint throttle_low_limit = 1;
  50. module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644);
  51. MODULE_PARM_DESC(throttle_low_limit,
  52. "Value for THRTLOWLM activation field "
  53. "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)");
  54. /*
  55. * simple invocation and duration statistics
  56. */
  57. static unsigned long total_starts;
  58. static unsigned long total_us;
  59. #ifdef DEBUG
  60. static unsigned long past_skip;
  61. #endif
  62. static struct pci_dev *fbd_dev;
  63. static raw_spinlock_t i7300_idle_lock;
  64. static int i7300_idle_active;
  65. static u8 i7300_idle_thrtctl_saved;
  66. static u8 i7300_idle_thrtlow_saved;
  67. static u32 i7300_idle_mc_saved;
  68. static cpumask_var_t idle_cpumask;
  69. static ktime_t start_ktime;
  70. static unsigned long avg_idle_us;
  71. static struct dentry *debugfs_dir;
  72. /* Begin: I/O AT Helper routines */
  73. #define IOAT_CHANBASE(ioat_ctl, chan) (ioat_ctl + 0x80 + 0x80 * chan)
  74. /* Snoop control (disable snoops when coherency is not important) */
  75. #define IOAT_DESC_SADDR_SNP_CTL (1UL << 1)
  76. #define IOAT_DESC_DADDR_SNP_CTL (1UL << 2)
  77. static struct pci_dev *ioat_dev;
  78. static struct ioat_dma_descriptor *ioat_desc; /* I/O AT desc & data (1 page) */
  79. static unsigned long ioat_desc_phys;
  80. static u8 *ioat_iomap; /* I/O AT memory-mapped control regs (aka CB_BAR) */
  81. static u8 *ioat_chanbase;
  82. /* Start I/O AT memory copy */
  83. static int i7300_idle_ioat_start(void)
  84. {
  85. u32 err;
  86. /* Clear error (due to circular descriptor pointer) */
  87. err = readl(ioat_chanbase + IOAT_CHANERR_OFFSET);
  88. if (err)
  89. writel(err, ioat_chanbase + IOAT_CHANERR_OFFSET);
  90. writeb(IOAT_CHANCMD_START, ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  91. return 0;
  92. }
  93. /* Stop I/O AT memory copy */
  94. static void i7300_idle_ioat_stop(void)
  95. {
  96. int i;
  97. u64 sts;
  98. for (i = 0; i < MAX_STOP_RETRIES; i++) {
  99. writeb(IOAT_CHANCMD_RESET,
  100. ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  101. udelay(10);
  102. sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  103. IOAT_CHANSTS_STATUS;
  104. if (sts != IOAT_CHANSTS_ACTIVE)
  105. break;
  106. }
  107. if (i == MAX_STOP_RETRIES) {
  108. dprintk("failed to stop I/O AT after %d retries\n",
  109. MAX_STOP_RETRIES);
  110. }
  111. }
  112. /* Test I/O AT by copying 1024 byte from 2k to 1k */
  113. static int __init i7300_idle_ioat_selftest(u8 *ctl,
  114. struct ioat_dma_descriptor *desc, unsigned long desc_phys)
  115. {
  116. u64 chan_sts;
  117. memset(desc, 0, 2048);
  118. memset((u8 *) desc + 2048, 0xab, 1024);
  119. desc[0].size = 1024;
  120. desc[0].ctl = 0;
  121. desc[0].src_addr = desc_phys + 2048;
  122. desc[0].dst_addr = desc_phys + 1024;
  123. desc[0].next = 0;
  124. writeb(IOAT_CHANCMD_RESET, ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  125. writeb(IOAT_CHANCMD_START, ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  126. udelay(1000);
  127. chan_sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  128. IOAT_CHANSTS_STATUS;
  129. if (chan_sts != IOAT_CHANSTS_DONE) {
  130. /* Not complete, reset the channel */
  131. writeb(IOAT_CHANCMD_RESET,
  132. ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  133. return -1;
  134. }
  135. if (*(u32 *) ((u8 *) desc + 3068) != 0xabababab ||
  136. *(u32 *) ((u8 *) desc + 2044) != 0xabababab) {
  137. dprintk("Data values src 0x%x, dest 0x%x, memset 0x%x\n",
  138. *(u32 *) ((u8 *) desc + 2048),
  139. *(u32 *) ((u8 *) desc + 1024),
  140. *(u32 *) ((u8 *) desc + 3072));
  141. return -1;
  142. }
  143. return 0;
  144. }
  145. static struct device dummy_dma_dev = {
  146. .init_name = "fallback device",
  147. .coherent_dma_mask = DMA_BIT_MASK(64),
  148. .dma_mask = &dummy_dma_dev.coherent_dma_mask,
  149. };
  150. /* Setup and initialize I/O AT */
  151. /* This driver needs I/O AT as the throttling takes effect only when there is
  152. * some memory activity. We use I/O AT to set up a dummy copy, while all CPUs
  153. * go idle and memory is throttled.
  154. */
  155. static int __init i7300_idle_ioat_init(void)
  156. {
  157. u8 ver, chan_count, ioat_chan;
  158. u16 chan_ctl;
  159. ioat_iomap = (u8 *) ioremap_nocache(pci_resource_start(ioat_dev, 0),
  160. pci_resource_len(ioat_dev, 0));
  161. if (!ioat_iomap) {
  162. printk(KERN_ERR I7300_PRINT "failed to map I/O AT registers\n");
  163. goto err_ret;
  164. }
  165. ver = readb(ioat_iomap + IOAT_VER_OFFSET);
  166. if (ver != IOAT_VER_1_2) {
  167. printk(KERN_ERR I7300_PRINT "unknown I/O AT version (%u.%u)\n",
  168. ver >> 4, ver & 0xf);
  169. goto err_unmap;
  170. }
  171. chan_count = readb(ioat_iomap + IOAT_CHANCNT_OFFSET);
  172. if (!chan_count) {
  173. printk(KERN_ERR I7300_PRINT "unexpected # of I/O AT channels "
  174. "(%u)\n",
  175. chan_count);
  176. goto err_unmap;
  177. }
  178. ioat_chan = chan_count - 1;
  179. ioat_chanbase = IOAT_CHANBASE(ioat_iomap, ioat_chan);
  180. chan_ctl = readw(ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  181. if (chan_ctl & IOAT_CHANCTRL_CHANNEL_IN_USE) {
  182. printk(KERN_ERR I7300_PRINT "channel %d in use\n", ioat_chan);
  183. goto err_unmap;
  184. }
  185. writew(IOAT_CHANCTRL_CHANNEL_IN_USE,
  186. ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  187. ioat_desc = (struct ioat_dma_descriptor *)dma_alloc_coherent(
  188. &dummy_dma_dev, 4096,
  189. (dma_addr_t *)&ioat_desc_phys, GFP_KERNEL);
  190. if (!ioat_desc) {
  191. printk(KERN_ERR I7300_PRINT "failed to allocate I/O AT desc\n");
  192. goto err_mark_unused;
  193. }
  194. writel(ioat_desc_phys & 0xffffffffUL,
  195. ioat_chanbase + IOAT1_CHAINADDR_OFFSET_LOW);
  196. writel(ioat_desc_phys >> 32,
  197. ioat_chanbase + IOAT1_CHAINADDR_OFFSET_HIGH);
  198. if (i7300_idle_ioat_selftest(ioat_iomap, ioat_desc, ioat_desc_phys)) {
  199. printk(KERN_ERR I7300_PRINT "I/O AT self-test failed\n");
  200. goto err_free;
  201. }
  202. /* Setup circular I/O AT descriptor chain */
  203. ioat_desc[0].ctl = IOAT_DESC_SADDR_SNP_CTL | IOAT_DESC_DADDR_SNP_CTL;
  204. ioat_desc[0].src_addr = ioat_desc_phys + 2048;
  205. ioat_desc[0].dst_addr = ioat_desc_phys + 3072;
  206. ioat_desc[0].size = 128;
  207. ioat_desc[0].next = ioat_desc_phys + sizeof(struct ioat_dma_descriptor);
  208. ioat_desc[1].ctl = ioat_desc[0].ctl;
  209. ioat_desc[1].src_addr = ioat_desc[0].src_addr;
  210. ioat_desc[1].dst_addr = ioat_desc[0].dst_addr;
  211. ioat_desc[1].size = ioat_desc[0].size;
  212. ioat_desc[1].next = ioat_desc_phys;
  213. return 0;
  214. err_free:
  215. dma_free_coherent(&dummy_dma_dev, 4096, (void *)ioat_desc, 0);
  216. err_mark_unused:
  217. writew(0, ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  218. err_unmap:
  219. iounmap(ioat_iomap);
  220. err_ret:
  221. return -ENODEV;
  222. }
  223. /* Cleanup I/O AT */
  224. static void __exit i7300_idle_ioat_exit(void)
  225. {
  226. int i;
  227. u64 chan_sts;
  228. i7300_idle_ioat_stop();
  229. /* Wait for a while for the channel to halt before releasing */
  230. for (i = 0; i < MAX_STOP_RETRIES; i++) {
  231. writeb(IOAT_CHANCMD_RESET,
  232. ioat_chanbase + IOAT1_CHANCMD_OFFSET);
  233. chan_sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  234. IOAT_CHANSTS_STATUS;
  235. if (chan_sts != IOAT_CHANSTS_ACTIVE) {
  236. writew(0, ioat_chanbase + IOAT_CHANCTRL_OFFSET);
  237. break;
  238. }
  239. udelay(1000);
  240. }
  241. chan_sts = readq(ioat_chanbase + IOAT1_CHANSTS_OFFSET) &
  242. IOAT_CHANSTS_STATUS;
  243. /*
  244. * We tried to reset multiple times. If IO A/T channel is still active
  245. * flag an error and return without cleanup. Memory leak is better
  246. * than random corruption in that extreme error situation.
  247. */
  248. if (chan_sts == IOAT_CHANSTS_ACTIVE) {
  249. printk(KERN_ERR I7300_PRINT "Unable to stop IO A/T channels."
  250. " Not freeing resources\n");
  251. return;
  252. }
  253. dma_free_coherent(&dummy_dma_dev, 4096, (void *)ioat_desc, 0);
  254. iounmap(ioat_iomap);
  255. }
  256. /* End: I/O AT Helper routines */
  257. #define DIMM_THRTLOW 0x64
  258. #define DIMM_THRTCTL 0x67
  259. #define DIMM_THRTCTL_THRMHUNT (1UL << 0)
  260. #define DIMM_MC 0x40
  261. #define DIMM_GTW_MODE (1UL << 17)
  262. #define DIMM_GBLACT 0x60
  263. /*
  264. * Keep track of an exponential-decaying average of recent idle durations.
  265. * The latest duration gets DURATION_WEIGHT_PCT percentage weight
  266. * in this average, with the old average getting the remaining weight.
  267. *
  268. * High weights emphasize recent history, low weights include long history.
  269. */
  270. #define DURATION_WEIGHT_PCT 55
  271. /*
  272. * When the decaying average of recent durations or the predicted duration
  273. * of the next timer interrupt is shorter than duration_threshold, the
  274. * driver will decline to throttle.
  275. */
  276. #define DURATION_THRESHOLD_US 100
  277. /* Store DIMM thermal throttle configuration */
  278. static int i7300_idle_thrt_save(void)
  279. {
  280. u32 new_mc_val;
  281. u8 gblactlm;
  282. pci_read_config_byte(fbd_dev, DIMM_THRTCTL, &i7300_idle_thrtctl_saved);
  283. pci_read_config_byte(fbd_dev, DIMM_THRTLOW, &i7300_idle_thrtlow_saved);
  284. pci_read_config_dword(fbd_dev, DIMM_MC, &i7300_idle_mc_saved);
  285. /*
  286. * Make sure we have Global Throttling Window Mode set to have a
  287. * "short" window. This (mostly) works around an issue where
  288. * throttling persists until the end of the global throttling window
  289. * size. On the tested system, this was resulting in a maximum of
  290. * 64 ms to exit throttling (average 32 ms). The actual numbers
  291. * depends on system frequencies. Setting the short window reduces
  292. * this by a factor of 4096.
  293. *
  294. * We will only do this only if the system is set for
  295. * unlimited-activations while in open-loop throttling (i.e., when
  296. * Global Activation Throttle Limit is zero).
  297. */
  298. pci_read_config_byte(fbd_dev, DIMM_GBLACT, &gblactlm);
  299. dprintk("thrtctl_saved = 0x%02x, thrtlow_saved = 0x%02x\n",
  300. i7300_idle_thrtctl_saved,
  301. i7300_idle_thrtlow_saved);
  302. dprintk("mc_saved = 0x%08x, gblactlm = 0x%02x\n",
  303. i7300_idle_mc_saved,
  304. gblactlm);
  305. if (gblactlm == 0) {
  306. new_mc_val = i7300_idle_mc_saved | DIMM_GTW_MODE;
  307. pci_write_config_dword(fbd_dev, DIMM_MC, new_mc_val);
  308. return 0;
  309. } else {
  310. dprintk("could not set GTW_MODE = 1 (OLTT enabled)\n");
  311. return -ENODEV;
  312. }
  313. }
  314. /* Restore DIMM thermal throttle configuration */
  315. static void i7300_idle_thrt_restore(void)
  316. {
  317. pci_write_config_dword(fbd_dev, DIMM_MC, i7300_idle_mc_saved);
  318. pci_write_config_byte(fbd_dev, DIMM_THRTLOW, i7300_idle_thrtlow_saved);
  319. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, i7300_idle_thrtctl_saved);
  320. }
  321. /* Enable DIMM thermal throttling */
  322. static void i7300_idle_start(void)
  323. {
  324. u8 new_ctl;
  325. u8 limit;
  326. new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
  327. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
  328. limit = throttle_low_limit;
  329. if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT))
  330. limit = MAX_THROTTLE_LOW_LIMIT;
  331. pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit);
  332. new_ctl = i7300_idle_thrtctl_saved | DIMM_THRTCTL_THRMHUNT;
  333. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
  334. }
  335. /* Disable DIMM thermal throttling */
  336. static void i7300_idle_stop(void)
  337. {
  338. u8 new_ctl;
  339. u8 got_ctl;
  340. new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT;
  341. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl);
  342. pci_write_config_byte(fbd_dev, DIMM_THRTLOW, i7300_idle_thrtlow_saved);
  343. pci_write_config_byte(fbd_dev, DIMM_THRTCTL, i7300_idle_thrtctl_saved);
  344. pci_read_config_byte(fbd_dev, DIMM_THRTCTL, &got_ctl);
  345. WARN_ON_ONCE(got_ctl != i7300_idle_thrtctl_saved);
  346. }
  347. /*
  348. * i7300_avg_duration_check()
  349. * return 0 if the decaying average of recent idle durations is
  350. * more than DURATION_THRESHOLD_US
  351. */
  352. static int i7300_avg_duration_check(void)
  353. {
  354. if (avg_idle_us >= DURATION_THRESHOLD_US)
  355. return 0;
  356. #ifdef DEBUG
  357. past_skip++;
  358. #endif
  359. return 1;
  360. }
  361. /* Idle notifier to look at idle CPUs */
  362. static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
  363. void *data)
  364. {
  365. unsigned long flags;
  366. ktime_t now_ktime;
  367. static ktime_t idle_begin_time;
  368. static int time_init = 1;
  369. if (!throttle_low_limit)
  370. return 0;
  371. if (unlikely(time_init)) {
  372. time_init = 0;
  373. idle_begin_time = ktime_get();
  374. }
  375. raw_spin_lock_irqsave(&i7300_idle_lock, flags);
  376. if (val == IDLE_START) {
  377. cpumask_set_cpu(smp_processor_id(), idle_cpumask);
  378. if (cpumask_weight(idle_cpumask) != num_online_cpus())
  379. goto end;
  380. now_ktime = ktime_get();
  381. idle_begin_time = now_ktime;
  382. if (i7300_avg_duration_check())
  383. goto end;
  384. i7300_idle_active = 1;
  385. total_starts++;
  386. start_ktime = now_ktime;
  387. i7300_idle_start();
  388. i7300_idle_ioat_start();
  389. } else if (val == IDLE_END) {
  390. cpumask_clear_cpu(smp_processor_id(), idle_cpumask);
  391. if (cpumask_weight(idle_cpumask) == (num_online_cpus() - 1)) {
  392. /* First CPU coming out of idle */
  393. u64 idle_duration_us;
  394. now_ktime = ktime_get();
  395. idle_duration_us = ktime_to_us(ktime_sub
  396. (now_ktime, idle_begin_time));
  397. avg_idle_us =
  398. ((100 - DURATION_WEIGHT_PCT) * avg_idle_us +
  399. DURATION_WEIGHT_PCT * idle_duration_us) / 100;
  400. if (i7300_idle_active) {
  401. ktime_t idle_ktime;
  402. idle_ktime = ktime_sub(now_ktime, start_ktime);
  403. total_us += ktime_to_us(idle_ktime);
  404. i7300_idle_ioat_stop();
  405. i7300_idle_stop();
  406. i7300_idle_active = 0;
  407. }
  408. }
  409. }
  410. end:
  411. raw_spin_unlock_irqrestore(&i7300_idle_lock, flags);
  412. return 0;
  413. }
  414. static struct notifier_block i7300_idle_nb = {
  415. .notifier_call = i7300_idle_notifier,
  416. };
  417. MODULE_DEVICE_TABLE(pci, pci_tbl);
  418. static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count,
  419. loff_t *off)
  420. {
  421. unsigned long *p = fp->private_data;
  422. char buf[32];
  423. int len;
  424. len = snprintf(buf, 32, "%lu\n", *p);
  425. return simple_read_from_buffer(ubuf, count, off, buf, len);
  426. }
  427. static const struct file_operations idle_fops = {
  428. .open = simple_open,
  429. .read = stats_read_ul,
  430. .llseek = default_llseek,
  431. };
  432. struct debugfs_file_info {
  433. void *ptr;
  434. char name[32];
  435. struct dentry *file;
  436. } debugfs_file_list[] = {
  437. {&total_starts, "total_starts", NULL},
  438. {&total_us, "total_us", NULL},
  439. #ifdef DEBUG
  440. {&past_skip, "past_skip", NULL},
  441. #endif
  442. {NULL, "", NULL}
  443. };
  444. static int __init i7300_idle_init(void)
  445. {
  446. raw_spin_lock_init(&i7300_idle_lock);
  447. total_us = 0;
  448. if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev, forceload))
  449. return -ENODEV;
  450. if (i7300_idle_thrt_save())
  451. return -ENODEV;
  452. if (i7300_idle_ioat_init())
  453. return -ENODEV;
  454. if (!zalloc_cpumask_var(&idle_cpumask, GFP_KERNEL))
  455. return -ENOMEM;
  456. debugfs_dir = debugfs_create_dir("i7300_idle", NULL);
  457. if (debugfs_dir) {
  458. int i = 0;
  459. while (debugfs_file_list[i].ptr != NULL) {
  460. debugfs_file_list[i].file = debugfs_create_file(
  461. debugfs_file_list[i].name,
  462. S_IRUSR,
  463. debugfs_dir,
  464. debugfs_file_list[i].ptr,
  465. &idle_fops);
  466. i++;
  467. }
  468. }
  469. idle_notifier_register(&i7300_idle_nb);
  470. printk(KERN_INFO "i7300_idle: loaded v%s\n", I7300_IDLE_DRIVER_VERSION);
  471. return 0;
  472. }
  473. static void __exit i7300_idle_exit(void)
  474. {
  475. idle_notifier_unregister(&i7300_idle_nb);
  476. free_cpumask_var(idle_cpumask);
  477. if (debugfs_dir) {
  478. int i = 0;
  479. while (debugfs_file_list[i].file != NULL) {
  480. debugfs_remove(debugfs_file_list[i].file);
  481. i++;
  482. }
  483. debugfs_remove(debugfs_dir);
  484. }
  485. i7300_idle_thrt_restore();
  486. i7300_idle_ioat_exit();
  487. }
  488. module_init(i7300_idle_init);
  489. module_exit(i7300_idle_exit);
  490. MODULE_AUTHOR("Andy Henroid <andrew.d.henroid@intel.com>");
  491. MODULE_DESCRIPTION("Intel Chipset DIMM Idle Power Saving Driver v"
  492. I7300_IDLE_DRIVER_VERSION);
  493. MODULE_LICENSE("GPL");