[Skiboot] [PATCH v3 5/6] slw: Move IDLE_TB_STOP and IDLE_LOSE_FULL_CONTEXT to opal-api.h

Michael Neuling mikey at neuling.org
Mon Jun 6 16:26:20 AEST 2016


On Thu, 2016-06-02 at 14:20 +0530, Shreyas B. Prabhu wrote:
> Move IDLE_TB_STOP and IDLE_LOSE_FULL_CONTEXT to opal-api.h since these
> flags will be used by the kernel.
> This patch does not change any functionality.

These flags are exported via the device tree, so why don't we export
all of these flag definitions?  Why do we export stuff in the flags
that we don't have usable definitions for?

Mikey

> 
> Signed-off-by: Shreyas B. Prabhu <shreyas at linux.vnet.ibm.com>
> ---
>  hw/slw.c           | 43 ++++++++++++++++++++-----------------------
>  include/opal-api.h |  7 +++++--
>  2 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/hw/slw.c b/hw/slw.c
> index d391cd70cc98..60a0ca470001 100644
> --- a/hw/slw.c
> +++ b/hw/slw.c
> @@ -409,12 +409,9 @@ struct cpu_idle_states {
>  /* Set bits to avoid misinterpretation even if kernel has endian bugs */
>  
>  #define IDLE_DEC_STOP		0x00000001 /* Decrementer would
stop */
> -#define IDLE_TB_STOP		0x00000002 /* Timebase would stop */
>  #define IDLE_LOSE_USER_CONTEXT	0x00001000 /* Restore GPRs like
nap */
>  #define IDLE_LOSE_HYP_CONTEXT	0x00002000 /* Restore hypervisor
resource
>  					      from PACA pointer */
> -#define IDLE_LOSE_FULL_CONTEXT	0x00004000 /* Restore hypervisor
resource
> -					      by searching PACA */
>  #define IDLE_USE_PMICR		0x00800000 /* Use SPR PMICR
instruction */
>  
>  #define IDLE_FASTSLEEP_PMICR	0x0000002000000000UL
> @@ -431,10 +428,10 @@ static struct cpu_idle_states
power7_cpu_idle_states[] = {
>  		.latency_ns = 4000,
>  		.residency_ns = 100000,
>  		.flags = 0*IDLE_DEC_STOP \
> -		       | 0*IDLE_TB_STOP  \
> +		       | 0*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 0*IDLE_LOSE_HYP_CONTEXT \
> -		       | 0*IDLE_LOSE_FULL_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_NAP_ENABLED \
>  		       | 0*OPAL_PM_SLEEP_ENABLED \
>  		       | 0*OPAL_PM_WINKLE_ENABLED \
> @@ -449,10 +446,10 @@ static struct cpu_idle_states
power8_cpu_idle_states[] = {
>  		.latency_ns = 4000,
>  		.residency_ns = 100000,
>  		.flags = 0*IDLE_DEC_STOP \
> -		       | 0*IDLE_TB_STOP  \
> +		       | 0*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 0*IDLE_LOSE_HYP_CONTEXT \
> -		       | 0*IDLE_LOSE_FULL_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_NAP_ENABLED \
>  		       | 0*IDLE_USE_PMICR,
>  		.pm_ctrl_reg_val = 0,
> @@ -462,10 +459,10 @@ static struct cpu_idle_states
power8_cpu_idle_states[] = {
>  		.latency_ns = 40000,
>  		.residency_ns = 300000000,
>  		.flags = 1*IDLE_DEC_STOP \
> -		       | 1*IDLE_TB_STOP  \
> +		       | 1*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 0*IDLE_LOSE_HYP_CONTEXT \
> -		       | 0*IDLE_LOSE_FULL_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_SLEEP_ENABLED_ER1 \
>  		       | 0*IDLE_USE_PMICR, /* Not enabled until deep
>  						states are available */
> @@ -482,10 +479,10 @@ static struct cpu_idle_states
power8_cpu_idle_states[] = {
>  					     * accurate for when linux
does
>  					     * use it. */
>  		.flags = 1*IDLE_DEC_STOP \
> -		       | 1*IDLE_TB_STOP  \
> +		       | 1*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 1*IDLE_LOSE_HYP_CONTEXT \
> -		       | 1*IDLE_LOSE_FULL_CONTEXT \
> +		       | 1*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_WINKLE_ENABLED \
>  		       | 0*IDLE_USE_PMICR, /* Currently choosing deep vs
>  						fast via EX_PM_GP1 reg
*/
> @@ -503,10 +500,10 @@ static struct cpu_idle_states
power9_cpu_idle_states[] = {
>  		.latency_ns = 300,
>  		.residency_ns = 3000,
>  		.flags = 0*IDLE_DEC_STOP \
> -		       | 0*IDLE_TB_STOP  \
> +		       | 0*OPAL_PM_TIMEBASE_STOP  \
>  		       | 0*IDLE_LOSE_USER_CONTEXT \
>  		       | 0*IDLE_LOSE_HYP_CONTEXT \
> -		       | 0*IDLE_LOSE_FULL_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
>  		.pm_ctrl_reg_val = 0,
>  		.pm_ctrl_reg_mask = 0xF },
> @@ -515,10 +512,10 @@ static struct cpu_idle_states
power9_cpu_idle_states[] = {
>  		.latency_ns = 5000,
>  		.residency_ns = 50000,
>  		.flags = 0*IDLE_DEC_STOP \
> -		       | 0*IDLE_TB_STOP  \
> +		       | 0*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 0*IDLE_LOSE_HYP_CONTEXT \
> -		       | 0*IDLE_LOSE_FULL_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
>  		.pm_ctrl_reg_val = 1,
>  		.pm_ctrl_reg_mask = 0xF },
> @@ -527,10 +524,10 @@ static struct cpu_idle_states
power9_cpu_idle_states[] = {
>  		.latency_ns = 10000,
>  		.residency_ns = 100000,
>  		.flags = 0*IDLE_DEC_STOP \
> -		       | 0*IDLE_TB_STOP  \
> +		       | 0*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 0*IDLE_LOSE_HYP_CONTEXT \
> -		       | 0*IDLE_LOSE_FULL_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
>  		.pm_ctrl_reg_val = 2,
>  		.pm_ctrl_reg_mask = 0xF },
> @@ -540,10 +537,10 @@ static struct cpu_idle_states
power9_cpu_idle_states[] = {
>  		.latency_ns = 100000,
>  		.residency_ns = 1000000,
>  		.flags = 1*IDLE_DEC_STOP \
> -		       | 1*IDLE_TB_STOP  \
> +		       | 1*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 1*IDLE_LOSE_HYP_CONTEXT \
> -		       | 1*IDLE_LOSE_FULL_CONTEXT \
> +		       | 1*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_DEEP,
>  		.pm_ctrl_reg_val = 4,
>  		.pm_ctrl_reg_mask = 0xF },
> @@ -553,10 +550,10 @@ static struct cpu_idle_states
power9_cpu_idle_states[] = {
>  		.latency_ns = 2000000,
>  		.residency_ns = 20000000,
>  		.flags = 1*IDLE_DEC_STOP \
> -		       | 1*IDLE_TB_STOP  \
> +		       | 1*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 1*IDLE_LOSE_HYP_CONTEXT \
> -		       | 1*IDLE_LOSE_FULL_CONTEXT \
> +		       | 1*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_DEEP,
>  		.pm_ctrl_reg_val = 0x8,
>  		.pm_ctrl_reg_mask = 0xF },
> @@ -567,10 +564,10 @@ static struct cpu_idle_states
power9_cpu_idle_states[] = {
>  		.latency_ns = 10000000,
>  		.residency_ns = 100000000,
>  		.flags = 1*IDLE_DEC_STOP \
> -		       | 1*IDLE_TB_STOP  \
> +		       | 1*OPAL_PM_TIMEBASE_STOP  \
>  		       | 1*IDLE_LOSE_USER_CONTEXT \
>  		       | 1*IDLE_LOSE_HYP_CONTEXT \
> -		       | 1*IDLE_LOSE_FULL_CONTEXT \
> +		       | 1*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_DEEP,
>  		.pm_ctrl_reg_val = 0xB,
>  		.pm_ctrl_reg_mask = 0xF },
> diff --git a/include/opal-api.h b/include/opal-api.h
> index 4c99db58e2e9..ae15e6eb33cc 100644
> --- a/include/opal-api.h
> +++ b/include/opal-api.h
> @@ -167,9 +167,12 @@
>  
>  /* Device tree flags */
>  
> -/* Flags set in power-mgmt nodes in device tree if
> - * respective idle states are supported in the platform.
> +/*
> + * Flags set in power-mgmt nodes in device tree describing
> + * idle states that are supported in the platform.
>   */
> +#define OPAL_PM_TIMEBASE_STOP		0x00000002
> +#define OPAL_PM_LOSE_FULL_CONTEXT	0x00004000
>  #define OPAL_PM_NAP_ENABLED		0x00010000
>  #define OPAL_PM_SLEEP_ENABLED		0x00020000
>  #define OPAL_PM_WINKLE_ENABLED		0x00040000


More information about the Skiboot mailing list