LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] powerpc/ptrace: Make user_mode() common to PPC32 and PPC64
@ 2021-08-17 16:00 Christophe Leroy
  2021-08-27 13:16 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2021-08-17 16:00 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

Today we have:

	#ifdef __powerpc64__
	#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
	#else
	#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
	#endif

With ppc64_defconfig, we get:

	if (!user_mode(regs))
    14b4:	e9 3e 01 08 	ld      r9,264(r30)
    14b8:	71 29 40 00 	andi.   r9,r9,16384
    14bc:	41 82 07 a4 	beq     1c60 <.emulate_instruction+0x7d0>

If taking the ppc32 definition of user_mode(), the exact same code
is generated for ppc64_defconfig.

So, only keep one version of user_mode(), preferably the one not
using MSR_PR_LG which should be kept internal to reg.h.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/ptrace.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 14422e851494..fd60538737a0 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -197,11 +197,7 @@ static inline unsigned long frame_pointer(struct pt_regs *regs)
 	return 0;
 }
 
-#ifdef __powerpc64__
-#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
-#else
 #define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
-#endif
 
 #define force_successful_syscall_return()   \
 	do { \
-- 
2.25.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/ptrace: Make user_mode() common to PPC32 and PPC64
  2021-08-17 16:00 [PATCH] powerpc/ptrace: Make user_mode() common to PPC32 and PPC64 Christophe Leroy
@ 2021-08-27 13:16 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2021-08-27 13:16 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Paul Mackerras,
	Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel

On Tue, 17 Aug 2021 16:00:14 +0000 (UTC), Christophe Leroy wrote:
> Today we have:
> 
> 	#ifdef __powerpc64__
> 	#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
> 	#else
> 	#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
> 	#endif
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/ptrace: Make user_mode() common to PPC32 and PPC64
      https://git.kernel.org/powerpc/c/19e932eb6ea47f4f37513eb2ae0daee19117765c

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-27 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 16:00 [PATCH] powerpc/ptrace: Make user_mode() common to PPC32 and PPC64 Christophe Leroy
2021-08-27 13:16 ` Michael Ellerman

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