[PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x
Michael Ellerman
mpe at ellerman.id.au
Wed Aug 25 14:54:32 AEST 2021
Christophe Leroy <christophe.leroy at 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 at 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
More information about the Linuxppc-dev
mailing list