From patchwork Tue Sep 24 12:14:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810883 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E57DCF9C6B for ; Tue, 24 Sep 2024 12:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=THhQb3BnW18KKaw4x+7oe+XEfsxz0yeSXMl5vSgztXs=; b=o7WjzK/VKnaPzInWgQ/NrTvKr/ xJAgZcPPOCUQZZyiLOJ+qIR+OeRXMvOVUYs38dXJ9NiaW1jJiGJUj+JQILt//VeGdlnAYAe5bc7qI w4QMUhiFi8pvEq9m6nqW93jdnaMvjvQRT6r3thtaUhPt+XXuOOJ5nhlSWtpQV2x0umVa/qIdrejpb 2C56dwsPZMIPbigESf+B9/wB8Z3J293rfp2CwmFC4ow1xO69Gtl9/YefbbnIvu0V1axi4xngVHQy7 9PNljjyW2D7We52NVTLCyiQfjbOUbDtEmCVmza5DELpi28bz5/qygH8Sd83BYQTzuTze0GwTiXWLZ BxjK94fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st4Sb-00000002I0p-0bAA; Tue, 24 Sep 2024 12:16:05 +0000 Received: from smtpout143.security-mail.net ([85.31.212.143]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st4RN-00000002HdI-2Cmz for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 12:14:51 +0000 Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id A93E490393D for ; Tue, 24 Sep 2024 14:14:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727180087; bh=QMnA7+j/tist6awVRaL1CsNxoHJDsR1I35iTnhFKLhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ABXig/f8mEBC70KOz3O6iA521R+4D9EGvuLITsmrJrAHPjeBm6Ujc96K9968dBvZd yj/oH/2ccxfbNSuzM5HB2sAYtMWIsGa63awmF7Lf5QDGvcyU+WdI6GyASsSts5JRZQ RuqhBUmIzjE3NYb6t9SxhsEQUsotwBGHXEKjyBCE= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 2B91C9039AF; Tue, 24 Sep 2024 14:14:47 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011029.outbound.protection.outlook.com [40.93.76.29]) by fx403.security-mail.net (Postfix) with ESMTPS id 475639038DC; Tue, 24 Sep 2024 14:14:45 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB2391.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 12:14:44 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 12:14:44 +0000 X-Secumail-id: <183d4.66f2ad35.457bc.1> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RbOfJpwRzKRs4d2jkImlyj7fwcDEAUUSwf3aJBSRUP1gujLdsVVBtJ2o/FypyfgY1Fb1PbFczX3sM0Ht32a6zaI7EjuSSGfKzV3iNarcPMstjk5WkUudO8P/UFfyWJYtv4T4k6wkxZ7h25l4GyVQykyBr3teMOOeUSjX2DdA1H0DlZqT0mFEeQyuJjSBIArCIWTA29sKy9a7r3ZL8IWhg3VMxNg13PG8GIp6W/RprM7MB1QfVP4epo9Jr6Q62N1P/iksp2Sw+Jc6QpiCNO1+h+rY0tbufKNyDr/upmJoTpfURqmsQH2izFOCiGAAHds0HnIhU2RJalBjiCYiGFQBew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=THhQb3BnW18KKaw4x+7oe+XEfsxz0yeSXMl5vSgztXs=; b=khpsAdu+n4YkjQcdHoz4TqluovZ41HaEGQdzf2nLkN8YmUQY1aUw/GMZkvI3I20ZjOOuWxjwwAMupHbxUWw4yN1/fqXoH5cO8GjzCbgCEvPUCT4QobVGCKTn8aoSc2OgF3ELit4fEWNXAas+QdmRLmZnn7myerL7LCoaUYDhPDPZ/tKBArGQsjy7XrQjjb31bJYlEO6X9lZ+OYV9lF7kqTPj34BH341M4mp0RXZSirU+k+8Un4u5F5jcufxF3tqt3k+rLg0iIhQEa/MXI1D76HTPL79DqwPAWs5SQt5RF2iyWhDrTmoniUZ9F9UWQW+MojwBBtlESuq+c4Xo6SBB3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=THhQb3BnW18KKaw4x+7oe+XEfsxz0yeSXMl5vSgztXs=; b=aiMmXvc6koUwqGp5aSnQF8BQhRQfX3+Qna8ZuX+TrS0JWs3qFjI17yFluNwjE2ucDwsQpSfBlk32uKvbw5n8z5F1uyf4qhYUjmOKXbRRHLvsIhrw/kl1xzg7UNIu1qjVSgCU7WtwFNZL3bVReaZur8o7+BM2DBZM859P4QIl3A6LjTj/ONzmePXZt7UGotuMePwNVHF+R02lV5fBMKE+DceIjN8Z4qv5dzV+2NLTSWgqIxPrJZ/uXxQmZGejfiaNzou/8ceCD98hkkpJyhQVle1QG0ekoHt2rrWXm8lYAtk1Zl+dpE59NKc6eQYK3E+6ETxenoIdHJXEokGb331J8Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v5 1/5] Consolidate __memcpy_{to,from}io and __memset_io into iomap_copy.c Date: Tue, 24 Sep 2024 14:14:28 +0200 Message-ID: <20240924121432.798655-2-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924121432.798655-1-jvetter@kalrayinc.com> References: <20240924121432.798655-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR3P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::10) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB2391:EE_ X-MS-Office365-Filtering-Correlation-Id: 831e1507-a312-4e93-ee79-08dcdc927983 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: xvmEIVS6+ra2rI2WjNk2OUYqWGme24rZdVZosRGKGGmIHqZQ19bhd0WphRrzD0v6W75/fdwV3o226Zn5K0zfZipnYWpFVTyqr0HpTqz4fDS/IXmkXLzHDU6L37dlo+8rGuSpnoWgmCYedMc3zaKFNHTrg+hSJluebyM1a0pRVE3m+3oq6HNPxjr1vxKVt+uC9AAH+TsDXo95o/48pTXCpsPZ7yWabJOF5gi26+6HGfIdVZC4bxZpGc4UaE5d9WqA2KFE+NgJik/nXQd2/hTzjLSxI2eySeUqXjagOuDj1U3xmBuOVgYq/8GKdtqEv5md0AIZ1bxHKNbFymRLlVejClqvFYdd2NUJPF9efM4fOIsDShE8/VA/0vmsqk+IZr2xCvDws/IYpDYfR/7rVsE+ZuOFZZkabujJHZtK1hr79uRNZemX73Rbxgr3098YR8GNK3MDX6lF3hsSo2RzEI84FvCQtw59Upz5uCjNoumn1pLEMWP0LVprvuDGFqmlB4oDW70Z/PaN0WxWYnLyh7z3a2xJAhoKB9rMdSjOFy/1Eyv2k7nZQ7SVHD24xVB3pTmZLxrlWpQrq8ZTJhgbNU21IA75O/bbZbDqGaQxy2gm+eEAj8WeNO72B2EKTnBievzkn/ZHDSVO8tZbmmqF26ngaeNVEJknlUfIDXgsFqKpEn9XpF/cg6y43ob4QWLLxbFkFHgyB0WD6VZKNxYdDozNwpe2SjibzigYAVWp76S633ai5JXKvuXhqEJEs2u1SNG9k+7oTb7o42TN0m8A+T7TNqYzE6wjK4XPwLNYAOvYu+/E2fXsE4+m4Y+RHomZFr0nFv1Y6DmRIYL63+eTLVW1Pc/tQvD8lVsqDKYZav8wVfIvBbbteNZQ7IksjXE8qn9XGbunMvo+H5K59eaJZlHeoMNK+dcTW1cf7NV31uCiU6GSZDCdOKlhGi7NZb1l21JVEXh bR6NrhrCnb/EqQM7+UvnYjr2gWBVxIUdYZglxjWYYe6ZONAAHc2v1KxpIZVX6pRBFIXVoqxmhq98/vcQuxoYidmkmHbrX1MXV127VIkYWJi3nyuvyYDQKQCgRcaYzD2v0EiCQeZtdgw1Ddvmhia6+ZJHzQaSGSAsizN7l5g8kHbgBYm/5F0tF+LHYu32maSC5UqxQN9T6PPPqVIZ1j4zm3CDVJs96vjzqG6PtZh6vrgTNW3HBYqtW4MSHiyQvhSzb/5dzqEYCz3+cMTBDjxswKhTo6d87IAJaeus6YI+RAmn2sNAnLNwNUSWR97Gh4rwJEJtQ/eJMNLQEVHYB9kyGz1PNPdgS3w+hytJYLQg2g6QKsRRlHHe1q4CKXbheED0hTeuyapO5INLofCFmyjQIEFW6a3qb34p0Hs3JHEvFjG7u0sEnv7iqOgfr/vsyjL5uflodoffVwdrB/gsX6w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z4xS5blTC+HvP10+A21fTMwB3sMfrnfm5zxasDS3WiXA1Tuy2ucAHftunIAHpnOsAtypMPveE2fhNvSdyrKoiIf/hGj0Jc5SSddxjRmdoM/BlfrJXYivDBsNTK1kOkQzIrmAQgtEGGYUg5jBGwQL1WioBgYE4b7Us4hDdqKGhyE2Jhn0kApzZO1nOYcR6YwN43rjwpydjrJAA2MRVG9MIOczZfavIQ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/vY2gfcT9piHeyNooa2vPwJzMB9J6i0uttH7c/TscPqmD2x4K+M0N0nXeBGLVSDzNoUW1lWU3xii6VidSW0L40ZWo+/Wr8VFRjxtYCzL1ugP5x81QDzeoku50b15QxU54Z1e8u4rxl8df5LPOyq6flg/xzrCc+H8BG/K0DHtMxMXOR+iXAMjhi8GDhCSR8aTBSAZ4NyJ4EtG9RH822BIH6BldkK6gRzGyeXykCxVW0vrSp6fdFnFpTqNhEV5KUstZClust/XZdyOCvAYQTAD8z19tN+CZmBzLkEv8807sWIA9K2sgQnzlcrmS7Yg== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 831e1507-a312-4e93-ee79-08dcdc927983 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 12:14:44.2996 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S/AZSCweF5We3ScrTFTDBNk7Nn7HkwmNLCmIV9oOBXVop7ucEzlF6+bjJVb5ZYkhGRwkFbB1MQ0aoshdIKo8sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2391 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_051449_739439_24561D87 X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Various architectures have almost the same implementations for __memcpy_{to,from}io and __memset_io functions. So, consolidate them into the existing lib/iomap_copy.c. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Changes for v5: - Add function prototypes to asm-generic/io.h - Instead of having yet another file, we add the functions to iomap_copy.c as proposed by Arndt --- include/asm-generic/io.h | 12 +++++ lib/iomap_copy.c | 107 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 80de699bf6af..9b8e0449da28 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -102,6 +102,18 @@ static inline void log_post_read_mmio(u64 val, u8 width, const volatile void __i #endif /* CONFIG_TRACE_MMIO_ACCESS */ +#ifndef __memcpy_fromio +void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count); +#endif + +#ifndef __memcpy_toio +void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count); +#endif + +#ifndef __memset_io +void __memset_io(volatile void __iomem *dst, int c, size_t count); +#endif + /* * __raw_{read,write}{b,w,l,q}() access memory in native endianness. * diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index 2fd5712fb7c0..fabcc1e95668 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c @@ -3,9 +3,14 @@ * Copyright 2006 PathScale, Inc. All Rights Reserved. */ +#include + #include +#include #include +#define NATIVE_STORE_SIZE (BITS_PER_LONG/8) + /** * __iowrite32_copy - copy data to MMIO space, in 32-bit units * @to: destination, in MMIO space (must be 32-bit aligned) @@ -76,3 +81,105 @@ void __iowrite64_copy(void __iomem *to, const void *from, size_t count) } EXPORT_SYMBOL_GPL(__iowrite64_copy); #endif + + +#ifndef __memcpy_fromio +void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) +{ + while (count && !IS_ALIGNED((unsigned long)from, NATIVE_STORE_SIZE)) { + *(u8 *)to = __raw_readb(from); + from++; + to++; + count--; + } + + while (count >= NATIVE_STORE_SIZE) { +#ifdef CONFIG_64BIT + put_unaligned(__raw_readq(from), (uintptr_t *)to); +#else + put_unaligned(__raw_readl(from), (uintptr_t *)to); +#endif + + from += NATIVE_STORE_SIZE; + to += NATIVE_STORE_SIZE; + count -= NATIVE_STORE_SIZE; + } + + while (count) { + *(u8 *)to = __raw_readb(from); + from++; + to++; + count--; + } +} +EXPORT_SYMBOL(__memcpy_fromio); +#endif + +#ifndef __memcpy_toio +void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) +{ + while (count && !IS_ALIGNED((unsigned long)to, NATIVE_STORE_SIZE)) { + __raw_writeb(*(u8 *)from, to); + from++; + to++; + count--; + } + + while (count >= NATIVE_STORE_SIZE) { +#ifdef CONFIG_64BIT + __raw_writeq(get_unaligned((uintptr_t *)from), to); +#else + __raw_writel(get_unaligned((uintptr_t *)from), to); +#endif + + from += NATIVE_STORE_SIZE; + to += NATIVE_STORE_SIZE; + count -= NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(*(u8 *)from, to); + from++; + to++; + count--; + } +} +EXPORT_SYMBOL(__memcpy_toio); +#endif + +#ifndef __memset_io +void __memset_io(volatile void __iomem *dst, int c, size_t count) +{ + uintptr_t qc = (u8)c; + + qc |= qc << 8; + qc |= qc << 16; + + if (IS_ENABLED(CONFIG_64BIT)) + qc |= qc << 32; + + while (count && !IS_ALIGNED((unsigned long)dst, NATIVE_STORE_SIZE)) { + __raw_writeb(c, dst); + dst++; + count--; + } + + while (count >= NATIVE_STORE_SIZE) { +#ifdef CONFIG_64BIT + __raw_writeq(qc, dst); +#else + __raw_writel(qc, dst); +#endif + + dst += NATIVE_STORE_SIZE; + count -= NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(c, dst); + dst++; + count--; + } +} +EXPORT_SYMBOL(__memset_io); +#endif From patchwork Tue Sep 24 12:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810884 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7C6FCF9C6B for ; Tue, 24 Sep 2024 12:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FRmJvYAJTqtUxvy9G9oJDYhDjiwT2qQaGFAxZDqB6j8=; b=V/9NtR26k81Us0ppwQsw3nD1Bv +0a2dE/e7DfUO2OSD9zBDFpBr56Va3iQtCCmNy0FqVUsit+hqSi6z/WyIg1QQ0CnucniI3HfxQp0C +MKmEy/sWFtSpPT73wRsqaNZtYZLqUQhZhAlyZCHp6eihJeNbfpESWTcbvrVxv9bxCjHJ9qArOP9B qkHAxW6fEVsmBsTyxIlIMrqY2hOzXU2SsvevJklht2LEHNRUfBUmZIuN3iwSY8JxVMBEqpwTCcvgx pt9mv1kewLkFT9YvTYYs+cO4Mtsv9xwHgKfxI5PjaE0HWn/10A57J7/+0RZKFXS8DbqKQ8RK4d5WQ eosiTLow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st4Tj-00000002INR-3XoE; Tue, 24 Sep 2024 12:17:15 +0000 Received: from smtpout143.security-mail.net ([85.31.212.143]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st4RO-00000002Hdi-11Dz for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 12:14:51 +0000 Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id F01F09034F0 for ; Tue, 24 Sep 2024 14:14:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727180089; bh=SNwdxDHvn8jf/lAUopERKt5pkWfYmeQpDiCuWVDpsLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WqD3AyEmw9Q/iklh7Rb7nw6Ny74IYAeQMV0RQvSdPplOygyWpgDlBHOINr0zBU6r/ mhui6cvpK8pf0S48tSlwOcaJ4ZCwBI7RmpzI2MQwP/GqI1MVbE+LKyDakqfL70AfnW 0wn9eof/CAlNfQLIXg9amfdDO5T02WosIFLHxzF4= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id A03629034EF; Tue, 24 Sep 2024 14:14:48 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011029.outbound.protection.outlook.com [40.93.76.29]) by fx403.security-mail.net (Postfix) with ESMTPS id 82D8F903B8D; Tue, 24 Sep 2024 14:14:46 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB2391.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 12:14:44 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 12:14:44 +0000 X-Secumail-id: <183d4.66f2ad36.81085.2> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uumk9wZElWguzLOcC7xzmKZnTy3ttvdxa2Y5vEfZe+ARdSj62QnF1gRtye1i/PmoqiCq2wXwkxxMAftYhetFo6+9jkwHM0AOyVvm8gRaRBN7xg2UIbOGa3XSGttOL6FR+UoWp7PVOtQfoQMvLvajVkqX3MTTj6yPCrB1VZnd12ODOO1mPJoRxci9XAXUQ1TxYCoYqRSd5JqWZYv8iygTlr7gvGvfqXl5818T3Z9oRCodO8cBwiw3zRGrLMVN0WcSL240aJFhymvW2Mh93sncWPMlcpA9lQa/E/jdC1h9v6S4OsVehNZncbBSnlbj4tSY9fvE9Oy2/b9HjtFAHippXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FRmJvYAJTqtUxvy9G9oJDYhDjiwT2qQaGFAxZDqB6j8=; b=gyu7eDDbbwohZxkTUYRQzMzJvVmIwNKAWSmkTnL2KnlP3cWliMrs/UjfZl4Vi9yI5DYoA55TUoCfO4EhQSfAS3FA3c1SoFUcuLXGc/CmdbRuuV4v1M1az1M04W6hgjZUGXhXfnxoUdhB6FElQpPE6cUdiPCAlirph+I12M4bSt1TViin+0jfYl4cST9SG6wiKO18eN6zW1gBLlNT1TqUrSOaJL1uedbZVzxffCh/Xf534xMlPapyPWobqI40JTtoZ986LrbnpS2/nfjMk8r+MGc0cd0HZAtTivc66uNTZiBPexZfreOqokQe0tgHN/1QHlWqQ+yO3SvcVftd9GjtKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FRmJvYAJTqtUxvy9G9oJDYhDjiwT2qQaGFAxZDqB6j8=; b=dV7scw2zB/3NeDC7mjplHWID1yFuAGGQn+iLMvD1B1xoNcKbyhay5Z26Lly+N/ZH2Qy9NAAZE08hD5ORwq51WmZeEEr/aAfV86Dy4V7msCndmHmSLRiyITAO2v/jjghTAXhyfH0rVSJRgfr3qkM6nEikZE50UbmwHOkKN+U2fv/Gii1iohEUe4eTFDUZC/e16qMLCBwktKfuThNHw3xAs1jLBxmF32x5/jatYEmJZfHoQ5X9bjbYrLuQAaPMHDN+ebk73njYjmhSxYD4Q+L7xjbwzZblNKN+uCRiOsJ1DY2GLNWHfdPsbdE0PEy/GwPiUTxKJ4FloQ0a3WvI/P0hfA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v5 2/5] Replace generic memcpy and memset by IO memcpy functions Date: Tue, 24 Sep 2024 14:14:29 +0200 Message-ID: <20240924121432.798655-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924121432.798655-1-jvetter@kalrayinc.com> References: <20240924121432.798655-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR3P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::10) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB2391:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dbaf19f-180c-4abe-204a-08dcdc9279c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: VRhg7jFbt8iEjkSZe1rbc9knum4kRKHIyaIt3zO6gh66kYaKszVAHYck+OpNQbIyEMT6xedotT7SHlYXGevwlHXoSwXMgoKPrh+j+uwJPIYYjA0yvRsqVfSeSJoBZQiZfa+mchTO91hjk3U8lC0h3kNo2tpXLoFSHpmr76R2Xsd6iSr7cCaPbRojGkPPY/9DjxKtfyxqkwCsXNLU0f7ydhAnvROs+dFXd744oV0sgQ8zIWUg6kRSiNbuAPdZoMJRbAV2l3MeCHmbZOrQmu574l2VFtadg3D5r0SybIiVsobszp0KELQ7L7Yjj8q0jSG8PcSvKDzmQjfDPDRHrau1TGTpjStd2PVYXVpp+tB0/9uFUnFcxVLdWEkgv4vJ3deBeyVv+skKUxKS9nVsrQh3msXzY37I/h06V+i4ZhsmMumU7O0v239whipjZrGtlEtw7mKtFe4M6Am1YJiE4NnVtfh6xHmeo5NtWPrAIHFmhdG439wijTlhsjyWfhyWst1MTGG8n0So55jstyeiLekQPr029ek1iC37dzoQC6Nrrsshj4kiJZvaWSOAPnVPmM0cMaJOM/DRgV53R8NLuEDt5PZJr98JAStDsP87F+NSPVNUwIGDDfHtAAkUrhYQxg3IZKJwMgp6Ay509J+nKs5+cqrRrWOdCrm22OjubD3TQfriyxQe1ieHy1aVBJ0TMEyzZtJwP4StglmL1EUTa8gF+fsRBadqyfZ/zbAXeI/GOnLasM4BZBq8iRepM1sKIxboP34ahgQNk8maku5KWhP3WdAlDdwB5tgespIg93tNs5sPIjpiU+o5FVuc9zTzfmsJZb2ocWfqNBPfIquSDt70OVVxyBMTkUAeHTz7S/7oTlQ0UwLLGshkzcDLwq6iybxtlBWQoHyzExvRK3Qh9up7zJLr9gQmbJ+J1Ao9Hho1HzlVk4juAH91Wei2RyYQUnF6Yfj mxzhvM6gnroVm2UPo0b7DKc9FVo8bPI8jOWF40Agu/kcVz3Mw7OIWrXGBokpC4+KEZK/l8149ot6rpgJ8YyYkaGszlIEBdzj6RR838E/HHMrdVklQ6CHuyLJg6V8QEnR0PMymOaBGt8sW8Jtqoay6IWvn65KWkvorvlWymSp3ucz+UsgnaiPnTTueAd82cEUoOnFf7tUakpDskeF72HenCdqEqLqFTSALLlDCbW7M0hM9nwA9L8rmm3QVj233FN/74UlpZ4/mg0ixi9iAYmiB8YZVdiIkXt/QlIZ8mhR33FDuTgivNKxU3Ffgd2RJ66w5n+jqEYLvR9EBq0aeNXWPJOVocFLJjUJVweX6FWLj8sQr0CfDnwySjBmHKGmLy5vH2CFvDglbpE2+Cck96QqpyiicMEedki1iQgkgdPIt7lEiNhdAK1Q9BJv4ZS+CCAhg6V+Q0LrxpDd7UDwYUA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W+M7bl94xPnjEMKxhBx57JWr00v46T0YMMQi+ubydYnTw5BWpCH+4DZIGH2ewAf51ov5A97L8j4WI+1bzujsIXCqGP4yvsTxnXUABfvoDWGKAMBL2JWUCMEL6beWyc5SEFobHVw3ub0TX85q2WR4vVhlhwSYpQ0+zGK8q58YTDMOXYIBuDf5FXa8hann5g5K49Xm8SngnVFXE5gx6YGQIlfhrkINMOr1q1k1YlHxGOH9KfPN+KrEt3vK5F70/A6TBH8O0TeTWDqBx6gnQ8jHFjlBQYHcvPLYPZWDvujfladRB/5C9/On8DgEk2KtE97Vnacop2JZEqNw96+o2FZumhJteqjoh16Q/XjW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u15XPCUzMLQPCNwL3glNLEiy5hsIYSZEJoERLZeoQkbhBBt/UiefkSU7X4z28DxHoyXOdaX12/rRzisi0YJLa9u+SVRchBycG3dkWgXzhw/Sd5zZYKAGrEtVPVU613SkuNmVxvdsnAEDDrJ3M3qkw/7RRavba3O/JmF2EduCRJH2qVtnFwfLQWgLTeBdGFTw== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dbaf19f-180c-4abe-204a-08dcdc9279c2 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 12:14:44.6786 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2d4Q9L3yhU0MtmicAeCW4H0PVCgL77Tp4/ULoBb1EUoal/7Sc4Fb60EN/Di72joG7yAyUK3Bjft0im/KEVWJNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2391 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_051450_470436_18C8BCE0 X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some architectures implement their own memcpy_{to,from}io and memset_io functions, because the generic memcpy_{to,from}io and memset_io just use memcpy/memset.This commit replaces the generic memcpy/memset functions by IO memcpy/memset functions that respect the given architectures alignment constraints. So, later we can get rid of the individual implementations and use the generic ones. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Changes for v5 - New patch which replaces the "generic" memcpy/memset by our new __memset_io/__memcpy_{to,from}io in asm-generic/io.h --- include/asm-generic/io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 9b8e0449da28..3b7deb724a2c 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -1175,7 +1175,7 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr) static inline void memset_io(volatile void __iomem *addr, int value, size_t size) { - memset(__io_virt(addr), value, size); + __memset_io(__io_virt(addr), value, size); } #endif @@ -1193,7 +1193,7 @@ static inline void memcpy_fromio(void *buffer, const volatile void __iomem *addr, size_t size) { - memcpy(buffer, __io_virt(addr), size); + __memcpy_fromio(buffer, __io_virt(addr), size); } #endif @@ -1210,7 +1210,7 @@ static inline void memcpy_fromio(void *buffer, static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer, size_t size) { - memcpy(__io_virt(addr), buffer, size); + __memcpy_toio(__io_virt(addr), buffer, size); } #endif From patchwork Tue Sep 24 12:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810886 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E99CCF9C6B for ; Tue, 24 Sep 2024 12:19:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QY8OUYCym0D+1vzf2u0UxM4OKV6Ibus96Ju0kY68Fvs=; b=LgaLR3Xh+rEHgaYraZVuJENmj6 USL7DKRqK+2HQ2y48LyEHe4nugd50HFmq6nU7BD34tHFB1eteS1VSTWgFgmkP/p4J7O2i04bMe+TZ Zql7O4HIaR1tNLXJp/OUj7LZ6psAJTBIL2o+DdeHP83EFX3FrhYMtw3wu3PT4aeeTSVhdQjqnpkQS T3zvNnLiXbXpW89RdSNncCiApuQ/yQfdvB7uM2wj8LfjFREqTsHkXZ8YVO43/DxbvpXyBc+fBC8TT bCmQSGIhbfSDjv8bBq7cwnJw0yGWa20QpnbdFh36KfiuCRkl7NE8LiYiYb1nDXhZnT4pU203n68E6 i9YU3b1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st4Vx-00000002IkO-2wEc; Tue, 24 Sep 2024 12:19:33 +0000 Received: from smtpout143.security-mail.net ([85.31.212.143]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st4RP-00000002Heq-2O4B for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 12:14:53 +0000 Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 2E357903240 for ; Tue, 24 Sep 2024 14:14:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727180090; bh=2obkPORmZBMUQ1Ws0SQuQym8aT5lkiXNf6lU5sRFwHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OCneEbsKB1wT84/WoRtMzQqKPedTiJEfhEWkS8ryF/2NhXNDx2pOtshwC4eUZxeBk K2kpcfYuwfbhAIJg85TujrIo7/85tqVRjjN1mK6rzOWvJJT1LNU7xgbmCmEKqFH0Dq Uk8u1nc19jjTG4etsvOet2TWNQOqCAXYrr/aNO14= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id D3ED2903948; Tue, 24 Sep 2024 14:14:49 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011029.outbound.protection.outlook.com [40.93.76.29]) by fx403.security-mail.net (Postfix) with ESMTPS id B6517903D85; Tue, 24 Sep 2024 14:14:47 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB2391.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 12:14:45 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 12:14:45 +0000 X-Secumail-id: <183d4.66f2ad37.b4b81.3> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bsVK66fh2PeiwJvJsEhqOcIE34zAu67m7UwK3GqCFh0siMSEeYmrXDJSae+8pldqMnvqvACelAY+C/p1lbNLCBjEWQHqEk/P5Iw6IrSLEfqmHbrW6aIgSKaIB4rHfTkD/dhYCczBIgp3U0cpBRH0SGQC55XLqE157YcRAmtXd99t7Lt4Z8lGwgFC13q7MDN/PrS1ueoNTljiI1/z7ab587/qv8fgisALh3ii1iv7Awza7wnmBe6yVBVIyC796kvSS4uZvCMtSj1BnAjmWBz1Cgob0f75YC/zNvX7Y1AJMWxb2pzL33MSQfILKZyRLRB/L6WFy9W6jeEnYKbMfkPcwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QY8OUYCym0D+1vzf2u0UxM4OKV6Ibus96Ju0kY68Fvs=; b=UWUY29DYEmFHwSZ4wPsM7B9kGRMLUns2H8t8nrwPm+9df7xyBuq01zlNFgvlCAaV+hfW5/7AeQLqlPpo6E+AdOkkVijoH3qep6fBrXBCmXFuZ1k0zFEoV/P0+bVepHjxU1c+9H6gvLHQtE+tsMK58LKgHkUjIXF6JZ/5tn/X9v8vaY7OZCBvf0/5zhIZid4LEzZepizU1XbuoPVWlTfHxXRS5WJ1kSyyiKQnqaH7j1H7jOy0EIarU2gwoC6BemuInoufMXE5es5V3tdjUn5gc2wcaKGCStWOUx8ZukLucmrZAoZAiuTYtTWQ6XCNeGB2bMOHJgTIEg0VeGnOChUaVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QY8OUYCym0D+1vzf2u0UxM4OKV6Ibus96Ju0kY68Fvs=; b=iroC/xhz4dvhNSdgpxMq8cm+nVojgFi8o76DvhgwIVD+icrBhqZ+9nRhM5cY97jVyXR45biz5/QEqesgcpwGDp58idRODQT0bFfG6bXuMLWwxiSMeIBR7Rb5lVRxsRguJgw6IsxaqpBE34zfAzgdgBB5yTBt6ucC3t+1p60RaQr+20e5uIOyRmuHf8TIR022nCiwPdbUinfGYeT/8l0o1pdzloZzhIC4G/oZuxR58G36DhuLMqplrQ9zxWy35bemdTCFzhwE/ssfCRZRX8O5S5joEaCq1NRVD4u6OlMzfK2L29r11s4a4GsdICrp/WOkQ7+Zo2g6vnViDGJ4Oq1zOw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v5 3/5] Use generic io memcpy functions on the arm64 architecture Date: Tue, 24 Sep 2024 14:14:30 +0200 Message-ID: <20240924121432.798655-4-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924121432.798655-1-jvetter@kalrayinc.com> References: <20240924121432.798655-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR3P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::10) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB2391:EE_ X-MS-Office365-Filtering-Correlation-Id: 13c8b3b6-e0bc-4974-f5ce-08dcdc9279f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: GpbeXTTyQCC5ePHdK61dhCkZND8SIxJ9rOCv5ENJI7CjKrclwG+l9PzNU7Y2tRk6xtoQZDYGGS+ufw2izX2qUhq6/jWn7N3OuKufiT8CL5GoAcNVn0iTGkAQ6loaHFSH9ZE+iWsfY3UNHq8dYbA/ctn/4KpvQnfeuK24ZzZp4YXu6Ynl5F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1bB+Kf4AS0Bv4B7ohWhkT9m7FSXWwbEeroXTGowiOGsIiFuDQZSBAqPkEcGcE2UTKqRhts0YvvnZEYPcq8PYnMr80Y6orma+PCAGwiDIit/l2JGSccgMnftwmTTImjEmuHZ0jj8ql+aBEksCCyCzRSXNMvKCDwhwbohqaP3u7odnfNFgAHLDBg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: erqcIbbGJDAoJekeIqoncRF4J8vAlNkcjFPtoqJ2hpO/dX+4Yb+h3xwAQDcxGxL6E1soyuDMA59P/bgPGyYZXdyV5CcOLMwj6SdYMHCt79Z41St/fLNtOFyKeTXXTEUpIcpBIpL09J3CN9dUWpL5ej3xE6W53XXRqCisp6H7g3Nx2zohMRXhJ3b61+p3PzIXjcHMjMlgrhKzAB3xBza2LHtgOw0B07wxwSPU69KHMK2m4BstO+9ZswPDJft6IABeYoFOzicQ2r+iLMjuhXlLFpAbgx/jjG/LiBUn0oPqmSuNSvGZoJUd1hp43662L2es5xClxxot5bFJCS6Qx9HY5MEBvltE3hBUO+eIWRVEchfQ7DVGN4xWYlM0BZDP+t7Tv4MqKhYDeboJD2p+iYZ0ilv5eC/ZkGl0Y3S/tlFBGD8wg+bDDF7rZQDnb2J+naJivE59XnQ7m18NsX7LG3gOoRkzgK8sD3oJFwz3xlfN5n2WF5Tol5yQAl5uaJ39QIpJUCdoLX3f6FvlVblktbf4HG1cRC6h57a9/+tFt6yZ2JwlVXPiuSc84WlVVC5aESxJqEVP2qyPjgYfAiJpxdtl/wBpgufLgh42d86Xb/4oFngj4EMJsFPGPjc/d03CitdeOEtQ3Ypl/BReF7E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S-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 12:14:45.0467 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9LofSeFXdKu30QI6dNIbBTAvHDNRXDbimuXODnfrn7ysLXOhb9D2vksqlOZX9S8Z7URL4tW+rpd5eM5iZpXtuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2391 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_051451_804448_9F249447 X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic __memcpy_{from,to}io and __memset_io functions on the arm64 processor architecture. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter Reviewed-by: Catalin Marinas --- Changes for v5: - Remove 'select GENERIC_IO_COPY' --- arch/arm64/kernel/io.c | 87 ------------------------------------------ 1 file changed, 87 deletions(-) diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c index ef48089fbfe1..fe86ada23c7d 100644 --- a/arch/arm64/kernel/io.c +++ b/arch/arm64/kernel/io.c @@ -9,34 +9,6 @@ #include #include -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } - - while (count >= 8) { - *(u64 *)to = __raw_readq(from); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - /* * This generates a memcpy that works on a from/to address which is aligned to * bits. Count is in terms of the number of bits sized quantities to copy. It @@ -78,62 +50,3 @@ void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count) dgh(); } EXPORT_SYMBOL(__iowrite32_copy_full); - -/* - * Copy data from "real" memory space to IO memory space. - */ -void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >= 8) { - __raw_writeq(*(u64 *)from, to); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_toio); - -/* - * "memset" on IO memory space. - */ -void __memset_io(volatile void __iomem *dst, int c, size_t count) -{ - u64 qc = (u8)c; - - qc |= qc << 8; - qc |= qc << 16; - qc |= qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >= 8) { - __raw_writeq(qc, dst); - dst += 8; - count -= 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); From patchwork Tue Sep 24 12:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810887 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68F3BCF9C6F for ; Tue, 24 Sep 2024 12:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TCAXrkwULjm+PubJi7UFy2hRZbaw2VKJbk3YvOeRJ5w=; b=UFHE41sg4Xq1xnGjFyidYRIyLF B9LDlcpaYx9pyJ7YVxcDt/VfBD2oI8eJcYL9T3V8kS1o6YYZrrR1fu91lNDSgYlHqXwWMD4IkmE/x AEa5Yd0kXmtC7xzGgQxI1RdcxHNkJBdfAtfUH+jcsrpXTnmaK16aqEw/XcA8nuTTjduta7sWZhkUS cqI2LtoFxc38qww8OoRGChRoXskR5Yp0sSRHdyLrp170EMu1AIJf4t0wUvsp5WmN++lEd96np8Yox Wz5+dNcGr2fSbbVn+E4MBHdesTdEN3WGhxxnOi6eDV8gsla4WYaX24Udqo4wIfDJ6X3E2lmw5z+1W 9J5j72QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st4X3-00000002Isk-3VD9; Tue, 24 Sep 2024 12:20:41 +0000 Received: from smtpout143.security-mail.net ([85.31.212.143]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st4RQ-00000002HfT-2wSY for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 12:14:54 +0000 Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 6D19E903B33 for ; Tue, 24 Sep 2024 14:14:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727180091; bh=7251be1NdUFGat2x6OZNhksQK9CIV8jm/WzvBBgUJhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AmKpLMnX14XIRibeWpQhiUX66vBxy5qz3YGZbiUytPHKh4sQoIiBdc18xqEI2Ovbk 1pGuiFdR34TtCFBOtBYJ1HhfEQxQ8Y36d6RQ3lKYo7+caIgsCfdrcnis9Go90UZFh4 9WOE5p2SXAkTilKVxWe589MGF99nL2A72uZI6e0A= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 16E3E903B30; Tue, 24 Sep 2024 14:14:51 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011029.outbound.protection.outlook.com [40.93.76.29]) by fx403.security-mail.net (Postfix) with ESMTPS id EDBFA903D87; Tue, 24 Sep 2024 14:14:48 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB2391.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 12:14:45 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 12:14:45 +0000 X-Secumail-id: <183d4.66f2ad38.ec3bd.4> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x9B5lcQkYUU3KeQwHnM45pnNO6uUYSlVR/zGY8bS4ns9BQTnZQ6qctCNspnim40yvI9WY60CPOkDw75eIqE3HRZHOaDfbI91BvJg7ouD2nLXlJTNpUj+NTv3Paew4AEZApCym+eE5Mc0KKCyyzuoKdH+Wf51+nUJ5vx2Mv+g7sZvpq8rWZ48xLjTlyLKQ8J9QZrN5dMjFuRUhpTlxBL9ni3/p612e3mqjz8oEYs/nloF8w/dlokcsCwdcFwDTAHp1RqhzqteCupHwm6X4iPEjg4bQI2UZn2n/fvnM/Agj2uUnYy28lMhJyQOnTEdJvh77kQgvQrxQaePCvrrEbgSjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TCAXrkwULjm+PubJi7UFy2hRZbaw2VKJbk3YvOeRJ5w=; b=yytC29wCd0UecYJ/CZfjwoWFb2IvUcCzpHGbSV95CHqzniKJC+TGKgzz4NtyVFnKU7yLn8LF9S0S1n9OSRQ8ViuaKWw8fd1L09OBK3lD+2iVkCGbRaPVtP8lcxugSUx16sFAuUd/TA9TCitlJE5vt5NIC/AaNRJqvExsqfJb0rDMoz3ZNQJaioJnRwOGwioUx/QpdJfmIIVZy50hvMOr+DhbE+X9Zrq2/niHFYha/oj14DRCaMlOyL4DN+EhGcwMnQe1v62ptVnbF/M6CNNuh0VLGDXapxcYujWwTO6DiQ5iJz06On/9PjLZ+1mzLqHLCThUu5iYqRabfVAeRfiGvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TCAXrkwULjm+PubJi7UFy2hRZbaw2VKJbk3YvOeRJ5w=; b=RhNZGrqh7m6Uww14+07YJsuVkE8j4q8nocuvsSlcKQD/j9AuMXN9RCbIJkxBW5vfoUv3cAtD3DmilRFLsRLZ5iqjaWkWXxq/xm8d0UmUzOIoseDlXx3kNmYTkAzvkEcKBseCZ/1UgK+tYtF2fXbwbcqCHm4cI24o3JWaaG12foOYQzaEA+tWHczEtuCrIdiu+TgmdQcdZvaTtQ6qWllsmPZaoWgC1PtcZ8kTxH9oJQ2+5QjYTJglnu1BsudpiwT/B/+wcZHSsA40NcSZONllNvOkg7gGxRtZeC8dhOSkwZoghUBSzJzTQ2IyB5f1NpTXmO5aHZkRNEFAbZa/P9wPfg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v5 4/5] Use generic io memcpy functions on the csky architecture Date: Tue, 24 Sep 2024 14:14:31 +0200 Message-ID: <20240924121432.798655-5-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924121432.798655-1-jvetter@kalrayinc.com> References: <20240924121432.798655-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR3P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::10) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB2391:EE_ X-MS-Office365-Filtering-Correlation-Id: cbd293a3-73a2-482b-3f5f-08dcdc927a3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam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/Io2KA5fPOceXsGBv0+DgPjMlql+nzquEGx4bD9wbT2zuu5EoHZNhM3aSchCPYX2ZnZpGVea+KL+OX/RirpmmlMNQ65QeLvYjWxSr0PuuPvoUlrAytX1O0U8Y91VntUKyHvjOBcUH9r5ZhfqqdanNjqEjn6FvHIgcQXjXt7/p/RCv9MjX3BI4T+JhUW/R0eXSsXwqHdDkn1gpVPRnIeJnmHyLyN/47xvxJJsxRSSsUvUydHSW85JPmU+sQEINPbteul6cCR0fin+KuPjJtbTA7CKAPmu/3q5lQ2MXa/vtuUS1ElWcCh3lzPj+pJ68jJmzx2veh7AcQ+qE1tj42kaql2LlKIIjYmPvydzy0FzFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 11L2VnbHNkrAVc75GbYfh7y/5VX+27ClMriPvTKtvSW3hRrZ6VXV9J3KQnJmXdKJg2BPHf7s6Q8uGG8PQKbCNcr6keTwVH+YG3DkpVWcIjEfAzKhBIVD5lWd8JyL6bNnqCC5xZFDGza5dvUsqFOLbNayfTGG5agTAyY9Y5U4Aa8X5QXZB2y4h2fd2c4O9mqiOYn9/A1iV2ZBxU6cV6Rq0cPoGMrBTcrOUWb3QUMteYm8jnsSncaIUQLtBtK2VOxJHw8FcZzt2jQx2zhiBDCEXYxyb99JAjLczPyUqFMekm958mSkUVD8F7IzhYibN+WHA1tgnez7Z+ZuPtiqEGR2wf10kaFHtTF7WmV4bLK4J4V/Hsg7OYU6NbHlbAetK3lgobctK2BIPKMhDZcqyiaYJFyemf2WMn32YiRhDFQwAdwuJmITwHvJ9cYDXGtNIcMgaqiOnDYVBo3f7ySbDv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8+/OW4bAbCUdTag2CDUQFkNehH9TAdj5zOhm4m3Qkfcaomxa6MrWMwBUDiQ43ypL4MtbxQ== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbd293a3-73a2-482b-3f5f-08dcdc927a3e X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 12:14:45.4871 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sa+hfnPSLRoH+2sJzFcQZhr93nM2ErEPmbREPk8yCf3BxCTAa0o/KZgqC9As/34ixXrlYGq2cbY3QKAlNIVJhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2391 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_051453_038009_C099D637 X-CRM114-Status: GOOD ( 13.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic __memcpy_{from,to}io and __memset_io functions on the csky processor architecture. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Changes for v5: - Remove 'select GENERIC_IO_COPY' --- arch/csky/kernel/Makefile | 2 +- arch/csky/kernel/io.c | 91 --------------------------------------- 2 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 arch/csky/kernel/io.c diff --git a/arch/csky/kernel/Makefile b/arch/csky/kernel/Makefile index 8a868316b912..de1c3472e8f0 100644 --- a/arch/csky/kernel/Makefile +++ b/arch/csky/kernel/Makefile @@ -2,7 +2,7 @@ extra-y := vmlinux.lds obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/ -obj-y += power.o syscall.o syscall_table.o setup.o io.o +obj-y += power.o syscall.o syscall_table.o setup.o obj-y += process.o cpu-probe.o ptrace.o stacktrace.o obj-y += probes/ diff --git a/arch/csky/kernel/io.c b/arch/csky/kernel/io.c deleted file mode 100644 index 5883f13fa2b1..000000000000 --- a/arch/csky/kernel/io.c +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include -#include -#include - -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)from, 4)) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } - - while (count >= 4) { - *(u32 *)to = __raw_readl(from); - from += 4; - to += 4; - count -= 4; - } - - while (count) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - -/* - * Copy data from "real" memory space to IO memory space. - */ -void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)to, 4)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >= 4) { - __raw_writel(*(u32 *)from, to); - from += 4; - to += 4; - count -= 4; - } - - while (count) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_toio); - -/* - * "memset" on IO memory space. - */ -void __memset_io(volatile void __iomem *dst, int c, size_t count) -{ - u32 qc = (u8)c; - - qc |= qc << 8; - qc |= qc << 16; - - while (count && !IS_ALIGNED((unsigned long)dst, 4)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >= 4) { - __raw_writel(qc, dst); - dst += 4; - count -= 4; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); From patchwork Tue Sep 24 12:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810888 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7769ACF9C6B for ; Tue, 24 Sep 2024 12:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DJTGgacsYFaEsu3T7mxy9E/2SaPsUedgRxJayCcSpws=; b=BGmaHS77H1SN3gZlszDel2qFtq BGZBVthBSmcGN7XWUqrLi6TixCUdLA/YjI8Nbe2e1wct9xpXQ/I8nUpRNfMyalxCPvtIf5OBXxO6N KNWowl4SR6G9UYRoPwHSSUO0NlD0TxVrZdu+wiTsEvMqUqzyKA+w927yLo6SJXcVEeD8iLNxoR7GR NUH6ic4ci9PJ6LpNxofaKLa4gtABhft7j+onGaJU7G7YslB8+6CmU7rgiqpYYk8siJmfTfLO2c0TH j2YtE8+c6eqEuDDz3BV+7F6cp+lf3b6DGZu1VwW08BhFVGb/QruqRemRg4dz5/4f1eDIM9uPuNGPV u1cvc2+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st4YD-00000002J7T-2LdN; Tue, 24 Sep 2024 12:21:53 +0000 Received: from smtpout35.security-mail.net ([85.31.212.35]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st4RV-00000002Hh0-1BnC for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 12:14:58 +0000 Received: from localhost (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id 54B6F30F021 for ; Tue, 24 Sep 2024 14:14:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727180095; bh=t67N+eRG6Bus32Yn5nrGTa0KLzUNxSqXsU7/n76Z5Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=h3j3yxA8pkEXVmwFeY/sIZOXLotLeprIF4p+A8d9m49lQtwc9SAy+Bo3njguOu/1G zYaxXks9P8CSOLQUDzItzEatJCTNDC+Tlm4U0kEyX3EO7X3HcgOM/Fwb+802/NYidW RWL2VFzH3o09sTyNz/aBZaLEPCJtSogktFXKqKPw= Received: from fx305 (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id DC49530EA39; Tue, 24 Sep 2024 14:14:54 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012054.outbound.protection.outlook.com [40.93.76.54]) by fx305.security-mail.net (Postfix) with ESMTPS id 91B4930F06D; Tue, 24 Sep 2024 14:14:47 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3153.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Tue, 24 Sep 2024 12:14:46 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 12:14:45 +0000 X-Secumail-id: <4821.66f2ad37.901e4.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YPC+6dqfn4wQWkDs/4PNgPIPkuInVcfOE7oX4dSyRMipcPxFUE4Tnah4/BoIAXRMJAlXhEcbX9jelk4C3CxigVxGiE2nl0oui2lR4tXFdBWmWLkM3xLopyzGYCjuDJen5m7a5KPPl/s7JYyK7aoHDM4mMyWtc2XPQc6xarKgHd4VAjiKPkZutWTS9mQRqhdzpXTXPoty1uDO4PItuVQbpyRxBcfepP6ViAdVreQi5oVPvuMYx7jPOvn+ri99fzrMt0Y2ABWed+kK4A9NYA+7lc4RM9nbRXeHTuMXKipjH3vbS+Q1pNCzHzXjjSMEU4bjwe0dBV7S7H9rAM28qxijhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DJTGgacsYFaEsu3T7mxy9E/2SaPsUedgRxJayCcSpws=; b=SxFAE0hgv1XfISqxuLl2QYgVLIUGjYwbxtQtM+RKRSMMItobObywzlRzgIz1JmNiLMQb91Y6d/X3KyW5302Q8We0lzKgxTj2Ifw40T297mxtSjd4pWRX3hjm60nO+aRzEaWSqAQ2DIpni3nZIfZbf9rNE7XHxjW5MB49pWznrvC5/EVI4wH5SP8hlBBdCVa9IgMmVyGDGYuVDwmNqOfscZhHYP3QPX9bNtDiwr8jujjTkJP/eLl98xIncP0FRJgqkNvLcOzTBJRdolR81nny4yQPN4U1vlwWeNbW/7sP++Y+7alJ7PGCsjA62VUBYMM+GLsu/sThBuU1xmtE4yhg9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DJTGgacsYFaEsu3T7mxy9E/2SaPsUedgRxJayCcSpws=; b=IaVc/BgLIcCutUDHk+dSWx2BUC3MPD+2uORuam5DMVq3ddGKNDxnxa/37ugivhr/RLGJKqeoCSU/6EAZM4KzjByb4nu+1NVQekT1um6MqkWYHzBdZGDPZMQr3RtsQXMbOVPHA2+Y0ywE7hAYPQ19ABqhXKVa3UDcHBljfB0IMhzeV+UVCtU5g3s+F/NXWgHw9qVKEKWwdEatxw8WaHf9Vn3jRMFtoE5phUhHr5Rlie/ssql4HWOYDu+aDxZM2x+7wBFQ1Cj/VHsgoII52Smu7dE0Mp8zC3j3rSIbdHr2MncpyyjxNtaeZn1gJMcq9Qe0IPsoHcwSqmxIifNzqWmvyA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v5 5/5] Use generic io memcpy functions on the loongarch architecture Date: Tue, 24 Sep 2024 14:14:32 +0200 Message-ID: <20240924121432.798655-6-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924121432.798655-1-jvetter@kalrayinc.com> References: <20240924121432.798655-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR3P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::10) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3153:EE_ X-MS-Office365-Filtering-Correlation-Id: a8f5e1b1-9d68-457b-042f-08dcdc927a81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 9JqgyHgyBLQsi53tByJz/Kz/U68+H/lBzFy1DlSEbA7Qhd1N1wljvCgaAJSkFMG4OL0l9o+aS0/p2F2ZytA5FTCL1r8553Ea3orJRMXmnZlVr5zsvfbhyW01uAjAbstx+6GHkFAFRQLl2VZOfEQ6DkfwfoG/QxM83TfQbYsVcF1kpdjvaSvM0KHjrgWQiAlFWlsV6psw4Dj8WZnIiqE+Sg+6uYcJ5UueSvdt9nbT1Kci5tgmUqXwJWlm640LrUzcm0Qa9irrdn5Ij94FXYUVrsEfedjwxC+c1RJ2xam0R2wJR2RO1JUG/2lo+nOBepJyfaXtiQrGvOm4IAX3urSfC3+Kbu0ckiCTF1MX4GRsMPQchVSsO4GWYn6Zr0B4oUhPCKRjOU157uwA2ZE9ZQ1WDIjQSqlZx4q1C0RB8/srxT/xT10gUHcb5Y3Zp557+SN0gZCpB5z81PnmjUfvg2cMdZ3khmzkPfHMMMjxMwr0zQuvvGm26r9jS7f2nFR6Cw2RAZSiNczqijXnLawpUB8pxtOKvKOfhZDVGy5oiAnfuj/NjJvzjhaDHxwOMOCAH3JBcRUnH5L6h80d1fabnijOvD1ISWImAqllqJuQqaw88I2lmxE/zBmg3pvNDvTXynfl9ML12oLhwWJhgAaW2cKlskBvVHt8/lJC2OOSn8tMjJO69/YziUCE4mS8VzI+JRMLqd3xhBhIaafBFl8X8U5IEnBfQQkIGOYYBzQTq6QNWeb2nleu2wLpUhAc5BDNsyAJy6MR8N5J4IPUEchwoZiJXG7xX4mEOi+iNcSfcVAFDtDKX4TpDshupf0x7svttdwkvh7zwCbcMusHd2gi/s1w7XWLxKX6xVb1FXj4eHsNRX3HWil1fLRnF2jXskOwzlJAs/I6jjCb1Wf5OMPqdLp6mawy34OSezka+MMOfZnXRGu1gPneyaF/ZHakTCuUHg7u40b NqCyosOLD9ks5ghef61ftTzenBCrFTOjezjUM7DvQWduk+f49/0MayfgTsnVtG4s6Mjr6eGKTHG2kkTc8giFvy6pkcc203O13WtMZ36eoaG37+qoMxIqlrkRM8v8/cbnixW/ktGA8qEHK+uQ6aWPhzCd/UcTVdaNa0oYBGca++C90VeRMD/F3QZSzULjX+15kzLvgGMA900JKzh8S1A17Zk7MHCLV3nAhBjM8L4VttEfW28+LN1C6SPeDYKxuVDs77gz3p73WWftyrIqC+gegthjNGtEAEm9qwxykOryULpIiqGfDjRZI+VFNMhetj9ng8acHMJCIS+CSE9JrAatKKHya69vvuYt/jTLOxXVyzEhpwoSLXB9BuhknWtVXnW6778LxK1IvDLa94rs8bg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tqFZU7LtrBmT1cLn/ULDbi2Hmw+FO69RcSPlyVRhZ4xdpoX80UGDi3by0r99UsUVumi2Te9LFCoxqVhhTogv/MuhL7U2NITfgbTpw21K6iUb95ICiBxX/GtiE0m4CDPkmRG8ZppEdkOyf/jB6uxIxyH4iLA4b2N8sflIr9OR6FL5+mm/4Opl4yYYDXrh0o4ba6HYq8nlfmw+LB12XuXd0rtITTZDTJ8K/DL+RkcpmHO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NqbAl7Se03HO6qk7n462V5o/jans2ERe92kWkL0trELahd3tOAGUqXjtJKR1rHhIBybR5nGZ9aT1CLziK3Q46XePmFBdwPLn6RmVZj+SYfLm97QZtu/Rh9rRcO2fR2zdAIDoBrhM+yLBT9+irGiiXvOIbhORMhzqnmOyzcoqVQ1koqTISY7Vs3E0g6wiCFbm3Eua5CpyhcErAqCVwoH36uKqHFnqN75wH+jvyc4VrzsQ6V4XbzMGr2662hy0dU0HzALxXU2jZAdYqSW9AnCQsc5ATr58Yx2Ul25rJiIDHmwjcagWNne/grt/eEsbEA== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8f5e1b1-9d68-457b-042f-08dcdc927a81 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 12:14:45.9288 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +qFJ2zpM9SUNly9Z5UyvDFEBp5eGGCn5Ng06bmcCEMBBqg+umKGvdBuzsbvS+zdgOcVVE52EKqUsUKiFycPVrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3153 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_051457_616397_DD139C96 X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic __memcpy_{from,to}io and __memset_io functions on the loongarch processor architecture. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Changes for v5: - Remove 'select GENERIC_IO_COPY' --- arch/loongarch/kernel/Makefile | 2 +- arch/loongarch/kernel/io.c | 94 ---------------------------------- 2 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 arch/loongarch/kernel/io.c diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile index c9bfeda89e40..9497968ee158 100644 --- a/arch/loongarch/kernel/Makefile +++ b/arch/loongarch/kernel/Makefile @@ -8,7 +8,7 @@ OBJECT_FILES_NON_STANDARD_head.o := y extra-y := vmlinux.lds obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \ - traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \ + traps.o irq.o idle.o process.o dma.o mem.o reset.o switch.o \ elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \ alternative.o unwind.o diff --git a/arch/loongarch/kernel/io.c b/arch/loongarch/kernel/io.c deleted file mode 100644 index cb85bda5a6ad..000000000000 --- a/arch/loongarch/kernel/io.c +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited - */ -#include -#include -#include - -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } - - while (count >= 8) { - *(u64 *)to = __raw_readq(from); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - -/* - * Copy data from "real" memory space to IO memory space. - */ -void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >= 8) { - __raw_writeq(*(u64 *)from, to); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_toio); - -/* - * "memset" on IO memory space. - */ -void __memset_io(volatile void __iomem *dst, int c, size_t count) -{ - u64 qc = (u8)c; - - qc |= qc << 8; - qc |= qc << 16; - qc |= qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >= 8) { - __raw_writeq(qc, dst); - dst += 8; - count -= 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io);