From patchwork Tue Sep 24 09:22:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810590 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 A3DC4CF9C71 for ; Tue, 24 Sep 2024 09:25:39 +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=+su7xVP/nBK4AP2/9awTMq43uDqoTskCRbgvJzWwbmM=; b=e2xw/CsGY73p6RiHhYAqr1pEae N/Cv44vluvLD27kQb4g1Pmook+gbAx46FpufGeJY5uDc1ko8gOZLjGfIuQqG01j9Mst26i6qBWVNN 6T9JnU8chx74atfFB+lnGyLw1YfTAkYdjymBm5yOt7OWn8JiRc4cbl500fW4WQbICmE7unYfkCI6D PWQZSgQUCh7ryXcgKJdo1m4Or7+rQZqQa0VjsDLhjjVRv03LnnbnOGhqOjwGAGaTPiMj+83OnXr9c QwG3coYkbRcIBWtJWEaU/FhfJ9ib78lxaRQTpLscmFwUr7aU47rF+OsvQXYX2cA3IeqFWNNQLus8w dj6t7LuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1nU-00000001myC-1ZM3; Tue, 24 Sep 2024 09:25:28 +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 1st1l9-00000001mYA-1nm0 for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:05 +0000 Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 7AD688EB305 for ; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169780; bh=JDefL0JG3b+NbPQBChl61mRz8IW4sP4EYSbbUOq6XKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Bo2/dOOLmzx+ZDo47qdzlP+nA71W3Q7Qpy6vfY+1OubgyVOgpJapDLqk4vg8VhKSZ JbmCcG+PK/lzymvwIiz/f9YjdM9ONQ4KIQ6VOvjwXzCPn2NilfJbo5d00okX3N5cLM ug4exewzsD/zvF7xplpgSRRgs9kPwZP4P3GuzL8Y= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 3E5EB8EADAF; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) Received: from PA5P264CU001.outbound.protection.outlook.com (mail-francecentralazlp17010005.outbound.protection.outlook.com [40.93.76.5]) by fx403.security-mail.net (Postfix) with ESMTPS id 312E28EA96D; Tue, 24 Sep 2024 11:22:59 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:22:58 +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 09:22:58 +0000 X-Secumail-id: <2db6.66f284f3.2f210.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GYNjhToGgirar64UXlmIB3bFyYeP2aASVUwJduXn7iFMI1VV51ZkxjA3UV7f4SgcoYeb2/rvymLzQioOUqgsBm/+mMDCGe9nvytWLB7gG+RYE55tMnV0dydmf5kBESn++Kxjr8EitbbXRSDYHYpfcE/pX4n3GBulSFGzraOi/S/zsm8s1LsKaAxx8Z4Y+PMTSjMmL4+vcp8sYHPduRqK8mxxB/Wwzf95rS9L3hodVq3xXnnXWDg8ZJWsMjBmtmTe/rYZLEe9MyBwGryeZunxbx9Bwcx4FQ6jbqgnOpL4k1nyWq3MutjPFm7XG+WDw76SrzSakXXYisXS1ggZ0cBTAg== 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=+su7xVP/nBK4AP2/9awTMq43uDqoTskCRbgvJzWwbmM=; b=W8JfCukw7744cBIgNrLMaCVjiOKcTdDNbPWJB6tn/m/Z9NIz3yVW5/G5xGsdfjWoXm51dF5CjzZ3yPN/ZUu/CFKpiRBde162kLQWZ9Q1K9l3Jp+hn6KbIHcD+CdznvpmBVNxAusVOCJkzfjurwJaUKlAfHErXssT8PrtPt3RNpK6lMjTJuxxw2QVAt3JTM5bPYdGSo3mzAoKktodMWl7oR+q4R/OpIbUqVLtC14/THy0eSBrQI6TCgkH3z4ru8x0czVU+/xWIf32quUt6V85lvHI8VOo2hjEEfk3rMqEVTNS1/uQG6y2pWvTF7dcNWMgB5qygsGmiOV9e8AaFvDRWA== 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=+su7xVP/nBK4AP2/9awTMq43uDqoTskCRbgvJzWwbmM=; b=pVtrwojteOtQbJtIMExgWGjmK3TWW6mcYq4Xgf4Wg2On+1NZk2GZrid0r6OCIHF1kcT7bXZoioI26fRrziTUFusz6YRwqZH2cT4qs6rcDR5Q3AcI1mXcXGYxYmjsJ58RzEv8Qq9hEsN4jgdKmLV5V5ovudsv5XjDQjRndTgjKrMEjC31kfts4t8GeGgVKfVqNCL83/WHTCIAWeDkRJ5z8AhIL833i9r8GO01v/Q89UhBmq1rnFS/0b5+e0JPngb6XPjJ1La//JfJt9Rxlb9SdZa3iA3pnfVAdrjYCiVg4HVTkOkU+FyAYAM0R8r8Lf9khz9fN/TGKWCBsMgXnf4MvQ== 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 v4 1/5] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Date: Tue, 24 Sep 2024 11:22:19 +0200 Message-ID: <20240924092223.534040-2-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: d1941696-1c87-489e-954e-08dcdc7a7a5b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: ZmlNXx0aNFctZWdkWhwk2lDQoz99zh6Nzp47mkYHiQClhghHNaCC3T63ehSVeJNvQottxdUFhkq2rcxj23E2t7na8kc7iqdavy+WP4WPFA/uByZ20rOj/xz2KuRKYK5mU5RvkkshjG2kRDqCoHo5wGT+ncFHsFFSZ+tbv9MpJMFCHQ7JbnwqRtC6CVavVtLNWmxBzIZh4wL7fXSB3ybMWBJZX2qT6IimaWdOUT0qd4XZNeQ4zeQ1q5g8Oq6wHZwanmZ+hcRsrpmgBQioa7PDzFVkw9IjOQPikc2y85U72ltUfqaDeOmbUSEUh70l4djduKBuUirCiuJjm0PFPU4ptF77luByiGfdOSJ/Z7ypmNjE2tUr1mwfVhDsO5I6YAtk5QOAES5OYBwZpkw5KaZiefwiQmWXkuts39CpSevawtnOOd6YRV/vncZW2bwdaQSaRt5sSgTFS44gSCThWojIWfy1zrwzAXAgfEkpORRG0vnVNNoMIrIu3btnY5QCXLQFdNmoAa4iLjQmVEgdgjnA/j4ARUd5YG6inJiTFSEapOWSN/bT0LJSCLZnOEg+ETyeuAkhQ5ckn+SRS9lMLb2f0l6qP5P7l2dHcFjgzH8unh9LUrNcRwpNsg/3DjKGa6lk38okbxTy7q6Ne0jJRV2vlntJhC2NszNpw9MS1JWOfNr+SKIOO3ecUI3+j/+1/RqVs2B2TjKg9E4WWfWuP5u0/YyE+9/IRk7/jBliaCHca528FMNGMppP0KsM70lRB/5eclhswR/YZs9box0XaFiMSgk1Lre/tgyPi69i+bF59fC9+yDmwUUtsWdvOSIb2SaPo/f+PEfoJ6Q8//InGsvnIFEvtM9xXSUll3YwPiRCAmgH8yAmdlUdQ/fa7Z0kwmSEGHgJGtnnHD6/jasic8hGC7v4gZCl7TUVnT2iXMCCJqbPYFC+a9S120aM9k3kl6EhXcr gAjxeZNYoqaHP1Vv0gUH4xbqiEwRjvLX8jo6JXCSTByYaWvvYuhfOE2KaB/Y74ND0YCrHLxFvNDnKjDOPtq+uFP9yPHMqRHVht5phykn8Uigs2zU5K2y/jp627Sp5XMn+0zvuDuXGkiujKPgy6KLkJhLjCkh0nvqUA8Iklzo+3CLHio6wI9fZBGkXVdzeVPt3ZL6eRtnice/ioGZgYXq50Dv2E8QYmVn8g+E9MVOWqbObIIP2r+AyNPHB9R7CUvZXsyEApyBA9rKwxqEG1XY9QJmYJQsheWUUdPivZ8s7VlzvDvx1rdfklIlUfOms9PoiGqcqbBLvQK0FcrmGWk8C68kpV1jktHJppQmsa90hNjs3CsEMDrSEw4RZI+ysV3qrE/L5mn3M8JuUi3E+mA== 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)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nG5ket4+WOxI9sEeiKW6N1o+KaPNf0K603svPpMBdRfOOw3WfnU2WOTMu34A80PbQkAaBVFjSLaiV20mu8EEizWCM7MpmOXVW02xwXggKyixprfliAUaMmlgh61spHnqNT3/YXFevfrKlIQjqfyKIbsTX6JYv8tpZemCyM5VP2sFv8s4/vUo2wUoeyRoq+5tmP70xD3am6toJShnu47xrR+YiSFZchgWWnDedf7aaQPHIvNmQA5gzsTJOu1O1l5JVYZCRbyZ5xN7txFjAv886EGC+ssBwIw+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W+DfPSXdDA5mn5tYWW0+mL/S6N8+ANPco3pnPJWEYto2kMsokmUo3wJyOA6A3voJEf/cEmptRl615SfMg41mPg5vH5r81m7DSqhiQ5TEqQ0OwoCBbZw2GR9ND6BboKWvfyjgnU+/l+2OE4AhCXIh2078wBQXlNn0BzQh333xX6eFd66wvTcTAdjDthXCl3/jQHFbnMqtjTFV9NdYDHUOnkSnVFUW9lPsj04KUxq9L4 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1941696-1c87-489e-954e-08dcdc7a7a5b X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:22:57.9911 (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: 5/WGzZuaHIwzhcTZVOn5ltn31M8dCIs28B7dKzN4946FgfAZQ+UVpe99o8e0oCtk62657txfKWv5yxd4LrsJVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_140009_A960DD89 X-CRM114-Status: GOOD ( 16.44 ) 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 and introduce a CONFIG_GENERIC_IO_COPY flag to build the given lib/io_copy.c. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- lib/Kconfig | 3 ++ lib/Makefile | 1 + lib/io_copy.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 lib/io_copy.c diff --git a/lib/Kconfig b/lib/Kconfig index b38849af6f13..741550bc3856 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -70,6 +70,9 @@ source "lib/math/Kconfig" config NO_GENERIC_PCI_IOPORT_MAP bool +config GENERIC_IO_COPY + bool + config GENERIC_IOMAP bool select GENERIC_PCI_IOMAP diff --git a/lib/Makefile b/lib/Makefile index 322bb127b4dc..4f56ad5f9ed6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -130,6 +130,7 @@ CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) obj-y += math/ crypto/ +obj-$(CONFIG_GENERIC_IO_COPY) += io_copy.o obj-$(CONFIG_GENERIC_IOMAP) += iomap.o obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o diff --git a/lib/io_copy.c b/lib/io_copy.c new file mode 100644 index 000000000000..f44583166325 --- /dev/null +++ b/lib/io_copy.c @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * derived from arch/arm/kernel/io.c + * + * Copyright (C) 2024 Kalray Inc. + * Author(s): Julian Vetter + */ + +#include + +#include +#include +#include + +#define NATIVE_STORE_SIZE (BITS_PER_LONG/8) + +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); + +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); + +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); From patchwork Tue Sep 24 09:22:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810607 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 20ADDCF9C71 for ; Tue, 24 Sep 2024 09:30:12 +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=LsCe7cUeho25XXzvkTKqw78HiJM39gQK+E6IL4W/sGk=; b=4B5mCqvkTVz3ol0wxKrkuX627L jMFHwdxpU7yEGsZm8FDYsN4BBG1nqe8eXs1QWALqU+v/lSR9yluxU8KFLurSfrsflnB/oLzPQ+90J UssJC52K2TovYX18whsity/mhFFwk9gJuwEcGusBGF8RSlaijyX9Z/F/mLJmdicmKVlzGRYwE9Kcf ImPUSDU8L3fNiWKs6i3v2bBdS3gXtaS5QRHf66CPiRyjoVu8VX2OGB5MQm/WqwklXrCmcpiuxBTJW IvzO+HJKJnS8QLKBX0x3Ew5c8kt4NykRg6tqVmaNGgvX7S1KFgKOHBjp1VdkRm6U7aS4tIIrsNSC0 w+qqIxrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1ru-00000001nnQ-2zAj; Tue, 24 Sep 2024 09:30:02 +0000 Received: from smtpout144.security-mail.net ([85.31.212.144]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st1lA-00000001mYD-09oo for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:08 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id E63CD3494F6 for ; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169781; bh=uHDwACn0oq0R87FWS7YdHeucD3CxZyAJGngfuIzYS5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GOpx3E1zLMBXoq0yndwO0NEkv8bmfYKK7gP7bHjoCob3W623c5yV7c+/QI4HqjKBY L4qUo7wmThGtUcMrYBpJnEZsgd3ygn/ddi1gllprRpY1i/olWW9rqSuPN5D9n68gxD bbF2nKetSg5THqs/0lJvU8vVjxRgp13vEK9nlzLA= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 9DC1A34948E; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011027.outbound.protection.outlook.com [40.93.76.27]) by fx601.security-mail.net (Postfix) with ESMTPS id B7F0A34946A; Tue, 24 Sep 2024 11:22:59 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:22:58 +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 09:22:58 +0000 X-Secumail-id: <17991.66f284f3.b4edf.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SeTUZ92rMqppuXO29glCu9hGhuRg/Z4JXdCksE0f4gZn0BczjVNKDWEUcl0j2iPcDeRqIkOAFARNZvovfq+NQu6PVRoRIxQ+A+wNYjZf/aG7lbt+JPEtiGUdfB6s0ZrAR2e0Yp3qH5/S2uttif+OAEDsMlIhsbNRsc8tIXAoCOyFH4ydOyzadvc5VraZO4cqQb/eNj1L6Ji/zmZzrlnpT6UjZ7RQV7Avo8Jz7rxA2lml8fpMXTJIff0y7U2Pk1BdKBA0Dkqki3hjE2kkAs4CC/y4oJZohnx5oTjwORZhxv9XkbMiSuIe+y1z0u9muYUXoz78hC408R1IryMGDWx71w== 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=LsCe7cUeho25XXzvkTKqw78HiJM39gQK+E6IL4W/sGk=; b=XXCqdCrNeOQy0V4zuxDU/f1dpte9b25wcdt8VO0CuXLpXUxorZbpfK3AoDnbJAIaJdkm8ygdWImxl/cHBmOC6FiKO88BTl8wofdrVgfkmv3ih9KIccvuztmLMQjSSpL3SbVYN0DZGMFihZYKp3eoM3PBlsOdc0QS5AkedXlKunCN0Bamo5Oul7tZXSfPyD0Nsv1D5enTaFuWuPEaxOPsJOG8BXlzCuSrSaLKNNOCugL+D9R+iZxA1fi+sNXuTVRFYTuvPmiyosotk8SldHArS9n6e6lVXF0OaVloxVJp/ijOLw6DnTtB07PiqRLvMaDs7fNeLXuDdZiKWnsKvI4quA== 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=LsCe7cUeho25XXzvkTKqw78HiJM39gQK+E6IL4W/sGk=; b=Pbc+lq5UYNq6FQMIvng7w50NIT4UaYl3UmQpfa7yenFjrnfRd0T96zTM/QhpgFXRksDic+ga9fuLnkuCoB3vdvg+dwqiTREuv/QzRgdif4JEj/VsMyNcXZ3Rx/RXluvYT5H8lOeo4A8/fzFN93kaPfN/1vxuQoJtMhjTDP8NLIv5jy17PCrJzjWY8eIxIOQI99gozafSJKlclU1Kq2NCk3ZMzAM13CfulAGBz+yvu0xSVe+SyBn0o4KuvM4IFMuz/377Vf4yvlXRvChGP5+okwqOeGplKb+DMb3AXrDjcaZL3zLOknnrJhGr437ISvK7+k/nuQ7RnwQMhE24mt+a/g== 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 v4 2/5] Replace generic memcpy and memset by IO memcpy functions Date: Tue, 24 Sep 2024 11:22:20 +0200 Message-ID: <20240924092223.534040-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: 07867b9e-32f5-419b-d3c1-08dcdc7a7adb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam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JUWqwbpiByNs9/Jkyt7qld/irUOy0FZHG7s99t9COrkeuv0eqQeycPdDllSMlHEoZXZOE595m/vO4ToqQ6mLKCrbFY4shox3SLp4Mz8xWCO77L+rYSJZ2T8WPOgWySR3PXfyRTydjs1PeHrxz9vZBoy0BOgfloDm/pHnPKdQlyL3SRCOBKuNGLdgsoOmY8xZUu5WHcKHXsnmjTohc6SISHQFcmAuh+/gpEcRDeidzp+TNbUryh1wnSBg4/3lE4KT9fA/+Tk0fY7PAgW8yTsQo42cMWd9uRogqL3Wj+Mw== 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)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oiKq4H9htI6IJPVWNp9DcvEX7gekG47MpRCuvjg+WyDb/YvNSCC1whUbOR3bKYJ284bRJC1aCubTcpRZVRgxQ0h6cli5qdBE5bQu4lPPiCaWSXAUMHOGdBsRJcjfy1fAts8CiJJqnd/+45fowgD48Y8BlmJXRwK2R7KUNJ6+YcCp58eBeSvBJzUVp22D6LJ89l9+ODCZlNOC2jbpnKCWy9X1gzch1VuDhASqx5HgHcF3FGpHAA2aIq3Vbm97FMZ1qLqlF2ZJHAUiWKkGF60F4/O33f6Jt9VNfgC06or5jMFyIOX89q9LxSObSCIHRX3EKe7jbCoa6cyJNTOq4escGSpBeAEJ+7hWIrwudX8Tk6QRAdGN/YtC7K4xUggdn+bbk2Fcr6kY8sBhttkyESiI7hEgskzm0NV4zdZNVJLABFthrf+SyVuIoSCbYCNWfc7DC+/qvpXMq1Wsmzgt4nlnUr/FXFbU4Y0K4ltcNV1CJ2jdmataKSMNLhZ3I4CNOgVngEgub+V/y/eyL01YqbD0Bl22e0meu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mom X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07867b9e-32f5-419b-d3c1-08dcdc7a7adb X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:22:58.6062 (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: mwTPX9vtj7+PkmmXi7Tp3CjwDLaVrAa9sQU1Icx2W9KeGfPmzMxzIFiZgfMdz7igDm1y2fWqVFHySp0KL93U2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_271264_77C297E5 X-CRM114-Status: GOOD ( 12.31 ) 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 --- 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 80de699bf6af..0f05d2399938 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -1163,7 +1163,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 @@ -1181,7 +1181,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 @@ -1198,7 +1198,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 09:22:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810608 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 EBD8DCF9C71 for ; Tue, 24 Sep 2024 09:31: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=SVUX+6s45Z0ge65VzI3FZt7ZlDdHSX5oJ+Km/4ciA+s=; b=QBbHHSffC504V5fl/72/r0EIM0 gSjwR0jqo2YGZ6erc5SYUXbRPNUMaPmd2Qr3ojD0WR2yljBAPmpcrvuBy5gc3ZUVkNbaR+dnrP1oL 3+mzzmrHftqJsFsNEUSOfRtx2cVwuz2FA9MKLSyyDdqngtKIqBgbiXBTBKuQRwmbJgB1Bmz+K+85n 550r8qQbup2YSt9SvmYzNWGxiNFLxKttWHNItxs7fnrVOcUXatBEH7fSUf1qLoAQjjaQNZNTJVtpz /zI+cFxv6hziY+/WyOZfUiXJ69U17XGE0WwwsttliyHKg5RARyt76n7DkLgdmHCaLbpdznRIatlQh i/qC0/4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1t4-00000001oBu-0BDb; Tue, 24 Sep 2024 09:31:14 +0000 Received: from smtpout144.security-mail.net ([85.31.212.144]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st1lA-00000001mYI-2NYy for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:08 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 8A52B349593 for ; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169781; bh=fm74sZv+wQupqd1aA35tAP0V73LJDMRwcbwSpgpGSEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UHXgvGfFgAXFIGBtK06mzRsjq874a90Njx1YHt+TnRjdJR8xal0tN5fDZRXvH7ebz bs1tr6Ymn0MsU3jzaEZfL1fY8BIAxSBo68IkY9IT5zp06likiNjC8MSFZA2UPbiipL bFTEpZ9vMCR8COJzzJ068l8PgLVgP07T9S1TTcXg= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 5ED4C34956B; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011024.outbound.protection.outlook.com [40.93.76.24]) by fx601.security-mail.net (Postfix) with ESMTPS id 534313493D7; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:22:59 +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 09:22:59 +0000 X-Secumail-id: <143a5.66f284f4.4fcef.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GpIM/jRfgOBDAWTuyvgrOlNVo0NhuBq5Y0Am33r5Wnjag8tPVrWYh/oj/zatlPXiftdDyYwB5E6Gek0xV3GwJfCwaBttD5BYO2CTbLmfyjFC35sAFqps0I7N9SGBtksu9NQTr7HnTU18Vd/kU/CZNBlZLGjj1Iv3avGMewFIcPSJaAgoDmO1uRIupHLxxfSQyXEMjfgyqnxlU1nlEQd1SQZoUWD2JujqDyAgI2TCWOtnWfQTpGDZbnk/h6oUjDP2sL1KR9AXdh2wVGeUDpPzPe5CWqG5s8H28R8tRovZvnYGrCSlRNHpAoS37063n6GgdCu5SxmsHAl+jXk2BHbahw== 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=SVUX+6s45Z0ge65VzI3FZt7ZlDdHSX5oJ+Km/4ciA+s=; b=PV1o09Fcs2v0TL5rlZR7K8K+PBu+g3apDV1C4XdpnzCSqBf9sUY99dXrkv+PFcwAmZnnAlMpgb5NbJE+Q6NIHxt+bQp4ryHNq4dcNRjSBaMZEhcOLUlCJWp3NJGZNQrUB6QD3V0hUWHBP9237x1nf+Y5R0Yr3XEPjECaUHfjlczKXr3oe8mJVwzerUPTuTvRgKJsjLhg8rSlem1IjAyeDDb06iYSs0cPz14SvARVy60rIQ+ceckRkFch4P3UFx5/1Im47sAJfjtJv2UzRPB9Zp2prqHjWsNto4BNjqnEM48Yq9L5VtJ2Bx20Z8bo2yWGO3gs48ZuwtRX9JiFIHpdeg== 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=SVUX+6s45Z0ge65VzI3FZt7ZlDdHSX5oJ+Km/4ciA+s=; b=Tlj0u0l1+GtT3OAb255rjGllJ5DCEKOa6h1vkEcNayN2SJpgt8OUkOyO2Xk8Gb47KegB+p42tYzyQ62guy+OC1axTBLqk4yCB9mQ8qEaEqLiDRw2x0BsVs4rwuM+RaevVca341rWNPOEbpkuxWCHSPs92TY3aWoGnlhPGHncCjecsrf2xtPrTe4XErFqqj+6u/Uh7q+YGBzfnhjbzAtjy+/aU0BSx3gjil0sAK+zouS7o00axmmAMC2Gx7JJy8CbICC4kAfCAxPGOpjtI1ixa5LPB56UaktdORYUdmcci585moEJgXwVLa3xQrD1U6dBs/PMn5tW64ajEekzSCkfBQ== 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 v4 3/5] Use generic io memcpy functions on the arm64 architecture Date: Tue, 24 Sep 2024 11:22:21 +0200 Message-ID: <20240924092223.534040-4-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: 44e1130e-9f22-4987-5746-08dcdc7a7b37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: hF3+HkvkEbRk9H9/sCMH9bkc9cqD4I/HJGeHPfbBJvJ5hraU1NskWKJ9vtK/kIpvqGZkTteiNqEUQV1/bJkrW0g9VDSamdujzGUzokspM5vgWlJL57F3xGoHroKSQR53P3PQU0XdvWeUVDFuG6PB0EicYlVmIgTKBwhXKi0aa+UOh8xRxa4Ay61TPu9nKXQ0CJ8WJkCRCv2wmc++WNbMT1grZPnjgjT64oQZ2bKFwCnKf3ePB+d/9aadDL6ByAY44CHtgmvyslC56s8cz3OQlbtsCbGo2OU5zY1Ixhdpayt5+6NXhkx8w7bdJvzSkBwOIpnfphHlkvq8kGW/qn77v7A7tFUoRt7D5kTlEgt65WVnXlEwu4pEZbBlR6KaSK1Emt7EcQ+rJcsWvIFyXbPNm4+ukc0Ay7Rk7UjWVIr+wP7MH+EexNwgFCd3wA7nExpepSdw/Si3HAenvXAyGW4zTJFKyZzxvwn5n9yb+MspSyFaU0LJKEg3jDtTm1/pGkIGhagRQe34iv3yW0AObfJf4mytu9qsfEYeb55umbNBMiMAyN70NPDHomXZN9oXHRMCKGABrv9B1IGJatig0aDkMWaKHbJFjv2Se3zzIXnhFTI0UjU1TGwCYwyPal5Me+cUAkOuyG2uyRX5eepS/AmCACIbS9pAM5nTZYDFsDmkBOLdNr40kL1pfDUZ6B8/k89ZgORptEX0si4CuzfVw99H3zwRuoflUCK35+FAv4tof2buwZpTrVuDjmgoOuFHY5yIli0F4QAH75LumPkthxKO4jxvDWqQoq8gx/oVxM6IuE5FZdMGCPG5ZUmbipfweXowl2QCHcfdXhbjQcfDMABrxhOs3uhkJH85VbN483a7cLjyE4I53ytDXW6LicXRT+F92M1soQ+eqhrEV5KOqutPUDvhTUND8dwt/fXxxojsJ5PVl5JzRWm00UKgO1ehgAsxP8x T691xLpql/yGanzMkmx2RKRrno06vHj6PpDZm1cuvWBujq6mP2lP0eK+XnIz4sMw1dkY3QYtGTTlfjmjWZFQfVY5Abr7JYD2G5jsaE5n4S8UGg8XGDOERAh2xd1QbTvpeFM7WLDuCZBmZOcLz1C6JHhyXRI/gd8hPJ9qcHReak/Y/r85A6MMEqUHt1wWgl9CWU/AAQtCh82H9qRom10S7C51D7cjeA1msegbnZkCFSkkUNhg3q4IirFV7S/sOlefvP2OOiHJDTccxviJb0sh5tkmpVHYKeIJr1/nYEp+dUlu4Ge4NWhJQnosz/7MZAxcn8bAAZJF94yqzp6jTPyC2sa5qv7wVIH7UfbrirrLnZmgWou6P0LY3DZYSROImr9LKY3Qwjy3HV8nYQ241Cw== 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)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f2d59TRD5kJjaT59cH2qyW79ieFhiYc6/Ie3hLdifhdiTbUWe9D8KfleLlTs0yiN+8QLCGvW3KpP0zf3W0Ee4Wv4Do97edM8khjBn74HT3XX3TJAvKfqONooMAaAgSk8TQkFk39La2+lHu6dt+2GmkLrAbX/JvRzVFntWrMytT0M0odyfVfkerASZjyVdshaaF7MdyZODZRMNGvT2wkh+8195nO10HZiwACrAEMM18u6NuW745YyYBGgVWTGsHj2U/9PcwpLu/dvX3j0tokQs7lYKUuXH1JS90Rz23eUge6rrimsnM1DN5cpFMpd0+r96otQ06G7s4ZA2ehJmYoldfHtGKMxICyr1elg9w6JfQE5Gm0WgyHLqFwM/cNZmE29G2b2dg+Az8emXgryuZqCTc2/M9kN1fml8dtKUqUBEc6xiEPGL3qXHKaJWByOiY1vU9qOYFJfr5XaM2X0W8GPd79DyfWXCubCad3mgWazQ8QUfXFMfbg+J7K3sS6ax1VKZHL/Mr7U0DA7mh08HCqbiotQasljgPJLV3zEvkpx75QOCIrrjxUmP5rbbSB++kBtwH+VbF4Yz0TnruxAdEQvTjMd4K0NcbW6Sfj8p2k/yh59y5IpMsyF/8dWVS4ootm2c3RYdisrYrulAWivVmM3kFdlWf3fzXoex2+BasQLxnrzLb+ZJXuICyLvcKn/tua6b5OFIBjyzQvci7vqhCyFCse0wMVa6lr3UTt4J3vXq/laE9/7dXZK1hp/bvhqz0oUTslw66xquuufAQauvfsbZ0AU9mRdkjQIHb+Lwkei6JHBtZk3/yhK9G2zzYb64MFPDgldd1uvIHV/WdCdYKgNAc+nAqA4uBwUw+99vtk0NmsYZvtFetadVnABDxWXlq4I3N2LyxpBfSW5oT2+ZbgRgfsxxB2XmCuvDDwO7Ozc1UgDd2EQFa3LYW5UGORk7n3z XLY0bSuvh1Gikjtn2nY1p8iyL8/uz6zgvCr6bgCEWrDuPwZ2E5tjuqp3i6thBhyfaSzybssfAF67cXcd5+imU3eMTHcb50HPdyQVyGTTcZ96yPm2rh5fE9JtzQzCkEgREcWckX5ScocvJgoLHsuWHjgJwM0TfPZe4P5e1uFbAkfiK7s1pBRLNmajDPOJZuRQ40IRKgyda1FOKy9mmKJBxDTd5bVRuF0RMOMy7cchrgLd335ELvTJnpt72NlCWJGvJLEhv51ULQ4fakSkC1Y/hE+V8Mmtm4gRv3diQ4bXAM5xeCaa+6rHtC7m8b/ZeisfxQLG3pEvErXIGlJCZaUf0nFveby6lzaKeQVC5GJhZ+aikjtg1OU0iN5Xz/x79VWUcpsXofzEu6w/tfZpp0y2k32Z78NjM+w0tajTu779XjrPpIGqIhV94toObESNzuhkvrZ+wrdngPWtyHJlH3uXDvdJbGq2sX9UqWXm17CygaZcjWE44JKDq9hVjTfpZB/CAOHCpQCqoRpn5AoA58hfqbwedU0+S6cx4DSkqfDYiYJcVKW9VfrYh+8T65QeEoSsGsZGlOLMSaxJMuvjvh2HQvK2yJ40qXCL8xQNEpNfA0PxNS/EFgsNVRtGmlS+s4aB X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44e1130e-9f22-4987-5746-08dcdc7a7b37 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:22:59.2024 (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: OHqPiTSJUv6pkPQyxy2Wv3g6k1jBK5dEbX8dlhQXwtDWT9fSANSMDeQvgfQm6e2tECbJE/0fus+lGum8TllLmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_903668_08E4363B X-CRM114-Status: GOOD ( 13.84 ) 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 --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/io.c | 87 ------------------------------------------ 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a2f8ff354ca6..cfb1c729c9a1 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -140,6 +140,7 @@ config ARM64 select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP select GENERIC_IDLE_POLL_SETUP + select GENERIC_IO_COPY select GENERIC_IOREMAP select GENERIC_IRQ_IPI select GENERIC_IRQ_PROBE 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 09:22:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810592 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 5EAB8CF9C71 for ; Tue, 24 Sep 2024 09:27:54 +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=DveJr7zsBccpWvAJKIk+kTDfNX03apt1gxEBBsrHIOA=; b=uyJhAqFtA5TfYrr4W+d2llxb19 eV8p6r+jKS89gdgCosGKs8avkrsNpLbzKr3faInn56hEJ3LKIizBT0TFkanNQA/WBLlAv1/NbUbkc I6rXDspby2HhYuXgjyL6TJseeG8yvMN8KAYliBTtDK0sVlhn1dkWPZOXZVHNDRr5uB6XL8pAnLbz9 kZ49jmHGJ2srGpj2jq+PfiVFJxYtHsrxaD+cIIJJaWbaJlLTlS0NYZ7SA/95Gq+LT8eS2Vu/aBVbh KF03KeBD47dGSo+0qRL9m4278DrO60hSi1Df1dbkxOH2f3fYrWNekIpp8N7b5krPy70J/XDBIpcSB NqM0GZFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1ph-00000001nQC-2rUp; Tue, 24 Sep 2024 09:27:45 +0000 Received: from smtpout144.security-mail.net ([85.31.212.144]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st1l9-00000001mYJ-27ht for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:07 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id CADE13496A2 for ; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169781; bh=DlBtsP+yHL6mWeXFHedZo7xJcnsxHLkO3HTJki7kIVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RfENmUancePRdo/hd0M8dyRwt1BbuTbp7EgN+wHec2+sVZrbn9PuXoay3uXqp4ctH 5RH5jIxkf0nJ7ihsfoNALEoPGemgzCyO1l76WlV2GrC01be2xpftCfVn+t+KtD3DZC 9Jf93EBxNh9phEwwXGgM6e5d8GHOMuSCfykOSpiQ= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 98BCF349604; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011030.outbound.protection.outlook.com [40.93.76.30]) by fx601.security-mail.net (Postfix) with ESMTPS id D54AD3494DF; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:22:59 +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 09:22:59 +0000 X-Secumail-id: <107b3.66f284f4.d35ae.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pqBIvzM50VDRloMgMfvDBh/vtIFonuZOFeZmFt66jZax+YmzH24MhKPr1YURFq11tyTntmUhMLcB4Z3SwidHage/U2QtGW9A1ytIgVZ4Rm/1i5tDwIBV51WTC6x6bpMgnMRTdNhmkIS8aP5U8ByWt/0KuTOFvPXojZcxfKUs9GjMMN9LQgodoi/FsbLm+/pnLi0O9AXk5Orf+R0tRYRE1O5hL8FvrNopEKVNGp0RKaHH5HOXIOiyxcB+C9eRM6EnXJrARWBFUHzE7XQpYerQ7YUiYeASPqrc4CyNunfLEME1MwIHCFttqA5IzoG5AMZdwu2nxWiVqllLLvzMqnPi4w== 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=DveJr7zsBccpWvAJKIk+kTDfNX03apt1gxEBBsrHIOA=; b=yXar0Vf2X+3gzRGO/xjfszRe0K5HxKb4zdsyA1RR8x3RT8nFCfao2+ug6gqyfqRCDHf5bUdfzLpUnOUHc6rU9yeZeRBwTkO4oJWEgJXvOLODzKH0CepcHbrYDwqJpmvIwvD7WDC4GN9gvJX+xfyNIyaUkbK3H4CTeB6urpMeszS309PJfK2GFPRgb5SbZdeb9WLDlm4FHkFUhRLQ44dlKQDw2XfCiE49VwHftuuAU9RX2lBm/UTdBhKPogJ5KUQ/6YsstnLv9KPM4RKQqQEkUytLQ7whfsTDY2nzaEOE/qkZDtBfwqKTr8IOEauckWrd2PltNhXncRUeut5QzOpy9Q== 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=DveJr7zsBccpWvAJKIk+kTDfNX03apt1gxEBBsrHIOA=; b=dBnuKBBVGt0X/9wOo1F0BD1hOTrbDBnRiZAFLwGArDuXsaNkndsXpJXBlQpL56e6ca1UvpLMymlGn006+j6Kh8jv6TaN1MOMIOMc5RlrkMX3Pv5FRc+pYzpAuBzPQ1ek674z4/zn4E5T7jb3DaVV/MKEe1C7YfTUkbXcnG4OGc6msYPQi4iWC2YQmJBbA64+V83RZKisQfZiOyacir07f/cgrKmeSji6mN/wZwjdsXIxbZMT/V53vcwc+98s04j8tJMswZsF43PvxRw8acp1s9lzAqukBKDuCeULSj5POvOvgv/yPfDXwTKKzVnp26jIuZPjvTA2bIOtM2g/49v+sw== 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 v4 4/5] Use generic io memcpy functions on the csky architecture Date: Tue, 24 Sep 2024 11:22:22 +0200 Message-ID: <20240924092223.534040-5-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: be752e5a-3cef-4c19-63f4-08dcdc7a7b94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: LJknpAN1hrh4UqAiufM+3Z5IHFe0kQVITMzI0hNyYXm6RCHFeM2yVukVBlM116hgbhTESST2Zb41n0hY/WtgjW52iz46P0DTLQSbyEP+4VAPz50SOtpGKHmFATLBIKud3VttgpDYWF0/f6eM6bSW7fAflv/8bTX2D/kDIo4sqfmQnojitkFPRGlWWGREopstfKCAwKQ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T0Ke0Y1OGrjLiMAPs9mgn7p6FJKC8zz8sKo4JHsTZEUfnBD3Ka1Y9wPGu6J0Z4hBNzGj+fvPUB7DnuRn+YnAZN3064kUG0qCjBMg== 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)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dr5JUvSeEbjbMZGuPmoCfH7ZAjnWvZ3Z4/j/OJjpFlWoS99RL7Fuh19OUbuV8eTNwW5xDWIwqtBUXvJa+wSQU6bRteo0WqlVkfMGJD+IWso7ucT7t4sNB8SxV5rwIGk0qkUWZALEC2ZvAnvXo6UZ/zQBu3ssstQCD2O/vdfl8XGymYrjf4NooeVQMzbmyBGa3s7SOpeSIAz1Wu+GhFqRZfMS8LwW9erNuXmENieGcF8XHhxchDA7LQT2p5sCk8uYVqggULVKGDkBv5wIizzfSCJkP4O/QhEpvk1BNxYeuHo+l1xDepF8gkvMM2sG7j1um3urfNGon/kyFsABzrhW42NF5URHEJ4Dg0V5fdcvuXmtZbnMTfV+Vb1QOaVB5vcGVVJS6tE38W0oR95i8nzO3MEvyG1SOUjqDyvBPsM4SuhiuMfoT7LlaqdKzxyCQgDAbbSgdZGotHiAOTOkts9qvye1yfE0ujRj3DVi8p2gymtHaKUhuuvhj94Ymfn9hcC/Deca15U30Czu+Pzv/mn+kdIy/r1aILjT9X+4vNymJQE4pgfVD0bdDIzemjQ9mT2DfvSG0dDP9Wqd8wiRtVCOUd0raRUp/wDfs0C3pQHA2Nd6feyR4sjHhq2fVoLO2iNXC1AP5WXS6RHyHIr6+OrNxbV7ZFF+yBeCGp3mJSF/Mzl+VDs/fm1KiuGWxv3HHOptyvceXXgml91RA91DSaMh2yv3ntfEaEIgrjXgCGVY9aWuZqkdtPo8cDNh0QRtcFwGB+5X84/btx/apGHPtEtref/1mhWf+8tfJEhoKlevp68A/Hf+lB4thZHQqMW3ejOdzvPvRnbneTXKyf+wQVsRkS2vCISbu3LTVtgdZOMii1rYSO/mFf0/FTkneMeK4ZWTUCA6Z8T52HA9p3wTw9DK76xyLkLpm/ya2EAsEyuOrijCEIX/Ong3Zi+ZQa44MNFs uUpumFT/4zOezUrTfF4LKESZraM+teb/uJY0ZyAUvQ+PkqraSsGATv+kgctqgARbjq+I4QFTlZspYi4Rev4nKuXBuoQppwbKgzZYCseioXrg9DyRnj0wmAWUzBslppB1o912wJxP8Hp6arOcuaNOO9hPpyA4uXkHqoZ2NlfhZV1vIvTqhD13DFs5GNyI2sveur8x450fb1UGrYzBCipzbnPdUGksMEFW/j+A0cxUEebiRqdXQpNhRqK3C/qIuhbuX4VcMrVYs+u7wri/SdYcr/ujnmahJFLxjlOPIrCrgQM3xSzXCNcNUsIdWeR8slDCJtvMQKhNq6tEPrW2rz8FtJ1lZY0MhcbROMuf1pWipQqOyVpGt0uF2Jw0gl4AqsXo1vV3w5tbF4CGLUcpSd0ecyIvhRctaO5V/R758dmvpyvEi9O4gjAAPazRwr/m6g9dDFT5GTEh/gy7Aix5YTedYqZHfFv+PHxc4rxnXeK0NvD/Tbf3uI30NXTO6JXO90widGn7sRLBx0aIfblw/aMoBWFcvWziCi3YBAMbVN+0McNmyHJsJjhAqNka7xN1AbqaxJY4pvZ1fEl5bi2UI2Yi2BayBIdZE7WFpWz4Re+Hb4LewSJFIwX8HToDWWwnNDU0 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: be752e5a-3cef-4c19-63f4-08dcdc7a7b94 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:22:59.8094 (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: oLcz/WHNRXMry78gvqFQ1dzHiSt7kdiMai+QzVhPs23rgJ+h3+txKcekyDr3Qw07tuwyfbsLubi10t0Z99h6vQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_149646_D7C51D66 X-CRM114-Status: GOOD ( 14.64 ) 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 --- arch/csky/Kconfig | 1 + arch/csky/kernel/Makefile | 2 +- arch/csky/kernel/io.c | 91 --------------------------------------- 3 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 arch/csky/kernel/io.c diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 5479707eb5d1..59d4051b2a83 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -48,6 +48,7 @@ config CSKY select DMA_DIRECT_REMAP select IRQ_DOMAIN select DW_APB_TIMER_OF + select GENERIC_IO_COPY select GENERIC_IOREMAP select GENERIC_LIB_ASHLDI3 select GENERIC_LIB_ASHRDI3 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 09:22:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810593 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 A964BCF9C6B for ; Tue, 24 Sep 2024 09:29:08 +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=ap33tf5qZZ62I8NJEWvBds9aSZQ+d7OzAL26H+fuCc8=; b=prbTxXqnzu6lLoxg51r78kZTEA bdcB4OOoKNooElnKiYa7DvF72gvC066cqh0oqk/Qe+T4Zio8sDApm1ga27PeVoCRVqVJicIwJkn0r SD6vviFV5cNfoX8lYpWemOcRcExGblnzjyTlwb9IWrfexfxtDVBrUTNnwnd0MK2JXo+4YEl5L1MJk bJB4n69HtaPL4kRjS4WhB/5xy+GtknCtt4VNMvB0y5k5Qlpn747Sc4NA/W+URw6WZ6eBjmvQJTlbZ g62AOQvSoJmtda0jpyU4ZCGL3swzOZ3ntBpO+Wg5yVjoaDso4GfleN31X1TPpyp0/rNwmyW3L1t8h 3+wzwwVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1qp-00000001ne2-0R5O; Tue, 24 Sep 2024 09:28:55 +0000 Received: from smtpout144.security-mail.net ([85.31.212.144]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st1lA-00000001mYM-12gR for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:07 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 54B9C3497C3 for ; Tue, 24 Sep 2024 11:23:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169782; bh=T5uSHgkmAwvTJQWgMDrPyQnAF/YeHQaaCcpuB+cWki0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eIplAb5PYMJiPhM+zEjD09Fe1nc9swQPwUK3u96zyo5CU26dnWpdESlHp+konHPjl wvdnhXoKuBVVfDD8vmXEMMpVdDPJlGAoRzJ+QMykXBVqePasYdRzM4/Zq1v9ut2Nkh +P5D+q38LAzwSIVGvLojwHid1gRqpg7SgHeKKa+U= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 2EBC134976F; Tue, 24 Sep 2024 11:23:02 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011025.outbound.protection.outlook.com [40.93.76.25]) by fx601.security-mail.net (Postfix) with ESMTPS id 76B59349570; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:23:00 +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 09:23:00 +0000 X-Secumail-id: <16471.66f284f5.74345.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iR59ryZlXi0NOCk0VgPCx3yhA3ZpWbYdEkZ73RTimncbO+Ur1mugIQGAuyZTucXWbrSDCFa//sGiPdNWyVCgs3Y8bhj2VOme4tLCLWU7axglceAb8yUBTCLKoaAaEl+F6xkHFmCufAoCosi/qwhiWoMsMobU9QGN1A5QYUSiGrUbLhjAFGUUt/1+CL5YE97dWfzFuzkOmeWK7QfecVW7PDoJr9a7iHuMjsLlH6MqBDKgd1QHu3CjiROtW4wVneK2tV0IiPAaot4r+HzPOlaOecj+ptJqlvVtD3ERoB5Pqa/wjgIrdcuCHojuYzj1K66IHIdEc+ffiqtlJFsCh78Tsw== 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=ap33tf5qZZ62I8NJEWvBds9aSZQ+d7OzAL26H+fuCc8=; b=oHVV3G9reGkIsHSea1cr4vwcxmkVETdd6LqBTu4yAGtPbxv0pS7xop0XXhkATC0PGHEN+AfTr+lDeC8S9TmcOH6EvrlaqLrL5StIolVBUExkgjQHj6ayqtUCIqf9tyfGvMwjRbuDZa0bOVyWEjD4RObYM+uvoLj2H0cAW5ZlAhejb8sdtGv6MeXi4tZxytw/+rBUz6cWS0vwhK0WegGVHwTi4Ef4tdX+IMjgD47cVVYu0jsZnwfjAKbsykDi0/4lG9l/LVOG5EQrjdc4a4NyuczYxz2DLBN2hMV2wz/3oImunvt7uQSgXHLfMFHSoHmEpoKoQwPFIZk4Apcb+oo9Pw== 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=ap33tf5qZZ62I8NJEWvBds9aSZQ+d7OzAL26H+fuCc8=; b=sKD/UN8elYWrJHK0oreZ4rM1vqb/ihd0ZDcd539hImuqHoWDhv16W0P/V3XAbfdBnHSKnIYNobDoiFvGjhdtpc6WyAk5njsZvivm/1hKRop7OTk4kKrK3XlUzjJyLdbJ3+rGoKHN76Qt4T9R+OlbosLo/H7A4wg+W6VSFQhTczF6QmOFTnHQO3awwsLSod0PEdc488oCCk+cNjWNFmvF1gn+9WeB3f3xpP2+ZS421pxIS+5jU/yfi5ozfFbt3+S1JWPrUrzczdmywovsnRIDhvEQOPef7bvQTNwgtb8jeOANbEImpC3CqJoCmqlpStTsfpoQqiLMw7xFNNCaIlDrKQ== 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 v4 5/5] Use generic io memcpy functions on the loongarch architecture Date: Tue, 24 Sep 2024 11:22:23 +0200 Message-ID: <20240924092223.534040-6-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: 557af0dd-54de-4834-96d1-08dcdc7a7bf3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: ClE0vi6dd6acGpZk7qmFmvVqn+jN1TesnT5i5M4nxDzFzyuizG6G6tIjesBY5zWKidmCQapMELWW9lnAIkMIpTDZP33SuB0JkhZjIHojs1inTIiVyFLZ84WUS0mDcrn08XkbntLz1QTtbK5aJr/X4+JoNXKT1qG+Hi/ww0xtb1EKpzBMigYe4ieB+7eIUGOYxc1lngwV80Gfm6rZJiTYJmp+MVbqnZeKAoKtXro+jE6ahhj9P4JThJCeEHY4w9SQ8SAiwAEFNXDaNGghEyL8PJkWA6GL/zEUa6vD/sKNBfYhUQzPdv9khoHBoZpGhJK8u9Rw/DkKP5QyIPVMMjgjI0UIixWDzQQtwnOxYCFvGE00tHnrE61dcAJe0mRdwrL+tcSY4qMGf53RWDGVqyF9QMMT76qAsnKnyf8gTWp7iB2YKbQWjpQexKZeyAC9Ml0xURmV0JTueIXMfISyCguAeVoR8azdqiTsrat8W4DZOculJMKC0SSpo4YxxQ4p6GERigXkzd7+xIOxCXEtKsulxhzAdLNQ+We2wfUFJP0njmS5ddo3ovBIQA019m7GGD4sNjmSn36NBohPj+c/SB5Aiqcc6EXpDa5pTrGvN7OvhPfwURvS7jv6COv3n00+2eRcchIL+vv0Q4+Xzt0ePT1dBHS1fC3sF8T/ML20bFSJFFM0iPg0Xt9AL3W9qTzBlhbLOiwnu39fPL9Cjt289VRIugeyTKWNwHJTapndU6VFmTadJ9okqQPNuN1KqeoMjdxSEoRYyyAWPX7tYRaeM0GceE06k1yKt6nr3U94qQTDaIWBcarreCVdbA8PsndBXL8ue62V7WxeovXaD/dNks13YgZHBcAGt5rj40yNMFE8BUuxH3i/71yVmslUIdQzmLdt1anvlflTaozfToeoRs6X/7qJepi8ZBfSTAeHpTlBHhWgKSjSzIDYR0sonFaXfxnzDcL mRLmjqY8OCPs9L2fWS3zPaN7/2Btk7mggf21nv0aOSgxtEXrXj48dfHQwwCnulZLhZCqjtDFP0vE+BdU8mD9qJ+esj+YqQYI/AHSnA+sjOJ0JHxFaGZDkAQE2vZnWwBS95MylrbWJFnrGR/nn+xdYkKG2L3iXTgC967VBro+Qsnn8vIMxMx0xmEqt37VfXODapFjFw75FBDW3iuMeN/L8S89V3Kp6QnGRIN38Z7vgMif/07gfqHX9intiumyjiAcFiQ5D1FfFyBLbZBSILMv9xr9GyLF0AYqRUI8xWHarSFmPqDREvgXcy8MLgqfcaYB/gnEGi5gAFaX/YmR3gfRzBrWIRQ6ygMk3UI36XWE+r22my1uMv5mDqYkXvhP5pWax+qg6M+bZcPdAHHWojw== 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)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AsHJ9KRUZvnsp6R8TOAgsuT6LUjM1H/t6yUHyAz9odBXCax2RYt5EGowLNpOwjUjtitL/nIuqcmwChI6u90lvjbsoZtngN99D4q+FXTb4r2NzomMDs2nCTun64RPbB88JzOTwWVB3iph1jLpZ+GOaP3bp+HHMGzjMGIRUD4a4IWyo8BglGXqlf9NzKy8XvdN0grfcPUrRmur2B0Ty+43ctqxXWo3jtmXkqsVKtT3Oe/Il4uJ/Amyzak21eKhJk54Vlk12PZIqhbTWjpG60gf8it2hU8pqnuwPQgtssxDOKnWajzX9f+Qz2VnJi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BBbGUZVEpJz1Sma7qSp4aAWkwZ8h7rKyhmky5iHw5ODdYOyFxDaJJ4Zg5hA1/3ZnIos7wwXW0b3NnUzZg81W9kGFq6jw1lIrFXhHn+EhgJp7MJSiChOdzxzW7eqfruWTbd+qMMcTiQI0F6KUXjMU3Hi86bQI4xY3tpuQpCw2AsAnuZSvIHyIclMB9vgdNfaKsd9/aBbT2vqPAI X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 557af0dd-54de-4834-96d1-08dcdc7a7bf3 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:23:00.4393 (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: exUCptaH5lhbs5eJudIQlgtkq4fjqEX1fWKXrqtFJX7TLCV1tH8LoZm6n39ff5a8saBwmObIaU7U6TClNb8n3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_576958_B2D6899F X-CRM114-Status: GOOD ( 14.17 ) 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 --- arch/loongarch/Kconfig | 1 + arch/loongarch/kernel/Makefile | 2 +- arch/loongarch/kernel/io.c | 94 ---------------------------------- 3 files changed, 2 insertions(+), 95 deletions(-) delete mode 100644 arch/loongarch/kernel/io.c diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 70f169210b52..bc97b09efd16 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -84,6 +84,7 @@ config LOONGARCH select GENERIC_CPU_DEVICES select GENERIC_ENTRY select GENERIC_GETTIMEOFDAY + select GENERIC_IO_COPY select GENERIC_IOREMAP if !ARCH_IOREMAP select GENERIC_IRQ_MULTI_HANDLER select GENERIC_IRQ_PROBE 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);