Lines Matching +full:idle +full:- +full:state +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0
3 * cpuidle-powernv - idle state cpuidle driver.
4 * Adapted from drivers/cpuidle/cpuidle-pseries
26 * Expose only those Hardware idle states via the cpuidle framework
32 .name = "powernv_idle",
58 for (i = index + 1; i < drv->state_count; i++) { in get_snooze_timeout()
59 if (dev->states_usage[i].disable) in get_snooze_timeout()
62 return drv->states[i].target_residency * tb_ticks_per_usec; in get_snooze_timeout()
79 dev->poll_time_limit = false; in snooze_loop()
90 dev->poll_time_limit = true; in snooze_loop()
156 .name = "snooze",
196 drv->state_count = 0; in powernv_cpuidle_driver_init()
199 /* Is the state not enabled? */ in powernv_cpuidle_driver_init()
203 drv->states[drv->state_count] = /* structure copy */ in powernv_cpuidle_driver_init()
206 drv->state_count += 1; in powernv_cpuidle_driver_init()
216 * drv->cpumask defaults to cpu_possible_mask in in powernv_cpuidle_driver_init()
219 * cannot be hot-added later at run time. in powernv_cpuidle_driver_init()
225 drv->cpumask = (struct cpumask *)cpu_present_mask; in powernv_cpuidle_driver_init()
230 static inline void add_powernv_state(int index, const char *name, in add_powernv_state() argument
239 strscpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN); in add_powernv_state()
240 strscpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN); in add_powernv_state()
262 pr_warn("cpuidle-powernv : Only Snooze is available\n"); in powernv_add_idle_states()
270 * Since snooze is used as first idle state, max idle states allowed is in powernv_add_idle_states()
271 * CPUIDLE_STATE_MAX -1 in powernv_add_idle_states()
273 if (nr_pnv_idle_states > CPUIDLE_STATE_MAX - 1) { in powernv_add_idle_states()
274 pr_warn("cpuidle-powernv: discovered idle states more than allowed"); in powernv_add_idle_states()
275 dt_idle_states = CPUIDLE_STATE_MAX - 1; in powernv_add_idle_states()
279 * If the idle states use stop instruction, probe for psscr values in powernv_add_idle_states()
288 struct pnv_idle_states_t *state = &pnv_idle_states[i]; in powernv_add_idle_states() local
291 * Skip the platform idle state whose flag isn't in in powernv_add_idle_states()
294 if ((state->flags & supported_flags) != state->flags) in powernv_add_idle_states()
297 * If an idle state has exit latency beyond in powernv_add_idle_states()
299 * in cpu-idle. in powernv_add_idle_states()
301 if (state->latency_ns > POWERNV_THRESHOLD_LATENCY_NS) in powernv_add_idle_states()
307 exit_latency = DIV_ROUND_UP(state->latency_ns, 1000); in powernv_add_idle_states()
308 target_residency = DIV_ROUND_UP(state->residency_ns, 1000); in powernv_add_idle_states()
310 if (has_stop_states && !(state->valid)) in powernv_add_idle_states()
313 if (state->flags & OPAL_PM_TIMEBASE_STOP) in powernv_add_idle_states()
316 if (state->flags & OPAL_PM_NAP_ENABLED) { in powernv_add_idle_states()
317 /* Add NAP state */ in powernv_add_idle_states()
322 add_powernv_state(nr_idle_states, state->name, in powernv_add_idle_states()
325 state->psscr_val, in powernv_add_idle_states()
326 state->psscr_mask); in powernv_add_idle_states()
334 else if (state->flags & OPAL_PM_SLEEP_ENABLED || in powernv_add_idle_states()
335 state->flags & OPAL_PM_SLEEP_ENABLED_ER1) { in powernv_add_idle_states()
336 /* Add FASTSLEEP state */ in powernv_add_idle_states()
342 add_powernv_state(nr_idle_states, state->name, in powernv_add_idle_states()
345 state->psscr_val, in powernv_add_idle_states()
346 state->psscr_mask); in powernv_add_idle_states()
359 * Choose state table for shared versus dedicated partition
364 return -ENODEV; in powernv_idle_probe()
368 /* Device tree can indicate more idle states */ in powernv_idle_probe()
374 return -ENODEV; in powernv_idle_probe()