intel_idle: Move 3 functions closer to their callers
Move intel_idle_verify_cstate(), auto_demotion_disable() and c1e_promotion_disable() closer to their callers. While at it, annotate intel_idle_verify_cstate() with __init, as it is only used during the initialization of the driver. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
095928ae48
commit
1aefbd7aeb
|
@ -951,39 +951,6 @@ static void intel_idle_s2idle(struct cpuidle_device *dev,
|
||||||
mwait_idle_with_hints(eax, ecx);
|
mwait_idle_with_hints(eax, ecx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool intel_idle_verify_cstate(unsigned int mwait_hint)
|
|
||||||
{
|
|
||||||
unsigned int mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint) + 1;
|
|
||||||
unsigned int num_substates = (mwait_substates >> mwait_cstate * 4) &
|
|
||||||
MWAIT_SUBSTATE_MASK;
|
|
||||||
|
|
||||||
/* Ignore the C-state if there are NO sub-states in CPUID for it. */
|
|
||||||
if (num_substates == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mwait_cstate > 2 && !boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
|
|
||||||
mark_tsc_unstable("TSC halts in idle states deeper than C2");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void auto_demotion_disable(void)
|
|
||||||
{
|
|
||||||
unsigned long long msr_bits;
|
|
||||||
|
|
||||||
rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
|
||||||
msr_bits &= ~(icpu->auto_demotion_disable_flags);
|
|
||||||
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
|
||||||
}
|
|
||||||
static void c1e_promotion_disable(void)
|
|
||||||
{
|
|
||||||
unsigned long long msr_bits;
|
|
||||||
|
|
||||||
rdmsrl(MSR_IA32_POWER_CTL, msr_bits);
|
|
||||||
msr_bits &= ~0x2;
|
|
||||||
wrmsrl(MSR_IA32_POWER_CTL, msr_bits);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct idle_cpu idle_cpu_nehalem = {
|
static const struct idle_cpu idle_cpu_nehalem = {
|
||||||
.state_table = nehalem_cstates,
|
.state_table = nehalem_cstates,
|
||||||
.auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,
|
.auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,
|
||||||
|
@ -1434,6 +1401,22 @@ static void __init sklh_idle_state_table_update(void)
|
||||||
skl_cstates[6].flags |= CPUIDLE_FLAG_UNUSABLE; /* C9-SKL */
|
skl_cstates[6].flags |= CPUIDLE_FLAG_UNUSABLE; /* C9-SKL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool __init intel_idle_verify_cstate(unsigned int mwait_hint)
|
||||||
|
{
|
||||||
|
unsigned int mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint) + 1;
|
||||||
|
unsigned int num_substates = (mwait_substates >> mwait_cstate * 4) &
|
||||||
|
MWAIT_SUBSTATE_MASK;
|
||||||
|
|
||||||
|
/* Ignore the C-state if there are NO sub-states in CPUID for it. */
|
||||||
|
if (num_substates == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mwait_cstate > 2 && !boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
|
||||||
|
mark_tsc_unstable("TSC halts in idle states deeper than C2");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
|
static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
|
||||||
{
|
{
|
||||||
int cstate;
|
int cstate;
|
||||||
|
@ -1503,6 +1486,24 @@ static void __init intel_idle_cpuidle_driver_init(struct cpuidle_driver *drv)
|
||||||
intel_idle_init_cstates_acpi(drv);
|
intel_idle_init_cstates_acpi(drv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void auto_demotion_disable(void)
|
||||||
|
{
|
||||||
|
unsigned long long msr_bits;
|
||||||
|
|
||||||
|
rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
||||||
|
msr_bits &= ~(icpu->auto_demotion_disable_flags);
|
||||||
|
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void c1e_promotion_disable(void)
|
||||||
|
{
|
||||||
|
unsigned long long msr_bits;
|
||||||
|
|
||||||
|
rdmsrl(MSR_IA32_POWER_CTL, msr_bits);
|
||||||
|
msr_bits &= ~0x2;
|
||||||
|
wrmsrl(MSR_IA32_POWER_CTL, msr_bits);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* intel_idle_cpu_init()
|
* intel_idle_cpu_init()
|
||||||
* allocate, initialize, register cpuidle_devices
|
* allocate, initialize, register cpuidle_devices
|
||||||
|
|
Loading…
Reference in New Issue