Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3614437ybd; Tue, 25 Jun 2019 05:46:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIBcD2HbF6GuDPnK+NuB7NAwuTdxmY8qXm0kn/sMestiQgcUkENr6zXbFJ61udmHVat6Ni X-Received: by 2002:a17:90a:bb0c:: with SMTP id u12mr32217691pjr.132.1561466791828; Tue, 25 Jun 2019 05:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561466791; cv=none; d=google.com; s=arc-20160816; b=MMGpLo+wLBP9Z9K1Ykvbbu558GzB/EMkRJ6SaaHRQjIHJDKQdzR41VaonCer369joX cPF3vM5syoKW+FRl5SvD9fg5pWusi7YGsx0LDt5kq9bodaK8r+Yzv/mcy+ftxG5Zm5pg kyreoMOQKyifSoctEgQBdp7fG+ew2hlOsOVb/xkvk0daL+QpIpNA73aQWH+Q+6Vz6Kee nliFTgcTqBandSZPOh4kD8ytQOqFDaBJlN16lWGanIb2S9H31n4t84viHK76Vy8qmcAt K+Sm+g7or9gvAGo56c9RI18UNY+3AtwwNjVon1sP5P8kbdtYPlIJYts9EhdzQKikWNkh fT6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=auZsk5+eXrNvOomMroEmyexOA4o1/bt7OLpPEQ8iQig=; b=03Gn9X1MSsNF4+ZH6bi1e557K7jtfr0Z2rVdcw8q2b79FHaw2Eob1+GgRk28tyw3Iw FnsyneO2vUDfLrGsTNI5onCtvPACuxOW2K0MK6+VTnRxn8k4V3s4kPMuderlXwxB/e9z 2A/tRNIjY06Y323PNcM52U3y36M0/dwp6c8ItEnM8uKiqprz+k8Im7KiPgSZ1szVyway e5pEtx/3EAlVEhyT5zyYrXm33IO/mmvKguaU2w2olvCJpDBbu7fxZ7YHM7gkQYUP9ete tDfexk7trVIVHieJjydmRoRbrXBmGwCtwflHiRLPPG058szPPxiV48XpHTVY1LJBVT89 Inug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="wCc/S002"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si2679157pjq.89.2019.06.25.05.46.16; Tue, 25 Jun 2019 05:46:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="wCc/S002"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732265AbfFYK6Q (ORCPT + 99 others); Tue, 25 Jun 2019 06:58:16 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:50852 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727144AbfFYK6N (ORCPT ); Tue, 25 Jun 2019 06:58:13 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 45Y36V2cfHz9v18M; Tue, 25 Jun 2019 12:58:10 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=wCc/S002; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id e_qvDbPCj_zQ; Tue, 25 Jun 2019 12:58:10 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 45Y36V1bDgz9v18K; Tue, 25 Jun 2019 12:58:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1561460290; bh=auZsk5+eXrNvOomMroEmyexOA4o1/bt7OLpPEQ8iQig=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=wCc/S002LSEYMxe9E5YjJfdXSaOQabgDCIWkB5YCkfxAXLNUYEpcF8IObxS7YmDfM DBWzChnZV10lyhbc57Ow2bOo0PYWREixLvwsqtaUYybLUE2Nd3tLTVKXXVoZkepAvx WxIPbLYvzc53ZQE4BEooA8R/ARPoJX20hSBQ+xtU= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 608448B87B; Tue, 25 Jun 2019 12:58:11 +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 mHQJVfIzuIjk; Tue, 25 Jun 2019 12:58:11 +0200 (CEST) Received: from pc17473vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F25EC8B874; Tue, 25 Jun 2019 12:58:10 +0200 (CEST) Received: by pc17473vm.idsi0.si.c-s.fr (Postfix, from userid 0) id DAB9F68E1C; Tue, 25 Jun 2019 10:58:07 +0000 (UTC) Message-Id: <80d3dfc4799faa2f173d88589a5c9cb4e586eda4.1561459983.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v1 02/13] powerpc/ptrace: drop unnecessary #ifdefs CONFIG_PPC64 To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , mikey@neuling.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 25 Jun 2019 10:58:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drop a bunch of #ifdefs CONFIG_PPC64 that are not vital. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ptrace.h | 9 ++++----- arch/powerpc/include/uapi/asm/ptrace.h | 12 ++++-------- arch/powerpc/kernel/ptrace/ptrace.c | 24 +++--------------------- 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index faa5a338ac5a..1506a9c61d50 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -36,11 +36,10 @@ struct pt_regs unsigned long link; unsigned long xer; unsigned long ccr; -#ifdef CONFIG_PPC64 - unsigned long softe; -#else - unsigned long mq; -#endif + union { + unsigned long softe; + unsigned long mq; + }; unsigned long trap; unsigned long dar; unsigned long dsisr; diff --git a/arch/powerpc/include/uapi/asm/ptrace.h b/arch/powerpc/include/uapi/asm/ptrace.h index f5f1ccc740fc..37d7befbb8dc 100644 --- a/arch/powerpc/include/uapi/asm/ptrace.h +++ b/arch/powerpc/include/uapi/asm/ptrace.h @@ -43,12 +43,11 @@ struct pt_regs unsigned long link; unsigned long xer; unsigned long ccr; -#ifdef __powerpc64__ - unsigned long softe; /* Soft enabled/disabled */ -#else - unsigned long mq; /* 601 only (not used at present) */ + union { + unsigned long softe; /* Soft enabled/disabled */ + unsigned long mq; /* 601 only (not used at present) */ /* Used on APUS to hold IPL value. */ -#endif + }; unsigned long trap; /* Reason for being here */ /* N.B. for critical exceptions on 4xx, the dar and dsisr fields are overloaded to hold srr0 and srr1. */ @@ -105,11 +104,8 @@ struct pt_regs #define PT_LNK 36 #define PT_XER 37 #define PT_CCR 38 -#ifndef __powerpc64__ #define PT_MQ 39 -#else #define PT_SOFTE 39 -#endif #define PT_TRAP 40 #define PT_DAR 41 #define PT_DSISR 42 diff --git a/arch/powerpc/kernel/ptrace/ptrace.c b/arch/powerpc/kernel/ptrace/ptrace.c index 684b0b315c32..0afb223c4d57 100644 --- a/arch/powerpc/kernel/ptrace/ptrace.c +++ b/arch/powerpc/kernel/ptrace/ptrace.c @@ -113,11 +113,8 @@ static const struct pt_regs_offset regoffset_table[] = { REG_OFFSET_NAME(link), REG_OFFSET_NAME(xer), REG_OFFSET_NAME(ccr), -#ifdef CONFIG_PPC64 REG_OFFSET_NAME(softe), -#else REG_OFFSET_NAME(mq), -#endif REG_OFFSET_NAME(trap), REG_OFFSET_NAME(dar), REG_OFFSET_NAME(dsisr), @@ -289,17 +286,15 @@ int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data) if (regno == PT_DSCR) return get_user_dscr(task, data); -#ifdef CONFIG_PPC64 /* * softe copies paca->irq_soft_mask variable state. Since irq_soft_mask is * no more used as a flag, lets force usr to alway see the softe value as 1 * which means interrupts are not soft disabled. */ - if (regno == PT_SOFTE) { + if (IS_ENABLED(CONFIG_PPC64) && regno == PT_SOFTE) { *data = 1; return 0; } -#endif regs_max = sizeof(struct user_pt_regs) / sizeof(unsigned long); if (regno < regs_max) { @@ -2013,7 +2008,6 @@ static const struct user_regset_view user_ppc_native_view = { .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets) }; -#ifdef CONFIG_PPC64 #include static int gpr32_get_common(struct task_struct *target, @@ -2287,14 +2281,11 @@ static const struct user_regset_view user_ppc_compat_view = { .name = "ppc", .e_machine = EM_PPC, .ei_osabi = ELF_OSABI, .regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets) }; -#endif /* CONFIG_PPC64 */ const struct user_regset_view *task_user_regset_view(struct task_struct *task) { -#ifdef CONFIG_PPC64 - if (test_tsk_thread_flag(task, TIF_32BIT)) + if (IS_ENABLED(CONFIG_PPC64) && test_tsk_thread_flag(task, TIF_32BIT)) return &user_ppc_compat_view; -#endif return &user_ppc_native_view; } @@ -3081,11 +3072,7 @@ long arch_ptrace(struct task_struct *child, long request, else dbginfo.num_data_bps = 0; dbginfo.num_condition_regs = 0; -#ifdef CONFIG_PPC64 - dbginfo.data_bp_alignment = 8; -#else - dbginfo.data_bp_alignment = 4; -#endif + dbginfo.data_bp_alignment = sizeof(long); dbginfo.sizeof_condition = 0; #ifdef CONFIG_HAVE_HW_BREAKPOINT dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE; @@ -3322,12 +3309,10 @@ long do_syscall_trace_enter(struct pt_regs *regs) if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) trace_sys_enter(regs, regs->gpr[0]); -#ifdef CONFIG_PPC64 if (!is_32bit_task()) audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4], regs->gpr[5], regs->gpr[6]); else -#endif audit_syscall_entry(regs->gpr[0], regs->gpr[3] & 0xffffffff, regs->gpr[4] & 0xffffffff, @@ -3382,13 +3367,10 @@ void __init pt_regs_check(void) offsetof(struct user_pt_regs, xer)); BUILD_BUG_ON(offsetof(struct pt_regs, ccr) != offsetof(struct user_pt_regs, ccr)); -#ifdef __powerpc64__ BUILD_BUG_ON(offsetof(struct pt_regs, softe) != offsetof(struct user_pt_regs, softe)); -#else BUILD_BUG_ON(offsetof(struct pt_regs, mq) != offsetof(struct user_pt_regs, mq)); -#endif BUILD_BUG_ON(offsetof(struct pt_regs, trap) != offsetof(struct user_pt_regs, trap)); BUILD_BUG_ON(offsetof(struct pt_regs, dar) != -- 2.13.3