#define pr_fmt(fmt) …
#include <linux/acpi.h>
#include <linux/kernel.h>
#include <linux/cpuidle.h>
#include <linux/tick.h>
#include <trace/events/power.h>
#include <linux/sched.h>
#include <linux/sched/smt.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
#include <linux/moduleparam.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>
#include <asm/mwait.h>
#include <asm/spec-ctrl.h>
#include <asm/fpu/api.h>
#define INTEL_IDLE_VERSION …
static struct cpuidle_driver intel_idle_driver = …;
static int max_cstate = …;
static unsigned int disabled_states_mask __read_mostly;
static unsigned int preferred_states_mask __read_mostly;
static bool force_irq_on __read_mostly;
static bool ibrs_off __read_mostly;
static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
static unsigned long auto_demotion_disable_flags;
static enum { … } c1e_promotion = …;
struct idle_cpu { … };
static const struct idle_cpu *icpu __initdata;
static struct cpuidle_state *cpuidle_state_table __initdata;
static unsigned int mwait_substates __initdata;
#define CPUIDLE_FLAG_IRQ_ENABLE …
#define CPUIDLE_FLAG_ALWAYS_ENABLE …
#define CPUIDLE_FLAG_IBRS …
#define CPUIDLE_FLAG_INIT_XSTATE …
#define flg2MWAIT(flags) …
#define MWAIT2flg(eax) …
static __always_inline int __intel_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index, bool irqoff)
{ … }
static __cpuidle int intel_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static __cpuidle int intel_idle_irq(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static __cpuidle int intel_idle_ibrs(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static __cpuidle int intel_idle_xstate(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static __cpuidle int intel_idle_s2idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{ … }
static struct cpuidle_state nehalem_cstates[] __initdata = …;
static struct cpuidle_state snb_cstates[] __initdata = …;
static struct cpuidle_state byt_cstates[] __initdata = …;
static struct cpuidle_state cht_cstates[] __initdata = …;
static struct cpuidle_state ivb_cstates[] __initdata = …;
static struct cpuidle_state ivt_cstates[] __initdata = …;
static struct cpuidle_state ivt_cstates_4s[] __initdata = …;
static struct cpuidle_state ivt_cstates_8s[] __initdata = …;
static struct cpuidle_state hsw_cstates[] __initdata = …;
static struct cpuidle_state bdw_cstates[] __initdata = …;
static struct cpuidle_state skl_cstates[] __initdata = …;
static struct cpuidle_state skx_cstates[] __initdata = …;
static struct cpuidle_state icx_cstates[] __initdata = …;
static struct cpuidle_state adl_cstates[] __initdata = …;
static struct cpuidle_state adl_l_cstates[] __initdata = …;
static struct cpuidle_state mtl_l_cstates[] __initdata = …;
static struct cpuidle_state gmt_cstates[] __initdata = …;
static struct cpuidle_state spr_cstates[] __initdata = …;
static struct cpuidle_state atom_cstates[] __initdata = …;
static struct cpuidle_state tangier_cstates[] __initdata = …;
static struct cpuidle_state avn_cstates[] __initdata = …;
static struct cpuidle_state knl_cstates[] __initdata = …;
static struct cpuidle_state bxt_cstates[] __initdata = …;
static struct cpuidle_state dnv_cstates[] __initdata = …;
static struct cpuidle_state snr_cstates[] __initdata = …;
static struct cpuidle_state grr_cstates[] __initdata = …;
static struct cpuidle_state srf_cstates[] __initdata = …;
static const struct idle_cpu idle_cpu_nehalem __initconst = …;
static const struct idle_cpu idle_cpu_nhx __initconst = …;
static const struct idle_cpu idle_cpu_atom __initconst = …;
static const struct idle_cpu idle_cpu_tangier __initconst = …;
static const struct idle_cpu idle_cpu_lincroft __initconst = …;
static const struct idle_cpu idle_cpu_snb __initconst = …;
static const struct idle_cpu idle_cpu_snx __initconst = …;
static const struct idle_cpu idle_cpu_byt __initconst = …;
static const struct idle_cpu idle_cpu_cht __initconst = …;
static const struct idle_cpu idle_cpu_ivb __initconst = …;
static const struct idle_cpu idle_cpu_ivt __initconst = …;
static const struct idle_cpu idle_cpu_hsw __initconst = …;
static const struct idle_cpu idle_cpu_hsx __initconst = …;
static const struct idle_cpu idle_cpu_bdw __initconst = …;
static const struct idle_cpu idle_cpu_bdx __initconst = …;
static const struct idle_cpu idle_cpu_skl __initconst = …;
static const struct idle_cpu idle_cpu_skx __initconst = …;
static const struct idle_cpu idle_cpu_icx __initconst = …;
static const struct idle_cpu idle_cpu_adl __initconst = …;
static const struct idle_cpu idle_cpu_adl_l __initconst = …;
static const struct idle_cpu idle_cpu_mtl_l __initconst = …;
static const struct idle_cpu idle_cpu_gmt __initconst = …;
static const struct idle_cpu idle_cpu_spr __initconst = …;
static const struct idle_cpu idle_cpu_avn __initconst = …;
static const struct idle_cpu idle_cpu_knl __initconst = …;
static const struct idle_cpu idle_cpu_bxt __initconst = …;
static const struct idle_cpu idle_cpu_dnv __initconst = …;
static const struct idle_cpu idle_cpu_snr __initconst = …;
static const struct idle_cpu idle_cpu_grr __initconst = …;
static const struct idle_cpu idle_cpu_srf __initconst = …;
static const struct x86_cpu_id intel_idle_ids[] __initconst = …;
static const struct x86_cpu_id intel_mwait_ids[] __initconst = …;
static bool __init intel_idle_max_cstate_reached(int cstate)
{ … }
static bool __init intel_idle_state_needs_timer_stop(struct cpuidle_state *state)
{ … }
#ifdef CONFIG_ACPI_PROCESSOR_CSTATE
#include <acpi/processor.h>
static bool no_acpi __read_mostly;
module_param(no_acpi, bool, 0444);
MODULE_PARM_DESC(…) …;
static bool force_use_acpi __read_mostly;
module_param_named(use_acpi, force_use_acpi, bool, 0444);
MODULE_PARM_DESC(…) …;
static struct acpi_processor_power acpi_state_table __initdata;
static bool __init intel_idle_cst_usable(void)
{ … }
static bool __init intel_idle_acpi_cst_extract(void)
{ … }
static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
{ … }
static bool __init intel_idle_off_by_default(u32 mwait_hint)
{ … }
#else
#define force_use_acpi …
static inline bool intel_idle_acpi_cst_extract(void) { return false; }
static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { }
static inline bool intel_idle_off_by_default(u32 mwait_hint) { return false; }
#endif
static void __init ivt_idle_state_table_update(void)
{ … }
static unsigned long long __init irtl_2_usec(unsigned long long irtl)
{ … }
static void __init bxt_idle_state_table_update(void)
{ … }
static void __init sklh_idle_state_table_update(void)
{ … }
static void __init skx_idle_state_table_update(void)
{ … }
static void __init adl_idle_state_table_update(void)
{ … }
static void __init spr_idle_state_table_update(void)
{ … }
static bool __init intel_idle_verify_cstate(unsigned int mwait_hint)
{ … }
static void state_update_enter_method(struct cpuidle_state *state, int cstate)
{ … }
static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
{ … }
static void __init intel_idle_cpuidle_driver_init(struct cpuidle_driver *drv)
{ … }
static void auto_demotion_disable(void)
{ … }
static void c1e_promotion_enable(void)
{ … }
static void c1e_promotion_disable(void)
{ … }
static int intel_idle_cpu_init(unsigned int cpu)
{ … }
static int intel_idle_cpu_online(unsigned int cpu)
{ … }
static void __init intel_idle_cpuidle_devices_uninit(void)
{ … }
static int __init intel_idle_init(void)
{ … }
device_initcall(intel_idle_init);
module_param(max_cstate, int, 0444);
module_param_named(states_off, disabled_states_mask, uint, 0444);
MODULE_PARM_DESC(…) …;
module_param_named(preferred_cstates, preferred_states_mask, uint, 0444);
MODULE_PARM_DESC(…) …;
module_param(force_irq_on, bool, 0444);
module_param(ibrs_off, bool, 0444);
MODULE_PARM_DESC(…) …;