From: Nicholas Piggin <npiggin@gmail•com>
To: linuxppc-dev@lists•ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail•com>
Subject: [PATCH 4/5] powerpc/64s: consolidate pnv_restore_hyp_resource into pnv_powersave_wakeup
Date: Fri, 17 Feb 2017 04:39:00 +1000 [thread overview]
Message-ID: <20170216183901.28611-5-npiggin@gmail.com> (raw)
In-Reply-To: <20170216183901.28611-1-npiggin@gmail.com>
There is only one caller, so this reduces spaghetti of subsequent
callees returning into the caller.
Signed-off-by: Nicholas Piggin <npiggin@gmail•com>
---
arch/powerpc/kernel/idle_book3s.S | 66 +++++++++++++++------------------------
1 file changed, 26 insertions(+), 40 deletions(-)
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index ab15dee371c9..58364a834f87 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -372,33 +372,6 @@ _GLOBAL(power9_idle_stop)
*/
.global pnv_powersave_wakeup
pnv_powersave_wakeup:
- bl pnv_restore_hyp_resource
-
- li r0,PNV_THREAD_RUNNING
- stb r0,PACA_THREAD_IDLE_STATE(r13) /* Clear thread state */
-
-#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
- li r0,KVM_HWTHREAD_IN_KERNEL
- stb r0,HSTATE_HWTHREAD_STATE(r13)
- /* Order setting hwthread_state vs. testing hwthread_req */
- sync
- lbz r0,HSTATE_HWTHREAD_REQ(r13)
- cmpwi r0,0
- beq 1f
- b kvm_start_guest
-1:
-#endif
-
- /* Return SRR1 from power7_nap() */
- mfspr r3,SPRN_SRR1
- blt cr3,pnv_wakeup_noloss
- b pnv_wakeup_loss
-
-/*
- * Check whether we have woken up with hypervisor state loss. If yes,
- * restore hypervisor state and return back to reset vector.
- */
-pnv_restore_hyp_resource:
ld r2,PACATOC(r13);
BEGIN_FTR_SECTION
@@ -416,7 +389,7 @@ BEGIN_FTR_SECTION
*/
rldicl r5,r5,4,60
cmpd cr4,r5,r4
- bge cr4,pnv_wakeup_tb_loss
+ bgel cr4,pnv_wakeup_tb_loss
FTR_SECTION_ELSE
@@ -425,23 +398,36 @@ FTR_SECTION_ELSE
* Check if we slept with winkle.
*/
lbz r0,PACA_THREAD_IDLE_STATE(r13)
- cmpwi cr2,r0,PNV_THREAD_NAP
- cmpwi cr4,r0,PNV_THREAD_WINKLE
- bgt cr2,pnv_wakeup_tb_loss /* Either sleep or Winkle */
+ cmpwi cr2,r0,PNV_THREAD_NAP
+ cmpwi cr4,r0,PNV_THREAD_WINKLE
+ bgtl cr2,pnv_wakeup_tb_loss /* Either sleep or Winkle */
- /*
- * We fall through here if PACA_THREAD_IDLE_STATE shows we are waking
- * up from nap. At this stage CR3 shouldn't contains 'gt' since that
- * indicates we are waking with hypervisor state loss from nap.
- */
- bgt cr3,.
ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
/*
- * Waking up without hypervisor state loss. Return to
- * reset vector
+ * Waking up without hypervisor state loss, or continuing after
+ * hypervisor state has been restored.
*/
- blr
+
+ li r0,PNV_THREAD_RUNNING
+ stb r0,PACA_THREAD_IDLE_STATE(r13) /* Clear thread state */
+
+#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
+ li r0,KVM_HWTHREAD_IN_KERNEL
+ stb r0,HSTATE_HWTHREAD_STATE(r13)
+ /* Order setting hwthread_state vs. testing hwthread_req */
+ sync
+ lbz r0,HSTATE_HWTHREAD_REQ(r13)
+ cmpwi r0,0
+ beq 1f
+ b kvm_start_guest
+1:
+#endif
+
+ /* Return SRR1 from power7_nap() */
+ mfspr r3,SPRN_SRR1
+ blt cr3,pnv_wakeup_noloss
+ b pnv_wakeup_loss
/*
* Called if waking up from idle state which can cause either partial or
--
2.11.0
next prev parent reply other threads:[~2017-02-16 18:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-16 18:38 [RFC][PATCH 0/5] power saving wakeup changes for POWER9 MCE Nicholas Piggin
2017-02-16 18:38 ` [PATCH 1/5] powerpc/64s: move remaining system reset idle code into idle_book3s.S Nicholas Piggin
2017-02-28 11:40 ` Gautham R Shenoy
2017-02-16 18:38 ` [PATCH 2/5] powerpc/64: stop using bit in HSPRG0 to test winkle Nicholas Piggin
2017-02-28 15:08 ` Gautham R Shenoy
2017-02-28 15:36 ` Nicholas Piggin
2017-02-16 18:38 ` [PATCH 3/5] powerpc/64s: use alternative feature patching Nicholas Piggin
2017-02-28 15:12 ` Gautham R Shenoy
2017-02-16 18:39 ` Nicholas Piggin [this message]
2017-02-28 15:26 ` [PATCH 4/5] powerpc/64s: consolidate pnv_restore_hyp_resource into pnv_powersave_wakeup Gautham R Shenoy
2017-02-16 18:39 ` [PATCH 5/5] powerpc/64s: fix POWER9 machine check handler from stop state Nicholas Piggin
2017-02-28 17:15 ` Gautham R Shenoy
2017-03-08 12:19 ` Nicholas Piggin
2017-03-10 10:34 ` Gautham R Shenoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170216183901.28611-5-npiggin@gmail.com \
--to=npiggin@gmail$(echo .)com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox