18c2ecf20Sopenharmony_ciIBM Power-Management Bindings
28c2ecf20Sopenharmony_ci=============================
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciLinux running on baremetal POWER machines has access to the processor
58c2ecf20Sopenharmony_ciidle states. The description of these idle states is exposed via the
68c2ecf20Sopenharmony_cinode @power-mgt in the device-tree by the firmware.
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciDefinitions:
98c2ecf20Sopenharmony_ci----------------
108c2ecf20Sopenharmony_ciTypically each idle state has the following associated properties:
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci- name: The name of the idle state as defined by the firmware.
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci- flags: indicating some aspects of this idle states such as the
158c2ecf20Sopenharmony_ci         extent of state-loss, whether timebase is stopped on this
168c2ecf20Sopenharmony_ci         idle states and so on. The flag bits are as follows:
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci- exit-latency: The latency involved in transitioning the state of the
198c2ecf20Sopenharmony_ci		CPU from idle to running.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci- target-residency: The minimum time that the CPU needs to reside in
228c2ecf20Sopenharmony_ci		    this idle state in order to accrue power-savings
238c2ecf20Sopenharmony_ci		    benefit.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciProperties
268c2ecf20Sopenharmony_ci----------------
278c2ecf20Sopenharmony_ciThe following properties provide details about the idle states. These
288c2ecf20Sopenharmony_ciproperties are exposed as arrays. Each entry in the property array
298c2ecf20Sopenharmony_ciprovides the value of that property for the idle state associated with
308c2ecf20Sopenharmony_cithe array index of that entry.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciIf idle-states are defined, then the properties
338c2ecf20Sopenharmony_ci"ibm,cpu-idle-state-names" and "ibm,cpu-idle-state-flags" are
348c2ecf20Sopenharmony_cirequired. The other properties are required unless mentioned
358c2ecf20Sopenharmony_ciotherwise. The length of all the property arrays must be the same.
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-names:
388c2ecf20Sopenharmony_ci	Array of strings containing the names of the idle states.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-flags:
418c2ecf20Sopenharmony_ci	Array of unsigned 32-bit values containing the values of the
428c2ecf20Sopenharmony_ci	flags associated with the the aforementioned idle-states. The
438c2ecf20Sopenharmony_ci	flag bits are as follows:
448c2ecf20Sopenharmony_ci		0x00000001 /* Decrementer would stop */
458c2ecf20Sopenharmony_ci		0x00000002 /* Needs timebase restore */
468c2ecf20Sopenharmony_ci		0x00001000 /* Restore GPRs like nap */
478c2ecf20Sopenharmony_ci		0x00002000 /* Restore hypervisor resource from PACA pointer */
488c2ecf20Sopenharmony_ci		0x00004000 /* Program PORE to restore PACA pointer */
498c2ecf20Sopenharmony_ci		0x00010000 /* This is a nap state (POWER7,POWER8) */
508c2ecf20Sopenharmony_ci		0x00020000 /* This is a fast-sleep state (POWER8)*/
518c2ecf20Sopenharmony_ci		0x00040000 /* This is a winkle state (POWER8) */
528c2ecf20Sopenharmony_ci		0x00080000 /* This is a fast-sleep state which requires a */
538c2ecf20Sopenharmony_ci			   /* software workaround for restoring the */
548c2ecf20Sopenharmony_ci			   /* timebase (POWER8) */
558c2ecf20Sopenharmony_ci		0x00800000 /* This state uses SPR PMICR instruction */
568c2ecf20Sopenharmony_ci			   /* (POWER8)*/
578c2ecf20Sopenharmony_ci		0x00100000 /* This is a fast stop state (POWER9) */
588c2ecf20Sopenharmony_ci		0x00200000 /* This is a deep-stop state (POWER9) */
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-latencies-ns:
618c2ecf20Sopenharmony_ci	Array of unsigned 32-bit values containing the values of the
628c2ecf20Sopenharmony_ci	exit-latencies (in ns) for the idle states in
638c2ecf20Sopenharmony_ci	ibm,cpu-idle-state-names.
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-residency-ns:
668c2ecf20Sopenharmony_ci	Array of unsigned 32-bit values containing the values of the
678c2ecf20Sopenharmony_ci	target-residency (in ns) for the idle states in
688c2ecf20Sopenharmony_ci	ibm,cpu-idle-state-names. On POWER8 this is an optional
698c2ecf20Sopenharmony_ci	property. If the property is absent, the target residency for
708c2ecf20Sopenharmony_ci	the "Nap", "FastSleep" are defined to 10000 and 300000000
718c2ecf20Sopenharmony_ci	respectively by the kernel. On POWER9 this property is required.
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-psscr:
748c2ecf20Sopenharmony_ci	Array of unsigned 64-bit values containing the values for the
758c2ecf20Sopenharmony_ci	PSSCR for each of the idle states in ibm,cpu-idle-state-names.
768c2ecf20Sopenharmony_ci	This property is required on POWER9 and absent on POWER8.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-psscr-mask:
798c2ecf20Sopenharmony_ci	Array of unsigned 64-bit values containing the masks
808c2ecf20Sopenharmony_ci	indicating which psscr fields are set in the corresponding
818c2ecf20Sopenharmony_ci	entries of ibm,cpu-idle-state-psscr. This property is
828c2ecf20Sopenharmony_ci	required on POWER9 and absent on POWER8.
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	Whenever the firmware sets an entry in
858c2ecf20Sopenharmony_ci	ibm,cpu-idle-state-psscr-mask value to 0xf, it implies that
868c2ecf20Sopenharmony_ci	only the Requested Level (RL) field of the corresponding entry
878c2ecf20Sopenharmony_ci	in ibm,cpu-idle-state-psscr should be considered by the
888c2ecf20Sopenharmony_ci	kernel. For such idle states, the kernel would set the
898c2ecf20Sopenharmony_ci	remaining fields of the psscr to the following sane-default
908c2ecf20Sopenharmony_ci	values.
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci		- ESL and EC bits are to 1. So wakeup from any stop
938c2ecf20Sopenharmony_ci		  state will be at vector 0x100.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci		- MTL and PSLL are set to the maximum allowed value as
968c2ecf20Sopenharmony_ci		  per the ISA, i.e. 15.
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci		- The Transition Rate, TR is set to the Maximum value
998c2ecf20Sopenharmony_ci                  3.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci	For all the other values of the entry in
1028c2ecf20Sopenharmony_ci	ibm,cpu-idle-state-psscr-mask, the kernel expects all the
1038c2ecf20Sopenharmony_ci	psscr fields of the corresponding entry in
1048c2ecf20Sopenharmony_ci	ibm,cpu-idle-state-psscr to be correctly set by the firmware.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-pmicr:
1078c2ecf20Sopenharmony_ci	Array of unsigned 64-bit values containing the pmicr values
1088c2ecf20Sopenharmony_ci	for the idle states in ibm,cpu-idle-state-names. This 64-bit
1098c2ecf20Sopenharmony_ci	register value is to be set in pmicr for the corresponding
1108c2ecf20Sopenharmony_ci	state if the flag indicates that pmicr SPR should be set. This
1118c2ecf20Sopenharmony_ci	is an optional property on POWER8 and is absent on
1128c2ecf20Sopenharmony_ci	POWER9.
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci- ibm,cpu-idle-state-pmicr-mask:
1158c2ecf20Sopenharmony_ci	Array of unsigned 64-bit values containing the mask indicating
1168c2ecf20Sopenharmony_ci	which of the fields of the PMICR are set in the corresponding
1178c2ecf20Sopenharmony_ci	entries in ibm,cpu-idle-state-pmicr. This is an optional
1188c2ecf20Sopenharmony_ci	property on POWER8 and is absent on POWER9.
119