Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp595888pxb; Thu, 25 Feb 2021 10:01:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7LH+bX2rdgDxxoC4cssJjTcDKOpe9zrLCSDPktNWq96XckSQqlT8IsCTaMOrigOCbga/y X-Received: by 2002:a17:907:7785:: with SMTP id ky5mr3893711ejc.176.1614276099323; Thu, 25 Feb 2021 10:01:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614276099; cv=none; d=google.com; s=arc-20160816; b=ndTrWISllotQ0/nPMTCrOh48BiWEZ7lG/Lo0JAMqvNbZyp911SlF4GiGuigqCIX9SB jsEOSEEj0IKQzpQjNKUFEtrLWh44uXlBp2OjvMtFianE44MKe9lsHopE5hGa7fEbK0cJ Gv9SpuktWBIoozphtgi3kOy68pgH7fxmWrI9j1qdnMructXibaqsbZNHm2l9/zQTm2zX te/zdNePec8WnxHjuERiA+uUwH1MaeiXhNBETAYOgTRBtVATeZBi3r0eTbhJm8elRr59 8pFso2AoiPr7TcE3VcE4Ea93rVcgbyN1KpEnGSCcbmqVPLXYSfkC1L/9iyC88GUSPhLD flCQ== 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:references:in-reply-to :message-id; bh=1ZG9XxBcsGqXdkGxIn5VnObvuU1cT9WscVWHGVgHwlY=; b=hUvcUTta+tPWc03TYvPGsTPgnDOlCZxffxZbJDhaFO+pCgEsrX/YedSRYVxiogjRK8 vSQTq+g3YMgtiCBgrGj3xKexa9z3buLoHZeSzDfx4du1/oFtVF13/Cwj7Zq2DUs9hhcG TcJ/XatqFiWSBDnxdsighQu3koUtTG4TNKyT4hWWv4eThqLRDT/fu+3epvPhHBsK2D/7 YhqLY7pz4qI8zPpfJ9YhqN0KhSjQtl++3g0fSC7/amsU+HLLDGFzc2VzwCXqUaCKEC9B Qbz2+Z5CmAzSrLhdNTIrGvsfCk9unMF54kXx9MrrtoOTqo7a9yqVnIsYcs7n34SQc9/9 Gkvw== 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 fj2si3784536ejc.472.2021.02.25.10.01.14; Thu, 25 Feb 2021 10:01:39 -0800 (PST) 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 S233329AbhBYSAj (ORCPT + 99 others); Thu, 25 Feb 2021 13:00:39 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:49941 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233025AbhBYRwn (ORCPT ); Thu, 25 Feb 2021 12:52:43 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4DmgLX0Htzz9v1BJ; Thu, 25 Feb 2021 18:50:44 +0100 (CET) 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 h81q8LE4tMZU; Thu, 25 Feb 2021 18:50:43 +0100 (CET) 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 4DmgLW64t9z9v19y; Thu, 25 Feb 2021 18:50:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A9AB98B895; Thu, 25 Feb 2021 18:50:45 +0100 (CET) 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 fZp56yAH2JLR; Thu, 25 Feb 2021 18:50:45 +0100 (CET) Received: from po16121vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 71BF28B88B; Thu, 25 Feb 2021 18:50:45 +0100 (CET) Received: by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 4C1BA67442; Thu, 25 Feb 2021 17:50:45 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 15/15] powerpc/uaccess: Move copy_mc_xxx() functions down To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 25 Feb 2021 17:50:45 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org copy_mc_xxx() functions are in the middle of raw_copy functions. For clarity, move them out of the raw_copy functions block. They are using access_ok, so they need to be after the general functions in order to eventually allow the inclusion of asm-generic/uaccess.h in some future. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 52 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index e831653db51a..f1f9237ed857 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -220,32 +220,6 @@ do { \ extern unsigned long __copy_tofrom_user(void __user *to, const void __user *from, unsigned long size); -#ifdef CONFIG_ARCH_HAS_COPY_MC -unsigned long __must_check -copy_mc_generic(void *to, const void *from, unsigned long size); - -static inline unsigned long __must_check -copy_mc_to_kernel(void *to, const void *from, unsigned long size) -{ - return copy_mc_generic(to, from, size); -} -#define copy_mc_to_kernel copy_mc_to_kernel - -static inline unsigned long __must_check -copy_mc_to_user(void __user *to, const void *from, unsigned long n) -{ - if (likely(check_copy_size(from, n, true))) { - if (access_ok(to, n)) { - allow_write_to_user(to, n); - n = copy_mc_generic((void *)to, from, n); - prevent_write_to_user(to, n); - } - } - - return n; -} -#endif - #ifdef __powerpc64__ static inline unsigned long raw_copy_in_user(void __user *to, const void __user *from, unsigned long n) @@ -302,6 +276,32 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size) extern long strncpy_from_user(char *dst, const char __user *src, long count); extern __must_check long strnlen_user(const char __user *str, long n); +#ifdef CONFIG_ARCH_HAS_COPY_MC +unsigned long __must_check +copy_mc_generic(void *to, const void *from, unsigned long size); + +static inline unsigned long __must_check +copy_mc_to_kernel(void *to, const void *from, unsigned long size) +{ + return copy_mc_generic(to, from, size); +} +#define copy_mc_to_kernel copy_mc_to_kernel + +static inline unsigned long __must_check +copy_mc_to_user(void __user *to, const void *from, unsigned long n) +{ + if (likely(check_copy_size(from, n, true))) { + if (access_ok(to, n)) { + allow_write_to_user(to, n); + n = copy_mc_generic((void *)to, from, n); + prevent_write_to_user(to, n); + } + } + + return n; +} +#endif + extern long __copy_from_user_flushcache(void *dst, const void __user *src, unsigned size); extern void memcpy_page_flushcache(char *to, struct page *page, size_t offset, -- 2.25.0