From nobody Sat Nov 30 12:42:29 2024 Received: from smtpout148.security-mail.net (smtpout148.security-mail.net [85.31.212.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BE641B6525 for ; Mon, 9 Sep 2024 13:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.148 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888906; cv=fail; b=Avokf8JyWR9jZcV8vKKhEvPT64KE06G+YkPeBnPuRHF9epeQNIIb8iWCYp6iy0BGMubt86tEvch92dxXLQw/okTZikiq55G3gpCQgjpyibjaKmiJyInk1tvlOYq4Hig22R5fM5PB6yVD8kIlA9W3YfKaMJjUkdMzzeBnQEHAXvc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888906; c=relaxed/simple; bh=isZQ8S99cmzWBeGfBCK3nOpys6uiEhT/93Z9H0zmZDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I1/NAKF0JJA7t6LFcEgL54ihXSr0L99yUirxE8XsDsQ9TATKZmQCxSKqNtFDvw99FF7TDwqt21W1wbn+JURzD0uMuUfAIaC40Yu+TwuOW67DynS5FbuJCRzBM/r7hHdCEYJr9rYYG0orQOqjJ7P/YuZZQB5oZM5/yQ+fGj/zWiE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=il/o1ZzM; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=Y/uqCQnA reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="il/o1ZzM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="Y/uqCQnA" Received: from localhost (fx408.security-mail.net [127.0.0.1]) by fx408.security-mail.net (Postfix) with ESMTP id 24876322D05 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> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/0Qkuk0dowGIidgKIR5KGz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KtNhRNg1DaoroLLhKvoM4M/VUPlWKko6mQI6I3NGUQI7TGRbWRwI/IQ4LbmxAIUMyewz4KQbFsd9z/IDiD9P+QtsYY6tTZuQzTBnSRgZMTjY9rWpeVQ2DullluXlermkm4NR+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 Content-Type: text/plain; charset="utf-8" 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 =20 +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 +=3D $(call cc-option, -femit-struc= t-debug-detailed=3Dany) =20 obj-y +=3D math/ crypto/ =20 +obj-$(CONFIG_GENERIC_IO_COPY) +=3D io_copy.o obj-$(CONFIG_GENERIC_IOMAP) +=3D iomap.o obj-$(CONFIG_HAS_IOMEM) +=3D iomap_copy.o devres.o obj-$(CONFIG_CHECK_SIGNATURE) +=3D 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 c= ount) +{ + while (count && !IS_ALIGNED((unsigned long)from, NATIVE_STORE_SIZE)) { + *(u8 *)to =3D __raw_readb(from); + from++; + to++; + count--; + } + + while (count >=3D 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 +=3D NATIVE_STORE_SIZE; + to +=3D NATIVE_STORE_SIZE; + count -=3D NATIVE_STORE_SIZE; + } + + while (count) { + *(u8 *)to =3D __raw_readb(from); + from++; + to++; + count--; + } +} +EXPORT_SYMBOL(__memcpy_fromio); + +void __memcpy_toio(volatile void __iomem *to, const void *from, size_t cou= nt) +{ + while (count && !IS_ALIGNED((unsigned long)to, NATIVE_STORE_SIZE)) { + __raw_writeb(*(u8 *)from, to); + from++; + to++; + count--; + } + + while (count >=3D 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 +=3D NATIVE_STORE_SIZE; + to +=3D NATIVE_STORE_SIZE; + count -=3D 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 =3D (u8)c; + + qc |=3D qc << 8; + qc |=3D qc << 16; + + if (IS_ENABLED(CONFIG_64BIT)) + qc |=3D qc << 32; + + while (count && !IS_ALIGNED((unsigned long)dst, NATIVE_STORE_SIZE)) { + __raw_writeb(c, dst); + dst++; + count--; + } + + while (count >=3D NATIVE_STORE_SIZE) { + if (IS_ENABLED(CONFIG_64BIT)) + __raw_writeq(qc, dst); + else + __raw_writel(qc, dst); + + dst +=3D NATIVE_STORE_SIZE; + count -=3D NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(c, dst); + dst++; + count--; + } +} +EXPORT_SYMBOL(__memset_io); --=20 2.34.1 From nobody Sat Nov 30 12:42:29 2024 Received: from smtpout42.security-mail.net (smtpout42.security-mail.net [85.31.212.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DF9B1EF01 for ; Mon, 9 Sep 2024 13:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888745; cv=fail; b=UbW+lTyfmq+zGuudNIbquVOnEJvgTy++Tq8yrBymgPdc/yfHOkvMXUzOExCTVKP6grAuGzsadPfxHcz3MBF2qd4EsdgIHN2ux4+aWfxTWfzjLj328umZGxQJlkbx0RC237WXHJQ+wpnAVxwtG+fvKF3EORWb+auXSmHv5fV7oqQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888745; c=relaxed/simple; bh=fm74sZv+wQupqd1aA35tAP0V73LJDMRwcbwSpgpGSEc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N/r3xXi7QYSTtuIoTAE9JsOkGwe+cW70AMoUwnQmBPfEab42TU8kobGstPF+LjDN7xmZ6YnCjkZU/9sU/DwA6/OI4M5DF6mhyP71jC6z3mGWxrzN1DFt+isRtCXdFZZTC2zUEifd5LCNDVKMDek2oIIx4ASRqv3ipEWnTy6f8Dw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=bUsFJNLz; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=grfeIMZa reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="bUsFJNLz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="grfeIMZa" Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id E52EBBF8C0 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> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/fmwoBRd29A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J+6MYVPNYOLEy0bDxiLstoL4y+FPPn5ANlaYgwyQr9fRfqJA/tvgjI9HaS/gYV5FvUCLkufuChM/G43akBCc+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 Content-Type: text/plain; charset="utf-8" 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 =20 -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t c= ount) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } - - while (count >=3D 8) { - *(u64 *)to =3D __raw_readq(from); - from +=3D 8; - to +=3D 8; - count -=3D 8; - } - - while (count) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - /* * This generates a memcpy that works on a from/to address which is aligne= d 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 cou= nt) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(*(u64 *)from, to); - from +=3D 8; - to +=3D 8; - count -=3D 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 =3D (u8)c; - - qc |=3D qc << 8; - qc |=3D qc << 16; - qc |=3D qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(qc, dst); - dst +=3D 8; - count -=3D 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); --=20 2.34.1 From nobody Sat Nov 30 12:42:29 2024 Received: from smtpout42.security-mail.net (smtpout42.security-mail.net [85.31.212.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 807D21B7901 for ; Mon, 9 Sep 2024 13:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888747; cv=fail; b=F8d/zAGGCHDWjWYzoSytthFqtinmU+vSGpdMTfbNPoK8stgQO2L1jiF50VofrxZjzuz+p9+ADU4pDRJfHDI3GPy1RYgD2aChoPQBGNJGXyovBhhCqoVpGPUXheklAXZuuS4fbQwh6pjlW6R/uhQCS2ofX/NyjW+vREhzWhkkXLo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888747; c=relaxed/simple; bh=DlBtsP+yHL6mWeXFHedZo7xJcnsxHLkO3HTJki7kIVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rDtFJX0huJZ0PlCTtKgHRq0Plq9rjxq6QybR8c9Fgxj2H9YvFTZXi7n0nAzDB7Pcs5G0vIecp3deMlVR7M8o4VIute7XHQ9PAklU8E7cO9L3SN79TMU/zOo3pnZDOTSmbybEjrzFxh8BhbSv/5PzpdkPA2bPlMdsxHydu2RiBwk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=eweiLZKm; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=q2nOikWe reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="eweiLZKm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="q2nOikWe" Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 2C12FBFCE3 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> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/un5e6yYJMGmA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OtAFBtPJ+GNWDoTv4JLv6D7QxGN2xbLWwc+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 Content-Type: text/plain; charset="utf-8" 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 :=3D vmlinux.lds =20 obj-y +=3D head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vd= so/ -obj-y +=3D power.o syscall.o syscall_table.o setup.o io.o +obj-y +=3D power.o syscall.o syscall_table.o setup.o obj-y +=3D process.o cpu-probe.o ptrace.o stacktrace.o obj-y +=3D probes/ =20 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 c= ount) -{ - while (count && !IS_ALIGNED((unsigned long)from, 4)) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } - - while (count >=3D 4) { - *(u32 *)to =3D __raw_readl(from); - from +=3D 4; - to +=3D 4; - count -=3D 4; - } - - while (count) { - *(u8 *)to =3D __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 cou= nt) -{ - while (count && !IS_ALIGNED((unsigned long)to, 4)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >=3D 4) { - __raw_writel(*(u32 *)from, to); - from +=3D 4; - to +=3D 4; - count -=3D 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 =3D (u8)c; - - qc |=3D qc << 8; - qc |=3D qc << 16; - - while (count && !IS_ALIGNED((unsigned long)dst, 4)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >=3D 4) { - __raw_writel(qc, dst); - dst +=3D 4; - count -=3D 4; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); --=20 2.34.1 From nobody Sat Nov 30 12:42:29 2024 Received: from smtpout42.security-mail.net (smtpout42.security-mail.net [85.31.212.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 264BA1B81B3 for ; Mon, 9 Sep 2024 13:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888747; cv=fail; b=Ml9/GMkf8hZBNwK86t6mobzmbY7Mj8kn1mfn8lEd+gAGyRZEVhrwfdz3ySwG6ntVDIjvGQRVhFMTaatsQHrZ8z70EPjjjB/IOrGguqDujj3rS5iHwgPh8vgO8Jg0PceC4+vzgqbURyfuZ403pKeErljeJQp+8I86BirjUf+BEpE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725888747; c=relaxed/simple; bh=T5uSHgkmAwvTJQWgMDrPyQnAF/YeHQaaCcpuB+cWki0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lJ8u9L9li8K5+Zyo+EUOGLrENAwDyyTCjBhQejH6LZFekYRsaEH9MaOPXVjFhy5PN7vGxHK7Po5hn7o3qfYst7/ew2ItEEgqET718iM7bARfTXKwcBiI0rH0xkaqo9nmWPkW7YKvr8Y4OuRIe60uFVDsuSvvd2VzY+wVcw+c7GA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=cMQtTE/K; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=GSkxU26e reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="cMQtTE/K"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="GSkxU26e" Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (Postfix) with ESMTP id 41237C0223 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> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PR0P264CA0106.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::22) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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+wlpvTMlKcE8ifjOJbbT8mLNrzseBH6ykK0XwWhSwlppZPbV6P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BTozv+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 Content-Type: text/plain; charset="utf-8" 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 :=3D y extra-y :=3D vmlinux.lds =20 obj-y +=3D 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 =20 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 c= ount) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } - - while (count >=3D 8) { - *(u64 *)to =3D __raw_readq(from); - from +=3D 8; - to +=3D 8; - count -=3D 8; - } - - while (count) { - *(u8 *)to =3D __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 cou= nt) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(*(u64 *)from, to); - from +=3D 8; - to +=3D 8; - count -=3D 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 =3D (u8)c; - - qc |=3D qc << 8; - qc |=3D qc << 16; - qc |=3D qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(qc, dst); - dst +=3D 8; - count -=3D 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); --=20 2.34.1