From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 9/9] powerpc/64s: Simplify POWER9 DD1 idle workaround code
Date: Wed, 19 Apr 2017 23:05:51 +1000 [thread overview]
Message-ID: <20170419130551.32378-10-npiggin@gmail.com> (raw)
In-Reply-To: <20170419130551.32378-1-npiggin@gmail.com>
The idle workaround does not need to load PACATOC, and it does not
need to be called within a nested function that requires LR to be
saved.
Load the PACATOC at entry to the idle wakeup. It does not matter which
PACA this comes from, so it's okay to call before the workaround. Then
apply the workaround to get the right PACA.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/include/asm/feature-fixups.h | 3 +++
arch/powerpc/kernel/idle_book3s.S | 16 +++++-----------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
index ddf54f5bbdd1..2de2319b99e2 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -66,6 +66,9 @@ label##5: \
#define END_FTR_SECTION(msk, val) \
END_FTR_SECTION_NESTED(msk, val, 97)
+#define END_FTR_SECTION_NESTED_IFSET(msk, label) \
+ END_FTR_SECTION_NESTED((msk), (msk), label)
+
#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 97c014de0ca3..a4c058f99164 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -411,7 +411,6 @@ power9_dd1_recover_paca:
/* Load paca->thread_sibling_pacas[i] into r13 */
ldx r13, r4, r5
SET_PACA(r13)
- ld r2, PACATOC(r13)
/*
* Indicate that we have lost NVGPR state
* which needs to be restored from the stack.
@@ -451,7 +450,12 @@ pnv_powersave_wakeup_mce:
*/
.global pnv_powersave_wakeup
pnv_powersave_wakeup:
+ ld r2, PACATOC(r13)
+
BEGIN_FTR_SECTION
+BEGIN_FTR_SECTION_NESTED(70)
+ bl power9_dd1_recover_paca
+END_FTR_SECTION_NESTED_IFSET(CPU_FTR_POWER9_DD1, 70)
bl pnv_restore_hyp_resource_arch300
FTR_SECTION_ELSE
bl pnv_restore_hyp_resource_arch207
@@ -488,14 +492,6 @@ pnv_restore_hyp_resource_arch300:
* POWER ISA 3. Use PSSCR to determine if we
* are waking up from deep idle state
*/
-BEGIN_FTR_SECTION
- mflr r6
- bl power9_dd1_recover_paca
- mtlr r6
-FTR_SECTION_ELSE
- ld r2, PACATOC(r13)
-ALT_FTR_SECTION_END_IFSET(CPU_FTR_POWER9_DD1)
-
LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
ld r4,ADDROFF(pnv_first_deep_stop_state)(r5)
@@ -516,8 +512,6 @@ pnv_restore_hyp_resource_arch207:
* POWER ISA 2.07 or less.
* Check if we slept with sleep or winkle.
*/
- ld r2,PACATOC(r13);
-
lbz r4,PACA_THREAD_IDLE_STATE(r13)
cmpwi cr2,r4,PNV_THREAD_NAP
bgt cr2,pnv_wakeup_tb_loss /* Either sleep or Winkle */
--
2.11.0
prev parent reply other threads:[~2017-04-19 13:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 13:05 [PATCH v2 0/9] idle fixes and changes for POWER8 and POWER9 Nicholas Piggin
2017-04-19 13:05 ` [PATCH 1/9] powerpc/64s: Remove unnecessary relocation branch from idle handler Nicholas Piggin
2017-04-23 11:53 ` [1/9] " Michael Ellerman
2017-04-19 13:05 ` [PATCH 2/9] powerpc/64s: move remaining system reset idle code into idle_book3s.S Nicholas Piggin
2017-04-19 13:05 ` [PATCH 3/9] powerpc/64s: stop using bit in HSPRG0 to test winkle Nicholas Piggin
2017-04-19 13:05 ` [PATCH 4/9] powerpc/64s: use alternative feature patching Nicholas Piggin
2017-04-19 13:05 ` [PATCH 5/9] powerpc/64s: fix POWER9 machine check handler from stop state Nicholas Piggin
2017-04-19 13:05 ` [PATCH 6/9] powerpc/64s: idle expand core idle state bits Nicholas Piggin
2017-04-19 13:05 ` [PATCH 7/9] powerpc/64s: idle do not hold reservation longer than required Nicholas Piggin
2017-04-19 13:05 ` [PATCH 8/9] powerpc/64s: idle POWER8 avoid full state loss recovery where possible Nicholas Piggin
2017-04-19 13:05 ` Nicholas Piggin [this message]
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=20170419130551.32378-10-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).