Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1326351pxb; Tue, 17 Aug 2021 09:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyOMGAat9QbQOQGkW9p60Yhc7/Qkg6hVo27bbj1U2sjFLF+26kg97Cw4A7BQgLs0hW0HDv X-Received: by 2002:a05:6638:168f:: with SMTP id f15mr3588529jat.85.1629216192304; Tue, 17 Aug 2021 09:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629216192; cv=none; d=google.com; s=arc-20160816; b=HO6Oo/huhJeJODa6d7vEAi+CgZHFyutChiThJo3KWTspxD/2h5qAsP7qUDiX4AnHt3 L09XljCAg6jivWAqWyYVVuF9ngZC6SUHLZzcknOQFnOiXYwVYNws0bBPSkwFBi/BZobE cK7mKBBwad8J87wOsd7hmVw/Nmmb9LOX31fxCFvBE2DsGFDjkW8Vom7wWhg6TUBMniDh wH19kfrzzMjtTkTOl37geKRYH8qsL0Zgw7o88QYkkfk1jEI+4L1MpkqLXHo4eSVsljG7 R1XoJ7dx1R9J2foR0rjGrGFPFwRiHuW8RPD2IzUCPXTxj3489OHb5H39OuFYfLPT4lwo N7ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:message-id; bh=yP6gjdSx9H1WNyYsynm2rUguzeQ+a80VmgBp5qK+yug=; b=Py8Qqi7+QuyUkmw2Nepk3ApzbIF46yn0hgOGFYW0P1fSh3QrGIzTICP/82BFdDwTsQ MQ0vDz5LIV0ibNyz7eOlK0B73uvZsDZ87O6R+8YoSFG8uXiOEDE0AN4obm3E9fde9EPj B4gJF6B5bMJ/6mfztFZ6E18fQitSTdfPCKZ4ZENYhoic9OgfMH67UWa7CFxCtBgUaQKh ZV0gHR4PM5DMYy9bl4l3+pfIiyXi1Rr73J5o0cI4qit/4nmFH9bldhqhPkza9eU5x/8G 10xOlftAD/nJjyXi41nAHrKVeQVVmATyDWCFZhEvZViLjXTltB8/8ZSKKFnwMLMtURdi 71bQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o14si3052965ilj.89.2021.08.17.09.02.59; Tue, 17 Aug 2021 09:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbhHQQAy (ORCPT + 99 others); Tue, 17 Aug 2021 12:00:54 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:44337 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbhHQQAu (ORCPT ); Tue, 17 Aug 2021 12:00:50 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4GpwjC12S7z9sTl; Tue, 17 Aug 2021 18:00:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5FYl5G2Uzyb6; Tue, 17 Aug 2021 18:00:15 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4GpwjC06SKz9sRj; Tue, 17 Aug 2021 18:00:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D57258B7C3; Tue, 17 Aug 2021 18:00:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id n39-hyA9LvO3; Tue, 17 Aug 2021 18:00:14 +0200 (CEST) Received: from po9473vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A6B088B7A9; Tue, 17 Aug 2021 18:00:14 +0200 (CEST) Received: by po9473vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 742D9667C7; Tue, 17 Aug 2021 16:00:14 +0000 (UTC) Message-Id: <000a28c51808bbd802b505af42d2cb316c2be7d3.1629216000.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH] powerpc/ptrace: Make user_mode() common to PPC32 and PPC64 To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 17 Aug 2021 16:00:14 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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