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 5c98a950eca0dba7ac0aaae9f2ec81461ca802a3..7a2690e97b0e886695e301b0fed3ab94a693e7ef 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 2b3278534bc1495c20a5c041fb4f54554c625a5b..13f0409dd617e35cfa061fa638b27b0670b3b5e8 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 6e560f035614bb06071528182626f572d782ad53..42f89e2d8f04f76a98679be6c634b9dba3a4a4c8 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 e9d27265253b492a5efa5878aa0ea8ddcce79a4b..50478738c8f13a489e2bc2ff02772586d3673596 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 cf3436b7b166e72fd1bafe985cfb13d0258b02aa..7582f3e3a3303a0a1ae4264d74ed6c24b7533a9e 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 035bf4f3eb5d84101d5b81dbeee6e40249053e56..7748c278d13c81729aff32ba9e947cfdbf039da0 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 c4f1d6b7d99235c350d9f9cdbb706f7834ce9f23..8207f97d51e8c6d7b944ec5a73eac4e6cc0ee6fd 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 bdee7262c080acb0ce7bbe15a42e6f1022db7c5b..9f8d0fa7b71821d6089313739ba1a9f15bf063bf 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 84058bbc8fe98b0066921ca27781391690129ec2..93f22da12abe78c4982c637da3f3afb70669248f 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 7ec5c47fce0e3030e2f0b79092b1aab391bf2d33..15e7386584f98799b4f26c9ba3930d88ca014d00 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 f7cddb82938f92693b6dd5c384a17212e5467880..42df9dd7fb4183a5bffeb0f6f3d0923762d89fa1 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 408d8ee5bfcd8d2d37af36f9e42196aae4c0ad4a..24b6ee6892392e4b5d9e2ac566f17508f0e10cbe 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