From patchwork Mon Dec 9 02:42:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tong Tiangen X-Patchwork-Id: 13898748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1908FE77181 for ; Mon, 9 Dec 2024 02:43:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2A516B03A1; Sun, 8 Dec 2024 21:43:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD90D6B03A2; Sun, 8 Dec 2024 21:43:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C7D96B03A3; Sun, 8 Dec 2024 21:43:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 813956B03A1 for ; Sun, 8 Dec 2024 21:43:28 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3892480BB5 for ; Mon, 9 Dec 2024 02:43:28 +0000 (UTC) X-FDA: 82873873698.25.25F3B1B Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf28.hostedemail.com (Postfix) with ESMTP id 70D85C0007 for ; Mon, 9 Dec 2024 02:43:02 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of tongtiangen@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=tongtiangen@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733712187; a=rsa-sha256; cv=none; b=iTkx3kR2OcHiYsSZmXUuBz8/92v1tMDk/cbouZZd454c5UU9lICRPsBt+/Zk6nZL70VMY+ rSqZQCNumOX7DV37jLZ/5gf4nbTAXI0xjUXxbhGn3rYjM2GD0tJ2FY2/VJ2Nnk7F9DguTx PRmjcsufhyPPFAvPYQB9CNjuM+AxSEI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of tongtiangen@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=tongtiangen@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733712187; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dl98tFGY+rPyC8FqJPKFVEBdvlsf0WDTKEQ63I8mg4k=; b=f9YnvZxTGrrz5tRref98pNFGPzz7dYHGl8Qb9GpCJ7jnwvqpc8QiAtE40Izwtg7WSrVaox kqRFv6BTQ3DKaRwUwSUzZRhG3vV5pRu27DlhzamxxKPfWodOjIzG1HS52JevuUHmFuX8yG R6km0BEfXnhQSqUXdKnkZUaiqVHmAWI= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Y65hT6ZTFz1T6l2; Mon, 9 Dec 2024 10:40:57 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id 483AF14010C; Mon, 9 Dec 2024 10:43:21 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 9 Dec 2024 10:43:19 +0800 From: Tong Tiangen To: Mark Rutland , Jonathan Cameron , Mauro Carvalho Chehab , Catalin Marinas , Will Deacon , Andrew Morton , James Morse , Robin Murphy , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Michael Ellerman , Nicholas Piggin , Andrey Ryabinin , Alexander Potapenko , Christophe Leroy , Aneesh Kumar K.V , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Madhavan Srinivasan CC: , , , , , Tong Tiangen , , Guohanjun Subject: [PATCH v13 1/5] uaccess: add generic fallback version of copy_mc_to_user() Date: Mon, 9 Dec 2024 10:42:53 +0800 Message-ID: <20241209024257.3618492-2-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241209024257.3618492-1-tongtiangen@huawei.com> References: <20241209024257.3618492-1-tongtiangen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemk500005.china.huawei.com (7.202.194.90) X-Stat-Signature: thwod99cumg346q86ndf6sdx91cnp3ke X-Rspam-User: X-Rspamd-Queue-Id: 70D85C0007 X-Rspamd-Server: rspam08 X-HE-Tag: 1733712182-65546 X-HE-Meta: U2FsdGVkX19ZSUJrXpVPNB/22TISCf3ALXRVCUgmVradQlpTQ/8bGUtkNgiwLGIm9mp6fOQjVB5uGK75A9s+ZDB7gcCwyw0zSzc+s0I19GXgaxBm9vsAzJynZbwVwOGblGXHDUIPm3qOGngPRWsWaFysk/Cr0yIp+nfEi0aRn4k3ZX71xhzFJ4AQ3kmPvV+rbvCTfYIlmLchsA2u4G02lt45QzHFfinX6YBFWb+ln59kMGlpgIbuvWarZ0jPGpNYHzAv/l+pGEPUreLY9tK3abix/CMBkPF9QW2uNVR/5VLuYi80YBIzDQp6XiSBAC5C0v65ZbPtLRNwI1iIOsImFzirlGPpQKGA6enfT/ULt00Ov9hY1I5uQMhXs+KlFLXKM4FoL8mxhh4EKCFoKeCrWtSr1GkWZkP12ass60ihJECgUZ9qnmROsoL9ZoJ2KxRB29l0ZquvJ34G1kF28325q9suGcI0Rvd81uhYT5pVr8L+ZMgOV5fUM64NkcKk5xD/nPpu1m0bfMgRCo8Q0cYzICYIsd4SFg60n9NRJRC8hK0fq88vFiUYk0DKKJ7KulmDHXIJccaVXH3s/GgzKz4PJoNE4KjmUlU649PVmmVGdVQWQeTHMAx9r5U9vNvOKFPbM4406R/AyKZ2fyYuSDb6ot9tRlejBgYzrmH2MeeNPczTYQ5gdve7yPaR4KiwPf0xd+0CRIX9uofn5taILwzpHn9YmmRbPKgnlIgf8xTCAvjzQfg/6mDw8Anxx4bLX9Aikllt6MQEDNjsMlAo1+8o1XGlRh/5S08npOewxvMDjRhG6eS4smufKCGJ6uzfTlUKcTvxLZOGIFgFt47I3Qh7ThC9oV7cFSuYQGx1+FWdhR68Ft1NgE/gO6ES8zzWkfntrg3KSUgdQx3QVNm4ptcWhxcglWkUHFeS8CAP17uVoXIkk7fEh9czPxC7XyqN+DNuRS8KOBSLzXF642CB627 GiJD3mco mCcRRkAyWj+kjvw6vx7e1Ka2EjUmCFThhZ0Kz7hK3CVyoyitm7yzoj9OYw89JnhB9os6aRQWYWsVfMs0pwCLurNRJNZYR57v6KiuTQWr+/pSa99bv7lMZiQd2NUK5N1wpiQqDl7nrvNbUJJeHzaooJJX5IglLWUWT3c6y23UQxsoXVtm/K9nWDcOKdwRzUrnlxwgC9jIm8RmdAqe/t1Csv6RYj8cDyjN70M4Juv54UUf7cHnFRgg6XQE5T6teuDSPmvKj1l+qX3qkh7W2ouV7hmzAfkgalhk6HRCZW610D2z08Q8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: x86/powerpc has it's implementation of copy_mc_to_user(), we add generic fallback in include/linux/uaccess.h prepare for other architechures to enable CONFIG_ARCH_HAS_COPY_MC. Signed-off-by: Tong Tiangen Acked-by: Michael Ellerman Reviewed-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron --- arch/powerpc/include/asm/uaccess.h | 1 + arch/x86/include/asm/uaccess.h | 1 + include/linux/uaccess.h | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 4f5a46a77fa2..44476d66ed13 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -403,6 +403,7 @@ copy_mc_to_user(void __user *to, const void *from, unsigned long n) return n; } +#define copy_mc_to_user copy_mc_to_user #endif extern long __copy_from_user_flushcache(void *dst, const void __user *src, diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 3a7755c1a441..3db67f44063b 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -497,6 +497,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len); unsigned long __must_check copy_mc_to_user(void __user *to, const void *from, unsigned len); +#define copy_mc_to_user copy_mc_to_user #endif /* diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index e9c702c1908d..9d8c9f8082ff 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -239,6 +239,14 @@ copy_mc_to_kernel(void *dst, const void *src, size_t cnt) } #endif +#ifndef copy_mc_to_user +static inline unsigned long __must_check +copy_mc_to_user(void *dst, const void *src, size_t cnt) +{ + return copy_to_user(dst, src, cnt); +} +#endif + static __always_inline void pagefault_disabled_inc(void) { current->pagefault_disabled++;