Thomas Gleixner | a61127c | 2019-05-29 16:57:49 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 2 | /* |
| 3 | * intel_idle.c - native hardware idle loop for modern Intel processors |
| 4 | * |
Rafael J. Wysocki | 317e5ec | 2020-02-06 18:45:49 +0100 | [diff] [blame] | 5 | * Copyright (c) 2013 - 2020, Intel Corporation. |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 6 | * Len Brown <len.brown@intel.com> |
Rafael J. Wysocki | 317e5ec | 2020-02-06 18:45:49 +0100 | [diff] [blame] | 7 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * intel_idle is a cpuidle driver that loads on specific Intel processors |
| 12 | * in lieu of the legacy ACPI processor_idle driver. The intent is to |
| 13 | * make Linux more efficient on these processors, as intel_idle knows |
| 14 | * more than ACPI, as well as make Linux more immune to ACPI BIOS bugs. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * Design Assumptions |
| 19 | * |
| 20 | * All CPUs have same idle states as boot CPU |
| 21 | * |
| 22 | * Chipset BM_STS (bus master status) bit is a NOP |
| 23 | * for preventing entry into deep C-stats |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | * Known limitations |
| 28 | * |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 29 | * ACPI has a .suspend hack to turn off deep c-statees during suspend |
| 30 | * to avoid complications with the lapic timer workaround. |
| 31 | * Have not seen issues with suspend, but may need same workaround here. |
| 32 | * |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 33 | */ |
| 34 | |
| 35 | /* un-comment DEBUG to enable pr_debug() statements */ |
| 36 | #define DEBUG |
| 37 | |
Joe Perches | 654d08a | 2017-06-09 12:29:20 -0700 | [diff] [blame] | 38 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 39 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 40 | #include <linux/acpi.h> |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 41 | #include <linux/kernel.h> |
| 42 | #include <linux/cpuidle.h> |
Thomas Gleixner | 76962ca | 2015-04-03 02:02:34 +0200 | [diff] [blame] | 43 | #include <linux/tick.h> |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 44 | #include <trace/events/power.h> |
| 45 | #include <linux/sched.h> |
Shaohua Li | 2a2d31c | 2011-01-10 09:38:12 +0800 | [diff] [blame] | 46 | #include <linux/notifier.h> |
| 47 | #include <linux/cpu.h> |
Paul Gortmaker | 02c4fae | 2016-06-17 01:28:33 -0400 | [diff] [blame] | 48 | #include <linux/moduleparam.h> |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 49 | #include <asm/cpu_device_id.h> |
Dave Hansen | db73c5a | 2016-06-02 17:19:32 -0700 | [diff] [blame] | 50 | #include <asm/intel-family.h> |
H. Peter Anvin | bc83ccc | 2010-09-17 15:36:40 -0700 | [diff] [blame] | 51 | #include <asm/mwait.h> |
Len Brown | 14796fc | 2011-01-18 20:48:27 -0500 | [diff] [blame] | 52 | #include <asm/msr.h> |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 53 | |
Rafael J. Wysocki | 317e5ec | 2020-02-06 18:45:49 +0100 | [diff] [blame] | 54 | #define INTEL_IDLE_VERSION "0.5.1" |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 55 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 56 | static struct cpuidle_driver intel_idle_driver = { |
| 57 | .name = "intel_idle", |
| 58 | .owner = THIS_MODULE, |
| 59 | }; |
| 60 | /* intel_idle.max_cstate=0 disables driver */ |
Len Brown | 137ecc7 | 2013-02-01 21:35:35 -0500 | [diff] [blame] | 61 | static int max_cstate = CPUIDLE_STATE_MAX - 1; |
Rafael J. Wysocki | 4dcb78e | 2020-02-03 11:57:18 +0100 | [diff] [blame] | 62 | static unsigned int disabled_states_mask; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 63 | |
Rafael J. Wysocki | 6eb0443 | 2020-02-06 18:45:18 +0100 | [diff] [blame] | 64 | static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 65 | |
| 66 | static unsigned long auto_demotion_disable_flags; |
| 67 | static bool disable_promotion_to_c1e; |
| 68 | |
Rafael J. Wysocki | 40ab82e | 2020-02-06 18:40:54 +0100 | [diff] [blame] | 69 | static bool lapic_timer_always_reliable; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 70 | |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 71 | struct idle_cpu { |
| 72 | struct cpuidle_state *state_table; |
| 73 | |
| 74 | /* |
| 75 | * Hardware C-state auto-demotion may not always be optimal. |
| 76 | * Indicate which enable bits to clear here. |
| 77 | */ |
| 78 | unsigned long auto_demotion_disable_flags; |
Len Brown | 8c058d53 | 2014-07-31 15:21:24 -0400 | [diff] [blame] | 79 | bool byt_auto_demotion_disable_flag; |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 80 | bool disable_promotion_to_c1e; |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 81 | bool use_acpi; |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 82 | }; |
| 83 | |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 84 | static const struct idle_cpu *icpu __initdata; |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 85 | static struct cpuidle_state *cpuidle_state_table __initdata; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 86 | |
Rafael J. Wysocki | 6eb0443 | 2020-02-06 18:45:18 +0100 | [diff] [blame] | 87 | static unsigned int mwait_substates __initdata; |
| 88 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 89 | /* |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 90 | * Enable this state by default even if the ACPI _CST does not list it. |
| 91 | */ |
| 92 | #define CPUIDLE_FLAG_ALWAYS_ENABLE BIT(15) |
| 93 | |
| 94 | /* |
Len Brown | 956d033 | 2011-01-12 02:51:20 -0500 | [diff] [blame] | 95 | * Set this flag for states where the HW flushes the TLB for us |
| 96 | * and so we don't need cross-calls to keep it consistent. |
| 97 | * If this flag is set, SW flushes the TLB, so even if the |
| 98 | * HW doesn't do the flushing, this flag is safe to use. |
| 99 | */ |
Rafael J. Wysocki | a472e4b | 2020-02-06 18:45:39 +0100 | [diff] [blame] | 100 | #define CPUIDLE_FLAG_TLB_FLUSHED BIT(16) |
Len Brown | 956d033 | 2011-01-12 02:51:20 -0500 | [diff] [blame] | 101 | |
| 102 | /* |
Len Brown | b1beab4 | 2013-01-31 19:55:37 -0500 | [diff] [blame] | 103 | * MWAIT takes an 8-bit "hint" in EAX "suggesting" |
| 104 | * the C-state (top nibble) and sub-state (bottom nibble) |
| 105 | * 0x00 means "MWAIT(C1)", 0x10 means "MWAIT(C2)" etc. |
| 106 | * |
| 107 | * We store the hint at the top of our "flags" for each state. |
| 108 | */ |
| 109 | #define flg2MWAIT(flags) (((flags) >> 24) & 0xFF) |
| 110 | #define MWAIT2flg(eax) ((eax & 0xFF) << 24) |
| 111 | |
Rafael J. Wysocki | 30a996f | 2020-02-06 18:41:15 +0100 | [diff] [blame] | 112 | /** |
| 113 | * intel_idle - Ask the processor to enter the given idle state. |
| 114 | * @dev: cpuidle device of the target CPU. |
| 115 | * @drv: cpuidle driver (assumed to point to intel_idle_driver). |
| 116 | * @index: Target idle state index. |
| 117 | * |
| 118 | * Use the MWAIT instruction to notify the processor that the CPU represented by |
| 119 | * @dev is idle and it can try to enter the idle state corresponding to @index. |
| 120 | * |
| 121 | * If the local APIC timer is not known to be reliable in the target idle state, |
| 122 | * enable one-shot tick broadcasting for the target CPU before executing MWAIT. |
| 123 | * |
| 124 | * Optionally call leave_mm() for the target CPU upfront to avoid wakeups due to |
| 125 | * flushing user TLBs. |
| 126 | * |
| 127 | * Must be called under local_irq_disable(). |
| 128 | */ |
| 129 | static __cpuidle int intel_idle(struct cpuidle_device *dev, |
| 130 | struct cpuidle_driver *drv, int index) |
| 131 | { |
| 132 | struct cpuidle_state *state = &drv->states[index]; |
| 133 | unsigned long eax = flg2MWAIT(state->flags); |
| 134 | unsigned long ecx = 1; /* break on interrupt flag */ |
| 135 | bool uninitialized_var(tick); |
| 136 | int cpu = smp_processor_id(); |
| 137 | |
| 138 | /* |
| 139 | * leave_mm() to avoid costly and often unnecessary wakeups |
| 140 | * for flushing the user TLB's associated with the active mm. |
| 141 | */ |
| 142 | if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED) |
| 143 | leave_mm(cpu); |
| 144 | |
| 145 | if (!static_cpu_has(X86_FEATURE_ARAT) && !lapic_timer_always_reliable) { |
| 146 | /* |
| 147 | * Switch over to one-shot tick broadcast if the target C-state |
| 148 | * is deeper than C1. |
| 149 | */ |
| 150 | if ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) { |
| 151 | tick = true; |
| 152 | tick_broadcast_enter(); |
| 153 | } else { |
| 154 | tick = false; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | mwait_idle_with_hints(eax, ecx); |
| 159 | |
| 160 | if (!static_cpu_has(X86_FEATURE_ARAT) && tick) |
| 161 | tick_broadcast_exit(); |
| 162 | |
| 163 | return index; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * intel_idle_s2idle - Ask the processor to enter the given idle state. |
| 168 | * @dev: cpuidle device of the target CPU. |
| 169 | * @drv: cpuidle driver (assumed to point to intel_idle_driver). |
| 170 | * @index: Target idle state index. |
| 171 | * |
| 172 | * Use the MWAIT instruction to notify the processor that the CPU represented by |
| 173 | * @dev is idle and it can try to enter the idle state corresponding to @index. |
| 174 | * |
| 175 | * Invoked as a suspend-to-idle callback routine with frozen user space, frozen |
| 176 | * scheduler tick and suspended scheduler clock on the target CPU. |
| 177 | */ |
| 178 | static __cpuidle void intel_idle_s2idle(struct cpuidle_device *dev, |
| 179 | struct cpuidle_driver *drv, int index) |
| 180 | { |
| 181 | unsigned long eax = flg2MWAIT(drv->states[index].flags); |
| 182 | unsigned long ecx = 1; /* break on interrupt flag */ |
| 183 | |
| 184 | mwait_idle_with_hints(eax, ecx); |
| 185 | } |
| 186 | |
Len Brown | b1beab4 | 2013-01-31 19:55:37 -0500 | [diff] [blame] | 187 | /* |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 188 | * States are indexed by the cstate number, |
| 189 | * which is also the index into the MWAIT hint array. |
| 190 | * Thus C0 is a dummy. |
| 191 | */ |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 192 | static struct cpuidle_state nehalem_cstates[] __initdata = { |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 193 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 194 | .name = "C1", |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 195 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 196 | .flags = MWAIT2flg(0x00), |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 197 | .exit_latency = 3, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 198 | .target_residency = 6, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 199 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 200 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 201 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 202 | .name = "C1E", |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 203 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 204 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 205 | .exit_latency = 10, |
| 206 | .target_residency = 20, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 207 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 208 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 209 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 210 | .name = "C3", |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 211 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 212 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 213 | .exit_latency = 20, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 214 | .target_residency = 80, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 215 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 216 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 217 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 218 | .name = "C6", |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 219 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 220 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 221 | .exit_latency = 200, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 222 | .target_residency = 800, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 223 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 224 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 225 | { |
| 226 | .enter = NULL } |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 227 | }; |
| 228 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 229 | static struct cpuidle_state snb_cstates[] __initdata = { |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 230 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 231 | .name = "C1", |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 232 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 233 | .flags = MWAIT2flg(0x00), |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 234 | .exit_latency = 2, |
| 235 | .target_residency = 2, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 236 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 237 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 238 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 239 | .name = "C1E", |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 240 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 241 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 242 | .exit_latency = 10, |
| 243 | .target_residency = 20, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 244 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 245 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 246 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 247 | .name = "C3", |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 248 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 249 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 250 | .exit_latency = 80, |
Len Brown | ddbd550 | 2010-12-13 18:28:22 -0500 | [diff] [blame] | 251 | .target_residency = 211, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 252 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 253 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 254 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 255 | .name = "C6", |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 256 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 257 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 258 | .exit_latency = 104, |
Len Brown | ddbd550 | 2010-12-13 18:28:22 -0500 | [diff] [blame] | 259 | .target_residency = 345, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 260 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 261 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 262 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 263 | .name = "C7", |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 264 | .desc = "MWAIT 0x30", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 265 | .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 266 | .exit_latency = 109, |
Len Brown | ddbd550 | 2010-12-13 18:28:22 -0500 | [diff] [blame] | 267 | .target_residency = 345, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 268 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 269 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 270 | { |
| 271 | .enter = NULL } |
Len Brown | d13780d | 2010-07-07 00:12:03 -0400 | [diff] [blame] | 272 | }; |
| 273 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 274 | static struct cpuidle_state byt_cstates[] __initdata = { |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 275 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 276 | .name = "C1", |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 277 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 278 | .flags = MWAIT2flg(0x00), |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 279 | .exit_latency = 1, |
| 280 | .target_residency = 1, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 281 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 282 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 283 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 284 | .name = "C6N", |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 285 | .desc = "MWAIT 0x58", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 286 | .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | d7ef767 | 2015-03-24 23:23:20 -0400 | [diff] [blame] | 287 | .exit_latency = 300, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 288 | .target_residency = 275, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 289 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 290 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 291 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 292 | .name = "C6S", |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 293 | .desc = "MWAIT 0x52", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 294 | .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | d7ef767 | 2015-03-24 23:23:20 -0400 | [diff] [blame] | 295 | .exit_latency = 500, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 296 | .target_residency = 560, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 297 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 298 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 299 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 300 | .name = "C7", |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 301 | .desc = "MWAIT 0x60", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 302 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 303 | .exit_latency = 1200, |
Len Brown | d7ef767 | 2015-03-24 23:23:20 -0400 | [diff] [blame] | 304 | .target_residency = 4000, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 305 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 306 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 307 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 308 | .name = "C7S", |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 309 | .desc = "MWAIT 0x64", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 310 | .flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 311 | .exit_latency = 10000, |
| 312 | .target_residency = 20000, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 313 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 314 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 315 | { |
| 316 | .enter = NULL } |
| 317 | }; |
| 318 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 319 | static struct cpuidle_state cht_cstates[] __initdata = { |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 320 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 321 | .name = "C1", |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 322 | .desc = "MWAIT 0x00", |
| 323 | .flags = MWAIT2flg(0x00), |
| 324 | .exit_latency = 1, |
| 325 | .target_residency = 1, |
| 326 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 327 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 328 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 329 | .name = "C6N", |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 330 | .desc = "MWAIT 0x58", |
| 331 | .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 332 | .exit_latency = 80, |
| 333 | .target_residency = 275, |
| 334 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 335 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 336 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 337 | .name = "C6S", |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 338 | .desc = "MWAIT 0x52", |
| 339 | .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 340 | .exit_latency = 200, |
| 341 | .target_residency = 560, |
| 342 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 343 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 344 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 345 | .name = "C7", |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 346 | .desc = "MWAIT 0x60", |
| 347 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 348 | .exit_latency = 1200, |
| 349 | .target_residency = 4000, |
| 350 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 351 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 352 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 353 | .name = "C7S", |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 354 | .desc = "MWAIT 0x64", |
| 355 | .flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 356 | .exit_latency = 10000, |
| 357 | .target_residency = 20000, |
| 358 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 359 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 360 | { |
| 361 | .enter = NULL } |
| 362 | }; |
| 363 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 364 | static struct cpuidle_state ivb_cstates[] __initdata = { |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 365 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 366 | .name = "C1", |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 367 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 368 | .flags = MWAIT2flg(0x00), |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 369 | .exit_latency = 1, |
| 370 | .target_residency = 1, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 371 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 372 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 373 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 374 | .name = "C1E", |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 375 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 376 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 377 | .exit_latency = 10, |
| 378 | .target_residency = 20, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 379 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 380 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 381 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 382 | .name = "C3", |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 383 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 384 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 385 | .exit_latency = 59, |
| 386 | .target_residency = 156, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 387 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 388 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 389 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 390 | .name = "C6", |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 391 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 392 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 393 | .exit_latency = 80, |
| 394 | .target_residency = 300, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 395 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 396 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 397 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 398 | .name = "C7", |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 399 | .desc = "MWAIT 0x30", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 400 | .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 401 | .exit_latency = 87, |
| 402 | .target_residency = 300, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 403 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 404 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 405 | { |
| 406 | .enter = NULL } |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 407 | }; |
| 408 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 409 | static struct cpuidle_state ivt_cstates[] __initdata = { |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 410 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 411 | .name = "C1", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 412 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 413 | .flags = MWAIT2flg(0x00), |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 414 | .exit_latency = 1, |
| 415 | .target_residency = 1, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 416 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 417 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 418 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 419 | .name = "C1E", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 420 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 421 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 422 | .exit_latency = 10, |
| 423 | .target_residency = 80, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 424 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 425 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 426 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 427 | .name = "C3", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 428 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 429 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 430 | .exit_latency = 59, |
| 431 | .target_residency = 156, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 432 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 433 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 434 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 435 | .name = "C6", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 436 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 437 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 438 | .exit_latency = 82, |
| 439 | .target_residency = 300, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 440 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 441 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 442 | { |
| 443 | .enter = NULL } |
| 444 | }; |
| 445 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 446 | static struct cpuidle_state ivt_cstates_4s[] __initdata = { |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 447 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 448 | .name = "C1", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 449 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 450 | .flags = MWAIT2flg(0x00), |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 451 | .exit_latency = 1, |
| 452 | .target_residency = 1, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 453 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 454 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 455 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 456 | .name = "C1E", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 457 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 458 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 459 | .exit_latency = 10, |
| 460 | .target_residency = 250, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 461 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 462 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 463 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 464 | .name = "C3", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 465 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 466 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 467 | .exit_latency = 59, |
| 468 | .target_residency = 300, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 469 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 470 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 471 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 472 | .name = "C6", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 473 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 474 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 475 | .exit_latency = 84, |
| 476 | .target_residency = 400, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 477 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 478 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 479 | { |
| 480 | .enter = NULL } |
| 481 | }; |
| 482 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 483 | static struct cpuidle_state ivt_cstates_8s[] __initdata = { |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 484 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 485 | .name = "C1", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 486 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 487 | .flags = MWAIT2flg(0x00), |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 488 | .exit_latency = 1, |
| 489 | .target_residency = 1, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 490 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 491 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 492 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 493 | .name = "C1E", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 494 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 495 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 496 | .exit_latency = 10, |
| 497 | .target_residency = 500, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 498 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 499 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 500 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 501 | .name = "C3", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 502 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 503 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 504 | .exit_latency = 59, |
| 505 | .target_residency = 600, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 506 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 507 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 508 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 509 | .name = "C6", |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 510 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 511 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 512 | .exit_latency = 88, |
| 513 | .target_residency = 700, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 514 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 515 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 516 | { |
| 517 | .enter = NULL } |
| 518 | }; |
| 519 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 520 | static struct cpuidle_state hsw_cstates[] __initdata = { |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 521 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 522 | .name = "C1", |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 523 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 524 | .flags = MWAIT2flg(0x00), |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 525 | .exit_latency = 2, |
| 526 | .target_residency = 2, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 527 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 528 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 529 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 530 | .name = "C1E", |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 531 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 532 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 533 | .exit_latency = 10, |
| 534 | .target_residency = 20, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 535 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 536 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 537 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 538 | .name = "C3", |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 539 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 540 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 541 | .exit_latency = 33, |
| 542 | .target_residency = 100, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 543 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 544 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 545 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 546 | .name = "C6", |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 547 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 548 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 549 | .exit_latency = 133, |
| 550 | .target_residency = 400, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 551 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 552 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 553 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 554 | .name = "C7s", |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 555 | .desc = "MWAIT 0x32", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 556 | .flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 557 | .exit_latency = 166, |
| 558 | .target_residency = 500, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 559 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 560 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 561 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 562 | .name = "C8", |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 563 | .desc = "MWAIT 0x40", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 564 | .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 565 | .exit_latency = 300, |
| 566 | .target_residency = 900, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 567 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 568 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 569 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 570 | .name = "C9", |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 571 | .desc = "MWAIT 0x50", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 572 | .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 573 | .exit_latency = 600, |
| 574 | .target_residency = 1800, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 575 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 576 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 577 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 578 | .name = "C10", |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 579 | .desc = "MWAIT 0x60", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 580 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 581 | .exit_latency = 2600, |
| 582 | .target_residency = 7700, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 583 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 584 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 86239ce | 2013-02-27 13:18:50 -0500 | [diff] [blame] | 585 | { |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 586 | .enter = NULL } |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 587 | }; |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 588 | static struct cpuidle_state bdw_cstates[] __initdata = { |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 589 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 590 | .name = "C1", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 591 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 592 | .flags = MWAIT2flg(0x00), |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 593 | .exit_latency = 2, |
| 594 | .target_residency = 2, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 595 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 596 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 597 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 598 | .name = "C1E", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 599 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 600 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 601 | .exit_latency = 10, |
| 602 | .target_residency = 20, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 603 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 604 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 605 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 606 | .name = "C3", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 607 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 608 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 609 | .exit_latency = 40, |
| 610 | .target_residency = 100, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 611 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 612 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 613 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 614 | .name = "C6", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 615 | .desc = "MWAIT 0x20", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 616 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 617 | .exit_latency = 133, |
| 618 | .target_residency = 400, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 619 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 620 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 621 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 622 | .name = "C7s", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 623 | .desc = "MWAIT 0x32", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 624 | .flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 625 | .exit_latency = 166, |
| 626 | .target_residency = 500, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 627 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 628 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 629 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 630 | .name = "C8", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 631 | .desc = "MWAIT 0x40", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 632 | .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 633 | .exit_latency = 300, |
| 634 | .target_residency = 900, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 635 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 636 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 637 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 638 | .name = "C9", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 639 | .desc = "MWAIT 0x50", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 640 | .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 641 | .exit_latency = 600, |
| 642 | .target_residency = 1800, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 643 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 644 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 645 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 646 | .name = "C10", |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 647 | .desc = "MWAIT 0x60", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 648 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 649 | .exit_latency = 2600, |
| 650 | .target_residency = 7700, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 651 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 652 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 653 | { |
| 654 | .enter = NULL } |
| 655 | }; |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 656 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 657 | static struct cpuidle_state skl_cstates[] __initdata = { |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 658 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 659 | .name = "C1", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 660 | .desc = "MWAIT 0x00", |
| 661 | .flags = MWAIT2flg(0x00), |
| 662 | .exit_latency = 2, |
| 663 | .target_residency = 2, |
| 664 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 665 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 666 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 667 | .name = "C1E", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 668 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 669 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 670 | .exit_latency = 10, |
| 671 | .target_residency = 20, |
| 672 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 673 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 674 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 675 | .name = "C3", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 676 | .desc = "MWAIT 0x10", |
| 677 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 678 | .exit_latency = 70, |
| 679 | .target_residency = 100, |
| 680 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 681 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 682 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 683 | .name = "C6", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 684 | .desc = "MWAIT 0x20", |
| 685 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 135919a | 2015-09-09 13:35:05 -0400 | [diff] [blame] | 686 | .exit_latency = 85, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 687 | .target_residency = 200, |
| 688 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 689 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 690 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 691 | .name = "C7s", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 692 | .desc = "MWAIT 0x33", |
| 693 | .flags = MWAIT2flg(0x33) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 694 | .exit_latency = 124, |
| 695 | .target_residency = 800, |
| 696 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 697 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 698 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 699 | .name = "C8", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 700 | .desc = "MWAIT 0x40", |
| 701 | .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 135919a | 2015-09-09 13:35:05 -0400 | [diff] [blame] | 702 | .exit_latency = 200, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 703 | .target_residency = 800, |
| 704 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 705 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 706 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 707 | .name = "C9", |
Len Brown | 135919a | 2015-09-09 13:35:05 -0400 | [diff] [blame] | 708 | .desc = "MWAIT 0x50", |
| 709 | .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 710 | .exit_latency = 480, |
| 711 | .target_residency = 5000, |
| 712 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 713 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 135919a | 2015-09-09 13:35:05 -0400 | [diff] [blame] | 714 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 715 | .name = "C10", |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 716 | .desc = "MWAIT 0x60", |
| 717 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 718 | .exit_latency = 890, |
| 719 | .target_residency = 5000, |
| 720 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 721 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 722 | { |
| 723 | .enter = NULL } |
| 724 | }; |
| 725 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 726 | static struct cpuidle_state skx_cstates[] __initdata = { |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 727 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 728 | .name = "C1", |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 729 | .desc = "MWAIT 0x00", |
| 730 | .flags = MWAIT2flg(0x00), |
| 731 | .exit_latency = 2, |
| 732 | .target_residency = 2, |
| 733 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 734 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 735 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 736 | .name = "C1E", |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 737 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 738 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 739 | .exit_latency = 10, |
| 740 | .target_residency = 20, |
| 741 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 742 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 743 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 744 | .name = "C6", |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 745 | .desc = "MWAIT 0x20", |
| 746 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 747 | .exit_latency = 133, |
| 748 | .target_residency = 600, |
| 749 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 750 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 751 | { |
| 752 | .enter = NULL } |
| 753 | }; |
| 754 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 755 | static struct cpuidle_state atom_cstates[] __initdata = { |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 756 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 757 | .name = "C1E", |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 758 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 759 | .flags = MWAIT2flg(0x00), |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 760 | .exit_latency = 10, |
| 761 | .target_residency = 20, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 762 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 763 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 764 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 765 | .name = "C2", |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 766 | .desc = "MWAIT 0x10", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 767 | .flags = MWAIT2flg(0x10), |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 768 | .exit_latency = 20, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 769 | .target_residency = 80, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 770 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 771 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 772 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 773 | .name = "C4", |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 774 | .desc = "MWAIT 0x30", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 775 | .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 776 | .exit_latency = 100, |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 777 | .target_residency = 400, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 778 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 779 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 780 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 781 | .name = "C6", |
Len Brown | 7fcca7d | 2010-10-05 13:43:14 -0400 | [diff] [blame] | 782 | .desc = "MWAIT 0x52", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 783 | .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | 7fcca7d | 2010-10-05 13:43:14 -0400 | [diff] [blame] | 784 | .exit_latency = 140, |
Len Brown | 7fcca7d | 2010-10-05 13:43:14 -0400 | [diff] [blame] | 785 | .target_residency = 560, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 786 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 787 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 788 | { |
| 789 | .enter = NULL } |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 790 | }; |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 791 | static struct cpuidle_state tangier_cstates[] __initdata = { |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 792 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 793 | .name = "C1", |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 794 | .desc = "MWAIT 0x00", |
| 795 | .flags = MWAIT2flg(0x00), |
| 796 | .exit_latency = 1, |
| 797 | .target_residency = 4, |
| 798 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 799 | .enter_s2idle = intel_idle_s2idle, }, |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 800 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 801 | .name = "C4", |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 802 | .desc = "MWAIT 0x30", |
| 803 | .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 804 | .exit_latency = 100, |
| 805 | .target_residency = 400, |
| 806 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 807 | .enter_s2idle = intel_idle_s2idle, }, |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 808 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 809 | .name = "C6", |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 810 | .desc = "MWAIT 0x52", |
| 811 | .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 812 | .exit_latency = 140, |
| 813 | .target_residency = 560, |
| 814 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 815 | .enter_s2idle = intel_idle_s2idle, }, |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 816 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 817 | .name = "C7", |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 818 | .desc = "MWAIT 0x60", |
| 819 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 820 | .exit_latency = 1200, |
| 821 | .target_residency = 4000, |
| 822 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 823 | .enter_s2idle = intel_idle_s2idle, }, |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 824 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 825 | .name = "C9", |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 826 | .desc = "MWAIT 0x64", |
| 827 | .flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 828 | .exit_latency = 10000, |
| 829 | .target_residency = 20000, |
| 830 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 831 | .enter_s2idle = intel_idle_s2idle, }, |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 832 | { |
| 833 | .enter = NULL } |
| 834 | }; |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 835 | static struct cpuidle_state avn_cstates[] __initdata = { |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 836 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 837 | .name = "C1", |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 838 | .desc = "MWAIT 0x00", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 839 | .flags = MWAIT2flg(0x00), |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 840 | .exit_latency = 2, |
| 841 | .target_residency = 2, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 842 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 843 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 844 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 845 | .name = "C6", |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 846 | .desc = "MWAIT 0x51", |
Daniel Lezcano | b82b6cc | 2014-11-12 16:03:50 +0100 | [diff] [blame] | 847 | .flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TLB_FLUSHED, |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 848 | .exit_latency = 15, |
| 849 | .target_residency = 45, |
Rafael J. Wysocki | 5fe2e52 | 2015-02-11 05:04:17 +0100 | [diff] [blame] | 850 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 851 | .enter_s2idle = intel_idle_s2idle, }, |
Jiang Liu | 8839099 | 2014-01-09 15:30:27 +0800 | [diff] [blame] | 852 | { |
| 853 | .enter = NULL } |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 854 | }; |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 855 | static struct cpuidle_state knl_cstates[] __initdata = { |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 856 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 857 | .name = "C1", |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 858 | .desc = "MWAIT 0x00", |
| 859 | .flags = MWAIT2flg(0x00), |
| 860 | .exit_latency = 1, |
| 861 | .target_residency = 2, |
| 862 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 863 | .enter_s2idle = intel_idle_s2idle }, |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 864 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 865 | .name = "C6", |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 866 | .desc = "MWAIT 0x10", |
| 867 | .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 868 | .exit_latency = 120, |
| 869 | .target_residency = 500, |
| 870 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 871 | .enter_s2idle = intel_idle_s2idle }, |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 872 | { |
| 873 | .enter = NULL } |
| 874 | }; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 875 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 876 | static struct cpuidle_state bxt_cstates[] __initdata = { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 877 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 878 | .name = "C1", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 879 | .desc = "MWAIT 0x00", |
| 880 | .flags = MWAIT2flg(0x00), |
| 881 | .exit_latency = 2, |
| 882 | .target_residency = 2, |
| 883 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 884 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 885 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 886 | .name = "C1E", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 887 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 888 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 889 | .exit_latency = 10, |
| 890 | .target_residency = 20, |
| 891 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 892 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 893 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 894 | .name = "C6", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 895 | .desc = "MWAIT 0x20", |
| 896 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 897 | .exit_latency = 133, |
| 898 | .target_residency = 133, |
| 899 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 900 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 901 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 902 | .name = "C7s", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 903 | .desc = "MWAIT 0x31", |
| 904 | .flags = MWAIT2flg(0x31) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 905 | .exit_latency = 155, |
| 906 | .target_residency = 155, |
| 907 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 908 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 909 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 910 | .name = "C8", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 911 | .desc = "MWAIT 0x40", |
| 912 | .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 913 | .exit_latency = 1000, |
| 914 | .target_residency = 1000, |
| 915 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 916 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 917 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 918 | .name = "C9", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 919 | .desc = "MWAIT 0x50", |
| 920 | .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 921 | .exit_latency = 2000, |
| 922 | .target_residency = 2000, |
| 923 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 924 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 925 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 926 | .name = "C10", |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 927 | .desc = "MWAIT 0x60", |
| 928 | .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 929 | .exit_latency = 10000, |
| 930 | .target_residency = 10000, |
| 931 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 932 | .enter_s2idle = intel_idle_s2idle, }, |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 933 | { |
| 934 | .enter = NULL } |
| 935 | }; |
| 936 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 937 | static struct cpuidle_state dnv_cstates[] __initdata = { |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 938 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 939 | .name = "C1", |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 940 | .desc = "MWAIT 0x00", |
| 941 | .flags = MWAIT2flg(0x00), |
| 942 | .exit_latency = 2, |
| 943 | .target_residency = 2, |
| 944 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 945 | .enter_s2idle = intel_idle_s2idle, }, |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 946 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 947 | .name = "C1E", |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 948 | .desc = "MWAIT 0x01", |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 949 | .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 950 | .exit_latency = 10, |
| 951 | .target_residency = 20, |
| 952 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 953 | .enter_s2idle = intel_idle_s2idle, }, |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 954 | { |
Len Brown | de09cdd | 2017-02-28 16:32:44 -0500 | [diff] [blame] | 955 | .name = "C6", |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 956 | .desc = "MWAIT 0x20", |
| 957 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 958 | .exit_latency = 50, |
| 959 | .target_residency = 500, |
| 960 | .enter = &intel_idle, |
Rafael J. Wysocki | 28ba086 | 2017-08-10 00:14:45 +0200 | [diff] [blame] | 961 | .enter_s2idle = intel_idle_s2idle, }, |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 962 | { |
| 963 | .enter = NULL } |
| 964 | }; |
| 965 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 966 | static const struct idle_cpu idle_cpu_nehalem __initconst = { |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 967 | .state_table = nehalem_cstates, |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 968 | .auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 969 | .disable_promotion_to_c1e = true, |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 970 | }; |
| 971 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 972 | static const struct idle_cpu idle_cpu_nhx __initconst = { |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 973 | .state_table = nehalem_cstates, |
| 974 | .auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE, |
| 975 | .disable_promotion_to_c1e = true, |
| 976 | .use_acpi = true, |
| 977 | }; |
| 978 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 979 | static const struct idle_cpu idle_cpu_atom __initconst = { |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 980 | .state_table = atom_cstates, |
| 981 | }; |
| 982 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 983 | static const struct idle_cpu idle_cpu_tangier __initconst = { |
Andy Shevchenko | 5e7ec26 | 2016-10-25 17:11:39 +0300 | [diff] [blame] | 984 | .state_table = tangier_cstates, |
| 985 | }; |
| 986 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 987 | static const struct idle_cpu idle_cpu_lincroft __initconst = { |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 988 | .state_table = atom_cstates, |
| 989 | .auto_demotion_disable_flags = ATM_LNC_C6_AUTO_DEMOTE, |
| 990 | }; |
| 991 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 992 | static const struct idle_cpu idle_cpu_snb __initconst = { |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 993 | .state_table = snb_cstates, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 994 | .disable_promotion_to_c1e = true, |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 995 | }; |
| 996 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 997 | static const struct idle_cpu idle_cpu_snx __initconst = { |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 998 | .state_table = snb_cstates, |
| 999 | .disable_promotion_to_c1e = true, |
| 1000 | .use_acpi = true, |
| 1001 | }; |
| 1002 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1003 | static const struct idle_cpu idle_cpu_byt __initconst = { |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 1004 | .state_table = byt_cstates, |
| 1005 | .disable_promotion_to_c1e = true, |
Len Brown | 8c058d53 | 2014-07-31 15:21:24 -0400 | [diff] [blame] | 1006 | .byt_auto_demotion_disable_flag = true, |
Len Brown | 718987d | 2014-02-14 02:30:00 -0500 | [diff] [blame] | 1007 | }; |
| 1008 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1009 | static const struct idle_cpu idle_cpu_cht __initconst = { |
Len Brown | cab07a5 | 2015-03-27 20:54:01 -0400 | [diff] [blame] | 1010 | .state_table = cht_cstates, |
| 1011 | .disable_promotion_to_c1e = true, |
| 1012 | .byt_auto_demotion_disable_flag = true, |
| 1013 | }; |
| 1014 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1015 | static const struct idle_cpu idle_cpu_ivb __initconst = { |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 1016 | .state_table = ivb_cstates, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 1017 | .disable_promotion_to_c1e = true, |
Len Brown | 6edab08 | 2012-06-01 19:45:32 -0400 | [diff] [blame] | 1018 | }; |
| 1019 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1020 | static const struct idle_cpu idle_cpu_ivt __initconst = { |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 1021 | .state_table = ivt_cstates, |
| 1022 | .disable_promotion_to_c1e = true, |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1023 | .use_acpi = true, |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 1024 | }; |
| 1025 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1026 | static const struct idle_cpu idle_cpu_hsw __initconst = { |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 1027 | .state_table = hsw_cstates, |
Len Brown | 32e9518 | 2013-02-02 01:31:56 -0500 | [diff] [blame] | 1028 | .disable_promotion_to_c1e = true, |
Len Brown | 85a4d2d | 2013-01-31 14:40:49 -0500 | [diff] [blame] | 1029 | }; |
| 1030 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1031 | static const struct idle_cpu idle_cpu_hsx __initconst = { |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1032 | .state_table = hsw_cstates, |
| 1033 | .disable_promotion_to_c1e = true, |
| 1034 | .use_acpi = true, |
| 1035 | }; |
| 1036 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1037 | static const struct idle_cpu idle_cpu_bdw __initconst = { |
Len Brown | a138b56 | 2014-02-04 23:56:40 -0500 | [diff] [blame] | 1038 | .state_table = bdw_cstates, |
| 1039 | .disable_promotion_to_c1e = true, |
| 1040 | }; |
| 1041 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1042 | static const struct idle_cpu idle_cpu_bdx __initconst = { |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1043 | .state_table = bdw_cstates, |
| 1044 | .disable_promotion_to_c1e = true, |
| 1045 | .use_acpi = true, |
| 1046 | }; |
| 1047 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1048 | static const struct idle_cpu idle_cpu_skl __initconst = { |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 1049 | .state_table = skl_cstates, |
| 1050 | .disable_promotion_to_c1e = true, |
| 1051 | }; |
| 1052 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1053 | static const struct idle_cpu idle_cpu_skx __initconst = { |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 1054 | .state_table = skx_cstates, |
| 1055 | .disable_promotion_to_c1e = true, |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1056 | .use_acpi = true, |
Len Brown | f9e7165 | 2016-04-06 17:00:58 -0400 | [diff] [blame] | 1057 | }; |
Len Brown | 493f133 | 2015-03-25 23:20:37 -0400 | [diff] [blame] | 1058 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1059 | static const struct idle_cpu idle_cpu_avn __initconst = { |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 1060 | .state_table = avn_cstates, |
| 1061 | .disable_promotion_to_c1e = true, |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1062 | .use_acpi = true, |
Len Brown | fab04b2 | 2013-11-09 00:30:17 -0500 | [diff] [blame] | 1063 | }; |
| 1064 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1065 | static const struct idle_cpu idle_cpu_knl __initconst = { |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 1066 | .state_table = knl_cstates, |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1067 | .use_acpi = true, |
Dasaratharaman Chandramouli | 281baf7 | 2014-09-04 17:22:54 -0700 | [diff] [blame] | 1068 | }; |
| 1069 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1070 | static const struct idle_cpu idle_cpu_bxt __initconst = { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1071 | .state_table = bxt_cstates, |
| 1072 | .disable_promotion_to_c1e = true, |
| 1073 | }; |
| 1074 | |
Rafael J. Wysocki | ab1a8522 | 2020-02-06 18:45:06 +0100 | [diff] [blame] | 1075 | static const struct idle_cpu idle_cpu_dnv __initconst = { |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 1076 | .state_table = dnv_cstates, |
| 1077 | .disable_promotion_to_c1e = true, |
Rafael J. Wysocki | e6d4f08 | 2019-12-13 09:56:38 +0100 | [diff] [blame] | 1078 | .use_acpi = true, |
Jacob Pan | 0080d65 | 2016-06-17 01:28:34 -0400 | [diff] [blame] | 1079 | }; |
| 1080 | |
Mathias Krause | d5cdc3c | 2015-03-25 22:15:14 +0100 | [diff] [blame] | 1081 | static const struct x86_cpu_id intel_idle_ids[] __initconst = { |
Thomas Gleixner | 4a9f45a | 2020-03-20 14:14:00 +0100 | [diff] [blame] | 1082 | X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EP, &idle_cpu_nhx), |
| 1083 | X86_MATCH_INTEL_FAM6_MODEL(NEHALEM, &idle_cpu_nehalem), |
| 1084 | X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_G, &idle_cpu_nehalem), |
| 1085 | X86_MATCH_INTEL_FAM6_MODEL(WESTMERE, &idle_cpu_nehalem), |
| 1086 | X86_MATCH_INTEL_FAM6_MODEL(WESTMERE_EP, &idle_cpu_nhx), |
| 1087 | X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EX, &idle_cpu_nhx), |
| 1088 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_BONNELL, &idle_cpu_atom), |
| 1089 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_BONNELL_MID, &idle_cpu_lincroft), |
| 1090 | X86_MATCH_INTEL_FAM6_MODEL(WESTMERE_EX, &idle_cpu_nhx), |
| 1091 | X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE, &idle_cpu_snb), |
| 1092 | X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE_X, &idle_cpu_snx), |
| 1093 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SALTWELL, &idle_cpu_atom), |
| 1094 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &idle_cpu_byt), |
| 1095 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, &idle_cpu_tangier), |
| 1096 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, &idle_cpu_cht), |
| 1097 | X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE, &idle_cpu_ivb), |
| 1098 | X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE_X, &idle_cpu_ivt), |
| 1099 | X86_MATCH_INTEL_FAM6_MODEL(HASWELL, &idle_cpu_hsw), |
| 1100 | X86_MATCH_INTEL_FAM6_MODEL(HASWELL_X, &idle_cpu_hsx), |
| 1101 | X86_MATCH_INTEL_FAM6_MODEL(HASWELL_L, &idle_cpu_hsw), |
| 1102 | X86_MATCH_INTEL_FAM6_MODEL(HASWELL_G, &idle_cpu_hsw), |
| 1103 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_D, &idle_cpu_avn), |
| 1104 | X86_MATCH_INTEL_FAM6_MODEL(BROADWELL, &idle_cpu_bdw), |
| 1105 | X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_G, &idle_cpu_bdw), |
| 1106 | X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_X, &idle_cpu_bdx), |
| 1107 | X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_D, &idle_cpu_bdx), |
| 1108 | X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, &idle_cpu_skl), |
| 1109 | X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, &idle_cpu_skl), |
| 1110 | X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, &idle_cpu_skl), |
| 1111 | X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, &idle_cpu_skl), |
| 1112 | X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, &idle_cpu_skx), |
| 1113 | X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &idle_cpu_knl), |
| 1114 | X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &idle_cpu_knl), |
| 1115 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, &idle_cpu_bxt), |
| 1116 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, &idle_cpu_bxt), |
| 1117 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, &idle_cpu_dnv), |
| 1118 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &idle_cpu_dnv), |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 1119 | {} |
| 1120 | }; |
Andi Kleen | b66b8b9 | 2012-01-26 00:09:07 +0100 | [diff] [blame] | 1121 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1122 | static const struct x86_cpu_id intel_mwait_ids[] __initconst = { |
Thomas Gleixner | 4a9f45a | 2020-03-20 14:14:00 +0100 | [diff] [blame] | 1123 | X86_MATCH_VENDOR_FAM_FEATURE(INTEL, 6, X86_FEATURE_MWAIT, NULL), |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1124 | {} |
| 1125 | }; |
| 1126 | |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1127 | static bool __init intel_idle_max_cstate_reached(int cstate) |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1128 | { |
| 1129 | if (cstate + 1 > max_cstate) { |
| 1130 | pr_info("max_cstate %d reached\n", max_cstate); |
| 1131 | return true; |
| 1132 | } |
| 1133 | return false; |
| 1134 | } |
| 1135 | |
| 1136 | #ifdef CONFIG_ACPI_PROCESSOR_CSTATE |
| 1137 | #include <acpi/processor.h> |
| 1138 | |
Rafael J. Wysocki | 4ec32d9 | 2019-12-13 09:56:29 +0100 | [diff] [blame] | 1139 | static bool no_acpi __read_mostly; |
| 1140 | module_param(no_acpi, bool, 0444); |
| 1141 | MODULE_PARM_DESC(no_acpi, "Do not use ACPI _CST for building the idle states list"); |
| 1142 | |
Rafael J. Wysocki | 3a5be9b | 2020-02-03 11:57:08 +0100 | [diff] [blame] | 1143 | static bool force_use_acpi __read_mostly; /* No effect if no_acpi is set. */ |
| 1144 | module_param_named(use_acpi, force_use_acpi, bool, 0444); |
| 1145 | MODULE_PARM_DESC(use_acpi, "Use ACPI _CST for building the idle states list"); |
| 1146 | |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1147 | static struct acpi_processor_power acpi_state_table __initdata; |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1148 | |
| 1149 | /** |
| 1150 | * intel_idle_cst_usable - Check if the _CST information can be used. |
| 1151 | * |
| 1152 | * Check if all of the C-states listed by _CST in the max_cstate range are |
| 1153 | * ACPI_CSTATE_FFH, which means that they should be entered via MWAIT. |
| 1154 | */ |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1155 | static bool __init intel_idle_cst_usable(void) |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1156 | { |
| 1157 | int cstate, limit; |
| 1158 | |
| 1159 | limit = min_t(int, min_t(int, CPUIDLE_STATE_MAX, max_cstate + 1), |
| 1160 | acpi_state_table.count); |
| 1161 | |
| 1162 | for (cstate = 1; cstate < limit; cstate++) { |
| 1163 | struct acpi_processor_cx *cx = &acpi_state_table.states[cstate]; |
| 1164 | |
| 1165 | if (cx->entry_method != ACPI_CSTATE_FFH) |
| 1166 | return false; |
| 1167 | } |
| 1168 | |
| 1169 | return true; |
| 1170 | } |
| 1171 | |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1172 | static bool __init intel_idle_acpi_cst_extract(void) |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1173 | { |
| 1174 | unsigned int cpu; |
| 1175 | |
Rafael J. Wysocki | 4ec32d9 | 2019-12-13 09:56:29 +0100 | [diff] [blame] | 1176 | if (no_acpi) { |
| 1177 | pr_debug("Not allowed to use ACPI _CST\n"); |
| 1178 | return false; |
| 1179 | } |
| 1180 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1181 | for_each_possible_cpu(cpu) { |
| 1182 | struct acpi_processor *pr = per_cpu(processors, cpu); |
| 1183 | |
| 1184 | if (!pr) |
| 1185 | continue; |
| 1186 | |
| 1187 | if (acpi_processor_evaluate_cst(pr->handle, cpu, &acpi_state_table)) |
| 1188 | continue; |
| 1189 | |
| 1190 | acpi_state_table.count++; |
| 1191 | |
| 1192 | if (!intel_idle_cst_usable()) |
| 1193 | continue; |
| 1194 | |
| 1195 | if (!acpi_processor_claim_cst_control()) { |
| 1196 | acpi_state_table.count = 0; |
| 1197 | return false; |
| 1198 | } |
| 1199 | |
| 1200 | return true; |
| 1201 | } |
| 1202 | |
| 1203 | pr_debug("ACPI _CST not found or not usable\n"); |
| 1204 | return false; |
| 1205 | } |
| 1206 | |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1207 | static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1208 | { |
| 1209 | int cstate, limit = min_t(int, CPUIDLE_STATE_MAX, acpi_state_table.count); |
| 1210 | |
| 1211 | /* |
| 1212 | * If limit > 0, intel_idle_cst_usable() has returned 'true', so all of |
| 1213 | * the interesting states are ACPI_CSTATE_FFH. |
| 1214 | */ |
| 1215 | for (cstate = 1; cstate < limit; cstate++) { |
| 1216 | struct acpi_processor_cx *cx; |
| 1217 | struct cpuidle_state *state; |
| 1218 | |
| 1219 | if (intel_idle_max_cstate_reached(cstate)) |
| 1220 | break; |
| 1221 | |
| 1222 | cx = &acpi_state_table.states[cstate]; |
| 1223 | |
| 1224 | state = &drv->states[drv->state_count++]; |
| 1225 | |
| 1226 | snprintf(state->name, CPUIDLE_NAME_LEN, "C%d_ACPI", cstate); |
| 1227 | strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); |
| 1228 | state->exit_latency = cx->latency; |
| 1229 | /* |
| 1230 | * For C1-type C-states use the same number for both the exit |
| 1231 | * latency and target residency, because that is the case for |
| 1232 | * C1 in the majority of the static C-states tables above. |
| 1233 | * For the other types of C-states, however, set the target |
| 1234 | * residency to 3 times the exit latency which should lead to |
| 1235 | * a reasonable balance between energy-efficiency and |
| 1236 | * performance in the majority of interesting cases. |
| 1237 | */ |
| 1238 | state->target_residency = cx->latency; |
| 1239 | if (cx->type > ACPI_STATE_C1) |
| 1240 | state->target_residency *= 3; |
| 1241 | |
| 1242 | state->flags = MWAIT2flg(cx->address); |
| 1243 | if (cx->type > ACPI_STATE_C2) |
| 1244 | state->flags |= CPUIDLE_FLAG_TLB_FLUSHED; |
| 1245 | |
Rafael J. Wysocki | 4dcb78e | 2020-02-03 11:57:18 +0100 | [diff] [blame] | 1246 | if (disabled_states_mask & BIT(cstate)) |
| 1247 | state->flags |= CPUIDLE_FLAG_OFF; |
| 1248 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1249 | state->enter = intel_idle; |
| 1250 | state->enter_s2idle = intel_idle_s2idle; |
| 1251 | } |
| 1252 | } |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 1253 | |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1254 | static bool __init intel_idle_off_by_default(u32 mwait_hint) |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 1255 | { |
| 1256 | int cstate, limit; |
| 1257 | |
| 1258 | /* |
| 1259 | * If there are no _CST C-states, do not disable any C-states by |
| 1260 | * default. |
| 1261 | */ |
| 1262 | if (!acpi_state_table.count) |
| 1263 | return false; |
| 1264 | |
| 1265 | limit = min_t(int, CPUIDLE_STATE_MAX, acpi_state_table.count); |
| 1266 | /* |
| 1267 | * If limit > 0, intel_idle_cst_usable() has returned 'true', so all of |
| 1268 | * the interesting states are ACPI_CSTATE_FFH. |
| 1269 | */ |
| 1270 | for (cstate = 1; cstate < limit; cstate++) { |
| 1271 | if (acpi_state_table.states[cstate].address == mwait_hint) |
| 1272 | return false; |
| 1273 | } |
| 1274 | return true; |
| 1275 | } |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1276 | #else /* !CONFIG_ACPI_PROCESSOR_CSTATE */ |
Rafael J. Wysocki | 3a5be9b | 2020-02-03 11:57:08 +0100 | [diff] [blame] | 1277 | #define force_use_acpi (false) |
| 1278 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1279 | static inline bool intel_idle_acpi_cst_extract(void) { return false; } |
| 1280 | static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { } |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 1281 | static inline bool intel_idle_off_by_default(u32 mwait_hint) { return false; } |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1282 | #endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */ |
| 1283 | |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1284 | /** |
| 1285 | * ivt_idle_state_table_update - Tune the idle states table for Ivy Town. |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1286 | * |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1287 | * Tune IVT multi-socket targets. |
| 1288 | * Assumption: num_sockets == (max_package_num + 1). |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1289 | */ |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1290 | static void __init ivt_idle_state_table_update(void) |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1291 | { |
| 1292 | /* IVT uses a different table for 1-2, 3-4, and > 4 sockets */ |
| 1293 | int cpu, package_num, num_sockets = 1; |
| 1294 | |
| 1295 | for_each_online_cpu(cpu) { |
| 1296 | package_num = topology_physical_package_id(cpu); |
| 1297 | if (package_num + 1 > num_sockets) { |
| 1298 | num_sockets = package_num + 1; |
| 1299 | |
| 1300 | if (num_sockets > 4) { |
| 1301 | cpuidle_state_table = ivt_cstates_8s; |
| 1302 | return; |
| 1303 | } |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | if (num_sockets > 2) |
| 1308 | cpuidle_state_table = ivt_cstates_4s; |
| 1309 | |
| 1310 | /* else, 1 and 2 socket systems use default ivt_cstates */ |
| 1311 | } |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1312 | |
Rafael J. Wysocki | 86e9466 | 2020-01-17 11:46:24 +0100 | [diff] [blame] | 1313 | /** |
| 1314 | * irtl_2_usec - IRTL to microseconds conversion. |
| 1315 | * @irtl: IRTL MSR value. |
| 1316 | * |
| 1317 | * Translate the IRTL (Interrupt Response Time Limit) MSR value to microseconds. |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1318 | */ |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1319 | static unsigned long long __init irtl_2_usec(unsigned long long irtl) |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1320 | { |
Rafael J. Wysocki | 86e9466 | 2020-01-17 11:46:24 +0100 | [diff] [blame] | 1321 | static const unsigned int irtl_ns_units[] __initconst = { |
| 1322 | 1, 32, 1024, 32768, 1048576, 33554432, 0, 0 |
| 1323 | }; |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1324 | unsigned long long ns; |
| 1325 | |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1326 | if (!irtl) |
| 1327 | return 0; |
| 1328 | |
Jan Beulich | bef4509 | 2016-06-27 00:35:48 -0600 | [diff] [blame] | 1329 | ns = irtl_ns_units[(irtl >> 10) & 0x7]; |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1330 | |
Rafael J. Wysocki | 86e9466 | 2020-01-17 11:46:24 +0100 | [diff] [blame] | 1331 | return div_u64((irtl & 0x3FF) * ns, NSEC_PER_USEC); |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1332 | } |
Rafael J. Wysocki | 86e9466 | 2020-01-17 11:46:24 +0100 | [diff] [blame] | 1333 | |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1334 | /** |
| 1335 | * bxt_idle_state_table_update - Fix up the Broxton idle states table. |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1336 | * |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1337 | * On BXT, trust the IRTL (Interrupt Response Time Limit) MSR to show the |
| 1338 | * definitive maximum latency and use the same value for target_residency. |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1339 | */ |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1340 | static void __init bxt_idle_state_table_update(void) |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1341 | { |
| 1342 | unsigned long long msr; |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1343 | unsigned int usec; |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1344 | |
| 1345 | rdmsrl(MSR_PKGC6_IRTL, msr); |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1346 | usec = irtl_2_usec(msr); |
| 1347 | if (usec) { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1348 | bxt_cstates[2].exit_latency = usec; |
| 1349 | bxt_cstates[2].target_residency = usec; |
| 1350 | } |
| 1351 | |
| 1352 | rdmsrl(MSR_PKGC7_IRTL, msr); |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1353 | usec = irtl_2_usec(msr); |
| 1354 | if (usec) { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1355 | bxt_cstates[3].exit_latency = usec; |
| 1356 | bxt_cstates[3].target_residency = usec; |
| 1357 | } |
| 1358 | |
| 1359 | rdmsrl(MSR_PKGC8_IRTL, msr); |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1360 | usec = irtl_2_usec(msr); |
| 1361 | if (usec) { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1362 | bxt_cstates[4].exit_latency = usec; |
| 1363 | bxt_cstates[4].target_residency = usec; |
| 1364 | } |
| 1365 | |
| 1366 | rdmsrl(MSR_PKGC9_IRTL, msr); |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1367 | usec = irtl_2_usec(msr); |
| 1368 | if (usec) { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1369 | bxt_cstates[5].exit_latency = usec; |
| 1370 | bxt_cstates[5].target_residency = usec; |
| 1371 | } |
| 1372 | |
| 1373 | rdmsrl(MSR_PKGC10_IRTL, msr); |
Jan Beulich | 3451ab3 | 2016-06-27 00:35:12 -0600 | [diff] [blame] | 1374 | usec = irtl_2_usec(msr); |
| 1375 | if (usec) { |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1376 | bxt_cstates[6].exit_latency = usec; |
| 1377 | bxt_cstates[6].target_residency = usec; |
| 1378 | } |
| 1379 | |
| 1380 | } |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1381 | |
| 1382 | /** |
| 1383 | * sklh_idle_state_table_update - Fix up the Sky Lake idle states table. |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1384 | * |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1385 | * On SKL-H (model 0x5e) skip C8 and C9 if C10 is enabled and SGX disabled. |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1386 | */ |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1387 | static void __init sklh_idle_state_table_update(void) |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1388 | { |
| 1389 | unsigned long long msr; |
| 1390 | unsigned int eax, ebx, ecx, edx; |
| 1391 | |
| 1392 | |
| 1393 | /* if PC10 disabled via cmdline intel_idle.max_cstate=7 or shallower */ |
| 1394 | if (max_cstate <= 7) |
| 1395 | return; |
| 1396 | |
| 1397 | /* if PC10 not present in CPUID.MWAIT.EDX */ |
| 1398 | if ((mwait_substates & (0xF << 28)) == 0) |
| 1399 | return; |
| 1400 | |
Len Brown | 6cfb237 | 2017-01-07 23:23:25 -0500 | [diff] [blame] | 1401 | rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr); |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1402 | |
| 1403 | /* PC10 is not enabled in PKG C-state limit */ |
| 1404 | if ((msr & 0xF) != 8) |
| 1405 | return; |
| 1406 | |
| 1407 | ecx = 0; |
| 1408 | cpuid(7, &eax, &ebx, &ecx, &edx); |
| 1409 | |
| 1410 | /* if SGX is present */ |
| 1411 | if (ebx & (1 << 2)) { |
| 1412 | |
Sean Christopherson | 32ad73d | 2019-12-20 20:44:55 -0800 | [diff] [blame] | 1413 | rdmsrl(MSR_IA32_FEAT_CTL, msr); |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1414 | |
| 1415 | /* if SGX is enabled */ |
| 1416 | if (msr & (1 << 18)) |
| 1417 | return; |
| 1418 | } |
| 1419 | |
Rafael J. Wysocki | ba1e78a | 2019-11-21 19:41:51 +0100 | [diff] [blame] | 1420 | skl_cstates[5].flags |= CPUIDLE_FLAG_UNUSABLE; /* C8-SKL */ |
| 1421 | skl_cstates[6].flags |= CPUIDLE_FLAG_UNUSABLE; /* C9-SKL */ |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1422 | } |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1423 | |
Rafael J. Wysocki | 1aefbd7 | 2020-01-10 11:52:32 +0100 | [diff] [blame] | 1424 | static bool __init intel_idle_verify_cstate(unsigned int mwait_hint) |
| 1425 | { |
| 1426 | unsigned int mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint) + 1; |
| 1427 | unsigned int num_substates = (mwait_substates >> mwait_cstate * 4) & |
| 1428 | MWAIT_SUBSTATE_MASK; |
| 1429 | |
| 1430 | /* Ignore the C-state if there are NO sub-states in CPUID for it. */ |
| 1431 | if (num_substates == 0) |
| 1432 | return false; |
| 1433 | |
| 1434 | if (mwait_cstate > 2 && !boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
| 1435 | mark_tsc_unstable("TSC halts in idle states deeper than C2"); |
| 1436 | |
| 1437 | return true; |
| 1438 | } |
| 1439 | |
Rafael J. Wysocki | 095928a | 2020-01-10 11:51:22 +0100 | [diff] [blame] | 1440 | static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv) |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 1441 | { |
Rafael J. Wysocki | 3d3a1ae | 2020-01-10 11:48:25 +0100 | [diff] [blame] | 1442 | int cstate; |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 1443 | |
Rafael J. Wysocki | 3d3a1ae | 2020-01-10 11:48:25 +0100 | [diff] [blame] | 1444 | switch (boot_cpu_data.x86_model) { |
Dave Hansen | db73c5a | 2016-06-02 17:19:32 -0700 | [diff] [blame] | 1445 | case INTEL_FAM6_IVYBRIDGE_X: |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1446 | ivt_idle_state_table_update(); |
| 1447 | break; |
Dave Hansen | db73c5a | 2016-06-02 17:19:32 -0700 | [diff] [blame] | 1448 | case INTEL_FAM6_ATOM_GOLDMONT: |
Peter Zijlstra | f2c4db1 | 2018-08-07 10:17:27 -0700 | [diff] [blame] | 1449 | case INTEL_FAM6_ATOM_GOLDMONT_PLUS: |
Len Brown | 5dcef69 | 2016-04-06 17:00:47 -0400 | [diff] [blame] | 1450 | bxt_idle_state_table_update(); |
| 1451 | break; |
Peter Zijlstra | c66f78a | 2019-08-27 21:48:21 +0200 | [diff] [blame] | 1452 | case INTEL_FAM6_SKYLAKE: |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1453 | sklh_idle_state_table_update(); |
| 1454 | break; |
Len Brown | 0138d8f | 2014-04-04 01:21:07 -0400 | [diff] [blame] | 1455 | } |
Deepthi Dharwar | 46bcfad | 2011-10-28 16:20:42 +0530 | [diff] [blame] | 1456 | |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 1457 | for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { |
Rafael J. Wysocki | 9f3d6da | 2019-12-13 09:55:52 +0100 | [diff] [blame] | 1458 | unsigned int mwait_hint; |
Deepthi Dharwar | 46bcfad | 2011-10-28 16:20:42 +0530 | [diff] [blame] | 1459 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1460 | if (intel_idle_max_cstate_reached(cstate)) |
| 1461 | break; |
| 1462 | |
Rafael J. Wysocki | 9f3d6da | 2019-12-13 09:55:52 +0100 | [diff] [blame] | 1463 | if (!cpuidle_state_table[cstate].enter && |
| 1464 | !cpuidle_state_table[cstate].enter_s2idle) |
Len Brown | e022e7e | 2013-02-01 23:37:30 -0500 | [diff] [blame] | 1465 | break; |
| 1466 | |
Rafael J. Wysocki | 9f3d6da | 2019-12-13 09:55:52 +0100 | [diff] [blame] | 1467 | /* If marked as unusable, skip this state. */ |
Rafael J. Wysocki | ba1e78a | 2019-11-21 19:41:51 +0100 | [diff] [blame] | 1468 | if (cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_UNUSABLE) { |
Joe Perches | 654d08a | 2017-06-09 12:29:20 -0700 | [diff] [blame] | 1469 | pr_debug("state %s is disabled\n", |
| 1470 | cpuidle_state_table[cstate].name); |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1471 | continue; |
| 1472 | } |
| 1473 | |
Rafael J. Wysocki | 9f3d6da | 2019-12-13 09:55:52 +0100 | [diff] [blame] | 1474 | mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags); |
| 1475 | if (!intel_idle_verify_cstate(mwait_hint)) |
| 1476 | continue; |
Len Brown | d70e28f | 2016-03-13 00:33:48 -0500 | [diff] [blame] | 1477 | |
Rafael J. Wysocki | 9f3d6da | 2019-12-13 09:55:52 +0100 | [diff] [blame] | 1478 | /* Structure copy. */ |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 1479 | drv->states[drv->state_count] = cpuidle_state_table[cstate]; |
| 1480 | |
Rafael J. Wysocki | 4dcb78e | 2020-02-03 11:57:18 +0100 | [diff] [blame] | 1481 | if ((disabled_states_mask & BIT(drv->state_count)) || |
| 1482 | ((icpu->use_acpi || force_use_acpi) && |
| 1483 | intel_idle_off_by_default(mwait_hint) && |
| 1484 | !(cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_ALWAYS_ENABLE))) |
Rafael J. Wysocki | bff8e60 | 2019-12-13 09:56:21 +0100 | [diff] [blame] | 1485 | drv->states[drv->state_count].flags |= CPUIDLE_FLAG_OFF; |
| 1486 | |
| 1487 | drv->state_count++; |
Deepthi Dharwar | 46bcfad | 2011-10-28 16:20:42 +0530 | [diff] [blame] | 1488 | } |
| 1489 | |
Len Brown | 8c058d53 | 2014-07-31 15:21:24 -0400 | [diff] [blame] | 1490 | if (icpu->byt_auto_demotion_disable_flag) { |
| 1491 | wrmsrl(MSR_CC6_DEMOTION_POLICY_CONFIG, 0); |
| 1492 | wrmsrl(MSR_MC6_DEMOTION_POLICY_CONFIG, 0); |
| 1493 | } |
Deepthi Dharwar | 46bcfad | 2011-10-28 16:20:42 +0530 | [diff] [blame] | 1494 | } |
| 1495 | |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1496 | /** |
| 1497 | * intel_idle_cpuidle_driver_init - Create the list of available idle states. |
| 1498 | * @drv: cpuidle driver structure to initialize. |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1499 | */ |
Rafael J. Wysocki | 3d3a1ae | 2020-01-10 11:48:25 +0100 | [diff] [blame] | 1500 | static void __init intel_idle_cpuidle_driver_init(struct cpuidle_driver *drv) |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1501 | { |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1502 | cpuidle_poll_state_init(drv); |
Rafael J. Wysocki | 4dcb78e | 2020-02-03 11:57:18 +0100 | [diff] [blame] | 1503 | |
| 1504 | if (disabled_states_mask & BIT(0)) |
| 1505 | drv->states[0].flags |= CPUIDLE_FLAG_OFF; |
| 1506 | |
Rafael J. Wysocki | 1873495 | 2019-12-13 09:56:01 +0100 | [diff] [blame] | 1507 | drv->state_count = 1; |
| 1508 | |
| 1509 | if (icpu) |
| 1510 | intel_idle_init_cstates_icpu(drv); |
| 1511 | else |
| 1512 | intel_idle_init_cstates_acpi(drv); |
| 1513 | } |
Deepthi Dharwar | 46bcfad | 2011-10-28 16:20:42 +0530 | [diff] [blame] | 1514 | |
Rafael J. Wysocki | 1aefbd7 | 2020-01-10 11:52:32 +0100 | [diff] [blame] | 1515 | static void auto_demotion_disable(void) |
| 1516 | { |
| 1517 | unsigned long long msr_bits; |
| 1518 | |
| 1519 | rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 1520 | msr_bits &= ~auto_demotion_disable_flags; |
Rafael J. Wysocki | 1aefbd7 | 2020-01-10 11:52:32 +0100 | [diff] [blame] | 1521 | wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits); |
| 1522 | } |
| 1523 | |
| 1524 | static void c1e_promotion_disable(void) |
| 1525 | { |
| 1526 | unsigned long long msr_bits; |
| 1527 | |
| 1528 | rdmsrl(MSR_IA32_POWER_CTL, msr_bits); |
| 1529 | msr_bits &= ~0x2; |
| 1530 | wrmsrl(MSR_IA32_POWER_CTL, msr_bits); |
| 1531 | } |
| 1532 | |
Rafael J. Wysocki | 6eacb15 | 2020-02-06 18:45:29 +0100 | [diff] [blame] | 1533 | /** |
| 1534 | * intel_idle_cpu_init - Register the target CPU with the cpuidle core. |
| 1535 | * @cpu: CPU to initialize. |
| 1536 | * |
| 1537 | * Register a cpuidle device object for @cpu and update its MSRs in accordance |
| 1538 | * with the processor model flags. |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1539 | */ |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1540 | static int intel_idle_cpu_init(unsigned int cpu) |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1541 | { |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1542 | struct cpuidle_device *dev; |
| 1543 | |
Thomas Renninger | 65b7f83 | 2012-01-17 22:40:08 +0100 | [diff] [blame] | 1544 | dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu); |
Thomas Renninger | 65b7f83 | 2012-01-17 22:40:08 +0100 | [diff] [blame] | 1545 | dev->cpu = cpu; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1546 | |
Thomas Renninger | 65b7f83 | 2012-01-17 22:40:08 +0100 | [diff] [blame] | 1547 | if (cpuidle_register_device(dev)) { |
Joe Perches | 654d08a | 2017-06-09 12:29:20 -0700 | [diff] [blame] | 1548 | pr_debug("cpuidle_register_device %d failed!\n", cpu); |
Thomas Renninger | 65b7f83 | 2012-01-17 22:40:08 +0100 | [diff] [blame] | 1549 | return -EIO; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1550 | } |
| 1551 | |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 1552 | if (auto_demotion_disable_flags) |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1553 | auto_demotion_disable(); |
Thomas Renninger | 65b7f83 | 2012-01-17 22:40:08 +0100 | [diff] [blame] | 1554 | |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 1555 | if (disable_promotion_to_c1e) |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1556 | c1e_promotion_disable(); |
| 1557 | |
| 1558 | return 0; |
| 1559 | } |
| 1560 | |
| 1561 | static int intel_idle_cpu_online(unsigned int cpu) |
| 1562 | { |
| 1563 | struct cpuidle_device *dev; |
| 1564 | |
Rafael J. Wysocki | 40ab82e | 2020-02-06 18:40:54 +0100 | [diff] [blame] | 1565 | if (!lapic_timer_always_reliable) |
Rafael J. Wysocki | cbd2c4c | 2020-01-10 11:43:23 +0100 | [diff] [blame] | 1566 | tick_broadcast_enable(); |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1567 | |
| 1568 | /* |
| 1569 | * Some systems can hotplug a cpu at runtime after |
| 1570 | * the kernel has booted, we have to initialize the |
| 1571 | * driver in this case |
| 1572 | */ |
| 1573 | dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu); |
| 1574 | if (!dev->registered) |
| 1575 | return intel_idle_cpu_init(cpu); |
Bartlomiej Zolnierkiewicz | dbf87ab | 2013-12-20 19:47:28 +0100 | [diff] [blame] | 1576 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1577 | return 0; |
| 1578 | } |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1579 | |
Rafael J. Wysocki | 0755a9b | 2020-01-10 11:49:58 +0100 | [diff] [blame] | 1580 | /** |
| 1581 | * intel_idle_cpuidle_devices_uninit - Unregister all cpuidle devices. |
| 1582 | */ |
| 1583 | static void __init intel_idle_cpuidle_devices_uninit(void) |
| 1584 | { |
| 1585 | int i; |
| 1586 | |
| 1587 | for_each_online_cpu(i) |
| 1588 | cpuidle_unregister_device(per_cpu_ptr(intel_idle_cpuidle_devices, i)); |
| 1589 | } |
| 1590 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1591 | static int __init intel_idle_init(void) |
| 1592 | { |
Rafael J. Wysocki | a6c86e3 | 2020-01-10 11:44:58 +0100 | [diff] [blame] | 1593 | const struct x86_cpu_id *id; |
| 1594 | unsigned int eax, ebx, ecx; |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1595 | int retval; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1596 | |
Thomas Renninger | d189604 | 2010-11-03 17:06:14 +0100 | [diff] [blame] | 1597 | /* Do not load intel_idle at all for now if idle= is passed */ |
| 1598 | if (boot_option_idle_override != IDLE_NO_OVERRIDE) |
| 1599 | return -ENODEV; |
| 1600 | |
Rafael J. Wysocki | a6c86e3 | 2020-01-10 11:44:58 +0100 | [diff] [blame] | 1601 | if (max_cstate == 0) { |
| 1602 | pr_debug("disabled\n"); |
| 1603 | return -EPERM; |
| 1604 | } |
| 1605 | |
| 1606 | id = x86_match_cpu(intel_idle_ids); |
| 1607 | if (id) { |
| 1608 | if (!boot_cpu_has(X86_FEATURE_MWAIT)) { |
| 1609 | pr_debug("Please enable MWAIT in BIOS SETUP\n"); |
| 1610 | return -ENODEV; |
| 1611 | } |
| 1612 | } else { |
| 1613 | id = x86_match_cpu(intel_mwait_ids); |
| 1614 | if (!id) |
| 1615 | return -ENODEV; |
| 1616 | } |
| 1617 | |
| 1618 | if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) |
| 1619 | return -ENODEV; |
| 1620 | |
| 1621 | cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates); |
| 1622 | |
| 1623 | if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || |
| 1624 | !(ecx & CPUID5_ECX_INTERRUPT_BREAK) || |
| 1625 | !mwait_substates) |
| 1626 | return -ENODEV; |
| 1627 | |
| 1628 | pr_debug("MWAIT substates: 0x%x\n", mwait_substates); |
| 1629 | |
| 1630 | icpu = (const struct idle_cpu *)id->driver_data; |
| 1631 | if (icpu) { |
| 1632 | cpuidle_state_table = icpu->state_table; |
Rafael J. Wysocki | 7f843dd | 2020-02-06 18:41:24 +0100 | [diff] [blame] | 1633 | auto_demotion_disable_flags = icpu->auto_demotion_disable_flags; |
| 1634 | disable_promotion_to_c1e = icpu->disable_promotion_to_c1e; |
Rafael J. Wysocki | 3a5be9b | 2020-02-03 11:57:08 +0100 | [diff] [blame] | 1635 | if (icpu->use_acpi || force_use_acpi) |
Rafael J. Wysocki | a6c86e3 | 2020-01-10 11:44:58 +0100 | [diff] [blame] | 1636 | intel_idle_acpi_cst_extract(); |
| 1637 | } else if (!intel_idle_acpi_cst_extract()) { |
| 1638 | return -ENODEV; |
| 1639 | } |
| 1640 | |
| 1641 | pr_debug("v" INTEL_IDLE_VERSION " model 0x%X\n", |
| 1642 | boot_cpu_data.x86_model); |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1643 | |
Richard Cochran | e9df69c | 2016-04-06 17:00:52 -0400 | [diff] [blame] | 1644 | intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device); |
Rafael J. Wysocki | 533da74 | 2020-01-10 11:45:49 +0100 | [diff] [blame] | 1645 | if (!intel_idle_cpuidle_devices) |
Richard Cochran | e9df69c | 2016-04-06 17:00:52 -0400 | [diff] [blame] | 1646 | return -ENOMEM; |
| 1647 | |
Rafael J. Wysocki | 3d3a1ae | 2020-01-10 11:48:25 +0100 | [diff] [blame] | 1648 | intel_idle_cpuidle_driver_init(&intel_idle_driver); |
| 1649 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1650 | retval = cpuidle_register_driver(&intel_idle_driver); |
| 1651 | if (retval) { |
Konrad Rzeszutek Wilk | 3735d52 | 2012-08-16 22:06:55 +0200 | [diff] [blame] | 1652 | struct cpuidle_driver *drv = cpuidle_get_driver(); |
Joe Perches | 654d08a | 2017-06-09 12:29:20 -0700 | [diff] [blame] | 1653 | printk(KERN_DEBUG pr_fmt("intel_idle yielding to %s\n"), |
| 1654 | drv ? drv->name : "none"); |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1655 | goto init_driver_fail; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1656 | } |
| 1657 | |
Richard Cochran | 2259a81 | 2016-04-06 17:00:54 -0400 | [diff] [blame] | 1658 | if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ |
Rafael J. Wysocki | 40ab82e | 2020-02-06 18:40:54 +0100 | [diff] [blame] | 1659 | lapic_timer_always_reliable = true; |
Richard Cochran | 2259a81 | 2016-04-06 17:00:54 -0400 | [diff] [blame] | 1660 | |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1661 | retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online", |
| 1662 | intel_idle_cpu_online, NULL); |
| 1663 | if (retval < 0) |
| 1664 | goto hp_setup_fail; |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1665 | |
Rafael J. Wysocki | 40ab82e | 2020-02-06 18:40:54 +0100 | [diff] [blame] | 1666 | pr_debug("Local APIC timer is reliable in %s\n", |
| 1667 | lapic_timer_always_reliable ? "all C-states" : "C1"); |
Richard Cochran | 2259a81 | 2016-04-06 17:00:54 -0400 | [diff] [blame] | 1668 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1669 | return 0; |
Sebastian Andrzej Siewior | fb1013a | 2016-11-29 10:51:43 +0100 | [diff] [blame] | 1670 | |
| 1671 | hp_setup_fail: |
| 1672 | intel_idle_cpuidle_devices_uninit(); |
| 1673 | cpuidle_unregister_driver(&intel_idle_driver); |
| 1674 | init_driver_fail: |
| 1675 | free_percpu(intel_idle_cpuidle_devices); |
| 1676 | return retval; |
| 1677 | |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1678 | } |
Paul Gortmaker | 02c4fae | 2016-06-17 01:28:33 -0400 | [diff] [blame] | 1679 | device_initcall(intel_idle_init); |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1680 | |
Paul Gortmaker | 02c4fae | 2016-06-17 01:28:33 -0400 | [diff] [blame] | 1681 | /* |
| 1682 | * We are not really modular, but we used to support that. Meaning we also |
| 1683 | * support "intel_idle.max_cstate=..." at boot and also a read-only export of |
| 1684 | * it at /sys/module/intel_idle/parameters/max_cstate -- so using module_param |
| 1685 | * is the easiest way (currently) to continue doing that. |
| 1686 | */ |
Len Brown | 2671717 | 2010-03-08 14:07:30 -0500 | [diff] [blame] | 1687 | module_param(max_cstate, int, 0444); |
Rafael J. Wysocki | 4dcb78e | 2020-02-03 11:57:18 +0100 | [diff] [blame] | 1688 | /* |
| 1689 | * The positions of the bits that are set in this number are the indices of the |
| 1690 | * idle states to be disabled by default (as reflected by the names of the |
| 1691 | * corresponding idle state directories in sysfs, "state0", "state1" ... |
| 1692 | * "state<i>" ..., where <i> is the index of the given state). |
| 1693 | */ |
| 1694 | module_param_named(states_off, disabled_states_mask, uint, 0444); |
| 1695 | MODULE_PARM_DESC(states_off, "Mask of disabled idle states"); |