static int __init pseries_idle_probe()

in cpuidle-pseries.c [406:450]


static int __init pseries_idle_probe(void)
{

	if (cpuidle_disable != IDLE_NO_OVERRIDE)
		return -ENODEV;

	if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
		/*
		 * Use local_paca instead of get_lppaca() since
		 * preemption is not disabled, and it is not required in
		 * fact, since lppaca_ptr does not need to be the value
		 * associated to the current CPU, it can be from any CPU.
		 */
		if (lppaca_shared_proc(local_paca->lppaca_ptr)) {
			cpuidle_state_table = shared_states;
			max_idle_state = ARRAY_SIZE(shared_states);
		} else {
			/*
			 * Use firmware provided latency values
			 * starting with POWER10 platforms. In the
			 * case that we are running on a POWER10
			 * platform but in an earlier compat mode, we
			 * can still use the firmware provided values.
			 *
			 * However, on platforms prior to POWER10, we
			 * cannot rely on the accuracy of the firmware
			 * provided latency values. On such platforms,
			 * go with the conservative default estimate
			 * of 10us.
			 */
			if (cpu_has_feature(CPU_FTR_ARCH_31) || pvr_version_is(PVR_POWER10))
				fixup_cede0_latency();
			cpuidle_state_table = dedicated_states;
			max_idle_state = NR_DEDICATED_STATES;
		}
	} else
		return -ENODEV;

	if (max_idle_state > 1) {
		snooze_timeout_en = true;
		snooze_timeout = cpuidle_state_table[1].target_residency *
				 tb_ticks_per_usec;
	}
	return 0;
}