···98989999static int acpi_processor_set_power_policy(struct acpi_processor *pr);100100101101+#else /* CONFIG_CPU_IDLE */102102+static unsigned int latency_factor __read_mostly = 2;103103+module_param(latency_factor, uint, 0644);101104#endif102105103106/*···204201 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2);205202}206203204204+/*205205+ * Callers should disable interrupts before the call and enable206206+ * interrupts after return.207207+ */207208static void acpi_safe_halt(void)208209{209210 current_thread_info()->status &= ~TS_POLLING;···268261/* Common C-state entry for C2, C3, .. */269262static void acpi_cstate_enter(struct acpi_processor_cx *cstate)270263{271271- if (cstate->space_id == ACPI_CSTATE_FFH) {264264+ if (cstate->entry_method == ACPI_CSTATE_FFH) {272265 /* Call into architectural FFH based C-state */273266 acpi_processor_ffh_cstate_enter(cstate);274267 } else {···420413 pm_idle_save();421414 else422415 acpi_safe_halt();416416+417417+ local_irq_enable();423418 return;424419 }425420···530521 * skew otherwise.531522 */532523 sleep_ticks = 0xFFFFFFFF;524524+ local_irq_enable();533525 break;534526535527 case ACPI_STATE_C2:···932922 cx.address = reg->address;933923 cx.index = current_count + 1;934924935935- cx.space_id = ACPI_CSTATE_SYSTEMIO;925925+ cx.entry_method = ACPI_CSTATE_SYSTEMIO;936926 if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {937927 if (acpi_processor_ffh_cstate_probe938928 (pr->id, &cx, reg) == 0) {939939- cx.space_id = ACPI_CSTATE_FFH;940940- } else if (cx.type != ACPI_STATE_C1) {929929+ cx.entry_method = ACPI_CSTATE_FFH;930930+ } else if (cx.type == ACPI_STATE_C1) {941931 /*942932 * C1 is a special case where FIXED_HARDWARE943933 * can be handled in non-MWAIT way as well.944934 * In that case, save this _CST entry info.945945- * That is, we retain space_id of SYSTEM_IO for946946- * halt based C1.947935 * Otherwise, ignore this info and continue.948936 */937937+ cx.entry_method = ACPI_CSTATE_HALT;938938+ } else {949939 continue;950940 }951941 }···13791369/**13801370 * acpi_idle_do_entry - a helper function that does C2 and C3 type entry13811371 * @cx: cstate data13721372+ *13731373+ * Caller disables interrupt before call and enables interrupt after return.13821374 */13831375static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)13841376{13851385- if (cx->space_id == ACPI_CSTATE_FFH) {13771377+ if (cx->entry_method == ACPI_CSTATE_FFH) {13861378 /* Call into architectural FFH based C-state */13871379 acpi_processor_ffh_cstate_enter(cx);13801380+ } else if (cx->entry_method == ACPI_CSTATE_HALT) {13811381+ acpi_safe_halt();13881382 } else {13891383 int unused;13901384 /* IO port based C-state */···14101396static int acpi_idle_enter_c1(struct cpuidle_device *dev,14111397 struct cpuidle_state *state)14121398{13991399+ u32 t1, t2;14131400 struct acpi_processor *pr;14141401 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);14021402+14151403 pr = processors[smp_processor_id()];1416140414171405 if (unlikely(!pr))14181406 return 0;1419140714081408+ local_irq_disable();14201409 if (pr->flags.bm_check)14211410 acpi_idle_update_bm_rld(pr, cx);1422141114231423- acpi_safe_halt();14121412+ t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);14131413+ acpi_idle_do_entry(cx);14141414+ t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);1424141514161416+ local_irq_enable();14251417 cx->usage++;1426141814271427- return 0;14191419+ return ticks_elapsed_in_us(t1, t2);14281420}1429142114301422/**···15371517 if (dev->safe_state) {15381518 return dev->safe_state->enter(dev, dev->safe_state);15391519 } else {15201520+ local_irq_disable();15401521 acpi_safe_halt();15221522+ local_irq_enable();15411523 return 0;15421524 }15431525 }···16311609 */16321610static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)16331611{16341634- int i, count = 0;16121612+ int i, count = CPUIDLE_DRIVER_STATE_START;16351613 struct acpi_processor_cx *cx;16361614 struct cpuidle_state *state;16371615 struct cpuidle_device *dev = &pr->power.dev;···1660163816611639 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);16621640 state->exit_latency = cx->latency;16631663- state->target_residency = cx->latency * 6;16411641+ state->target_residency = cx->latency * latency_factor;16641642 state->power_usage = cx->power;1665164316661644 state->flags = 0;16671645 switch (cx->type) {16681646 case ACPI_STATE_C1:16691647 state->flags |= CPUIDLE_FLAG_SHALLOW;16481648+ state->flags |= CPUIDLE_FLAG_TIME_VALID;16701649 state->enter = acpi_idle_enter_c1;16711650 dev->safe_state = state;16721651 break;···16901667 }1691166816921669 count++;16701670+ if (count == CPUIDLE_STATE_MAX)16711671+ break;16931672 }1694167316951674 dev->state_count = count;
+2-2
drivers/cpuidle/Kconfig
···1122config CPU_IDLE33 bool "CPU idle PM support"44+ default ACPI45 help56 CPU idle is a generic framework for supporting software-controlled67 idle processor power management. It includes modular cross-platform78 governors that can be swapped during runtime.8999- If you're using a mobile platform that supports CPU idle PM (e.g.1010- an ACPI-capable notebook), you should say Y here.1010+ If you're using an ACPI-enabled platform, you should say Y here.11111212config CPU_IDLE_GOV_LADDER1313 bool