@@ -69,7 +69,12 @@ static unsigned int preferred_states_mask;
69
69
static struct cpuidle_device __percpu * intel_idle_cpuidle_devices ;
70
70
71
71
static 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 ;
73
78
74
79
struct idle_cpu {
75
80
struct cpuidle_state * state_table ;
@@ -1398,8 +1403,6 @@ static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { }
1398
1403
static inline bool intel_idle_off_by_default (u32 mwait_hint ) { return false; }
1399
1404
#endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */
1400
1405
1401
- static void c1e_promotion_enable (void );
1402
-
1403
1406
/**
1404
1407
* ivt_idle_state_table_update - Tune the idle states table for Ivy Town.
1405
1408
*
@@ -1578,17 +1581,14 @@ static void __init spr_idle_state_table_update(void)
1578
1581
unsigned long long msr ;
1579
1582
1580
1583
/* 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. */
1586
1587
spr_cstates [0 ].flags |= CPUIDLE_FLAG_UNUSABLE ;
1587
1588
spr_cstates [1 ].flags &= ~CPUIDLE_FLAG_UNUSABLE ;
1588
1589
1589
1590
/* Enable C1E using the "C1E promotion" bit. */
1590
- c1e_promotion_enable ();
1591
- disable_promotion_to_c1e = false;
1591
+ c1e_promotion = C1E_PROMOTION_ENABLE ;
1592
1592
}
1593
1593
1594
1594
/*
@@ -1754,7 +1754,9 @@ static int intel_idle_cpu_init(unsigned int cpu)
1754
1754
if (auto_demotion_disable_flags )
1755
1755
auto_demotion_disable ();
1756
1756
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 )
1758
1760
c1e_promotion_disable ();
1759
1761
1760
1762
return 0 ;
@@ -1833,7 +1835,8 @@ static int __init intel_idle_init(void)
1833
1835
if (icpu ) {
1834
1836
cpuidle_state_table = icpu -> state_table ;
1835
1837
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 ;
1837
1840
if (icpu -> use_acpi || force_use_acpi )
1838
1841
intel_idle_acpi_cst_extract ();
1839
1842
} else if (!intel_idle_acpi_cst_extract ()) {
0 commit comments