LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	npiggin@gmail.com
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x
Date: Wed, 25 Aug 2021 14:54:32 +1000	[thread overview]
Message-ID: <8735qyceev.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <627ead32d40c840f9e8a329b60647b649eceb2aa.1629707037.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 40x and BOOKE don't have MSR_RI.
>
> Define MSR_RI only for platforms where it exists. For the other ones,
> defines it as BUILD_BUG for C and do not define it for ASM.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> v3: Fixes kvm_emul.S and include <linux/bug.h> in <asm/reg.h>
> ---
>  arch/powerpc/include/asm/reg.h       |  5 +++++
>  arch/powerpc/include/asm/reg_booke.h |  6 +++---
>  arch/powerpc/kernel/head_32.h        |  4 ++++
>  arch/powerpc/kernel/kvm_emul.S       | 13 +++++++++++++
>  arch/powerpc/kernel/process.c        |  2 +-
>  arch/powerpc/lib/sstep.c             |  2 +-
>  6 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> index be85cf156a1f..b270b570fb51 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -109,7 +109,12 @@
>  #ifndef MSR_PMM
>  #define MSR_PMM		__MASK(MSR_PMM_LG)	/* Performance monitor */
>  #endif
> +#if !defined(CONFIG_BOOKE) && !defined(CONFIG_40x)
>  #define MSR_RI		__MASK(MSR_RI_LG)	/* Recoverable Exception */

This breaks 64-bit BookE, which is using MSR_RI in bookehv_interrupts.S.

eg. ppc64_book3e_allmodconfig gives:

  arch/powerpc/kvm/bookehv_interrupts.S: Assembler messages:
  arch/powerpc/kvm/bookehv_interrupts.S:221: Error: invalid operands (*ABS* and *UND* sections) for `|'
  etc.

ISA v2.07B says MSR_RI is Book3S only, but looking at the e500mc manual
it does have bit 62 defined as RI.

I can fix it with:

+#if !(defined(CONFIG_BOOKE) && !defined(CONFIG_PPC_BOOK3E)) && !defined(CONFIG_40x)
 #define MSR_RI         __MASK(MSR_RI_LG)       /* Recoverable Exception */


But that's getting really ugly, and we'd have to repeat it elsewhere.

I think we need a kconfig symbol that captures which platforms should
use MSR_RI, something like:

  CONFIG PPC_MSR_RI
    def_bool y
    depends on !40x && (!BOOKE || PPC_BOOK3E)


Or maybe we should just define MSR_RI to 0 for platforms that don't use
it, to avoid so much ifdefing?

cheers

  reply	other threads:[~2021-08-25  4:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  8:24 [PATCH v3 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare() Christophe Leroy
2021-08-23  8:24 ` [PATCH v3 2/3] powerpc: Refactor verification of MSR_RI Christophe Leroy
2021-08-23  8:24 ` [PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x Christophe Leroy
2021-08-25  4:54   ` Michael Ellerman [this message]
2021-08-25  6:21     ` Christophe Leroy
2021-08-25  5:27 ` [PATCH v3 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare() Michael Ellerman
2021-08-25  5:45   ` Christophe Leroy
2021-08-25  6:56     ` Michael Ellerman
2021-08-27 13:16 ` (subset) " Michael Ellerman
2021-08-31 14:00 ` 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=8735qyceev.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    --subject='Re: [PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x' \
    /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

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).