OSDN Git Service

powerpc/config: Add CONFIG_BOOKE_OR_40x
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 19 Oct 2021 07:29:25 +0000 (09:29 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 9 Dec 2021 11:41:19 +0000 (22:41 +1100)
We have many functionnalities common to 40x and BOOKE, it leads to
many places with #if defined(CONFIG_BOOKE) || defined(CONFIG_40x).

We are going to add a few more with KUAP for booke/40x, so create
a new symbol which is defined when either BOOKE or 40x is defined.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/9a3dbd60924cb25c9f944d3d8205ac5a0d15e229.1634627931.git.christophe.leroy@csgroup.eu
12 files changed:
arch/powerpc/include/asm/hw_irq.h
arch/powerpc/include/asm/irq.h
arch/powerpc/include/asm/ptrace.h
arch/powerpc/include/asm/reg.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/kgdb.c
arch/powerpc/kernel/setup.h
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/time.c
arch/powerpc/platforms/Kconfig.cputype

index 5c98a95..7a2690e 100644 (file)
@@ -61,7 +61,7 @@
 
 static inline void __hard_irq_enable(void)
 {
-       if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+       if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
                wrtee(MSR_EE);
        else if (IS_ENABLED(CONFIG_PPC_8xx))
                wrtspr(SPRN_EIE);
@@ -73,7 +73,7 @@ static inline void __hard_irq_enable(void)
 
 static inline void __hard_irq_disable(void)
 {
-       if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+       if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
                wrtee(0);
        else if (IS_ENABLED(CONFIG_PPC_8xx))
                wrtspr(SPRN_EID);
@@ -85,7 +85,7 @@ static inline void __hard_irq_disable(void)
 
 static inline void __hard_EE_RI_disable(void)
 {
-       if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+       if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
                wrtee(0);
        else if (IS_ENABLED(CONFIG_PPC_8xx))
                wrtspr(SPRN_NRI);
@@ -97,7 +97,7 @@ static inline void __hard_EE_RI_disable(void)
 
 static inline void __hard_RI_enable(void)
 {
-       if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+       if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
                return;
 
        if (IS_ENABLED(CONFIG_PPC_8xx))
index 2b32785..13f0409 100644 (file)
@@ -36,7 +36,7 @@ extern int distribute_irqs;
 
 struct pt_regs;
 
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
 /*
  * Per-cpu stacks for handling critical, debug and machine check
  * level interrupts.
index 6e560f0..42f89e2 100644 (file)
@@ -291,7 +291,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
 
 static inline bool cpu_has_msr_ri(void)
 {
-       return !IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x);
+       return !IS_ENABLED(CONFIG_BOOKE_OR_40x);
 }
 
 static inline bool regs_is_unrecoverable(struct pt_regs *regs)
index e9d2726..5047873 100644 (file)
@@ -18,9 +18,9 @@
 #include <asm/feature-fixups.h>
 
 /* Pickup Book E specific registers. */
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
 #include <asm/reg_booke.h>
-#endif /* CONFIG_BOOKE || CONFIG_40x */
+#endif
 
 #ifdef CONFIG_FSL_EMB_PERFMON
 #include <asm/reg_fsl_emb.h>
index cf3436b..7582f3e 100644 (file)
@@ -54,7 +54,7 @@
 #endif
 
 #ifdef CONFIG_PPC32
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
 #include "head_booke.h"
 #endif
 #endif
index 035bf4f..7748c27 100644 (file)
@@ -105,7 +105,7 @@ transfer_to_syscall:
        stw     r11, 0(r1)
        mflr    r12
        stw     r12, _LINK(r1)
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
        rlwinm  r9,r9,0,14,12           /* clear MSR_WE (necessary?) */
 #endif
        lis     r12,STACK_FRAME_REGS_MARKER@ha /* exception frame marker */
index c4f1d6b..8207f97 100644 (file)
@@ -811,7 +811,7 @@ void __init init_IRQ(void)
                ppc_md.init_IRQ();
 }
 
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
 void   *critirq_ctx[NR_CPUS] __read_mostly;
 void    *dbgirq_ctx[NR_CPUS] __read_mostly;
 void *mcheckirq_ctx[NR_CPUS] __read_mostly;
index bdee726..9f8d0fa 100644 (file)
@@ -48,7 +48,7 @@ static struct hard_trap_info
        { 0x0800, 0x08 /* SIGFPE */  },         /* fp unavailable */
        { 0x0900, 0x0e /* SIGALRM */ },         /* decrementer */
        { 0x0c00, 0x14 /* SIGCHLD */ },         /* system call */
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_BOOKE_OR_40x
        { 0x2002, 0x05 /* SIGTRAP */ },         /* debug */
 #if defined(CONFIG_FSL_BOOKE)
        { 0x2010, 0x08 /* SIGFPE */  },         /* spe unavailable */
@@ -67,7 +67,7 @@ static struct hard_trap_info
        { 0x2010, 0x08 /* SIGFPE */  },         /* fp unavailable */
        { 0x2020, 0x08 /* SIGFPE */  },         /* ap unavailable */
 #endif
-#else /* ! (defined(CONFIG_40x) || defined(CONFIG_BOOKE)) */
+#else /* !CONFIG_BOOKE_OR_40x */
        { 0x0d00, 0x05 /* SIGTRAP */ },         /* single-step */
 #if defined(CONFIG_PPC_8xx)
        { 0x1000, 0x04 /* SIGILL */  },         /* software emulation */
index 84058bb..93f22da 100644 (file)
@@ -29,7 +29,7 @@ void setup_tlb_core_data(void);
 static inline void setup_tlb_core_data(void) { }
 #endif
 
-#if defined(CONFIG_PPC_BOOK3E) || defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
 void exc_lvl_early_init(void);
 #else
 static inline void exc_lvl_early_init(void) { }
index 7ec5c47..15e7386 100644 (file)
@@ -175,7 +175,7 @@ void __init emergency_stack_init(void)
 }
 #endif
 
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
 void __init exc_lvl_early_init(void)
 {
        unsigned int i, hw_cpu;
index f7cddb8..42df9dd 100644 (file)
@@ -770,7 +770,7 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
 
 static void start_cpu_decrementer(void)
 {
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
        unsigned int tcr;
 
        /* Clear any pending timer interrupts */
index 408d8ee..24b6ee6 100644 (file)
@@ -287,6 +287,11 @@ config BOOKE
        depends on E500 || 44x || PPC_BOOK3E
        default y
 
+config BOOKE_OR_40x
+       bool
+       depends on BOOKE || 40x
+       default y
+
 config FSL_BOOKE
        bool
        depends on E500 && PPC32