From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Nicholas Piggin <npiggin@gmail.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/64s: power4 nap fixup in C
Date: Tue, 16 Mar 2021 08:16:27 +0100 [thread overview]
Message-ID: <6ab2073b-dd10-ef2c-375d-1300f071ae1a@csgroup.eu> (raw)
In-Reply-To: <20210312012044.3660743-1-npiggin@gmail.com>
Le 12/03/2021 à 02:20, Nicholas Piggin a écrit :
> There is no need for this to be in asm, use the new intrrupt entry wrapper.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> Hopefully this works on a real G5 now, but I couldn't reproduce the
> problem with QEMU.
>
> Thanks,
> Nick
>
> arch/powerpc/include/asm/interrupt.h | 19 +++++++++++
> arch/powerpc/include/asm/processor.h | 1 +
> arch/powerpc/include/asm/thread_info.h | 6 ++++
> arch/powerpc/kernel/exceptions-64s.S | 45 --------------------------
> arch/powerpc/kernel/idle_book3s.S | 4 +++
> 5 files changed, 30 insertions(+), 45 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
> index aedfba29e43a..ef015d3b5e39 100644
> --- a/arch/powerpc/include/asm/interrupt.h
> +++ b/arch/powerpc/include/asm/interrupt.h
> @@ -9,6 +9,17 @@
> #include <asm/kprobes.h>
> #include <asm/runlatch.h>
>
> +static inline void nap_adjust_return(struct pt_regs *regs)
> +{
> +#ifdef CONFIG_PPC_970_NAP
> + if (unlikely(test_thread_local_flags(_TLF_NAPPING))) {
> + /* Can avoid a test-and-clear because NMIs do not call this */
> + clear_thread_local_flags(_TLF_NAPPING);
> + regs->nip = (unsigned long)power4_idle_nap_return;
Why don't you do regs->nip = regs->link like PPC32 instead of going via an intermediate symbol that
does nothing else than branching to LR ?
> + }
> +#endif
> +}
> +
> struct interrupt_state {
> #ifdef CONFIG_PPC_BOOK3E_64
> enum ctx_state ctx_state;
> @@ -111,6 +122,9 @@ static inline void interrupt_async_exit_prepare(struct pt_regs *regs, struct int
> {
> irq_exit();
> interrupt_exit_prepare(regs, state);
> +
> + /* Adjust at exit so the main handler sees the true NIA */
> + nap_adjust_return(regs);
> }
>
> struct interrupt_nmi_state {
> @@ -164,6 +178,11 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter
> radix_enabled() || (mfmsr() & MSR_DR))
> nmi_exit();
>
> + /*
> + * nmi does not call nap_adjust_return because nmi should not create
> + * new work to do (must use irq_work for that).
> + */
> +
> #ifdef CONFIG_PPC64
> if (TRAP(regs) != 0x900 && TRAP(regs) != 0xf00 && TRAP(regs) != 0x260)
> this_cpu_set_ftrace_enabled(state->ftrace_enabled);
...
> diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
> index f9e6d83e6720..abb719b21cae 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -209,4 +209,8 @@ _GLOBAL(power4_idle_nap)
> mtmsrd r7
> isync
> b 1b
> +
> + .globl power4_idle_nap_return
> +power4_idle_nap_return:
> + blr
> #endif
>
next prev parent reply other threads:[~2021-03-16 7:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 1:20 [PATCH] powerpc/64s: power4 nap fixup in C Nicholas Piggin
2021-03-16 7:16 ` Christophe Leroy [this message]
2021-03-16 8:11 ` Nicholas Piggin
2021-03-29 4:40 ` Michael Ellerman
2021-03-29 8:33 ` Benjamin Herrenschmidt
2021-03-29 9:04 ` Christophe Leroy
[not found] ` <236a67a4-1609-5fec-3c68-41db02cd1a4c__18973.8760514714$1617008745$gmane$org@csgroup.eu>
2021-03-29 11:56 ` Andreas Schwab
[not found] ` <87czvikwb7.fsf__13924.9042653077$1617019017$gmane$org@igel.home>
2021-03-29 16:51 ` Andreas Schwab
[not found] ` <87y2e6fu7v.fsf__9754.75274478725$1616992871$gmane$org@mpe.ellerman.id.au>
2021-03-29 15:30 ` Andreas Schwab
[not found] ` <87v99aj7tr.fsf__47134.2879392736$1617031867$gmane$org@igel.home>
2021-03-29 16:23 ` Andreas Schwab
2021-04-01 7:36 ` Nicholas Piggin
2021-04-05 12:56 ` Nicholas Piggin
2021-04-05 16:40 ` Andreas Schwab
2021-04-06 2:45 ` Nicholas Piggin
2021-04-10 14:28 ` Michael Ellerman
2021-04-19 5:16 ` Michael Ellerman
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=6ab2073b-dd10-ef2c-375d-1300f071ae1a@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
/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).