Skip to content

Commit bc71bec

Browse files
venkatesh.pallipadi@intel.comlenb
authored andcommitted
ACPI: enable MWAIT for C1 idle
Add MWAIT idle for C1 state instead of halt, on platforms that support C1 state with MWAIT. Renames cx->space_id to something more appropriate. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 2e90665 commit bc71bec

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎drivers/acpi/processor_idle.c‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static atomic_t c3_cpu_count;
265265
/* Common C-state entry for C2, C3, .. */
266266
static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
267267
{
268-
if (cstate->space_id == ACPI_CSTATE_FFH) {
268+
if (cstate->entry_method == ACPI_CSTATE_FFH) {
269269
/* Call into architectural FFH based C-state */
270270
acpi_processor_ffh_cstate_enter(cstate);
271271
} else {
@@ -929,20 +929,20 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
929929
cx.address = reg->address;
930930
cx.index = current_count + 1;
931931

932-
cx.space_id = ACPI_CSTATE_SYSTEMIO;
932+
cx.entry_method = ACPI_CSTATE_SYSTEMIO;
933933
if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
934934
if (acpi_processor_ffh_cstate_probe
935935
(pr->id, &cx, reg) == 0) {
936-
cx.space_id = ACPI_CSTATE_FFH;
937-
} else if (cx.type != ACPI_STATE_C1) {
936+
cx.entry_method = ACPI_CSTATE_FFH;
937+
} else if (cx.type == ACPI_STATE_C1) {
938938
/*
939939
* C1 is a special case where FIXED_HARDWARE
940940
* can be handled in non-MWAIT way as well.
941941
* In that case, save this _CST entry info.
942-
* That is, we retain space_id of SYSTEM_IO for
943-
* halt based C1.
944942
* Otherwise, ignore this info and continue.
945943
*/
944+
cx.entry_method = ACPI_CSTATE_HALT;
945+
} else {
946946
continue;
947947
}
948948
}
@@ -1376,12 +1376,16 @@ static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr,
13761376
/**
13771377
* acpi_idle_do_entry - a helper function that does C2 and C3 type entry
13781378
* @cx: cstate data
1379+
*
1380+
* Caller disables interrupt before call and enables interrupt after return.
13791381
*/
13801382
static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
13811383
{
1382-
if (cx->space_id == ACPI_CSTATE_FFH) {
1384+
if (cx->entry_method == ACPI_CSTATE_FFH) {
13831385
/* Call into architectural FFH based C-state */
13841386
acpi_processor_ffh_cstate_enter(cx);
1387+
} else if (cx->entry_method == ACPI_CSTATE_HALT) {
1388+
acpi_safe_halt();
13851389
} else {
13861390
int unused;
13871391
/* IO port based C-state */
@@ -1414,7 +1418,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
14141418
if (pr->flags.bm_check)
14151419
acpi_idle_update_bm_rld(pr, cx);
14161420

1417-
acpi_safe_halt();
1421+
acpi_idle_do_entry(cx);
14181422

14191423
local_irq_enable();
14201424
cx->usage++;

‎include/acpi/processor.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#define ACPI_CSTATE_SYSTEMIO (0)
3636
#define ACPI_CSTATE_FFH (1)
37+
#define ACPI_CSTATE_HALT (2)
3738

3839
/* Power Management */
3940

@@ -64,7 +65,7 @@ struct acpi_processor_cx {
6465
u8 valid;
6566
u8 type;
6667
u32 address;
67-
u8 space_id;
68+
u8 entry_method;
6869
u8 index;
6970
u32 latency;
7071
u32 latency_ticks;

0 commit comments

Comments
 (0)