Le 29/07/2026 à 22:49, Link Mauve a écrit : > Previously, both CONFIG_PPC64 and __powerpc64__ were being used to check > whether we were on 32-bit or on 64-bit PowerPC, sometimes in a single > function. > > I picked __powerpc64__ since it was used six times as much as > CONFIG_PPC64 in this file, but could be convinced to use the other one > if there is any reason to prefer it.
Well, we tend to use the other as much as possible: $ git grep -w -e "#ifdef CONFIG_PPC64" -e "defined(CONFIG_PPC64)" | wc -l 368 $ git grep -w -e "#ifdef __powerpc64__" | wc -l 118 Allthough in most cases you can use one or the other, they don't mean the same. CONFIG_PPC64 means you are building a 64 bit kernel. __powerpc64__ means you are building 64 bit code. In a 64 bit kernel you can have 32 bit code, for instance the vdso32. If you look into include/asm/feature-fixups.h for instance you have : #if defined(CONFIG_PPC64) && !defined(__powerpc64__) /* 64 bits kernel, 32 bits code (ie. vdso32) */ #define FTR_ENTRY_LONG .8byte #define FTR_ENTRY_OFFSET .long 0xffffffff; .long #elif defined(CONFIG_PPC64) #define FTR_ENTRY_LONG .8byte #define FTR_ENTRY_OFFSET .8byte #else #define FTR_ENTRY_LONG .long #define FTR_ENTRY_OFFSET .long #endif Unless you are a good reason to use __powerpc64__ it is often better to use CONFIG_PPC64 Christophe > > Signed-off-by: Link Mauve <[email protected]> > --- > arch/powerpc/lib/sstep.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > index f0d6aa657c1a..597a0d841fe8 100644 > --- a/arch/powerpc/lib/sstep.c > +++ b/arch/powerpc/lib/sstep.c > @@ -15,7 +15,7 @@ > #include <asm/cputable.h> > #include <asm/disassemble.h> > > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > /* Bits in SRR1 that are copied from MSR */ > #define MSR_MASK 0xffffffff87c0ffffUL > #else > @@ -1256,7 +1256,7 @@ static nokprobe_inline void do_popcnt(const struct > pt_regs *regs, > op->val = out; /* popcntd */ > } > > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > static nokprobe_inline void do_bpermd(const struct pt_regs *regs, > struct instruction_op *op, > unsigned long v1, unsigned long v2) > @@ -1273,7 +1273,7 @@ static nokprobe_inline void do_bpermd(const struct > pt_regs *regs, > } > op->val = perm; > } > -#endif /* CONFIG_PPC64 */ > +#endif /* __powerpc64__ */ > /* > * The size parameter adjusts the equivalent prty instruction. > * prtyw = 32, prtyd = 64 > @@ -1340,7 +1340,7 @@ static nokprobe_inline int trap_compare(long v1, long > v2) > int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, > ppc_inst_t instr) > { > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > unsigned int suffixopcode, prefixtype, prefix_r; > #endif > unsigned int opcode, ra, rb, rc, rd, spr, u; > @@ -1739,7 +1739,7 @@ int analyse_instr(struct instruction_op *op, const > struct pt_regs *regs, > op->reg = rd; > op->val = 0xffffffff & ~(MSR_ME | MSR_LE); > return 0; > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > case 178: /* mtmsrd */ > if (user_mode(regs)) > goto priv; > @@ -2054,7 +2054,7 @@ int analyse_instr(struct instruction_op *op, const > struct pt_regs *regs, > case 186: /* prtyd */ > do_prty(regs, op, regs->gpr[rd], 64); > goto logical_done_nocc; > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > case 252: /* bpermd */ > do_bpermd(regs, op, regs->gpr[rd], regs->gpr[rb]); > goto logical_done_nocc; > @@ -2082,7 +2082,7 @@ int analyse_instr(struct instruction_op *op, const > struct pt_regs *regs, > case 476: /* nand */ > op->val = ~(regs->gpr[rd] & regs->gpr[rb]); > goto logical_done; > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > case 506: /* popcntd */ > do_popcnt(regs, op, regs->gpr[rd], 64); > goto logical_done_nocc; > @@ -3247,7 +3247,7 @@ void emulate_update_regs(struct pt_regs *regs, struct > instruction_op *op) > case BARRIER_EIEIO: > eieio(); > break; > -#ifdef CONFIG_PPC64 > +#ifdef __powerpc64__ > case BARRIER_LWSYNC: > asm volatile("lwsync" : : : "memory"); > break;
