diff mbox series

[1/3] idle: user context state loss flags fix for stop states

Message ID 20170830062011.15199-2-npiggin@gmail.com
State Accepted
Headers show
Series misc idle fixes | expand

Commit Message

Nicholas Piggin Aug. 30, 2017, 6:20 a.m. UTC
The "lite" stop variants with PSSCR[ESL]=PSSCR[EC]=1 do not lose user
context, while the non-lite variants do (ESL: enable state loss).

Some of the POWER9 idle states had these wrong.

These are not used by Linux yet.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 hw/slw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Akshay Adiga Sept. 1, 2017, 10:34 a.m. UTC | #1
On 08/30/2017 11:50 AM, Nicholas Piggin wrote:
> The "lite" stop variants with PSSCR[ESL]=PSSCR[EC]=1 do not lose user
> context, while the non-lite variants do (ESL: enable state loss).
>
> Some of the POWER9 idle states had these wrong.
>
> These are not used by Linux yet.
Thanks Nick for correcting. The patch looks good.
It's good to have this patch, in case someone uses this flag in the future.

Reviewed-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

> ---
>  hw/slw.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/slw.c b/hw/slw.c
> index 98040e6e..0720545c 100644
> --- a/hw/slw.c
> +++ b/hw/slw.c
> @@ -526,7 +526,7 @@ static struct cpu_idle_states power9_cpu_idle_states[] = {
>  		.residency_ns = 20000,
>  		.flags = 0*OPAL_PM_DEC_STOP \
>  		       | 0*OPAL_PM_TIMEBASE_STOP  \
> -		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
> +		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
> @@ -542,7 +542,7 @@ static struct cpu_idle_states power9_cpu_idle_states[] = {
>  		.residency_ns = 49000,
>  		.flags = 0*OPAL_PM_DEC_STOP \
>  		       | 0*OPAL_PM_TIMEBASE_STOP  \
> -		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
> @@ -572,7 +572,7 @@ static struct cpu_idle_states power9_cpu_idle_states[] = {
>  		.residency_ns = 99000,
>  		.flags = 0*OPAL_PM_DEC_STOP \
>  		       | 0*OPAL_PM_TIMEBASE_STOP  \
> -		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
> @@ -671,7 +671,7 @@ static struct cpu_idle_states power9_ndd1_cpu_idle_states[] = {
>  		.residency_ns = 49000,
>  		.flags = 0*OPAL_PM_DEC_STOP \
>  		       | 0*OPAL_PM_TIMEBASE_STOP  \
> -		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
> +		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
>  		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
>  		       | 1*OPAL_PM_STOP_INST_FAST,
>
diff mbox series

Patch

diff --git a/hw/slw.c b/hw/slw.c
index 98040e6e..0720545c 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -526,7 +526,7 @@  static struct cpu_idle_states power9_cpu_idle_states[] = {
 		.residency_ns = 20000,
 		.flags = 0*OPAL_PM_DEC_STOP \
 		       | 0*OPAL_PM_TIMEBASE_STOP  \
-		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
+		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
 		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
 		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
 		       | 1*OPAL_PM_STOP_INST_FAST,
@@ -542,7 +542,7 @@  static struct cpu_idle_states power9_cpu_idle_states[] = {
 		.residency_ns = 49000,
 		.flags = 0*OPAL_PM_DEC_STOP \
 		       | 0*OPAL_PM_TIMEBASE_STOP  \
-		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
+		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
 		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
 		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
 		       | 1*OPAL_PM_STOP_INST_FAST,
@@ -572,7 +572,7 @@  static struct cpu_idle_states power9_cpu_idle_states[] = {
 		.residency_ns = 99000,
 		.flags = 0*OPAL_PM_DEC_STOP \
 		       | 0*OPAL_PM_TIMEBASE_STOP  \
-		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
+		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
 		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
 		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
 		       | 1*OPAL_PM_STOP_INST_FAST,
@@ -671,7 +671,7 @@  static struct cpu_idle_states power9_ndd1_cpu_idle_states[] = {
 		.residency_ns = 49000,
 		.flags = 0*OPAL_PM_DEC_STOP \
 		       | 0*OPAL_PM_TIMEBASE_STOP  \
-		       | 1*OPAL_PM_LOSE_USER_CONTEXT \
+		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
 		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
 		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
 		       | 1*OPAL_PM_STOP_INST_FAST,