@@ -69,7 +69,12 @@ static unsigned int preferred_states_mask;
6969static struct cpuidle_device __percpu * intel_idle_cpuidle_devices ;
7070
7171static unsigned long auto_demotion_disable_flags ;
72- static bool disable_promotion_to_c1e ;
72+
73+ static enum {
74+ C1E_PROMOTION_PRESERVE ,
75+ C1E_PROMOTION_ENABLE ,
76+ C1E_PROMOTION_DISABLE
77+ } c1e_promotion = C1E_PROMOTION_PRESERVE ;
7378
7479struct idle_cpu {
7580 struct cpuidle_state * state_table ;
@@ -1398,8 +1403,6 @@ static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { }
13981403static inline bool intel_idle_off_by_default (u32 mwait_hint ) { return false; }
13991404#endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */
14001405
1401- static void c1e_promotion_enable (void );
1402-
14031406/**
14041407 * ivt_idle_state_table_update - Tune the idle states table for Ivy Town.
14051408 *
@@ -1578,17 +1581,14 @@ static void __init spr_idle_state_table_update(void)
15781581 unsigned long long msr ;
15791582
15801583 /* Check if user prefers C1E over C1. */
1581- if (preferred_states_mask & BIT (2 )) {
1582- if (preferred_states_mask & BIT (1 ))
1583- /* Both can't be enabled, stick to the defaults. */
1584- return ;
1585-
1584+ if ((preferred_states_mask & BIT (2 )) &&
1585+ !(preferred_states_mask & BIT (1 ))) {
1586+ /* Disable C1 and enable C1E. */
15861587 spr_cstates [0 ].flags |= CPUIDLE_FLAG_UNUSABLE ;
15871588 spr_cstates [1 ].flags &= ~CPUIDLE_FLAG_UNUSABLE ;
15881589
15891590 /* Enable C1E using the "C1E promotion" bit. */
1590- c1e_promotion_enable ();
1591- disable_promotion_to_c1e = false;
1591+ c1e_promotion = C1E_PROMOTION_ENABLE ;
15921592 }
15931593
15941594 /*
@@ -1754,7 +1754,9 @@ static int intel_idle_cpu_init(unsigned int cpu)
17541754 if (auto_demotion_disable_flags )
17551755 auto_demotion_disable ();
17561756
1757- if (disable_promotion_to_c1e )
1757+ if (c1e_promotion == C1E_PROMOTION_ENABLE )
1758+ c1e_promotion_enable ();
1759+ else if (c1e_promotion == C1E_PROMOTION_DISABLE )
17581760 c1e_promotion_disable ();
17591761
17601762 return 0 ;
@@ -1833,7 +1835,8 @@ static int __init intel_idle_init(void)
18331835 if (icpu ) {
18341836 cpuidle_state_table = icpu -> state_table ;
18351837 auto_demotion_disable_flags = icpu -> auto_demotion_disable_flags ;
1836- disable_promotion_to_c1e = icpu -> disable_promotion_to_c1e ;
1838+ if (icpu -> disable_promotion_to_c1e )
1839+ c1e_promotion = C1E_PROMOTION_DISABLE ;
18371840 if (icpu -> use_acpi || force_use_acpi )
18381841 intel_idle_acpi_cst_extract ();
18391842 } else if (!intel_idle_acpi_cst_extract ()) {
0 commit comments