From patchwork Mon May 14 17:14:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 135745 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2049701lji; Mon, 14 May 2018 10:15:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpxBlkdUXJARwrlk7jfllIUhkCkrN652d+oWdb/YbVGyiItN3m3NBVD5NcDWc0p0Nvi9bqi X-Received: by 2002:a17:902:7d8a:: with SMTP id a10-v6mr10664930plm.317.1526318138293; Mon, 14 May 2018 10:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318138; cv=none; d=google.com; s=arc-20160816; b=01QU8TLJKJdZIFsL/VgpcYQjPZOOqyL+Yj79i2WrBH7OBkVKmm9lqHYRVwTt9jJF4m VR2K4L55MAkl0v1hl8iiE/IzYvtauwKRHs68w7lGKpoyR1M6FZIbX18KaBiY0sY0IBBn 0ux96EAMWq563FC3Wwre4XMJORHNl3RVP8Tr/UXl03ITuTop7xPtjCrR1Q9nRXFbCBTo t8ptnyTo076rJe8fklsdmLxPwBeKehMPHJdbkgjDWjWvpG5IXZmnzn+sPBEQ3Tm5ALWp 80PXR8E2Yl+TDrqWAmwFeUutQbbHsE1Vrpxj1S76yP6J6WaJINSKgvEROdXa1XD6/kBZ PTwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1uyoZ6LVFVTjMU95I1EPVd6t5TZan6i3pI+UIACUj4M=; b=D4nP4wleUvlP0R7lxZ6GUbGceL4LxqVFLfqF50pS1qf38LrVlsjMa3Bbfl88ZYky+v w14se6QK6v/QGjhmSyMbuAqbhk8WDZFo26zrPyEplNkLCqyp2xV0nX/y8zZyFa9xe9ra BkloK/Xfe+XSeQYNyUALTZowxh8n2ApofOnBWp+aRletdECROQjt/x6IfsERIGJ4/YCC LP9payfhyxK78Z2Zz48kRsvYWqu14zmiEVuAwP/+9n1l/vebfgBqeMUWW6geOH/io+wk zlGeSHaL1vOWbD5b9VyBniZhMAjT8gw4Wd20Svge+5SFhGdQuT6Zj5Ik1sy4ZB4O4/Vb JDLw== ARC-Authentication-Results: i=1; mx.google.com; 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 3-v6si10028099plv.323.2018.05.14.10.15.38; Mon, 14 May 2018 10:15:38 -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; 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 S932242AbeENRPg (ORCPT + 29 others); Mon, 14 May 2018 13:15:36 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46990 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbeENRPc (ORCPT ); Mon, 14 May 2018 13:15:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FDA016EA; Mon, 14 May 2018 10:15:32 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 559F23F59F; Mon, 14 May 2018 10:15:31 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [RFC PATCH 07/11] powerpc: Move arch-specific prctls out of core code Date: Mon, 14 May 2018 18:14:23 +0100 Message-Id: <1526318067-4964-8-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1526318067-4964-1-git-send-email-Dave.Martin@arm.com> References: <1526318067-4964-1-git-send-email-Dave.Martin@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch moves the powerpc-specific prctl call implementations out of core code and removes redundant boilerplate associated with them. No functional change. Signed-off-by: Dave Martin Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/processor.h | 6 ------ arch/powerpc/kernel/syscalls.c | 17 +++++++++++++++++ kernel/sys.c | 24 ------------------------ 4 files changed, 18 insertions(+), 30 deletions(-) -- 2.1.4 Acked-by: Michael Ellerman diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c32a181..b94323e 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -218,6 +218,7 @@ config PPC select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP + select HAVE_PRCTL_ARCH select HAVE_RCU_TABLE_FREE if SMP select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_SYSCALL_TRACEPOINTS diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 313dec1..e1cd7ec 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -407,15 +407,9 @@ unsigned long get_wchan(struct task_struct *p); #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0) /* Get/set floating-point exception mode */ -#define GET_FPEXC_CTL(adr) get_fpexc_mode((adr)) -#define SET_FPEXC_CTL(val) set_fpexc_mode((val)) - extern int get_fpexc_mode(unsigned long adr); extern int set_fpexc_mode(unsigned int val); -#define GET_ENDIAN(adr) get_endian((adr)) -#define SET_ENDIAN(val) set_endian((val)) - extern int get_endian(unsigned long adr); extern int set_endian(unsigned int val); diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index 4662165..0d6a914 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -139,3 +139,20 @@ long sys_switch_endian(void) return 0; } + +int prctl_arch(int option, unsigned long arg2, unsigned long arg3, + unsigned long arg4, unsigned long arg5) +{ + switch (option) { + case PR_SET_FPEXC: + return set_fpexc_mode(arg2); + case PR_GET_FPEXC: + return get_fpexc_mode(arg2); + case PR_GET_ENDIAN: + return get_endian(arg2); + case PR_SET_ENDIAN: + return set_endian(arg2); + default: + return -EINVAL; + } +} diff --git a/kernel/sys.c b/kernel/sys.c index 44e1c47..b154561 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -83,18 +83,6 @@ #ifndef GET_FPEMU_CTL # define GET_FPEMU_CTL(a, b) (-EINVAL) #endif -#ifndef SET_FPEXC_CTL -# define SET_FPEXC_CTL(a, b) (-EINVAL) -#endif -#ifndef GET_FPEXC_CTL -# define GET_FPEXC_CTL(a, b) (-EINVAL) -#endif -#ifndef GET_ENDIAN -# define GET_ENDIAN(b) (-EINVAL) -#endif -#ifndef SET_ENDIAN -# define SET_ENDIAN(b) (-EINVAL) -#endif /* * this is where the system-wide overflow UID and GID are defined, for @@ -2264,12 +2252,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, case PR_GET_FPEMU: error = GET_FPEMU_CTL(me, arg2); break; - case PR_SET_FPEXC: - error = SET_FPEXC_CTL(arg2); - break; - case PR_GET_FPEXC: - error = GET_FPEXC_CTL(arg2); - break; case PR_GET_TIMING: error = PR_TIMING_STATISTICAL; break; @@ -2290,12 +2272,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, if (copy_to_user((char __user *)arg2, comm, sizeof(comm))) return -EFAULT; break; - case PR_GET_ENDIAN: - error = GET_ENDIAN(arg2); - break; - case PR_SET_ENDIAN: - error = SET_ENDIAN(arg2); - break; case PR_GET_SECCOMP: error = prctl_get_seccomp(); break;