126717172SLen Brown /* 226717172SLen Brown * intel_idle.c - native hardware idle loop for modern Intel processors 326717172SLen Brown * 4fab04b22SLen Brown * Copyright (c) 2013, Intel Corporation. 526717172SLen Brown * Len Brown <len.brown@intel.com> 626717172SLen Brown * 726717172SLen Brown * This program is free software; you can redistribute it and/or modify it 826717172SLen Brown * under the terms and conditions of the GNU General Public License, 926717172SLen Brown * version 2, as published by the Free Software Foundation. 1026717172SLen Brown * 1126717172SLen Brown * This program is distributed in the hope it will be useful, but WITHOUT 1226717172SLen Brown * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1326717172SLen Brown * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1426717172SLen Brown * more details. 1526717172SLen Brown * 1626717172SLen Brown * You should have received a copy of the GNU General Public License along with 1726717172SLen Brown * this program; if not, write to the Free Software Foundation, Inc., 1826717172SLen Brown * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 1926717172SLen Brown */ 2026717172SLen Brown 2126717172SLen Brown /* 2226717172SLen Brown * intel_idle is a cpuidle driver that loads on specific Intel processors 2326717172SLen Brown * in lieu of the legacy ACPI processor_idle driver. The intent is to 2426717172SLen Brown * make Linux more efficient on these processors, as intel_idle knows 2526717172SLen Brown * more than ACPI, as well as make Linux more immune to ACPI BIOS bugs. 2626717172SLen Brown */ 2726717172SLen Brown 2826717172SLen Brown /* 2926717172SLen Brown * Design Assumptions 3026717172SLen Brown * 3126717172SLen Brown * All CPUs have same idle states as boot CPU 3226717172SLen Brown * 3326717172SLen Brown * Chipset BM_STS (bus master status) bit is a NOP 3426717172SLen Brown * for preventing entry into deep C-stats 3526717172SLen Brown */ 3626717172SLen Brown 3726717172SLen Brown /* 3826717172SLen Brown * Known limitations 3926717172SLen Brown * 4026717172SLen Brown * The driver currently initializes for_each_online_cpu() upon modprobe. 4126717172SLen Brown * It it unaware of subsequent processors hot-added to the system. 4226717172SLen Brown * This means that if you boot with maxcpus=n and later online 4326717172SLen Brown * processors above n, those processors will use C1 only. 4426717172SLen Brown * 4526717172SLen Brown * ACPI has a .suspend hack to turn off deep c-statees during suspend 4626717172SLen Brown * to avoid complications with the lapic timer workaround. 4726717172SLen Brown * Have not seen issues with suspend, but may need same workaround here. 4826717172SLen Brown * 4926717172SLen Brown * There is currently no kernel-based automatic probing/loading mechanism 5026717172SLen Brown * if the driver is built as a module. 5126717172SLen Brown */ 5226717172SLen Brown 5326717172SLen Brown /* un-comment DEBUG to enable pr_debug() statements */ 5426717172SLen Brown #define DEBUG 5526717172SLen Brown 5626717172SLen Brown #include <linux/kernel.h> 5726717172SLen Brown #include <linux/cpuidle.h> 5826717172SLen Brown #include <linux/clockchips.h> 5926717172SLen Brown #include <trace/events/power.h> 6026717172SLen Brown #include <linux/sched.h> 612a2d31c8SShaohua Li #include <linux/notifier.h> 622a2d31c8SShaohua Li #include <linux/cpu.h> 637c52d551SPaul Gortmaker #include <linux/module.h> 64b66b8b9aSAndi Kleen #include <asm/cpu_device_id.h> 65bc83ccccSH. Peter Anvin #include <asm/mwait.h> 6614796fcaSLen Brown #include <asm/msr.h> 6726717172SLen Brown 6826717172SLen Brown #define INTEL_IDLE_VERSION "0.4" 6926717172SLen Brown #define PREFIX "intel_idle: " 7026717172SLen Brown 7126717172SLen Brown static struct cpuidle_driver intel_idle_driver = { 7226717172SLen Brown .name = "intel_idle", 7326717172SLen Brown .owner = THIS_MODULE, 7426717172SLen Brown }; 7526717172SLen Brown /* intel_idle.max_cstate=0 disables driver */ 76137ecc77SLen Brown static int max_cstate = CPUIDLE_STATE_MAX - 1; 7726717172SLen Brown 78c4236282SLen Brown static unsigned int mwait_substates; 7926717172SLen Brown 802a2d31c8SShaohua Li #define LAPIC_TIMER_ALWAYS_RELIABLE 0xFFFFFFFF 8126717172SLen Brown /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ 82d13780d4SLen Brown static unsigned int lapic_timer_reliable_states = (1 << 1); /* Default to only C1 */ 8326717172SLen Brown 84b66b8b9aSAndi Kleen struct idle_cpu { 85b66b8b9aSAndi Kleen struct cpuidle_state *state_table; 8626717172SLen Brown 8726717172SLen Brown /* 8814796fcaSLen Brown * Hardware C-state auto-demotion may not always be optimal. 8914796fcaSLen Brown * Indicate which enable bits to clear here. 9014796fcaSLen Brown */ 91b66b8b9aSAndi Kleen unsigned long auto_demotion_disable_flags; 9232e95180SLen Brown bool disable_promotion_to_c1e; 93b66b8b9aSAndi Kleen }; 94b66b8b9aSAndi Kleen 95b66b8b9aSAndi Kleen static const struct idle_cpu *icpu; 96b66b8b9aSAndi Kleen static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; 97b66b8b9aSAndi Kleen static int intel_idle(struct cpuidle_device *dev, 98b66b8b9aSAndi Kleen struct cpuidle_driver *drv, int index); 9925ac7761SDaniel Lezcano static int intel_idle_cpu_init(int cpu); 100b66b8b9aSAndi Kleen 101b66b8b9aSAndi Kleen static struct cpuidle_state *cpuidle_state_table; 10214796fcaSLen Brown 10314796fcaSLen Brown /* 104956d033fSLen Brown * Set this flag for states where the HW flushes the TLB for us 105956d033fSLen Brown * and so we don't need cross-calls to keep it consistent. 106956d033fSLen Brown * If this flag is set, SW flushes the TLB, so even if the 107956d033fSLen Brown * HW doesn't do the flushing, this flag is safe to use. 108956d033fSLen Brown */ 109956d033fSLen Brown #define CPUIDLE_FLAG_TLB_FLUSHED 0x10000 110956d033fSLen Brown 111956d033fSLen Brown /* 112b1beab48SLen Brown * MWAIT takes an 8-bit "hint" in EAX "suggesting" 113b1beab48SLen Brown * the C-state (top nibble) and sub-state (bottom nibble) 114b1beab48SLen Brown * 0x00 means "MWAIT(C1)", 0x10 means "MWAIT(C2)" etc. 115b1beab48SLen Brown * 116b1beab48SLen Brown * We store the hint at the top of our "flags" for each state. 117b1beab48SLen Brown */ 118b1beab48SLen Brown #define flg2MWAIT(flags) (((flags) >> 24) & 0xFF) 119b1beab48SLen Brown #define MWAIT2flg(eax) ((eax & 0xFF) << 24) 120b1beab48SLen Brown 121b1beab48SLen Brown /* 12226717172SLen Brown * States are indexed by the cstate number, 12326717172SLen Brown * which is also the index into the MWAIT hint array. 12426717172SLen Brown * Thus C0 is a dummy. 12526717172SLen Brown */ 126ba0dc81eSJiang Liu static struct cpuidle_state nehalem_cstates[] = { 127e022e7ebSLen Brown { 12815e123e5SThomas Renninger .name = "C1-NHM", 12926717172SLen Brown .desc = "MWAIT 0x00", 130b1beab48SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 13126717172SLen Brown .exit_latency = 3, 13226717172SLen Brown .target_residency = 6, 13326717172SLen Brown .enter = &intel_idle }, 134e022e7ebSLen Brown { 13532e95180SLen Brown .name = "C1E-NHM", 13632e95180SLen Brown .desc = "MWAIT 0x01", 13732e95180SLen Brown .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 13832e95180SLen Brown .exit_latency = 10, 13932e95180SLen Brown .target_residency = 20, 14032e95180SLen Brown .enter = &intel_idle }, 14132e95180SLen Brown { 14215e123e5SThomas Renninger .name = "C3-NHM", 14326717172SLen Brown .desc = "MWAIT 0x10", 144b1beab48SLen Brown .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 14526717172SLen Brown .exit_latency = 20, 14626717172SLen Brown .target_residency = 80, 14726717172SLen Brown .enter = &intel_idle }, 148e022e7ebSLen Brown { 14915e123e5SThomas Renninger .name = "C6-NHM", 15026717172SLen Brown .desc = "MWAIT 0x20", 151b1beab48SLen Brown .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 15226717172SLen Brown .exit_latency = 200, 15326717172SLen Brown .target_residency = 800, 15426717172SLen Brown .enter = &intel_idle }, 155e022e7ebSLen Brown { 156e022e7ebSLen Brown .enter = NULL } 15726717172SLen Brown }; 15826717172SLen Brown 159ba0dc81eSJiang Liu static struct cpuidle_state snb_cstates[] = { 160e022e7ebSLen Brown { 16115e123e5SThomas Renninger .name = "C1-SNB", 162d13780d4SLen Brown .desc = "MWAIT 0x00", 163b1beab48SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 16432e95180SLen Brown .exit_latency = 2, 16532e95180SLen Brown .target_residency = 2, 16632e95180SLen Brown .enter = &intel_idle }, 16732e95180SLen Brown { 16832e95180SLen Brown .name = "C1E-SNB", 16932e95180SLen Brown .desc = "MWAIT 0x01", 17032e95180SLen Brown .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 17132e95180SLen Brown .exit_latency = 10, 17232e95180SLen Brown .target_residency = 20, 173d13780d4SLen Brown .enter = &intel_idle }, 174e022e7ebSLen Brown { 17515e123e5SThomas Renninger .name = "C3-SNB", 176d13780d4SLen Brown .desc = "MWAIT 0x10", 177b1beab48SLen Brown .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 178d13780d4SLen Brown .exit_latency = 80, 179ddbd550dSLen Brown .target_residency = 211, 180d13780d4SLen Brown .enter = &intel_idle }, 181e022e7ebSLen Brown { 18215e123e5SThomas Renninger .name = "C6-SNB", 183d13780d4SLen Brown .desc = "MWAIT 0x20", 184b1beab48SLen Brown .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 185d13780d4SLen Brown .exit_latency = 104, 186ddbd550dSLen Brown .target_residency = 345, 187d13780d4SLen Brown .enter = &intel_idle }, 188e022e7ebSLen Brown { 18915e123e5SThomas Renninger .name = "C7-SNB", 190d13780d4SLen Brown .desc = "MWAIT 0x30", 191b1beab48SLen Brown .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 192d13780d4SLen Brown .exit_latency = 109, 193ddbd550dSLen Brown .target_residency = 345, 194d13780d4SLen Brown .enter = &intel_idle }, 195e022e7ebSLen Brown { 196e022e7ebSLen Brown .enter = NULL } 197d13780d4SLen Brown }; 198d13780d4SLen Brown 199718987d6SLen Brown static struct cpuidle_state byt_cstates[] = { 200718987d6SLen Brown { 201718987d6SLen Brown .name = "C1-BYT", 202718987d6SLen Brown .desc = "MWAIT 0x00", 203718987d6SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 204718987d6SLen Brown .exit_latency = 1, 205718987d6SLen Brown .target_residency = 1, 206718987d6SLen Brown .enter = &intel_idle }, 207718987d6SLen Brown { 208718987d6SLen Brown .name = "C1E-BYT", 209718987d6SLen Brown .desc = "MWAIT 0x01", 210718987d6SLen Brown .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 211718987d6SLen Brown .exit_latency = 15, 212718987d6SLen Brown .target_residency = 30, 213718987d6SLen Brown .enter = &intel_idle }, 214718987d6SLen Brown { 215718987d6SLen Brown .name = "C6N-BYT", 216718987d6SLen Brown .desc = "MWAIT 0x58", 217718987d6SLen Brown .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 218718987d6SLen Brown .exit_latency = 40, 219718987d6SLen Brown .target_residency = 275, 220718987d6SLen Brown .enter = &intel_idle }, 221718987d6SLen Brown { 222718987d6SLen Brown .name = "C6S-BYT", 223718987d6SLen Brown .desc = "MWAIT 0x52", 224718987d6SLen Brown .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 225718987d6SLen Brown .exit_latency = 140, 226718987d6SLen Brown .target_residency = 560, 227718987d6SLen Brown .enter = &intel_idle }, 228718987d6SLen Brown { 229718987d6SLen Brown .name = "C7-BYT", 230718987d6SLen Brown .desc = "MWAIT 0x60", 231718987d6SLen Brown .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 232718987d6SLen Brown .exit_latency = 1200, 233718987d6SLen Brown .target_residency = 1500, 234718987d6SLen Brown .enter = &intel_idle }, 235718987d6SLen Brown { 236718987d6SLen Brown .name = "C7S-BYT", 237718987d6SLen Brown .desc = "MWAIT 0x64", 238718987d6SLen Brown .flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 239718987d6SLen Brown .exit_latency = 10000, 240718987d6SLen Brown .target_residency = 20000, 241718987d6SLen Brown .enter = &intel_idle }, 242718987d6SLen Brown { 243718987d6SLen Brown .enter = NULL } 244718987d6SLen Brown }; 245718987d6SLen Brown 246ba0dc81eSJiang Liu static struct cpuidle_state ivb_cstates[] = { 247e022e7ebSLen Brown { 2486edab08cSLen Brown .name = "C1-IVB", 2496edab08cSLen Brown .desc = "MWAIT 0x00", 250b1beab48SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 2516edab08cSLen Brown .exit_latency = 1, 2526edab08cSLen Brown .target_residency = 1, 2536edab08cSLen Brown .enter = &intel_idle }, 254e022e7ebSLen Brown { 25532e95180SLen Brown .name = "C1E-IVB", 25632e95180SLen Brown .desc = "MWAIT 0x01", 25732e95180SLen Brown .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 25832e95180SLen Brown .exit_latency = 10, 25932e95180SLen Brown .target_residency = 20, 26032e95180SLen Brown .enter = &intel_idle }, 26132e95180SLen Brown { 2626edab08cSLen Brown .name = "C3-IVB", 2636edab08cSLen Brown .desc = "MWAIT 0x10", 264b1beab48SLen Brown .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 2656edab08cSLen Brown .exit_latency = 59, 2666edab08cSLen Brown .target_residency = 156, 2676edab08cSLen Brown .enter = &intel_idle }, 268e022e7ebSLen Brown { 2696edab08cSLen Brown .name = "C6-IVB", 2706edab08cSLen Brown .desc = "MWAIT 0x20", 271b1beab48SLen Brown .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 2726edab08cSLen Brown .exit_latency = 80, 2736edab08cSLen Brown .target_residency = 300, 2746edab08cSLen Brown .enter = &intel_idle }, 275e022e7ebSLen Brown { 2766edab08cSLen Brown .name = "C7-IVB", 2776edab08cSLen Brown .desc = "MWAIT 0x30", 278b1beab48SLen Brown .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 2796edab08cSLen Brown .exit_latency = 87, 2806edab08cSLen Brown .target_residency = 300, 2816edab08cSLen Brown .enter = &intel_idle }, 282e022e7ebSLen Brown { 283e022e7ebSLen Brown .enter = NULL } 2846edab08cSLen Brown }; 2856edab08cSLen Brown 286ba0dc81eSJiang Liu static struct cpuidle_state hsw_cstates[] = { 287e022e7ebSLen Brown { 28885a4d2d4SLen Brown .name = "C1-HSW", 28985a4d2d4SLen Brown .desc = "MWAIT 0x00", 29085a4d2d4SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 29185a4d2d4SLen Brown .exit_latency = 2, 29285a4d2d4SLen Brown .target_residency = 2, 29385a4d2d4SLen Brown .enter = &intel_idle }, 294e022e7ebSLen Brown { 29532e95180SLen Brown .name = "C1E-HSW", 29632e95180SLen Brown .desc = "MWAIT 0x01", 29732e95180SLen Brown .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 29832e95180SLen Brown .exit_latency = 10, 29932e95180SLen Brown .target_residency = 20, 30032e95180SLen Brown .enter = &intel_idle }, 30132e95180SLen Brown { 30285a4d2d4SLen Brown .name = "C3-HSW", 30385a4d2d4SLen Brown .desc = "MWAIT 0x10", 30485a4d2d4SLen Brown .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 30585a4d2d4SLen Brown .exit_latency = 33, 30685a4d2d4SLen Brown .target_residency = 100, 30785a4d2d4SLen Brown .enter = &intel_idle }, 308e022e7ebSLen Brown { 30985a4d2d4SLen Brown .name = "C6-HSW", 31085a4d2d4SLen Brown .desc = "MWAIT 0x20", 31185a4d2d4SLen Brown .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 31285a4d2d4SLen Brown .exit_latency = 133, 31385a4d2d4SLen Brown .target_residency = 400, 31485a4d2d4SLen Brown .enter = &intel_idle }, 315e022e7ebSLen Brown { 31685a4d2d4SLen Brown .name = "C7s-HSW", 31785a4d2d4SLen Brown .desc = "MWAIT 0x32", 31885a4d2d4SLen Brown .flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 31985a4d2d4SLen Brown .exit_latency = 166, 32085a4d2d4SLen Brown .target_residency = 500, 32185a4d2d4SLen Brown .enter = &intel_idle }, 322e022e7ebSLen Brown { 32386239cebSLen Brown .name = "C8-HSW", 32486239cebSLen Brown .desc = "MWAIT 0x40", 32586239cebSLen Brown .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 32686239cebSLen Brown .exit_latency = 300, 32786239cebSLen Brown .target_residency = 900, 32886239cebSLen Brown .enter = &intel_idle }, 32986239cebSLen Brown { 33086239cebSLen Brown .name = "C9-HSW", 33186239cebSLen Brown .desc = "MWAIT 0x50", 33286239cebSLen Brown .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 33386239cebSLen Brown .exit_latency = 600, 33486239cebSLen Brown .target_residency = 1800, 33586239cebSLen Brown .enter = &intel_idle }, 33686239cebSLen Brown { 33786239cebSLen Brown .name = "C10-HSW", 33886239cebSLen Brown .desc = "MWAIT 0x60", 33986239cebSLen Brown .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 34086239cebSLen Brown .exit_latency = 2600, 34186239cebSLen Brown .target_residency = 7700, 34286239cebSLen Brown .enter = &intel_idle }, 34386239cebSLen Brown { 344e022e7ebSLen Brown .enter = NULL } 34585a4d2d4SLen Brown }; 34685a4d2d4SLen Brown 347ba0dc81eSJiang Liu static struct cpuidle_state atom_cstates[] = { 348e022e7ebSLen Brown { 34932e95180SLen Brown .name = "C1E-ATM", 35026717172SLen Brown .desc = "MWAIT 0x00", 351b1beab48SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 35232e95180SLen Brown .exit_latency = 10, 35332e95180SLen Brown .target_residency = 20, 35426717172SLen Brown .enter = &intel_idle }, 355e022e7ebSLen Brown { 35615e123e5SThomas Renninger .name = "C2-ATM", 35726717172SLen Brown .desc = "MWAIT 0x10", 358b1beab48SLen Brown .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID, 35926717172SLen Brown .exit_latency = 20, 36026717172SLen Brown .target_residency = 80, 36126717172SLen Brown .enter = &intel_idle }, 362e022e7ebSLen Brown { 36315e123e5SThomas Renninger .name = "C4-ATM", 36426717172SLen Brown .desc = "MWAIT 0x30", 365b1beab48SLen Brown .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 36626717172SLen Brown .exit_latency = 100, 36726717172SLen Brown .target_residency = 400, 36826717172SLen Brown .enter = &intel_idle }, 369e022e7ebSLen Brown { 37015e123e5SThomas Renninger .name = "C6-ATM", 3717fcca7d9SLen Brown .desc = "MWAIT 0x52", 372b1beab48SLen Brown .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 3737fcca7d9SLen Brown .exit_latency = 140, 3747fcca7d9SLen Brown .target_residency = 560, 3757fcca7d9SLen Brown .enter = &intel_idle }, 376e022e7ebSLen Brown { 377e022e7ebSLen Brown .enter = NULL } 37826717172SLen Brown }; 37988390996SJiang Liu static struct cpuidle_state avn_cstates[] = { 380fab04b22SLen Brown { 381fab04b22SLen Brown .name = "C1-AVN", 382fab04b22SLen Brown .desc = "MWAIT 0x00", 383fab04b22SLen Brown .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 384fab04b22SLen Brown .exit_latency = 2, 385fab04b22SLen Brown .target_residency = 2, 386fab04b22SLen Brown .enter = &intel_idle }, 387fab04b22SLen Brown { 388fab04b22SLen Brown .name = "C6-AVN", 389fab04b22SLen Brown .desc = "MWAIT 0x51", 39022e580d0SBockholdt Arne .flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 391fab04b22SLen Brown .exit_latency = 15, 392fab04b22SLen Brown .target_residency = 45, 393fab04b22SLen Brown .enter = &intel_idle }, 39488390996SJiang Liu { 39588390996SJiang Liu .enter = NULL } 396fab04b22SLen Brown }; 39726717172SLen Brown 39826717172SLen Brown /** 39926717172SLen Brown * intel_idle 40026717172SLen Brown * @dev: cpuidle_device 40146bcfad7SDeepthi Dharwar * @drv: cpuidle driver 402e978aa7dSDeepthi Dharwar * @index: index of cpuidle state 40326717172SLen Brown * 40463ff07beSYanmin Zhang * Must be called under local_irq_disable(). 40526717172SLen Brown */ 40646bcfad7SDeepthi Dharwar static int intel_idle(struct cpuidle_device *dev, 40746bcfad7SDeepthi Dharwar struct cpuidle_driver *drv, int index) 40826717172SLen Brown { 40926717172SLen Brown unsigned long ecx = 1; /* break on interrupt flag */ 41046bcfad7SDeepthi Dharwar struct cpuidle_state *state = &drv->states[index]; 411b1beab48SLen Brown unsigned long eax = flg2MWAIT(state->flags); 41226717172SLen Brown unsigned int cstate; 41326717172SLen Brown int cpu = smp_processor_id(); 41426717172SLen Brown 41526717172SLen Brown cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1; 41626717172SLen Brown 4176110a1f4SSuresh Siddha /* 418c8381cc3SLen Brown * leave_mm() to avoid costly and often unnecessary wakeups 419c8381cc3SLen Brown * for flushing the user TLB's associated with the active mm. 4206110a1f4SSuresh Siddha */ 421c8381cc3SLen Brown if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED) 4226110a1f4SSuresh Siddha leave_mm(cpu); 4236110a1f4SSuresh Siddha 42426717172SLen Brown if (!(lapic_timer_reliable_states & (1 << (cstate)))) 42526717172SLen Brown clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); 42626717172SLen Brown 42716824255SPeter Zijlstra mwait_idle_with_hints(eax, ecx); 42826717172SLen Brown 42926717172SLen Brown if (!(lapic_timer_reliable_states & (1 << (cstate)))) 43026717172SLen Brown clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); 43126717172SLen Brown 432e978aa7dSDeepthi Dharwar return index; 43326717172SLen Brown } 43426717172SLen Brown 4352a2d31c8SShaohua Li static void __setup_broadcast_timer(void *arg) 4362a2d31c8SShaohua Li { 4372a2d31c8SShaohua Li unsigned long reason = (unsigned long)arg; 4382a2d31c8SShaohua Li int cpu = smp_processor_id(); 4392a2d31c8SShaohua Li 4402a2d31c8SShaohua Li reason = reason ? 4412a2d31c8SShaohua Li CLOCK_EVT_NOTIFY_BROADCAST_ON : CLOCK_EVT_NOTIFY_BROADCAST_OFF; 4422a2d31c8SShaohua Li 4432a2d31c8SShaohua Li clockevents_notify(reason, &cpu); 4442a2d31c8SShaohua Li } 4452a2d31c8SShaohua Li 44625ac7761SDaniel Lezcano static int cpu_hotplug_notify(struct notifier_block *n, 4472a2d31c8SShaohua Li unsigned long action, void *hcpu) 4482a2d31c8SShaohua Li { 4492a2d31c8SShaohua Li int hotcpu = (unsigned long)hcpu; 45025ac7761SDaniel Lezcano struct cpuidle_device *dev; 4512a2d31c8SShaohua Li 452e2401453SPrarit Bhargava switch (action & ~CPU_TASKS_FROZEN) { 4532a2d31c8SShaohua Li case CPU_ONLINE: 45425ac7761SDaniel Lezcano 45525ac7761SDaniel Lezcano if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) 4562a2d31c8SShaohua Li smp_call_function_single(hotcpu, __setup_broadcast_timer, 4572a2d31c8SShaohua Li (void *)true, 1); 45825ac7761SDaniel Lezcano 45925ac7761SDaniel Lezcano /* 46025ac7761SDaniel Lezcano * Some systems can hotplug a cpu at runtime after 46125ac7761SDaniel Lezcano * the kernel has booted, we have to initialize the 46225ac7761SDaniel Lezcano * driver in this case 46325ac7761SDaniel Lezcano */ 46425ac7761SDaniel Lezcano dev = per_cpu_ptr(intel_idle_cpuidle_devices, hotcpu); 46525ac7761SDaniel Lezcano if (!dev->registered) 46625ac7761SDaniel Lezcano intel_idle_cpu_init(hotcpu); 46725ac7761SDaniel Lezcano 4682a2d31c8SShaohua Li break; 4692a2d31c8SShaohua Li } 4702a2d31c8SShaohua Li return NOTIFY_OK; 4712a2d31c8SShaohua Li } 4722a2d31c8SShaohua Li 47325ac7761SDaniel Lezcano static struct notifier_block cpu_hotplug_notifier = { 47425ac7761SDaniel Lezcano .notifier_call = cpu_hotplug_notify, 4752a2d31c8SShaohua Li }; 4762a2d31c8SShaohua Li 47714796fcaSLen Brown static void auto_demotion_disable(void *dummy) 47814796fcaSLen Brown { 47914796fcaSLen Brown unsigned long long msr_bits; 48014796fcaSLen Brown 48114796fcaSLen Brown rdmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); 482b66b8b9aSAndi Kleen msr_bits &= ~(icpu->auto_demotion_disable_flags); 48314796fcaSLen Brown wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); 48414796fcaSLen Brown } 48532e95180SLen Brown static void c1e_promotion_disable(void *dummy) 48632e95180SLen Brown { 48732e95180SLen Brown unsigned long long msr_bits; 48832e95180SLen Brown 48932e95180SLen Brown rdmsrl(MSR_IA32_POWER_CTL, msr_bits); 49032e95180SLen Brown msr_bits &= ~0x2; 49132e95180SLen Brown wrmsrl(MSR_IA32_POWER_CTL, msr_bits); 49232e95180SLen Brown } 49314796fcaSLen Brown 494b66b8b9aSAndi Kleen static const struct idle_cpu idle_cpu_nehalem = { 495b66b8b9aSAndi Kleen .state_table = nehalem_cstates, 496b66b8b9aSAndi Kleen .auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE, 49732e95180SLen Brown .disable_promotion_to_c1e = true, 498b66b8b9aSAndi Kleen }; 499b66b8b9aSAndi Kleen 500b66b8b9aSAndi Kleen static const struct idle_cpu idle_cpu_atom = { 501b66b8b9aSAndi Kleen .state_table = atom_cstates, 502b66b8b9aSAndi Kleen }; 503b66b8b9aSAndi Kleen 504b66b8b9aSAndi Kleen static const struct idle_cpu idle_cpu_lincroft = { 505b66b8b9aSAndi Kleen .state_table = atom_cstates, 506b66b8b9aSAndi Kleen .auto_demotion_disable_flags = ATM_LNC_C6_AUTO_DEMOTE, 507b66b8b9aSAndi Kleen }; 508b66b8b9aSAndi Kleen 509b66b8b9aSAndi Kleen static const struct idle_cpu idle_cpu_snb = { 510b66b8b9aSAndi Kleen .state_table = snb_cstates, 51132e95180SLen Brown .disable_promotion_to_c1e = true, 512b66b8b9aSAndi Kleen }; 513b66b8b9aSAndi Kleen 514718987d6SLen Brown static const struct idle_cpu idle_cpu_byt = { 515718987d6SLen Brown .state_table = byt_cstates, 516718987d6SLen Brown .disable_promotion_to_c1e = true, 517718987d6SLen Brown }; 518718987d6SLen Brown 5196edab08cSLen Brown static const struct idle_cpu idle_cpu_ivb = { 5206edab08cSLen Brown .state_table = ivb_cstates, 52132e95180SLen Brown .disable_promotion_to_c1e = true, 5226edab08cSLen Brown }; 5236edab08cSLen Brown 52485a4d2d4SLen Brown static const struct idle_cpu idle_cpu_hsw = { 52585a4d2d4SLen Brown .state_table = hsw_cstates, 52632e95180SLen Brown .disable_promotion_to_c1e = true, 52785a4d2d4SLen Brown }; 52885a4d2d4SLen Brown 529fab04b22SLen Brown static const struct idle_cpu idle_cpu_avn = { 530fab04b22SLen Brown .state_table = avn_cstates, 531fab04b22SLen Brown .disable_promotion_to_c1e = true, 532fab04b22SLen Brown }; 533fab04b22SLen Brown 534b66b8b9aSAndi Kleen #define ICPU(model, cpu) \ 535b66b8b9aSAndi Kleen { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } 536b66b8b9aSAndi Kleen 537b66b8b9aSAndi Kleen static const struct x86_cpu_id intel_idle_ids[] = { 538b66b8b9aSAndi Kleen ICPU(0x1a, idle_cpu_nehalem), 539b66b8b9aSAndi Kleen ICPU(0x1e, idle_cpu_nehalem), 540b66b8b9aSAndi Kleen ICPU(0x1f, idle_cpu_nehalem), 5418bf11938SBen Hutchings ICPU(0x25, idle_cpu_nehalem), 5428bf11938SBen Hutchings ICPU(0x2c, idle_cpu_nehalem), 5438bf11938SBen Hutchings ICPU(0x2e, idle_cpu_nehalem), 544b66b8b9aSAndi Kleen ICPU(0x1c, idle_cpu_atom), 545b66b8b9aSAndi Kleen ICPU(0x26, idle_cpu_lincroft), 5468bf11938SBen Hutchings ICPU(0x2f, idle_cpu_nehalem), 547b66b8b9aSAndi Kleen ICPU(0x2a, idle_cpu_snb), 548b66b8b9aSAndi Kleen ICPU(0x2d, idle_cpu_snb), 549acead1b0SJan Kiszka ICPU(0x36, idle_cpu_atom), 550718987d6SLen Brown ICPU(0x37, idle_cpu_byt), 5516edab08cSLen Brown ICPU(0x3a, idle_cpu_ivb), 55223795e58SLen Brown ICPU(0x3e, idle_cpu_ivb), 55385a4d2d4SLen Brown ICPU(0x3c, idle_cpu_hsw), 55485a4d2d4SLen Brown ICPU(0x3f, idle_cpu_hsw), 55585a4d2d4SLen Brown ICPU(0x45, idle_cpu_hsw), 5560b15841bSLen Brown ICPU(0x46, idle_cpu_hsw), 557fab04b22SLen Brown ICPU(0x4D, idle_cpu_avn), 558b66b8b9aSAndi Kleen {} 559b66b8b9aSAndi Kleen }; 560b66b8b9aSAndi Kleen MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); 561b66b8b9aSAndi Kleen 56226717172SLen Brown /* 56326717172SLen Brown * intel_idle_probe() 56426717172SLen Brown */ 56500f3e755SBartlomiej Zolnierkiewicz static int __init intel_idle_probe(void) 56626717172SLen Brown { 567c4236282SLen Brown unsigned int eax, ebx, ecx; 568b66b8b9aSAndi Kleen const struct x86_cpu_id *id; 56926717172SLen Brown 57026717172SLen Brown if (max_cstate == 0) { 57126717172SLen Brown pr_debug(PREFIX "disabled\n"); 57226717172SLen Brown return -EPERM; 57326717172SLen Brown } 57426717172SLen Brown 575b66b8b9aSAndi Kleen id = x86_match_cpu(intel_idle_ids); 576b66b8b9aSAndi Kleen if (!id) { 577b66b8b9aSAndi Kleen if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && 578b66b8b9aSAndi Kleen boot_cpu_data.x86 == 6) 579b66b8b9aSAndi Kleen pr_debug(PREFIX "does not run on family %d model %d\n", 580b66b8b9aSAndi Kleen boot_cpu_data.x86, boot_cpu_data.x86_model); 58126717172SLen Brown return -ENODEV; 582b66b8b9aSAndi Kleen } 58326717172SLen Brown 58426717172SLen Brown if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) 58526717172SLen Brown return -ENODEV; 58626717172SLen Brown 587c4236282SLen Brown cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates); 58826717172SLen Brown 58926717172SLen Brown if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || 5905c2a9f06SThomas Renninger !(ecx & CPUID5_ECX_INTERRUPT_BREAK) || 5915c2a9f06SThomas Renninger !mwait_substates) 59226717172SLen Brown return -ENODEV; 59326717172SLen Brown 594c4236282SLen Brown pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates); 59526717172SLen Brown 596b66b8b9aSAndi Kleen icpu = (const struct idle_cpu *)id->driver_data; 597b66b8b9aSAndi Kleen cpuidle_state_table = icpu->state_table; 59826717172SLen Brown 59956b9aea3SLen Brown if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ 6002a2d31c8SShaohua Li lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE; 60125ac7761SDaniel Lezcano else 60239a74fdeSShaohua Li on_each_cpu(__setup_broadcast_timer, (void *)true, 1); 60325ac7761SDaniel Lezcano 60426717172SLen Brown pr_debug(PREFIX "v" INTEL_IDLE_VERSION 60526717172SLen Brown " model 0x%X\n", boot_cpu_data.x86_model); 60626717172SLen Brown 60726717172SLen Brown pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n", 60826717172SLen Brown lapic_timer_reliable_states); 60926717172SLen Brown return 0; 61026717172SLen Brown } 61126717172SLen Brown 61226717172SLen Brown /* 61326717172SLen Brown * intel_idle_cpuidle_devices_uninit() 61426717172SLen Brown * unregister, free cpuidle_devices 61526717172SLen Brown */ 61626717172SLen Brown static void intel_idle_cpuidle_devices_uninit(void) 61726717172SLen Brown { 61826717172SLen Brown int i; 61926717172SLen Brown struct cpuidle_device *dev; 62026717172SLen Brown 62126717172SLen Brown for_each_online_cpu(i) { 62226717172SLen Brown dev = per_cpu_ptr(intel_idle_cpuidle_devices, i); 62326717172SLen Brown cpuidle_unregister_device(dev); 62426717172SLen Brown } 62526717172SLen Brown 62626717172SLen Brown free_percpu(intel_idle_cpuidle_devices); 62726717172SLen Brown return; 62826717172SLen Brown } 62926717172SLen Brown /* 63046bcfad7SDeepthi Dharwar * intel_idle_cpuidle_driver_init() 63146bcfad7SDeepthi Dharwar * allocate, initialize cpuidle_states 63246bcfad7SDeepthi Dharwar */ 63300f3e755SBartlomiej Zolnierkiewicz static int __init intel_idle_cpuidle_driver_init(void) 63446bcfad7SDeepthi Dharwar { 63546bcfad7SDeepthi Dharwar int cstate; 63646bcfad7SDeepthi Dharwar struct cpuidle_driver *drv = &intel_idle_driver; 63746bcfad7SDeepthi Dharwar 63846bcfad7SDeepthi Dharwar drv->state_count = 1; 63946bcfad7SDeepthi Dharwar 640e022e7ebSLen Brown for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { 64124bfa950SLen Brown int num_substates, mwait_hint, mwait_cstate; 64246bcfad7SDeepthi Dharwar 643e022e7ebSLen Brown if (cpuidle_state_table[cstate].enter == NULL) 644e022e7ebSLen Brown break; 645e022e7ebSLen Brown 646e022e7ebSLen Brown if (cstate + 1 > max_cstate) { 64746bcfad7SDeepthi Dharwar printk(PREFIX "max_cstate %d reached\n", 64846bcfad7SDeepthi Dharwar max_cstate); 64946bcfad7SDeepthi Dharwar break; 65046bcfad7SDeepthi Dharwar } 65146bcfad7SDeepthi Dharwar 652e022e7ebSLen Brown mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags); 653e022e7ebSLen Brown mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint); 65446bcfad7SDeepthi Dharwar 65524bfa950SLen Brown /* number of sub-states for this state in CPUID.MWAIT */ 656e022e7ebSLen Brown num_substates = (mwait_substates >> ((mwait_cstate + 1) * 4)) 657e022e7ebSLen Brown & MWAIT_SUBSTATE_MASK; 658e022e7ebSLen Brown 65924bfa950SLen Brown /* if NO sub-states for this state in CPUID, skip it */ 66024bfa950SLen Brown if (num_substates == 0) 661e022e7ebSLen Brown continue; 662e022e7ebSLen Brown 663e022e7ebSLen Brown if (((mwait_cstate + 1) > 2) && 66446bcfad7SDeepthi Dharwar !boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 66546bcfad7SDeepthi Dharwar mark_tsc_unstable("TSC halts in idle" 66646bcfad7SDeepthi Dharwar " states deeper than C2"); 66746bcfad7SDeepthi Dharwar 66846bcfad7SDeepthi Dharwar drv->states[drv->state_count] = /* structure copy */ 66946bcfad7SDeepthi Dharwar cpuidle_state_table[cstate]; 67046bcfad7SDeepthi Dharwar 67146bcfad7SDeepthi Dharwar drv->state_count += 1; 67246bcfad7SDeepthi Dharwar } 67346bcfad7SDeepthi Dharwar 674b66b8b9aSAndi Kleen if (icpu->auto_demotion_disable_flags) 67539a74fdeSShaohua Li on_each_cpu(auto_demotion_disable, NULL, 1); 67646bcfad7SDeepthi Dharwar 67732e95180SLen Brown if (icpu->disable_promotion_to_c1e) /* each-cpu is redundant */ 67832e95180SLen Brown on_each_cpu(c1e_promotion_disable, NULL, 1); 67932e95180SLen Brown 68046bcfad7SDeepthi Dharwar return 0; 68146bcfad7SDeepthi Dharwar } 68246bcfad7SDeepthi Dharwar 68346bcfad7SDeepthi Dharwar 68446bcfad7SDeepthi Dharwar /* 68565b7f839SThomas Renninger * intel_idle_cpu_init() 68626717172SLen Brown * allocate, initialize, register cpuidle_devices 68765b7f839SThomas Renninger * @cpu: cpu/core to initialize 68826717172SLen Brown */ 68925ac7761SDaniel Lezcano static int intel_idle_cpu_init(int cpu) 69026717172SLen Brown { 69126717172SLen Brown struct cpuidle_device *dev; 69226717172SLen Brown 69365b7f839SThomas Renninger dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu); 69426717172SLen Brown 69565b7f839SThomas Renninger dev->cpu = cpu; 69626717172SLen Brown 69726717172SLen Brown if (cpuidle_register_device(dev)) { 69865b7f839SThomas Renninger pr_debug(PREFIX "cpuidle_register_device %d failed!\n", cpu); 69926717172SLen Brown intel_idle_cpuidle_devices_uninit(); 70026717172SLen Brown return -EIO; 70126717172SLen Brown } 70265b7f839SThomas Renninger 703b66b8b9aSAndi Kleen if (icpu->auto_demotion_disable_flags) 70465b7f839SThomas Renninger smp_call_function_single(cpu, auto_demotion_disable, NULL, 1); 70526717172SLen Brown 706dbf87ab8SBartlomiej Zolnierkiewicz if (icpu->disable_promotion_to_c1e) 707dbf87ab8SBartlomiej Zolnierkiewicz smp_call_function_single(cpu, c1e_promotion_disable, NULL, 1); 708dbf87ab8SBartlomiej Zolnierkiewicz 70926717172SLen Brown return 0; 71026717172SLen Brown } 71126717172SLen Brown 71226717172SLen Brown static int __init intel_idle_init(void) 71326717172SLen Brown { 71465b7f839SThomas Renninger int retval, i; 71526717172SLen Brown 716d1896049SThomas Renninger /* Do not load intel_idle at all for now if idle= is passed */ 717d1896049SThomas Renninger if (boot_option_idle_override != IDLE_NO_OVERRIDE) 718d1896049SThomas Renninger return -ENODEV; 719d1896049SThomas Renninger 72026717172SLen Brown retval = intel_idle_probe(); 72126717172SLen Brown if (retval) 72226717172SLen Brown return retval; 72326717172SLen Brown 72446bcfad7SDeepthi Dharwar intel_idle_cpuidle_driver_init(); 72526717172SLen Brown retval = cpuidle_register_driver(&intel_idle_driver); 72626717172SLen Brown if (retval) { 7273735d524SKonrad Rzeszutek Wilk struct cpuidle_driver *drv = cpuidle_get_driver(); 72826717172SLen Brown printk(KERN_DEBUG PREFIX "intel_idle yielding to %s", 7293735d524SKonrad Rzeszutek Wilk drv ? drv->name : "none"); 73026717172SLen Brown return retval; 73126717172SLen Brown } 73226717172SLen Brown 73365b7f839SThomas Renninger intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device); 73465b7f839SThomas Renninger if (intel_idle_cpuidle_devices == NULL) 73565b7f839SThomas Renninger return -ENOMEM; 73665b7f839SThomas Renninger 73765b7f839SThomas Renninger for_each_online_cpu(i) { 73865b7f839SThomas Renninger retval = intel_idle_cpu_init(i); 73926717172SLen Brown if (retval) { 74026717172SLen Brown cpuidle_unregister_driver(&intel_idle_driver); 74126717172SLen Brown return retval; 74226717172SLen Brown } 74365b7f839SThomas Renninger } 7446f8c2e79SKonrad Rzeszutek Wilk register_cpu_notifier(&cpu_hotplug_notifier); 74526717172SLen Brown 74626717172SLen Brown return 0; 74726717172SLen Brown } 74826717172SLen Brown 74926717172SLen Brown static void __exit intel_idle_exit(void) 75026717172SLen Brown { 75126717172SLen Brown intel_idle_cpuidle_devices_uninit(); 75226717172SLen Brown cpuidle_unregister_driver(&intel_idle_driver); 75326717172SLen Brown 75425ac7761SDaniel Lezcano 75525ac7761SDaniel Lezcano if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) 75639a74fdeSShaohua Li on_each_cpu(__setup_broadcast_timer, (void *)false, 1); 75725ac7761SDaniel Lezcano unregister_cpu_notifier(&cpu_hotplug_notifier); 7582a2d31c8SShaohua Li 75926717172SLen Brown return; 76026717172SLen Brown } 76126717172SLen Brown 76226717172SLen Brown module_init(intel_idle_init); 76326717172SLen Brown module_exit(intel_idle_exit); 76426717172SLen Brown 76526717172SLen Brown module_param(max_cstate, int, 0444); 76626717172SLen Brown 76726717172SLen Brown MODULE_AUTHOR("Len Brown <len.brown@intel.com>"); 76826717172SLen Brown MODULE_DESCRIPTION("Cpuidle driver for Intel Hardware v" INTEL_IDLE_VERSION); 76926717172SLen Brown MODULE_LICENSE("GPL"); 770