From patchwork Mon May 14 17:14:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 135749 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2051118lji; Mon, 14 May 2018 10:16:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqcHij/jAk2cC2sJWp2sJEPWS/XxgJL2bGlBTguGyQMSog43bLIt1f+86U04tWgA/iqdKX3 X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr10504875plt.162.1526318214258; Mon, 14 May 2018 10:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318214; cv=none; d=google.com; s=arc-20160816; b=pPEZL9KiN+3IsnImZ3DY8fkGgM0yEpdhLxzDnvBCkIOwbqB8wBhgVDPovuvKgacEpX az34D2ebb7UhKzM9rqPE2xOo0aCjHPyNavQNJ1LZNdiSEDXB4+2dy4HO1pAi0iQMpGOk 2sCNaUxIIRYNfvoqx9JbHKNAoAzdW5cNrdRD8n6QUa7hmHVI82X2ygDWMxTunEukWrB5 OdTQIoJl6KqOal07B+O9NX2ERbzFdxGkhjJbUhBxsWcvuuQxWD30UPUtJFYEQVT5NeYf ky0L+h3EdCAS6Ro8yfxGk+mOrDuxqxQbxL6c31SNCem4qFcE3UBurKBZcPeo02jCMEFV JRyA== 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=hXYABfY3tdiVegfc4bwFWHac0W0TBU0+H40kOFnAZA0=; b=AGCpX3qK9TukRhGI54wiRFjJODdlIFMzKtLd7Q1fUeUcMrxYmk0wsctP5ITz+wWrZ/ iexeJ7RNqr7ETu6k/AIc5eOg32WNiBZPymEeLux6u/fLPdH3gMU+HkytjmbKuZds3oBD 7yCRTnI4tZ0I63whvd8HCnMUQLTKL3KQjwzi3mlC/Mi2P7yulA2Aflj5amqsUWzHCQBc YEovsihKTZOXGMAjgu8/pKa4cMBY6V45x8cTfRsFDPXt/HgzOXIV6C5J5fxZT6+SMQdn Us7KqbX4HkTQyHqHoQVNIwLARbgzf3hpwXoNary58XAR+61RDEp+hV5gDTPRi6MmUBXD X4Cg== 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 h16-v6si6001933pli.53.2018.05.14.10.16.53; Mon, 14 May 2018 10:16:54 -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 S1754355AbeENRQv (ORCPT + 29 others); Mon, 14 May 2018 13:16:51 -0400 Received: from foss.arm.com ([217.140.101.70]:47006 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754145AbeENRPe (ORCPT ); Mon, 14 May 2018 13:15:34 -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 4BFA61688; Mon, 14 May 2018 10:15:34 -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 851953F59F; Mon, 14 May 2018 10:15:33 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Tony Luck , Fenghua Yu Subject: [RFC PATCH 09/11] ia64: Move arch-specific prctls out of core code Date: Mon, 14 May 2018 18:14:25 +0100 Message-Id: <1526318067-4964-10-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 ia64-specific prctl call implementations out of core code and removes redundant boilerplate associated with them. No functional change. Signed-off-by: Dave Martin Cc: Tony Luck Cc: Fenghua Yu --- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/processor.h | 12 ------------ arch/ia64/kernel/sys_ia64.c | 22 ++++++++++++++++++++++ kernel/sys.c | 12 ------------ 4 files changed, 23 insertions(+), 24 deletions(-) -- 2.1.4 diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index bbe12a0..a673dd7 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -54,6 +54,7 @@ config IA64 select MODULES_USE_ELF_RELA select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_AUDITSYSCALL + select HAVE_PRCTL_ARCH default y help The Itanium Processor Family is Intel's 64-bit successor to diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h index 0489b80..e40242e 100644 --- a/arch/ia64/include/asm/processor.h +++ b/arch/ia64/include/asm/processor.h @@ -259,18 +259,6 @@ typedef struct { (int __user *) (addr)); \ }) -#define SET_FPEMU_CTL(value) \ -({ \ - current->thread.flags = ((current->thread.flags & ~IA64_THREAD_FPEMU_MASK) \ - | (((value) << IA64_THREAD_FPEMU_SHIFT) & IA64_THREAD_FPEMU_MASK)); \ - 0; \ -}) -#define GET_FPEMU_CTL(addr) \ -({ \ - put_user((current->thread.flags & IA64_THREAD_FPEMU_MASK) >> IA64_THREAD_FPEMU_SHIFT, \ - (int __user *) (addr)); \ -}) - struct thread_struct { __u32 flags; /* various thread flags (see IA64_THREAD_*) */ /* writing on_ustack is performance-critical, so it's worth spending 8 bits on it... */ diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 9ebe1d6..d996585 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -15,11 +15,13 @@ #include #include #include /* doh, must come after sched.h... */ +#include #include #include #include #include +#include #include #include @@ -184,3 +186,23 @@ sys_pciconfig_write (unsigned long bus, unsigned long dfn, unsigned long off, un } #endif /* CONFIG_PCI */ + +int prctl_arch(int option, unsigned long arg2, unsigned long arg3, + unsigned long arg4, unsigned long arg5) +{ + int res; + + switch (option) { + case PR_SET_FPEMU: + current->thread.flags &= ~IA64_THREAD_FPEMU_MASK; + current->thread.flags |= (arg2 << IA64_THREAD_FPEMU_SHIFT) & + IA64_THREAD_FPEMU_MASK; + return 0; + case PR_GET_FPEMU: + res = (current->thread.flags & IA64_THREAD_FPEMU_MASK) >> + IA64_THREAD_FPEMU_SHIFT; + return put_user(res, (int __user *)arg2); + default: + return -EINVAL; + } +} diff --git a/kernel/sys.c b/kernel/sys.c index 5549505..8111c0d 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -77,12 +77,6 @@ #ifndef GET_UNALIGN_CTL # define GET_UNALIGN_CTL(a, b) (-EINVAL) #endif -#ifndef SET_FPEMU_CTL -# define SET_FPEMU_CTL(a) (-EINVAL) -#endif -#ifndef GET_FPEMU_CTL -# define GET_FPEMU_CTL(a) (-EINVAL) -#endif /* * this is where the system-wide overflow UID and GID are defined, for @@ -2246,12 +2240,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, case PR_GET_UNALIGN: error = GET_UNALIGN_CTL(me, arg2); break; - case PR_SET_FPEMU: - error = SET_FPEMU_CTL(arg2); - break; - case PR_GET_FPEMU: - error = GET_FPEMU_CTL(arg2); - break; case PR_GET_TIMING: error = PR_TIMING_STATISTICAL; break;