Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
--
2.25.4
Replace the variable name from using "pnv_first_spr_loss_level" to
"pnv_first_fullstate_loss_level".
As pnv_first_spr_loss_level is supposed to be the earliest state that
has OPAL_PM_LOSE_FULL_CONTEXT set, however as shallow states too loose
SPR values, render an incorrect terminology.
Signed-off-by: Pratik Rajesh Sampat <redacted>
---
arch/powerpc/platforms/powernv/idle.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
@@ -1168,7 +1168,7 @@ static void __init pnv_power9_idle_init(void)}pr_info("cpuidle-powernv: First stop level that may lose SPRs = 0x%llx\n",-pnv_first_spr_loss_level);+pnv_first_fullstate_loss_level);pr_info("cpuidle-powernv: First stop level that may lose timebase = 0x%llx\n",pnv_first_tb_loss_level);
POWER9 onwards the support for the registers HID1, HID4, HID5 has been
receded.
Although mfspr on the above registers worked in Power9, In Power10
simulator is unrecognized. Moving their assignment under the
check for machines lower than Power9
Signed-off-by: Pratik Rajesh Sampat <redacted>
Reviewed-by: Gautham R. Shenoy <redacted>
---
arch/powerpc/platforms/powernv/idle.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -73,9 +73,6 @@ static int pnv_save_sprs_for_deep_states(void)*/uint64_tlpcr_val=mfspr(SPRN_LPCR);uint64_thid0_val=mfspr(SPRN_HID0);-uint64_thid1_val=mfspr(SPRN_HID1);-uint64_thid4_val=mfspr(SPRN_HID4);-uint64_thid5_val=mfspr(SPRN_HID5);uint64_thmeer_val=mfspr(SPRN_HMEER);uint64_tmsr_val=MSR_IDLE;uint64_tpsscr_val=pnv_deepest_stop_psscr_val;
@@ -117,6 +114,9 @@ static int pnv_save_sprs_for_deep_states(void)/* Only p8 needs to set extra HID regiters */if(!cpu_has_feature(CPU_FTR_ARCH_300)){+uint64_thid1_val=mfspr(SPRN_HID1);+uint64_thid4_val=mfspr(SPRN_HID4);+uint64_thid5_val=mfspr(SPRN_HID5);rc=opal_slw_set_reg(pir,SPRN_HID1,hid1_val);if(rc!=0)
Additional registers DAWR0, DAWRX0 may be lost on Power 10 for
stop levels < 4.
Therefore save the values of these SPRs before entering a "stop"
state and restore their values on wakeup.
Signed-off-by: Pratik Rajesh Sampat <redacted>
---
arch/powerpc/platforms/powernv/idle.c | 10 ++++++++++
1 file changed, 10 insertions(+)
@@ -687,6 +689,10 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on)sprs.iamr=mfspr(SPRN_IAMR);sprs.amor=mfspr(SPRN_AMOR);sprs.uamor=mfspr(SPRN_UAMOR);+if(cpu_has_feature(CPU_FTR_ARCH_31)){+sprs.dawr0=mfspr(SPRN_DAWR0);+sprs.dawrx0=mfspr(SPRN_DAWRX0);+}srr1=isa300_idle_stop_mayloss(psscr);/* go idle */
@@ -710,6 +716,10 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on)mtspr(SPRN_IAMR,sprs.iamr);mtspr(SPRN_AMOR,sprs.amor);mtspr(SPRN_UAMOR,sprs.uamor);+if(cpu_has_feature(CPU_FTR_ARCH_31)){+mtspr(SPRN_DAWR0,sprs.dawr0);+mtspr(SPRN_DAWRX0,sprs.dawrx0);+}/**WorkaroundforPOWER9DD2.0,ifwelostresources,theERAT
From: Nicholas Piggin <npiggin@gmail.com> Date: 2020-07-13 05:23:31
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
These look okay to me, but the CPU_FTR_ARCH_300 test for
pnv_power9_idle_init() is actually wrong, it should be a PVR test
because idle is not completely architected (not even shallow stop
states, unfortunately).
It doesn't look like we support POWER10 idle correctly yet, and on older
kernels it wouldn't work even if we fixed newer, so ideally the PVR
check would be backported as a fix in the front of the series.
Sadly, we have no OPAL idle driver yet. Hopefully we will before the
next processor shows up :P
Thanks,
Nick
From: Nicholas Piggin <npiggin@gmail.com> Date: 2020-07-13 05:52:40
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
Additional registers DAWR0, DAWRX0 may be lost on Power 10 for
stop levels < 4.
Therefore save the values of these SPRs before entering a "stop"
state and restore their values on wakeup.
Hmm, where do you get this from? Documentation I see says DAWR is lost
on POWER9 but not P10.
Does idle thread even need to save DAWR, or does it get switched when
going to a thread that has a watchpoint set?
Thanks,
Nick
@@ -687,6 +689,10 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on)sprs.iamr=mfspr(SPRN_IAMR);sprs.amor=mfspr(SPRN_AMOR);sprs.uamor=mfspr(SPRN_UAMOR);+if(cpu_has_feature(CPU_FTR_ARCH_31)){+sprs.dawr0=mfspr(SPRN_DAWR0);+sprs.dawrx0=mfspr(SPRN_DAWRX0);+}srr1=isa300_idle_stop_mayloss(psscr);/* go idle */
@@ -710,6 +716,10 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on)mtspr(SPRN_IAMR,sprs.iamr);mtspr(SPRN_AMOR,sprs.amor);mtspr(SPRN_UAMOR,sprs.uamor);+if(cpu_has_feature(CPU_FTR_ARCH_31)){+mtspr(SPRN_DAWR0,sprs.dawr0);+mtspr(SPRN_DAWRX0,sprs.dawrx0);+}/**WorkaroundforPOWER9DD2.0,ifwelostresources,theERAT
From: Nicholas Piggin <npiggin@gmail.com> Date: 2020-07-13 05:53:22
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
POWER9 onwards the support for the registers HID1, HID4, HID5 has been
receded.
Although mfspr on the above registers worked in Power9, In Power10
simulator is unrecognized. Moving their assignment under the
check for machines lower than Power9
@@ -73,9 +73,6 @@ static int pnv_save_sprs_for_deep_states(void)*/uint64_tlpcr_val=mfspr(SPRN_LPCR);uint64_thid0_val=mfspr(SPRN_HID0);-uint64_thid1_val=mfspr(SPRN_HID1);-uint64_thid4_val=mfspr(SPRN_HID4);-uint64_thid5_val=mfspr(SPRN_HID5);uint64_thmeer_val=mfspr(SPRN_HMEER);uint64_tmsr_val=MSR_IDLE;uint64_tpsscr_val=pnv_deepest_stop_psscr_val;
@@ -117,6 +114,9 @@ static int pnv_save_sprs_for_deep_states(void)/* Only p8 needs to set extra HID regiters */if(!cpu_has_feature(CPU_FTR_ARCH_300)){+uint64_thid1_val=mfspr(SPRN_HID1);+uint64_thid4_val=mfspr(SPRN_HID4);+uint64_thid5_val=mfspr(SPRN_HID5);rc=opal_slw_set_reg(pir,SPRN_HID1,hid1_val);if(rc!=0)
Thank you for your comments,
On 13/07/20 10:53 am, Nicholas Piggin wrote:
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
quoted
Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
These look okay to me, but the CPU_FTR_ARCH_300 test for
pnv_power9_idle_init() is actually wrong, it should be a PVR test
because idle is not completely architected (not even shallow stop
states, unfortunately).
It doesn't look like we support POWER10 idle correctly yet, and on older
kernels it wouldn't work even if we fixed newer, so ideally the PVR
check would be backported as a fix in the front of the series.
Sadly, we have no OPAL idle driver yet. Hopefully we will before the
next processor shows up :P
Thanks,
Nick
So if I understand this correctly, in powernv/idle.c where we check for
CPU_FTR_ARCH_300, we should rather be making a pvr_version_is(PVR_POWER9)
check instead?
Of course, the P10 PVR and its relevant checks will have to be added then too.
Thanks
Pratik
From: Gautham R Shenoy <hidden> Date: 2020-07-13 11:56:44
On Mon, Jul 13, 2020 at 03:23:21PM +1000, Nicholas Piggin wrote:
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
quoted
Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
These look okay to me, but the CPU_FTR_ARCH_300 test for
pnv_power9_idle_init() is actually wrong, it should be a PVR test
because idle is not completely architected (not even shallow stop
states, unfortunately).
It doesn't look like we support POWER10 idle correctly yet, and on older
kernels it wouldn't work even if we fixed newer, so ideally the PVR
check would be backported as a fix in the front of the series.
Sadly, we have no OPAL idle driver yet. Hopefully we will before the
next processor shows up :P
From: Nicholas Piggin <npiggin@gmail.com> Date: 2020-07-13 16:50:08
Excerpts from Pratik Sampat's message of July 13, 2020 8:02 pm:
Thank you for your comments,
On 13/07/20 10:53 am, Nicholas Piggin wrote:
quoted
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
quoted
Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
These look okay to me, but the CPU_FTR_ARCH_300 test for
pnv_power9_idle_init() is actually wrong, it should be a PVR test
because idle is not completely architected (not even shallow stop
states, unfortunately).
It doesn't look like we support POWER10 idle correctly yet, and on older
kernels it wouldn't work even if we fixed newer, so ideally the PVR
check would be backported as a fix in the front of the series.
Sadly, we have no OPAL idle driver yet. Hopefully we will before the
next processor shows up :P
Thanks,
Nick
So if I understand this correctly, in powernv/idle.c where we check for
CPU_FTR_ARCH_300, we should rather be making a pvr_version_is(PVR_POWER9)
check instead?
Of course, the P10 PVR and its relevant checks will have to be added then too.
From: Nicholas Piggin <npiggin@gmail.com> Date: 2020-07-13 16:59:04
Excerpts from Gautham R Shenoy's message of July 13, 2020 8:48 pm:
On Mon, Jul 13, 2020 at 03:23:21PM +1000, Nicholas Piggin wrote:
quoted
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
quoted
Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
These look okay to me, but the CPU_FTR_ARCH_300 test for
pnv_power9_idle_init() is actually wrong, it should be a PVR test
because idle is not completely architected (not even shallow stop
states, unfortunately).
It doesn't look like we support POWER10 idle correctly yet, and on older
kernels it wouldn't work even if we fixed newer, so ideally the PVR
check would be backported as a fix in the front of the series.
Sadly, we have no OPAL idle driver yet. Hopefully we will before the
next processor shows up :P
Excerpts from Pratik Sampat's message of July 13, 2020 8:02 pm:
quoted
Thank you for your comments,
On 13/07/20 10:53 am, Nicholas Piggin wrote:
quoted
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
quoted
Changelog v1 --> v2:
1. Save-restore DAWR and DAWRX unconditionally as they are lost in
shallow idle states too
2. Rename pnv_first_spr_loss_level to pnv_first_fullstate_loss_level to
correct naming terminology
Pratik Rajesh Sampat (3):
powerpc/powernv/idle: Exclude mfspr on HID1,4,5 on P9 and above
powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10
powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
arch/powerpc/platforms/powernv/idle.c | 34 +++++++++++++++++----------
1 file changed, 22 insertions(+), 12 deletions(-)
These look okay to me, but the CPU_FTR_ARCH_300 test for
pnv_power9_idle_init() is actually wrong, it should be a PVR test
because idle is not completely architected (not even shallow stop
states, unfortunately).
It doesn't look like we support POWER10 idle correctly yet, and on older
kernels it wouldn't work even if we fixed newer, so ideally the PVR
check would be backported as a fix in the front of the series.
Sadly, we have no OPAL idle driver yet. Hopefully we will before the
next processor shows up :P
Thanks,
Nick
So if I understand this correctly, in powernv/idle.c where we check for
CPU_FTR_ARCH_300, we should rather be making a pvr_version_is(PVR_POWER9)
check instead?
Of course, the P10 PVR and its relevant checks will have to be added then too.
From: Ravi Bangoria <hidden> Date: 2020-07-20 04:31:45
Hi Nick,
On 7/13/20 11:22 AM, Nicholas Piggin wrote:
Excerpts from Pratik Rajesh Sampat's message of July 10, 2020 3:22 pm:
quoted
Additional registers DAWR0, DAWRX0 may be lost on Power 10 for
stop levels < 4.
Therefore save the values of these SPRs before entering a "stop"
state and restore their values on wakeup.
Hmm, where do you get this from? Documentation I see says DAWR is lost
on POWER9 but not P10.
Does idle thread even need to save DAWR, or does it get switched when
going to a thread that has a watchpoint set?
I don't know how idle states works internally but IIUC, we need to save/restore
DAWRs. This is needed when user creates per-cpu watchpoint event.
Ravi
From: Michael Neuling <hidden> Date: 2020-07-24 01:25:28
On Fri, 2020-07-10 at 10:52 +0530, Pratik Rajesh Sampat wrote:
quoted hunk
Additional registers DAWR0, DAWRX0 may be lost on Power 10 for
stop levels < 4.
Therefore save the values of these SPRs before entering a "stop"
state and restore their values on wakeup.
Signed-off-by: Pratik Rajesh Sampat <redacted>
---
arch/powerpc/platforms/powernv/idle.c | 10 ++++++++++
1 file changed, 10 insertions(+)
@@ -710,6 +716,10 @@ static unsigned long power9_idle_stop(unsigned long
psscr, bool mmu_on)
mtspr(SPRN_IAMR, sprs.iamr);
mtspr(SPRN_AMOR, sprs.amor);
mtspr(SPRN_UAMOR, sprs.uamor);
+ if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+ mtspr(SPRN_DAWR0, sprs.dawr0);
+ mtspr(SPRN_DAWRX0, sprs.dawrx0);
+ }
/*
* Workaround for POWER9 DD2.0, if we lost resources, the ERAT
On Fri, 2020-07-10 at 10:52 +0530, Pratik Rajesh Sampat wrote:
quoted
Additional registers DAWR0, DAWRX0 may be lost on Power 10 for
stop levels < 4.
Therefore save the values of these SPRs before entering a "stop"
state and restore their values on wakeup.
Signed-off-by: Pratik Rajesh Sampat <redacted>
---
arch/powerpc/platforms/powernv/idle.c | 10 ++++++++++
1 file changed, 10 insertions(+)
You are actually viewing an old version of the patches
The main point of change were based on comments from Nick Piggin, I
have changed the top level function check from ARCH_300 to a P9 PVR
check instead.
A similar thing needs to be done for P10, however as the P10 PVR isn't
exposed yet, I've shelved this particular patch.
Nick's comment to check based on PVR:https://lkml.org/lkml/2020/7/13/1018
v4 of the series:https://lkml.org/lkml/2020/7/21/784
Thanks for your review,
Pratik
Can you add a comment here saying even though DAWR0 is ARCH_30, it's only
required to be saved on 31. Otherwise this looks pretty odd.
@@ -710,6 +716,10 @@ static unsigned long power9_idle_stop(unsigned long
psscr, bool mmu_on)
mtspr(SPRN_IAMR, sprs.iamr);
mtspr(SPRN_AMOR, sprs.amor);
mtspr(SPRN_UAMOR, sprs.uamor);
+ if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+ mtspr(SPRN_DAWR0, sprs.dawr0);
+ mtspr(SPRN_DAWRX0, sprs.dawrx0);
+ }
/*
* Workaround for POWER9 DD2.0, if we lost resources, the ERAT