aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBoris Ostrovsky <boris.ostrovsky@amd.com>2012-03-13 14:55:09 -0400
committerLen Brown <len.brown@intel.com>2012-03-30 03:23:01 -0400
commit1a022e3f1be11730bd8747b1af96a0274bf6356e (patch)
treed3c95b68626ac7d963ac3a85a07dae1cfc011906 /drivers/acpi
parente07510585a88c0f6c6c728e2e006aa913496d4ae (diff)
idle, x86: Allow off-lined CPU to enter deeper C states
Currently when a CPU is off-lined it enters either MWAIT-based idle or, if MWAIT is not desired or supported, HLT-based idle (which places the processor in C1 state). This patch allows processors without MWAIT support to stay in states deeper than C1. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_idle.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 0e8e2de2ed3e..6b1d32a161ae 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -770,6 +770,35 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
770 return index; 770 return index;
771} 771}
772 772
773
774/**
775 * acpi_idle_play_dead - enters an ACPI state for long-term idle (i.e. off-lining)
776 * @dev: the target CPU
777 * @index: the index of suggested state
778 */
779static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
780{
781 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
782 struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
783
784 ACPI_FLUSH_CPU_CACHE();
785
786 while (1) {
787
788 if (cx->entry_method == ACPI_CSTATE_HALT)
789 halt();
790 else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
791 inb(cx->address);
792 /* See comment in acpi_idle_do_entry() */
793 inl(acpi_gbl_FADT.xpm_timer_block.address);
794 } else
795 return -ENODEV;
796 }
797
798 /* Never reached */
799 return 0;
800}
801
773/** 802/**
774 * acpi_idle_enter_simple - enters an ACPI state without BM handling 803 * acpi_idle_enter_simple - enters an ACPI state without BM handling
775 * @dev: the target CPU 804 * @dev: the target CPU
@@ -1077,12 +1106,14 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
1077 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1106 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1078 1107
1079 state->enter = acpi_idle_enter_c1; 1108 state->enter = acpi_idle_enter_c1;
1109 state->enter_dead = acpi_idle_play_dead;
1080 drv->safe_state_index = count; 1110 drv->safe_state_index = count;
1081 break; 1111 break;
1082 1112
1083 case ACPI_STATE_C2: 1113 case ACPI_STATE_C2:
1084 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1114 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1085 state->enter = acpi_idle_enter_simple; 1115 state->enter = acpi_idle_enter_simple;
1116 state->enter_dead = acpi_idle_play_dead;
1086 drv->safe_state_index = count; 1117 drv->safe_state_index = count;
1087 break; 1118 break;
1088 1119