@@ -120,6 +120,12 @@ static unsigned int mwait_substates __initdata;
120
120
*/
121
121
#define CPUIDLE_FLAG_INIT_XSTATE BIT(17)
122
122
123
+ /*
124
+ * Ignore the sub-state when matching mwait hints between the ACPI _CST and
125
+ * custom tables.
126
+ */
127
+ #define CPUIDLE_FLAG_PARTIAL_HINT_MATCH BIT(18)
128
+
123
129
/*
124
130
* MWAIT takes an 8-bit "hint" in EAX "suggesting"
125
131
* the C-state (top nibble) and sub-state (bottom nibble)
@@ -1043,7 +1049,8 @@ static struct cpuidle_state gnr_cstates[] __initdata = {
1043
1049
.name = "C6" ,
1044
1050
.desc = "MWAIT 0x20" ,
1045
1051
.flags = MWAIT2flg (0x20 ) | CPUIDLE_FLAG_TLB_FLUSHED |
1046
- CPUIDLE_FLAG_INIT_XSTATE ,
1052
+ CPUIDLE_FLAG_INIT_XSTATE |
1053
+ CPUIDLE_FLAG_PARTIAL_HINT_MATCH ,
1047
1054
.exit_latency = 170 ,
1048
1055
.target_residency = 650 ,
1049
1056
.enter = & intel_idle ,
@@ -1052,7 +1059,8 @@ static struct cpuidle_state gnr_cstates[] __initdata = {
1052
1059
.name = "C6P" ,
1053
1060
.desc = "MWAIT 0x21" ,
1054
1061
.flags = MWAIT2flg (0x21 ) | CPUIDLE_FLAG_TLB_FLUSHED |
1055
- CPUIDLE_FLAG_INIT_XSTATE ,
1062
+ CPUIDLE_FLAG_INIT_XSTATE |
1063
+ CPUIDLE_FLAG_PARTIAL_HINT_MATCH ,
1056
1064
.exit_latency = 210 ,
1057
1065
.target_residency = 1000 ,
1058
1066
.enter = & intel_idle ,
@@ -1354,15 +1362,17 @@ static struct cpuidle_state srf_cstates[] __initdata = {
1354
1362
{
1355
1363
.name = "C6S" ,
1356
1364
.desc = "MWAIT 0x22" ,
1357
- .flags = MWAIT2flg (0x22 ) | CPUIDLE_FLAG_TLB_FLUSHED ,
1365
+ .flags = MWAIT2flg (0x22 ) | CPUIDLE_FLAG_TLB_FLUSHED |
1366
+ CPUIDLE_FLAG_PARTIAL_HINT_MATCH ,
1358
1367
.exit_latency = 270 ,
1359
1368
.target_residency = 700 ,
1360
1369
.enter = & intel_idle ,
1361
1370
.enter_s2idle = intel_idle_s2idle , },
1362
1371
{
1363
1372
.name = "C6SP" ,
1364
1373
.desc = "MWAIT 0x23" ,
1365
- .flags = MWAIT2flg (0x23 ) | CPUIDLE_FLAG_TLB_FLUSHED ,
1374
+ .flags = MWAIT2flg (0x23 ) | CPUIDLE_FLAG_TLB_FLUSHED |
1375
+ CPUIDLE_FLAG_PARTIAL_HINT_MATCH ,
1366
1376
.exit_latency = 310 ,
1367
1377
.target_residency = 900 ,
1368
1378
.enter = & intel_idle ,
@@ -1744,7 +1754,7 @@ static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
1744
1754
}
1745
1755
}
1746
1756
1747
- static bool __init intel_idle_off_by_default (u32 mwait_hint )
1757
+ static bool __init intel_idle_off_by_default (unsigned int flags , u32 mwait_hint )
1748
1758
{
1749
1759
int cstate , limit ;
1750
1760
@@ -1761,7 +1771,15 @@ static bool __init intel_idle_off_by_default(u32 mwait_hint)
1761
1771
* the interesting states are ACPI_CSTATE_FFH.
1762
1772
*/
1763
1773
for (cstate = 1 ; cstate < limit ; cstate ++ ) {
1764
- if (acpi_state_table .states [cstate ].address == mwait_hint )
1774
+ u32 acpi_hint = acpi_state_table .states [cstate ].address ;
1775
+ u32 table_hint = mwait_hint ;
1776
+
1777
+ if (flags & CPUIDLE_FLAG_PARTIAL_HINT_MATCH ) {
1778
+ acpi_hint &= ~MWAIT_SUBSTATE_MASK ;
1779
+ table_hint &= ~MWAIT_SUBSTATE_MASK ;
1780
+ }
1781
+
1782
+ if (acpi_hint == table_hint )
1765
1783
return false;
1766
1784
}
1767
1785
return true;
@@ -1771,7 +1789,10 @@ static bool __init intel_idle_off_by_default(u32 mwait_hint)
1771
1789
1772
1790
static inline bool intel_idle_acpi_cst_extract (void ) { return false; }
1773
1791
static inline void intel_idle_init_cstates_acpi (struct cpuidle_driver * drv ) { }
1774
- static inline bool intel_idle_off_by_default (u32 mwait_hint ) { return false; }
1792
+ static inline bool intel_idle_off_by_default (unsigned int flags , u32 mwait_hint )
1793
+ {
1794
+ return false;
1795
+ }
1775
1796
#endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */
1776
1797
1777
1798
/**
@@ -2098,7 +2119,7 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
2098
2119
2099
2120
if ((disabled_states_mask & BIT (drv -> state_count )) ||
2100
2121
((icpu -> use_acpi || force_use_acpi ) &&
2101
- intel_idle_off_by_default (mwait_hint ) &&
2122
+ intel_idle_off_by_default (state -> flags , mwait_hint ) &&
2102
2123
!(state -> flags & CPUIDLE_FLAG_ALWAYS_ENABLE )))
2103
2124
state -> flags |= CPUIDLE_FLAG_OFF ;
2104
2125
0 commit comments