From patchwork Fri Nov 9 21:17:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 12798 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F383B2420A for ; Fri, 9 Nov 2012 21:18:33 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 85AC5A18472 for ; Fri, 9 Nov 2012 21:18:33 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so6299447iej.11 for ; Fri, 09 Nov 2012 13:18:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=QjLyQGE9dwMGdO29xlJcpZ+ej+ASWFRJ0H2yM+34xF0=; b=dXIYvN5iCjRE6BlHDZj58ILM/btiFu7/R2x00ZH7Dyh3sEhxRXvJeDGjKDykTNngc9 1FOA7sb3OSzDw4TDpGFW/6lNR+rz5f2Z4CByvPLAuv2jV9dUgYlX9RWCdaQ9TACTSKDl QFeLOzogT9Y+Cdja2aVuEU5uJFVBCTidclKS9Wds3UJ79UwPiWGJkmdgy/NhD1tFxbo/ ayT4M10jjlYVSn6S7uy/41aW/iVsf3d2R/p+F4TcUSZFV2FdRaPGcK6QlZgv5hU3GGKh W+6QgBUR48BVUouyr1sKA23++CsIbjsjYTzhg7kui3yzczbcZI/omf79lM/MQ9DtjT1b 9+mw== Received: by 10.50.213.34 with SMTP id np2mr2555601igc.57.1352495912921; Fri, 09 Nov 2012 13:18:32 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp88570igt; Fri, 9 Nov 2012 13:18:32 -0800 (PST) Received: by 10.60.32.137 with SMTP id j9mr9127379oei.133.1352495911733; Fri, 09 Nov 2012 13:18:31 -0800 (PST) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx.google.com with ESMTPS id h8si28406384obn.153.2012.11.09.13.18.31 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Nov 2012 13:18:31 -0800 (PST) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.182 as permitted sender) client-ip=209.85.214.182; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.182 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f182.google.com with SMTP id wc20so5636792obb.13 for ; Fri, 09 Nov 2012 13:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=QjLyQGE9dwMGdO29xlJcpZ+ej+ASWFRJ0H2yM+34xF0=; b=RCrKom3PkcMmflUIVDSu7d+utM/SGnwv1BWyF1hD+qnNGCWIys+uqjsKar673BHwGI jad9BBEcP35R5oM0czjodyU2xakQhkFs8ILaOnJaJiF7Z9uU9nPZCNZFyvTe7MhLMF2F tcgWqBlTCvExbK8sjakg5Urcm60kFArbvW0CIlsrg2ByXVSxBndZKFMe1rfspTGv8MnZ zzc9ZlKZmHqK19fQhpH9Qvl3Rqr8kqRU48JAUZP8NI26942Gyeaomvkd/Hw+Fn71/F2I gGim8P945Ir0kb4T27FIZ5HQVB5ht2D2l18CTYwk3ntiBjIs1JcN83gjCUMs1k4mFgWW TxFg== Received: by 10.60.20.40 with SMTP id k8mr8720310oee.23.1352495911448; Fri, 09 Nov 2012 13:18:31 -0800 (PST) Received: from localhost (ppp-70-129-143-201.dsl.rcsntx.swbell.net. [70.129.143.201]) by mx.google.com with ESMTPS id m3sm30621107obm.21.2012.11.09.13.18.29 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Nov 2012 13:18:30 -0800 (PST) Sender: Rob Clark From: Rob Clark To: linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , Russell King , Rob Clark Subject: [PATCH] ARM: add get_user() support for 8 byte types Date: Fri, 9 Nov 2012 15:17:33 -0600 Message-Id: <1352495853-9790-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.8.0 X-Gm-Message-State: ALoCoQlirnRSoLLstrRg0H6P5jMcmjV4ikqapBMtUb3OVbjM9cV/yBKVog/mNY/8xooMI8mgI3+H From: Rob Clark A new atomic modeset/pageflip ioctl being developed in DRM requires get_user() to work for 64bit types (in addition to just put_user()). Signed-off-by: Rob Clark --- arch/arm/include/asm/uaccess.h | 25 ++++++++++++++++++++----- arch/arm/lib/getuser.S | 17 ++++++++++++++++- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 7e1f760..2e3fdb2 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -100,6 +100,7 @@ static inline void set_fs(mm_segment_t fs) extern int __get_user_1(void *); extern int __get_user_2(void *); extern int __get_user_4(void *); +extern int __get_user_8(void *); #define __GUP_CLOBBER_1 "lr", "cc" #ifdef CONFIG_CPU_USE_DOMAINS @@ -108,6 +109,7 @@ extern int __get_user_4(void *); #define __GUP_CLOBBER_2 "lr", "cc" #endif #define __GUP_CLOBBER_4 "lr", "cc" +#define __GUP_CLOBBER_8 "lr", "cc" #define __get_user_x(__r2,__p,__e,__l,__s) \ __asm__ __volatile__ ( \ @@ -122,22 +124,35 @@ extern int __get_user_4(void *); ({ \ unsigned long __limit = current_thread_info()->addr_limit - 1; \ register const typeof(*(p)) __user *__p asm("r0") = (p);\ - register unsigned long __r2 asm("r2"); \ register unsigned long __l asm("r1") = __limit; \ register int __e asm("r0"); \ switch (sizeof(*(__p))) { \ - case 1: \ + case 1: { \ + register unsigned long __r2 asm("r2"); \ __get_user_x(__r2, __p, __e, __l, 1); \ + x = (typeof(*(p))) __r2; \ break; \ - case 2: \ + } \ + case 2: { \ + register unsigned long __r2 asm("r2"); \ __get_user_x(__r2, __p, __e, __l, 2); \ + x = (typeof(*(p))) __r2; \ break; \ - case 4: \ + } \ + case 4: { \ + register unsigned long __r2 asm("r2"); \ __get_user_x(__r2, __p, __e, __l, 4); \ + x = (typeof(*(p))) __r2; \ + break; \ + } \ + case 8: { \ + register unsigned long long __r2 asm("r2"); \ + __get_user_x(__r2, __p, __e, __l, 8); \ + x = (typeof(*(p))) __r2; \ break; \ + } \ default: __e = __get_user_bad(); break; \ } \ - x = (typeof(*(p))) __r2; \ __e; \ }) diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S index 9b06bb4..d05285c 100644 --- a/arch/arm/lib/getuser.S +++ b/arch/arm/lib/getuser.S @@ -18,7 +18,7 @@ * Inputs: r0 contains the address * r1 contains the address limit, which must be preserved * Outputs: r0 is the error code - * r2 contains the zero-extended value + * r2, r3 contains the zero-extended value * lr corrupted * * No other registers must be altered. (see @@ -66,6 +66,19 @@ ENTRY(__get_user_4) mov pc, lr ENDPROC(__get_user_4) +ENTRY(__get_user_8) + check_uaccess r0, 4, r1, r2, __get_user_bad +#ifdef CONFIG_THUMB2_KERNEL +5: TUSER(ldr) r2, [r0] +6: TUSER(ldr) r3, [r0, #4] +#else +5: TUSER(ldr) r2, [r0], #4 +6: TUSER(ldr) r3, [r0] +#endif + mov r0, #0 + mov pc, lr +ENDPROC(__get_user_8) + __get_user_bad: mov r2, #0 mov r0, #-EFAULT @@ -77,4 +90,6 @@ ENDPROC(__get_user_bad) .long 2b, __get_user_bad .long 3b, __get_user_bad .long 4b, __get_user_bad + .long 5b, __get_user_bad + .long 6b, __get_user_bad .popsection