From patchwork Mon Sep 9 13:31:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13797049 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 9E2E7ECE579 for ; Mon, 9 Sep 2024 13:34:34 +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=gFX4Nbl+cIIYBfgTMBFIxu4xXP0OyUcfQnhOLMiIhEU=; b=O2zb9yl8OlYUnK+HRHwvNQSMV/ awEw3U8RM4ujd67Jsm4z/CoPvuPGX7j06gvO9all22hvTa3B5MibKlUM6sccM1ZSp6Q0tIbN28GE7 BlETIxc1or/E1Kkwq1ksg+EgBwkryBbob9fHYkC5d9eGMCGGlRO7welcnf9M6xnlKFOA/FHq9Xk0g QnhmeZ9wpr7Ziozy5asuYum4p3Ht5JHHInjzqB2X+0MbgqqpG63ms0r6G0ppls8He6UiWqQPnhh7b kFixzSoyGt6CO6R0NzSIk6Rc6U0svndBndHpg88CCTn7cSqiOxK0SjEtubsjqt2aIJk/1vW1Qjuqs FX86fx4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneXA-0000000259R-36RI; Mon, 09 Sep 2024 13:34:24 +0000 Received: from smtpout148.security-mail.net ([85.31.212.148]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneV7-000000024j7-2JiY for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 13:32:20 +0000 Received: from localhost (fx408.security-mail.net [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 22BEA322CF5 for ; Mon, 09 Sep 2024 15:32:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725888734; bh=isZQ8S99cmzWBeGfBCK3nOpys6uiEhT/93Z9H0zmZDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=il/o1ZzM03mdSzuqu7xsa3Y1TwwtA5zqBho0TsgWwjD0XELBj9C9BQ1QEkuCmqkR5 70+9VgQR6Z91ouL7v7bnQzU4JyH884HafaCOJ4t+4Y9weJRA35qmyOBan/6+JKUtx4 bHfcB/U1ASpc7j6pel/K1JhZMdiedVcd4D9HTyJY= Received: from fx408 (fx408.security-mail.net [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id E89EC322CDA; Mon, 09 Sep 2024 15:32:13 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx408.security-mail.net (Postfix) with ESMTPS id 44AC7322C79; Mon, 09 Sep 2024 15:32:13 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PARP264MB4655.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:42f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Mon, 9 Sep 2024 13:32:12 +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.7939.022; Mon, 9 Sep 2024 13:32:12 +0000 X-Secumail-id: <349.66def8dd.43827.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ov/Sw4qJUsGSPz9j8P/EctN0lbsDXwCPINa8pUL/w4WAY7WL4C4XX1cKnQRfDoFWriLiOdHl+e7mNNLMldxeD1nrIN4m0qtDiVdl0EQC/Tg1DB1ucztDbnkBCyWVN3RmVGpOHhOzURldxjWziJpzSvkvUFG121YoeLfHBUsO0VM/2iI5IC5s9Ry/IklVoPv0CYVX0l4y4XLzRXDVeD10I9A7CQCYgnjOw3vJake2QBxuRiO8RF8GgSFaCl/DeAw/2Iug3NazeRCbmnL4gqVwb1rEafpcvE3zWu8uA2DjJNC5eXTvKjE/vbdAwFRCoQDHfpjl+pX/PedM7hEue1MCjg== 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=gFX4Nbl+cIIYBfgTMBFIxu4xXP0OyUcfQnhOLMiIhEU=; b=KQZVSnvaWyYgD69ESRCWA50axtx/AjIDnR8rpga4ip+FSFPf57aNxZkS3/LK+j3b4Xr3OJ3804X/lvdZe76dM/B7NkkfnqeVDCXZpGbjUf4O0aNDkFxPFr4ade2fxwNy9CxqLIK+ddIvWcpJDJNrzeaygUsVB2G2w8/buNgCcVnFtTxF/1gSvGDCiocdLwmEt55Nmzt7ROBIRb6IkmJTNI4YDmt8IHy7lPvjKis439XqnyI+uLox8j5oQvAx6c3m3NPMzv0spfIIbDrZSHADrAyFZpt+PPoWo3f6Od43imYzEhMlijLAme/1F+xLyPPOGItRutjULHJIJHXOWDB57A== 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=gFX4Nbl+cIIYBfgTMBFIxu4xXP0OyUcfQnhOLMiIhEU=; b=Y/uqCQnAdv4SfvXpTB3Q06wOrpynD4N72chqz8VVKaPHyvTwlkUVorO1ya7qSzWyJgRdUYAz+tbyP30JjzjqSKgnxVKz4QA7RIzL8lpkKNLMyEqSpN1RSBaQlEMT8zd5T6UHmcG6MAxl3eqWnCUFzWOfl10hG8oEg1UJCxUCH8zAPK8Yl+zK7NBs7nQm66AGf8sAwZsuJ+gjFvp8IMNKS6VAmm4aD7kdFnq6ZkMbPDBq+xSkfhdBPmjDZrUypA8feP9Gp5QJnClJFRz/dRJ4DAxCsujFJFoXdvtSzlbDKhnnAXzBOELXE2dDQxll0D/SsFv0GaKd6WcC7YKspzZLLA== 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 v2 1/4] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Date: Mon, 9 Sep 2024 15:31:56 +0200 Message-ID: <20240909133159.2024688-2-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240909133159.2024688-1-jvetter@kalrayinc.com> References: <20240909133159.2024688-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PARP264MB4655:EE_ X-MS-Office365-Filtering-Correlation-Id: 9915a7d5-7d85-4edc-d4ff-08dcd0d3cfc9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: x4LeuOgNcz4NA3LnB/wZBnnG2yO/dDQexXT8aNVxjI/NnwB4pmGhxVAVKKIhB8T/3kHvuyHD4wHuIklu3Qs60upid7D0KNVSuE/ipLHzYtGqDg2zqdVS6BhxJPoGIkFcVAbyzokFv2WFPRx4zHASJvDuWXMqjQuFhdTvWa4D6wyc4KEdNQldaYuH09XZQq8qxDPfrpfktjfC2jWfAt6PYCkP8wuXdKu3M15cZo7qhzb9icbpbz9NxjIcL3lLyf/mCySAFagjOZWJS+tm6Iwd6zSWrLKetnKycl1QKnLbTQeKMQDn9E0V4+vbeZNv+mfNxnnqTzIKE1G+GMil32vn/ylIAAOSwHgQeftJYqDP49elQklqhI7TVkR8Qa5bQjiMEx/nqhb2J6YJg6DqI4m2vf2EPtW//MX3Un0tWL31SKtm3wjHhLlJjyRkPIbw3zZwYdQtr/UYRIbVCcJpDa8DBnRuYg6ZSl7edLFiIifi97iTPsD1JuzhSZMxaBEqj5Y9E5Puo8y/K6+mZQzf4SlQhrAphCQaE7WHlZsduGk95mpKxX+PvDwFM0yWNlkhJFEaRPS/OZxWwdLyWE6ihxYUSem/KYDJCzBFXwD6HaJ2YcpaUjrKFsWI09ZEw5YG3UnnqwhcqxKY+ll/WU4z15mzqAmJzjPilMDPjkjMQwTTBgT4krCM51/troKLs5Z6cw/Hyr/rnNwrQW+GOAuA2oCzfdEd0QW3bI0OLNQ6CEa9fVg+lhudgRj8AH+I630Zy1+O/o/3SVzWSh2SiOpyIm2kLnvTjF+1dqbgrUZDQ3Nkh5PVpK6TOcZJaaGjYMcocyyFfB8QxB6uBkNFhdF0ZMvqNjFK0PP1PPDfYYp+p0DtPheCU6n+M5nfcVh4CRwZ/SMg5mptDY4fvm6uJHZd/U2TtBCtQZv7R5Gya/cRh91+IdufP2V1yozshCsJh8OIGQlQwvG xJC2/mA5Rxp7GsbDoV5cYEjM+Z7yVzo2IuHvlv7wxzGaNILq32W1biv6UcgSK/bdmfItGpfOXwUZou3cnJ+g3cKyBexpK43JN+rFFn3Mwt5a16ozBReL1lqzotAQAom/8b+1hltQg6kGKJ2e0fwL82SNEAGqcaFs5Ap8ql+wgDSXEsu5spj0Qug8zO+SJGjFilqVtggjT5KshDtvFhwHy3Po3RKE7HUnkjxMkNQoirY7IhHufaBJxWSi6DG1/YOM9hdoxgtOshtqe0QIl5CG8Cj1Cr5/FlXTMAuFBOI8QCyBACI/fJOHMrxDwM3/CTFqB3gHXbaS/HqZMThAsYvlDhOyonZJGuo2fKvYwRr0dZDmozwRjGbE40MjRQtCzKVTOU7lqOzfQtdKgEowswzJnVwGe4g4W+LHYdMxwKDWG3alFuv3Z0QqRVFhkBLozpMnLHugA4QP+IGh6dVfk5Q== 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)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KauLMa9y4jpBDHrhjEGVXb+I+kHgU/0Qkuk0dowGIidgKIR5KGzlO0yQsnRK+Y3M/vqwi60lh9D8A3Yo98XIOBIH8q8ZbMrsoHNn1KvNIGJ+tfqkpg2gEaAgpP1h01eN8fzGW5vewrR302RmsSKojpfFG9QRdAVRkh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WpeVQ2DullluXlermkm4NR+65AcwbYFFvFg+eAqew9Zg5FtOnok8r8R2J+8zC6Nai0XzL6136hm2uacj0tRAPRUMCgqqYw9JkvRPN3hPFVPDR4S5luqpmwV6eLrwmOYSp2vJuviwiMjGPSHGofvf2j/pzKajGonyupTafP8M4qkfg6wh/9JrPI4y5dl18nOoimA63YAJAeD6IpK7j+J8+2LH/D6ans00gtfcO6nKoQR778IeT06TsJmG8Wsz/LBKJFK7qODracQZi6Zqg4pPMroddn3QOY3taG72ptYlv3GWvFELSp9YZZvsqZVj09lS37N6/H4Iu6jQBbd4xwQ0RHcKIa+0Nx1Zo X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9915a7d5-7d85-4edc-d4ff-08dcd0d3cfc9 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 13:32:12.3633 (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: ZFHObUEBWe95lZigCF2GWCcMuRfadhAD5kd3tAX+Z+/wGqhk7cgJh5kIbhWfhiOr0c6UB1f3M3p6EnaDX59llQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PARP264MB4655 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_063218_510268_957D40D5 X-CRM114-Status: GOOD ( 15.92 ) 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 | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 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..bfdb84e87607 --- /dev/null +++ b/lib/io_copy.c @@ -0,0 +1,107 @@ +// 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) { + if (IS_ENABLED(CONFIG_64BIT)) + put_unaligned(__raw_readq(from), (uintptr_t *)to); + else + put_unaligned(__raw_readl(from), (uintptr_t *)to); + + 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) { + if (IS_ENABLED(CONFIG_64BIT)) + __raw_writeq(get_unaligned((uintptr_t *)from), to); + else + __raw_writel(get_unaligned((uintptr_t *)from), to); + + 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) { + if (IS_ENABLED(CONFIG_64BIT)) + __raw_writeq(qc, dst); + else + __raw_writel(qc, dst); + + dst += NATIVE_STORE_SIZE; + count -= NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(c, dst); + dst++; + count--; + } +} +EXPORT_SYMBOL(__memset_io); From patchwork Mon Sep 9 13:31:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13797048 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 020F2ECE579 for ; Mon, 9 Sep 2024 13:33: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=SVUX+6s45Z0ge65VzI3FZt7ZlDdHSX5oJ+Km/4ciA+s=; b=lsZeSh52lkrpQ1f9bYgqlRDFNZ 73pMt12BOf35rgqH1hz2OYahi5OoodIbmTAxz67UJufZ9dVXtDpdjyWXDqkcSJ213FGyzw8CtNIem mB3mykl7E9VVK+nefoJ0ekfpQnSIIuabeUgGSyCy2iUPSSK4U5N4q3+jGl1zeAT2+cmrQcfVBXfa2 OBPpnokivXpD4EmolIO0vTAYskbMMhjph859TpOjSVz9W/DthKeC30bCx6zURvNlwKnWt370QinB/ LP054AV5YZBuK7EN6zfMAui53rsIPWW049H4+S7x+9quYTRvKto21RFauXjyrMEZhOM6PRMRVIla4 BmFbIEPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneWB-0000000250B-1LW6; Mon, 09 Sep 2024 13:33:23 +0000 Received: from smtpout42.security-mail.net ([85.31.212.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneV8-000000024jB-0EP3 for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 13:32:20 +0000 Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id CE64CBFD45 for ; Mon, 09 Sep 2024 15:32:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725888734; bh=fm74sZv+wQupqd1aA35tAP0V73LJDMRwcbwSpgpGSEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bUsFJNLz4Y7LBsGYrfR53UrKPNnKEpe75aQoo9qWVff2Qxb5GRCYjPv+N0eRFRkzv B9XRYkeRjxbNioWf0I79uGsCuNzx/EYlhggWDDsWn2BcKuH5hsgpUf3yuXLeaJMmIS gEm3DLV3AbaWDGbOC46nlhPDlFot6KS3cBwRwCdc= Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 871B9C0066; Mon, 09 Sep 2024 15:32:14 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012051.outbound.protection.outlook.com [40.93.76.51]) by fx302.security-mail.net (Postfix) with ESMTPS id E3642BFAEB; Mon, 09 Sep 2024 15:32:13 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB2580.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:35::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Mon, 9 Sep 2024 13:32:12 +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.7939.022; Mon, 9 Sep 2024 13:32:12 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KWjv4DYHlHpZVQH7VzeDCs+828PD37TTOUoaz9IREIecXVl7jkzRNqng0DYSi1smI7xNf61SzHIEXIYiHa9z116SNYfhGxWHHTX8KTiyy2qDgm4cpbL+u0xNl7qgrVuaGgW+UhhDJLyAKJ9QuL8s5KRPWqfDM7HIZjKWCw7WM7ckPFJwc3ExYYWDX39T8u4cprn6jT9/DXisS4iYFK7vVwCnMIOsly/w9eAO9b4Zx8xLIf6KHQAAhsrDYUzP8onecmQbCnGh8hxpxbfdTP9HkXdiPQ1ax/JlD78KYYy82SAu2yEpeXAKZWFFrD1VGyN86Rcia+uADO2UvorOW6iMrg== 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=J5GCjBYt8HbB28NjMbmFqHXI+XXTPFUW+isNOJD++JUoYPS+0VqPmclnFb7OHfOfMFtWAB+PGEJdpYshIreNTxyY+ZRS3r4dMiqFgx7DkREnnDlbnkVUFczoML8iVUpn2mXzFTbt7tsNtoc+XJ3Md8ob3IPFOw+oE3BiNesiKLRQ+FYSMRl7FHnWjVbhcNJFbqg2ZWq1QkJi6/XPexW7KcunlwRKkCosYKwQDDCT3X0ZwTGCxAkkg3zwVUpGon7OlhzxD+SFFIjL/8mUCcH9e7NokKvsd7E74v/uXs8dLa1BIzlLWMwey/mBLcvCJRnRYo4PydFNkcsnPOLGRvGNeA== 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=grfeIMZax3zk8DiOduqxwkZOCJTPrVNo6ll9G99jJZ4TMJn3p4J43H/3/eqBb4iRTu4MPJbYOhAwi6hCQaEtlwI+YtQ8ejR/R9THI+PnGi5+ic8XTFJvQ0O6BzbcjQ14XfwbSnprSOybJFyhw/9gVK5ekTCvDwP3+s3fapvoFjurzyrZJFbNgc1aagfMXfJJR7K9qbijLTH1MfPQoxuFtO20069eaiSUFFbmEXPibtcY4vxXIjCrdSp9luqdeSBcaUbe5G0xzMd52pykVDnqfATDvG88PSU35g5/8RAE0OVoJ4q6DXo0rDHKMAgIZipY8ogwVGHnMJUtGNuLtrmoMQ== 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 v2 2/4] Use generic io memcpy functions on the arm64 architecture Date: Mon, 9 Sep 2024 15:31:57 +0200 Message-ID: <20240909133159.2024688-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240909133159.2024688-1-jvetter@kalrayinc.com> References: <20240909133159.2024688-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB2580:EE_ X-MS-Office365-Filtering-Correlation-Id: 3386f99f-5534-4836-e451-08dcd0d3d008 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: hOIToskQQwTquixe7ZyknEDO61S+BH0/UFT+eigrrIT+Gy+3CDiH8L4hyEgq8x22Kxb6yMLAShWjvgfXaUazxK7GIBW2wCEOTplln3mUuDjGVlVKbLMdBA5clNCQGfSullKJw54/B3VxBbfyYicVxang0SJ2cR5QtuykA3DdAlifDQIOeaQVtWeeiaJdYCIj7mMdeVdQV3GkxCxOTIA3gzdRa3qP+5hhP6mqHRBu7oxXq1D/ObSEZQ1t/aExuyI/ye6v92sdgogD20tlkDKvyU9lhyRS2bM0dkIsdwwn32jRnYl2386+C2C4PtmgAF6dKxc5YayUCkvJUPbgA8SAoiG/dAX36XOc7JQi6kfRgj5zGrE+cJb7Z8PX6xawsB6nsN/gY9U53PVhoJ2oGKS61uwpBKZ6GHaLdCFgc0tRORgLDFELZ8+TJwEk1o0eIDu5Mdi2AhIToTTaE3LPpdNyciMQuvEXGENSbLKXMVo+3Ag2RXgyYw1MKssOdUWGpQ55bps5FtaJWLYzHqNLKNU2ZoVf3nghSOCWLfGyJqyKHC6Xbe9kxUu7ohroOUhDyk5ARVQIb3tHR6Lz0Pe3F7rm18jgeqO7Ijbpx/5zLZ5wI9NfQmrsDYOHbY2KMbzZhh9GnddwQHfItoYfilQDtfxFYLWsphLjscnhnVGWeTQxgjnblc2GJGDfmNUC75p+Dw4xsolZLjnyI2d+ujKWmhw4oQLdYI8QAwi5Kb5kQ1ujWsuwNspkmNbYf0DJRc/VBmNgnkM2wxK6QocZEMTU3QhUZYhYO+/a95N1mfdryJpVPkjemC303Hau4yEEA6kvxba/T7ez2MhUNSV0VMPf4KdR6tC5JGOwsVQgzvPiGFHSsDrdbNnc1PvdrMgzkMYrlE99lpqnCfjW4LGE61o2VsrYC56HMCV3ZKi8MpJJH20HWd9PFyrx40z+o01b9yJh5AbAsyb TlxK96kIR2jR60xYpcuUsgRDKsR/BBdEfgz3Sr364nGhwFF1WgL7vrtSUlo3RWNaOllL/Qg10QMiVksSvBYPisYFDGuF/YRicOfFYdi3w7KrqjDzPMoildl8cofrkSjh9yi4RGY5w2lSoeuHQwRxgTBCLFSfJlLIu8pgGW/7aDADkACo98XZLmktQ+Ntft+s4/n68jLtioNNuvMNrNFs2alJvo5dmPXR+M+W/IbdIP5yrBGM+jqO3ZIFTjqTSov+E9/F5n9eXrQgg/+ypTkT5qvgqgyuHLoM/7ule2EmOLOPJiFLZLVFHOJTssJP1PRUIC3oSQ6W9Z2WleicbbuHwdi/BVFuwgxN3ouxS4krz3vXSFHhXjVsNprlwB6OpRuR0udvzj4D2PTz4oIVlvM+zvzL0JOdO0YU/pYR3BWUR6O/XUn1clJa1ZNq9FTwl8BSio/e9xw9EB5DjE/FTHw== 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)(7416014)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QNOIDnp30BHxCy6YTTlXBTzZnf+yIKn0zi5zcZpPFKiGD2fWB5EkW4TYU/iN9483vDnmQWRP9bq7gWVqidaGyNRBkGiGjmFtufUCP8U3vx1/55kHSOK3aubixYkWoILfnz2HPgqIlZDAqRRTDfKzjDOtd/3iEfbutjMAjQ+XxE38AjWExce2Vs8h54dX65X3UxGXNLd31t5nXd7e1AZRcBC1tUe8P5rOwrC4vxsYwXTka5P/b0NlbQ2+nIxzciNgMzZ56Zb2yF6/DzW6Dodk/fmwoBRd29AEsoD8pgG0UljJ7zcJa4/Y5BlhuhJrOe8zDBa6KgfW5ubF8Do0wD+m0/cJEq50wHA3rF0cc8x5qjCAh6v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+k1anCkVPE08ZFw1UiXrLDCwfMYizq7XdqJzGdi9uqgmWe2LBc8c0Zip6v/Dg5mMmXOCLi24PDdTGgvpMFR6+tqE3InvW62g4d9HaMDrag5R9X12m1un+etzvUzlvByQNypDge+Iy5JnqJRnd+glnHhOa+we1 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3386f99f-5534-4836-e451-08dcd0d3d008 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 13:32:12.7946 (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: t9lZEfMDVHAsCGG37qPh7/CkSuDYWd/MNRRoSUGavv03t6VoRy2KgUqknqhT4BokUUkeyfLLM9TzIADFDDeeAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2580 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_063218_512220_8032409D X-CRM114-Status: GOOD ( 13.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 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 Mon Sep 9 13:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13797050 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 05611ECE579 for ; Mon, 9 Sep 2024 13:35:34 +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=rBZDihIi5BzWsLMlqsZEJ4q2zb oL6ms2jxQYl36G9Zy/PuYSrmCkbz+oD11/u+9GTPoXu2KkWl0pwPjxaAvdgjkxoIi/nxhxhE+7p0z Vz+zwxWQH/6bXZRTuAhUW9i7DYi6yCGO7lykTh3V02+nk0WgSTnmi5BJRT2DDVEgdLs5vNuu2LsSx WkxpDNt7GefYhF5YUTMQEDmjhJKNd9kWbw1I5cLgiyMcNaqI+TBcSrBhB8R9AdjnY3+p6s8sQclV8 OlwjpqURKaefRaj3f2970S6JUBlXig4bEuB06XsCAu+AkLapM7GC/W+mWfny9EcZCOfFfi0JpYHW0 0hMumDwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneY7-000000025Jf-3PxS; Mon, 09 Sep 2024 13:35:23 +0000 Received: from smtpout42.security-mail.net ([85.31.212.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneV8-000000024js-109e for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 13:32:21 +0000 Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 12F66BFB6D for ; Mon, 09 Sep 2024 15:32:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725888737; bh=DlBtsP+yHL6mWeXFHedZo7xJcnsxHLkO3HTJki7kIVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eweiLZKmpbQUqu567lva0xyrIiOEjDtWZ/eyEYbkdXAgLr8Wh8Dw539wv/Qx9t7be dPmCROSDt9oR+26xLISoyGVuWvZGA+Afog+TPjuglX2JQDvKn2s/YttV0aRcR/xhM5 p5ymEfYi0PJ8VLxLbYNNMGBinEsYoCWLkNfib1cE= Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id E1617BFDD0; Mon, 09 Sep 2024 15:32:16 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012051.outbound.protection.outlook.com [40.93.76.51]) by fx302.security-mail.net (Postfix) with ESMTPS id 5AC92BF8C2; Mon, 09 Sep 2024 15:32:15 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB2580.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:35::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Mon, 9 Sep 2024 13:32:13 +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.7939.022; Mon, 9 Sep 2024 13:32:13 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FyJ5hM2/8Ag4B/ws8+sfPAgo/Cfj6C5Tkddz0dfpQwBtpFqueezh7qtJl/oK1SbTmzEqz8mt0oigq8OGVFq68tMtHsBy0e7/P6UPIBCgIZC11+PuOYiuoJYyItS2Ia8IQFOlmRDy/ufJuvPbHyD6yewKlK1KaTd9mKAw+zts1XH7NTf9wIqFAmkXAoM+H/amS753OLZWj0Edf/A4yh5Gan7HrEjIhDwORxR6o5kQV4C5/iExItgX3YFPf6q+1l812DZiKEKSw33brtNgkH96e++R5QuhDJCk/MVx0jbdqZylsTJKEoY43GV7XCsIPBCYW7d+phhngzp/hG75wCWoxQ== 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=pvkejmH+JTu62tCGkrxAGoU/I7f2zWJTzuswrKajC61bcq5otV4NqIYt7BUOz1LoCqUG6QxCaVaNW3kg05j4Z4jBsv3LW6V/o80pKKZAnchbRbD1OYM932Dd8bcVYYPB7UY2h2xpuiDNpmSPi47dF6XFTBwd8O2gg1El+NQ3SbtaouMzFYy0LBGBGn9C4TJDu2vtLuXdCnJEjXFPE0zhOBlfHuzA4S6Cob1EYL3dBqKk9IPqR5pB1419gD77ibKSvWDBB6++XxbHfWp7E8o7wixr+3v8rwMBC8MxakqhZgkTGgpC3eCoeY2hOIS6YZwQrCjms9opthrdo6xR82uHhQ== 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=q2nOikWesCSR9cmoy3xUOeDS7gNf/I6ZICjalPAhE2vOn9Ak5HpGfwYjHSI2X7tI8tgsZhFuL3t7z0SiPPUg2BayO3cd/0MRCxrzXG35oENIg+71Lwh47m1iaz5C+3DnNMzZTPTbTao1NmU0xQM3Xu+It0k0Y4fDH1AZgENRWefHOVL88uzF3UYFo1j4ZEHN0uzUIinv79corbSm/OwEX02Is1UFteswYnCaSzMm5GfT/5T0GzQmjMPUTbrVgVVnc/kZToq+nIWRgho8y/FMmzKylKbE30BOk12TB3+xwgtdP2eRw5fNCcTThM7xxif/BDkQQuktvRefGhMf9T1EjA== 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 v2 3/4] Use generic io memcpy functions on the csky architecture Date: Mon, 9 Sep 2024 15:31:58 +0200 Message-ID: <20240909133159.2024688-4-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240909133159.2024688-1-jvetter@kalrayinc.com> References: <20240909133159.2024688-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB2580:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d01f4b2-6d83-499d-ff56-08dcd0d3d047 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: rowxQE88TECXkVp4EA/z5eMLyz9/dhdBh5a4+szikOVsg5v+BMomlYrkHOoDqEGVcHuX7RuBw/VCZy6/U/Bsrc2e/+kILtJp9HrMgZRY6HFWAtY7+fmv8z0T/2KjbyHBKHYML47WyD8j+Uh9ncbMLHnvoJclurFllQrFjxM3KVWLHGLVASEJSngiBIlRgQtDfzy2E3LdwPlSwL8JGsrkXe33N1ksUktKJc3IFnwOFAF2byyFzU9PiK1zo8RJjuCvr/OmOmHnzlnpOLRz/ocdn1imTnQDpQzdXyeEpgen7+t7Gtiy1IROgkDw+x7Ny16nnFlQ9oY1N/XrLBoxE9zwalAN4Y6opP3bUe3KDK6ukYrVWSvf0V8s0V71p3GNfa/4ZGXOVu4ZS0R8OSG25IKujTufdCQp7IaILbWWAC6ZONRlMslOw3rPWHWQpupkPDwi6c+W0vceySZVUhV3aYOi6wA+gOOyw3lNZTvz6Is4V4++qfRbWzxduiVSsygG8kNYc/i/77mvZQ3RfKKqH4noIOCbbWJhG2xoKjfmxNFbRaNhp6hLpeCPcyc56XKgUsKiNIUylKnYomCbA+0vLapkJtT9LDC+o+FWB7z67MORydFGx2L4qBOp4fPJkwXYO+MbfLNqZPSC2Eq225qTS2IHyCYfX7BpCCix/DuzbGysP4yqCMLPglyrWojoJL3HyWY07Jc3+0n91Sh6VE3jnkF921ctt6Guj320AL6ywm+vI/vZ+Kaov8sJX8qU3BP+APYqq0LY10oGdE0WRMXRmsGFMA22lXyT/0kGA4Z4/WOOskV2gn3y5qPSHuiQWV1oxlL5+K1PCdBjRe4ao74SSFYXhaw6DFQD6QEtoen76I0UxNDqtiB7OBiBADs8ehEEbIe8rWItu7O1pYgUYOC4M9zeXeFaeu6XqRipGHN/ZrX3f7KYbUFwT0MdnMDrVN9Oq0Fzbuu XOAEtvarjw+hOt4KLTHbrAEpUNBtR1zS/TsTTP0F+Zx2r7T/qNVzSrw8tHYS2B5zwG1XHS9pkWhQNwfeOsy8nyz4sSt2qswC1I/TBB5m4Uq7jxOtfemjvTLu+CsuvYi3Ye1jih/k4aO/bbgAvR4aLmIaLJbv9CtVdzAMH323ga+GtUjwiFtJ6xbjm2XCUKA77NtH6ynC5Qf7g0odH8BmCfUsQhdiCWxVS3Xgx/RlG4IUWxMYDDP5b8vAjZC1mZje77lNBXNTehl1EdgjYffI/oZcolOCo4OSx33ybDmo4IEYV7BaHrPfQJsXMk0tYlr9laj4YET3wGftiKG6wewqYmwD06zAqiWyOEMKhDoxv2uJiavGA8jcM09ZDSzd0nYbzfdSoiqg79baQPVm+xo3ksOECVfhwGbYSSj869FitLEzIpD4/QgsPUtqMEErJHX1PRVZ87YTIgr6zCgqhlQ== 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)(7416014)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xljaU2FhCyBG4JtkCPqX7RxlZMGS3I8kXS+0iEeN+r/un5e6yYJMGmAv6PobMdq+L8QlOBKWn+uc8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6D7QxGN2xbLWwc+WnnznDc2bv+FyjtOCHWG3KQCa+LZzJ3Kg7T6m1EGbAdz12siv5BymEAbwNqf8XRKACnQROovc2vk3qiR8wQcKCZ+kytMP1ii/egWTWRHzAwufpVY/DTc/3M5eE+g8zIprVillA1AvQk2hX4JCVXn1V02CyYj7qwPJeIjM5fxHutjOfLpjtUCQGSzZeSl/y8gK4Afe19OV/3QMJ/kpVLcIcd2rBBMBGinXB9RL4hQ2uJgk/u6ljRhydmItWbeVIza3iu8nGfn6NWqKulEwvxkeVGXQswgm5Cu5iQux2HaAq6mguOGZlupo1RLq1NFvdYir3XNnToiWM/8z9xNe3eBXdhfS8N8cN57PSDr6FtDftcvOh01hkHxOTi7C6TJD1SDzzjpue1uiPa2NHyFOdcGlDmJQVbI96jOA8gH+Pfka9AcjgMJbM X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d01f4b2-6d83-499d-ff56-08dcd0d3d047 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 13:32:13.1993 (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: CJ97Xy2DjSY5m5Cqrb+xVSk5PMgvlTYZnJJST1jEVAA6objdgLrlyL0cwZLRn4HXXnechdFdxcPvciw6hAl0rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2580 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_063218_570622_4EBEAFD2 X-CRM114-Status: GOOD ( 14.33 ) 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 Mon Sep 9 13:31:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13797060 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 1F266ECE579 for ; Mon, 9 Sep 2024 13:36:34 +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=mPefoGC6XmJrbFWpAt/UdNEtZ/ vuOSiASA8I9nlqmS0W3KAPsxp9CHainRp3q9gD8Usg4UPVgydUDym0sYpGxkxkYWl5VHrCa8f4JkC dUReS4sgNZvzwaQvz5kSmXvEEVLJfUFH0fyRqacwP99cZAW3ymNCOGVci5abXcr8FiPuF6ciIhe4B oQu4OvKe8gLwpDYi9xCRRRrcUzjtyELC245EbjrKw09iZoUE9jN3ReblCa6d0obMpHReZvKLedSmD VLMhzDVAgPro+1Wsbxs+9ljpKQ9+s06oEhyqGzshMBHqSpn148QeEcGadWMcpUI090lGHAfiBYa76 isC/WzOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneZ6-000000025RT-0N7L; Mon, 09 Sep 2024 13:36:24 +0000 Received: from smtpout42.security-mail.net ([85.31.212.42]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sneV9-000000024kg-2n42 for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 13:32:21 +0000 Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 3E3CEBF7DA for ; Mon, 09 Sep 2024 15:32:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725888738; bh=T5uSHgkmAwvTJQWgMDrPyQnAF/YeHQaaCcpuB+cWki0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cMQtTE/KDaRGCVqNF5utDzSx8C0nYsIQgV/Jm0HSZKm9/UFsihVqepJrnuLwXbqUM WnCt0ORbvrQlwanb5Yv4KptasMJjkojL/KxQeBKwM191j3uFN3MSPA5a11Cdus8/cp DZMNiH5KgaAf/MTMrQsdi4C+KfhbaFisV6yDSIFE= Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 1A706C00CF; Mon, 09 Sep 2024 15:32:18 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012051.outbound.protection.outlook.com [40.93.76.51]) by fx302.security-mail.net (Postfix) with ESMTPS id 850AFC00CE; Mon, 09 Sep 2024 15:32:16 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB2580.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:35::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Mon, 9 Sep 2024 13:32:13 +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.7939.022; Mon, 9 Sep 2024 13:32:13 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vzcEhMzCB5WAqacwPP2ejBm7TLfOnypIDjzf60VGm43A42eaXiQCUuy51wD9l92odRVNckGJg8l8JBX9/OOOiXP0oBBCUxgIYkszx5K4eduGCX2Y4/qJO5VoZLfBgYlMhFJlXAT5Lr1giEFXbopIZIEYm+t56BV/gTrHZUG12DaBBQp8DcAb7OFtR5H0ym2VzgeIT2U1NmvfCoKBCKhjlnFlXX7JlTCXUehs5FnoksMVhOC/h7u8vQnnFPhhRZF1BPjkaLhRg74yFwiArVe98sEGjGu+tx5kJi0qyf1UyELt1LfoAyJHMYJwaEzojTLShNEmiPUNqXCardgJVqPvBg== 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=vUdpZDIsh5ogiKvCtBSiRFczXIXfvxi/b881zRPSlggsuRgZ8KzhZ2str1qHhhUI05urUPoa/4USW4u5qApaqrdSPRL/uhKFb+sFzgrOvQgJxMTbufyx3pGZFFdgRl4xURwfMt550c3yrZXZGyWGrOoAR3oKAdhAdlkEpia4ERSrRYgZoXlw5JfXOUzomUgo9BiG21xwK3YPx/OR1O4KcOMaPo2UZv0B8aFxZ3doqxFnGYXRbisTdTxr1UTcgCxc7l9nxrlmVUt7atT23LfM8Mu9JXr2xUhsQ+NVdx7yHiHmr68Xx0gWkR55ZWAmWvhbZmMMxU4u4wIC2XAm9nShmw== 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=GSkxU26eqSm0BB71z4WIZ+D7pGIUj56EINkCMGF/NzY2MvN3E9sQbX8dEtv2Z4xSKwq1ETbAeRYg3pXg99ziQB5iZ09Y+Rox/2O8czOHFQqP7HBRv+Cu1Y/mDzXEZZtjKXS62mlINa0sAELMwL3bejBkcZ7hYMj2mBj72TF4NN1m07Y6ScPbVlMMg65jurJOAQBpITlSDFYsABjSW77RhZr5LsGT+cKi0Pp5mIYl/eUWdk50KyVkRgPnu5pXiIOQ3CAVEx0gtluXuzerdXpehSdvFL5JwEk4KjXPSPELUBm6xjlvEpMWlRaja48+1o3kxtivBcb5LiFpycl52wtC2A== 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 v2 4/4] Use generic io memcpy functions on the loongarch architecture Date: Mon, 9 Sep 2024 15:31:59 +0200 Message-ID: <20240909133159.2024688-5-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240909133159.2024688-1-jvetter@kalrayinc.com> References: <20240909133159.2024688-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB2580:EE_ X-MS-Office365-Filtering-Correlation-Id: e0b5ab6c-7f3d-403a-3050-08dcd0d3d08c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: wVbVo21/t8JR9+a733oj8m00H0Lj5AmtVg3fhIsqGJn1iSZrZL3Jgrz1UegBrUD6Yi0XhIUxThjoW4rwcQTC4oA1T2JdKf1Ze2AfwWweCDw6ZNgrRMwMZUT2kvhsi8KudndW8hHdKlZtTnixgGN0bMe6+1nVu/yBJ2TqmtT37+wlpvTMlKcE8ifjOJbbT8mLNrzseBH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om8MTo5qp37i2+Oo+9kiBTozv+EDxFmasfnJ1u4Uaq1/wnTaLvmCSemDqMTYs1fCE32Jri0+nXx4J+qjzpKu67oZ+5tuqfRmxevOs2x0pd1LBusDFrq8WFseN+oCG9aCDs6UNmaQ== 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)(7416014)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WQk643TowifeIdn/A88k7w5dPylACgi02tQC9g2gmlpy5YN0/cT4KJ36gxLzcjA/8FCcuqcoIsKbEjsWGJRAjNPXuldcP6mzDIxH/puHgQDjCGHkHttoDvMX0LLAzA5JyLzxH0k91boWWUrCQ0oT0wmC0XRJvoZilp12y7Ol19s1vyVm0DWjZKJliXsl/17vb597CXhJ8dzHVz4oW4ew1IfV5CWfCEZ5kDoJdHWHtbDr57OTgCTlqdT5y64tDD2+t+vzQzdAXKsuMhX5nAHSsfrNP3wWiBZH3BHvx2dqUPNwtLaKfTXIP/s570FKeyzKi1yLqLkzkhBvlmtcs39np4VemKiRj9eypJE5PMx65Te7d7To9r3NtXS5BgHu7k5BxWhJlGEYE9TNfg+AHQxNwDexrMuJfJ61Npzbt+1oL6SO4kUfYmZ7CZlrrzVBwOyiCaFd0IWPEmbzdPymiQCZe5aZgod7ntJJo+UOJbqgJwFgS0ujogGUreIUqEcRhM6NsvIwSfLkKqF02lQA1FU5gRlgBBylnzCuij4CeqAW8/f/JXYhwrIYD+yaTZUQZ9zYMX/FqG3aRRMzOsdFXMjTJDZG4OCqUAqYEWiiE+tBIGYRLzOa8+1iesHXFMbQYF2a0h1CSRWHtfbyTTRPWIea5lud5CowuEntwoweNhOEDfxNzvG3M7ojlbmrZmxeSHABfBG5kRHpD9CRTcKLLk7p5lTwElB0RxzMmd6cKAFUEmwLpIDHA07vqrE7LTFBZ1XVgt8AaaYoVmvy+jClC/I3qe/XAmejloYQIx8HrT7+SvHUZlVmPZTBFXyvoGzRksMkgIKfMeSQ5VsJ6mq3IM0f6lUoLbaW9xCiWcEWWbq4PhuyjCYaMxue7UHUqYyN2bzDMHnxETENLYmqeST8MW8bQRcAfYA3jH8vnOp/25p7PhsEeQcgsVtXNn3o5Xz1dCev DsgU3o99BWQ6vDQe6xjsLpyhdYwDHJTEXObwInp5vSDQDk33v3aOXtMRORRfkY/X3b1JXU8ER/9JZ0PNfBQxDrHF0rrdBOWjbbxUbGXCKF9ib1Gw/KS+iQHG+poiQJx94/FtsWtEY4lnSG7zbjyvlMFOXdXkhbDzFqH4vqEFlEqxcb2TW3HfmqH4dOB6ym8CYS3LugeiSMy3aW600yIe4gPSu7yWCghGKJmKFxigY/ieFQxocMJFWld7VbD6i7SYtzBIQ1R+etrUFSx1Ylm11Oo8Y6To2pWdC9sSCoIZv/etTKWd3668vw2CLjnoQj3p9FP8XM5LtFKf9ou0+2F1HMjEWLAnNafehDYoKPJNv7nq0Zy4vAgq1L7+s6iK8YNYVpDax5VInpSpIv9AfaGj2xQN424RHVR23ifcZ7G+BynrarW17FSbrR94JmolVING2a40nCdLJCxZ/nK68K9AOSFrZxafFp0yhkb4MutvMChIVkIxDC5Hc4kAforg60Ob8XlSo7yAMQqcQQFLw0ncmVU/VcDeb4T1wtxLNXPXMk6cpNUO7IkYcnSmaNJ238tQomZuz1B6pEoervjxc+am9EIpku60t3iC6CixSAh2cXtqc2K6KUoaaNPZ4MDDJqgN X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0b5ab6c-7f3d-403a-3050-08dcd0d3d08c X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 13:32:13.6467 (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: 1H193o0aDcdLCRKRnPq76LxZVU6pCxoTsoVS2EGakDqdRFyPtjS+PrvctZcvbCHFpEEn///ZD3AtUSDdHrpuyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2580 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_063219_992594_0B0B89C2 X-CRM114-Status: GOOD ( 14.15 ) 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);