From patchwork Fri Sep 6 11:41:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13794081 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 10307CE7AA3 for ; Fri, 6 Sep 2024 11:50:06 +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=su6uqV//aq3x8vFtvr15k76SevvdLy/xrw/uCm36YQw=; b=YE48i9lG7sjsBVEY2TQamj6/XU /k9k93PNLvWNDTT75argwA9MG+2hx/Jk5HjUI/q88SXNu4UEF7pOGyFud4RFf54z5fuNoIpZ398x7 K3mrStvybyxf1NORCMOlWxPntvARCxJWLQBRkLD4HUeuUp19DHfBmeSxHaA0aUheSZpfhrLc/USv4 VlfygwG8/bi5DUuJyQ1L57PYbA0hGnntAIOhltDQcXVr2NeR0i7zFrI0BKZP047qqUlsrhaak12mM MUgLQMiZYHLSWNjWseNdiFc0v0NMxIQNBh9UfzswzSbGCIS3alg/p/0f/34RCgZnRCf0OVBwFtXWD Ne0Y1qIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXTP-0000000C32q-33IR; Fri, 06 Sep 2024 11:49:55 +0000 Received: from smtpout146.security-mail.net ([85.31.212.146] helo=smtpout144.security-mail.net) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXR3-0000000C2b3-3kne for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 11:47:31 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 64C9E349896 for ; Fri, 06 Sep 2024 13:47:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725623248; bh=zsz9SAayOjCkEYXsvfYV05bD2nmMvTn7YzsRgzfj7bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GdBEV7jQHUXOHa3Q7MIbgyOMdx9QvvCgsT+TTQSq+oLw3vdkJltLm+rNzHKYkUbGs o+IY/yS1yqRb3TqPBUHci0oyFIJ51C49W8Dut4xu4qsp/p0I8brAa+S52+rnTs/lWN VN/36yAaNzE7Q6MxrODD8/uXRcMb5gGY0nV9UjNw= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 277DA34988F; Fri, 06 Sep 2024 13:47:28 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011027.outbound.protection.outlook.com [40.93.76.27]) by fx601.security-mail.net (Postfix) with ESMTPS id 41E8834989A; Fri, 06 Sep 2024 13:47:27 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB3466.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:14b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.26; Fri, 6 Sep 2024 11:47:25 +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.017; Fri, 6 Sep 2024 11:47:25 +0000 X-Secumail-id: <1595f.66daebcf.18faf.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D7SdRq+fOuKLe1a08Qg3uWvtFcqWUAo5EybJB8W73kf7pbJ9UUcn0cbHSCg54djEMSi2a0TznGiajLrVabAX7cT8kkYt9Y5ziD02SnI/6YscSIhfcQlEQluwkXnhNpiIWeXJy4ExkST0w5+CPeyXin9bMsE3O2SUB6iJfPvULLRKkTQYFPk4CYR2wG/WdzHwQJyt+K12iQRILFWV/XsVAFEbogm9fRxx25Fa/5jS2gppl5wsO1bqsfuG7K+1t7urhhVPUQmF7Jt16cGvGVfUZfNNaKOUnyMlSQ4MtjwYzT8R7nYbi2eZ4EtAyBcIlvwBi101Dm9KANdau9oyDxESog== 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=su6uqV//aq3x8vFtvr15k76SevvdLy/xrw/uCm36YQw=; b=DRS8geCXop6OoQzmmkrsq2vsadyZL892FmPBP9e7uD0KyOSIJL8t7R3KCvQPin9IJYZOL21el18rovLYOLWlCNH252/weRHGBHcdlSLJz1Tx4QrjV3bWwNFrlik45S3LZzX1SLlreoC9cARMFu/0vykNuCM6yGo1OygRseI2KoOciI5+9fdFFk6uY4yAKHGStyDV7BrY8j3CK1D25VUgsn9/QgjyxW4479WthZq1da88byfK91GAAcYs6VUbUQ3qHzeeL+ucQaw8SAA28h9Gt9Y4qDwTeoGoWMYzx16fQzN5IZu0j5QXP3s4atM6QUW2GXYnJMp3DKFIo2xz6m+AfQ== 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=su6uqV//aq3x8vFtvr15k76SevvdLy/xrw/uCm36YQw=; b=gjiYLUDmd4iNk1gBHtmzVw0ArKn93i7goL9Y74qbH9DEZMduDJLvE5L/XNybG8Eab0BlKPngXWlBarsJOGq8cI1jRzN5yuUALD0PEEEKKlhTrYNDBE8zCsbTfRIedriSp2rrtrUTHIEfqFoyZrnlGFYAHz/rCrioaULRHS7o9KwD+qkjw61+7V9rWO1l+2hSfmeQzerXV63OqX83w2mUKPD8reMRgNAr01gex2hQ2uOrp3lBYF3hOKd64oiTPJU61rw3WA3Q4KtvubTE7k7dB5AmrcwK9S4F714zPIRVcni6JgDrjcFgys1TdEehyhOM62hHsdMHfXfQC7/5rlJjGA== 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 1/4] Consolidate __memcpy_{to,from}io and __memset_io into a single lib Date: Fri, 6 Sep 2024 13:41:48 +0200 Message-ID: <20240906114151.519028-2-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906114151.519028-1-jvetter@kalrayinc.com> References: <20240906114151.519028-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AM0PR02CA0021.eurprd02.prod.outlook.com (2603:10a6:208:3e::34) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB3466:EE_ X-MS-Office365-Filtering-Correlation-Id: 95feb3cf-de43-4739-6af5-08dcce69ad26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: StYenri4oTQVjuheysfK9B2Y9+kZuKojV2BjWWUUQDFXVuJInIFxExwt2Adbb+dYW2rkhBH1sYBe4i5Wv523N3WJQd91ggdp0IVrlqAnevdYkijvjb/jtaoF4v8YLAJrw7D/8cK9Yor7hq7Pr8TJdypjmqR3grGskwzhkrZAdnzYWPCvLgsXYKsA+p4cTu87M8SvHGbCY3N042MK9p8KqmCWtTsvNYSRv+CT9uNYY7GeXtPfx+OICQyGeknf2V3a2obhyCN8EdYDeQOK/exvdAd+iPiS6+btzJ9jrFsEcwFJlQkYei06Xo88dMRvsQt9o3zqH6dc0/bQOkGQvEor4f4oRnzi3Aa/ZRGqwUT1qeyR6pv/KHSgn9hDWtq/yVa9TA4kNsGp/PMQFloZcPkiVbbLaqTwsmvhzeONyVKaqVQ4mGKySFT8EBOjGW2LTBlDdbVTSqi6Wy0SWC+qxsFFGEvoUW8CcaXWevKruLa75HUWpzzy2a9yQqfD3pvkjO8dQvnttPTDAsB9ffK3dEwicoGiq7wJPtYZk9ESEG/nPtx/GT2McDoDPNxlntALObaNemcD2mVW82UB/M79wifx8esPQOOg+hsIUuggHVqRbZxSoHkck+Z6jP7d8dnoElo6i+kp26aEnnj4ndIQiHF/I2TuFWs+W+IQK3qQP/kpzdT86Gn1vBS5n8XED2mJdBqh0JcDaBTj4pzqWhu+0s+KXkmu8Pw0TVTaT2y19r323FzAVy0Baa5byhzQC1Mls+b8z9KOa4Yf5qwBrOwdGFMKdqHYCopR+TSCAtbkJuxlo+phjssC2pqX8KiPKfNfUYI33+H3NLtw2M5QFyAEUuyOv9hIcovQilW4Uu0KBzke0BRQD/KRrYLP1Xs/z+lZfdmUNcS2ojgVC3d3XMNz0J9+9OjoUYl3RTJCOyx1xkEQf3qpkaw1332PDkeWxmS5bz1kc7z b3XQDLcvmT9BJi0bazce3ofBycVRMMa0YA0ho9oNaK2gAEDKZns0ZKsScZdC2yOfVbiWTNEM0EsLuKrhAHwunOSMdeL2oxlCmCS01xorSzw0VGthxauoW949u5VNyRGPDzOrYiUPEoWSYoZPEfCjyt9NgTdTmF2eL3mo22f0nqT3yYlUxdk7CdRkjEko4H6qmJYUjVuaSnUp8FzqRjMiK0/HOIJAYhIZsL/dD/POoHRywO3nRAJTEGNrPC6PsDM36VCWDeFnR+cnhIQi9TxeGE+04W4HNl3ovjac0ymRoXe87M+Yf9jNCHu3fRMfMN9IgCyxoum/M2IZP2LVyVXu2lCaXA/uRSD6ucPYIpgkhstf9/OA++V1vnW2tyrDFnV5CyXpbaGCtMtYpxxg6IifLDvFrheTqRiRj26sJ74VwMjXBPLmfWfuL2l3oIMV+YeoeTlD8jOTjjzcnVOn4Qg== 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)(366016)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1Y0+CJL1bLcR0oQe/rr4LKFk+TaSypyf/KWPMGAag77JYv/Xq9SDbW8QLvak4hXTULoV4KXZtN1xKnjJuyKclOTWxQCDbc/G+bknTHOtOiMcdig5X7dGUZgmWQTcvNHySI8dfe2B1voUx1Xuh8lGnOaLIqgioE6uNOcF1Bjtdn/ViJUufK2sbaDq/GiYEE2rkFtdOl9WMA083Si9TssfVCyRFWfhLR2SwnpZBMOezYhd8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cmHnDHLg3//xPHtfrxChIhB5N5IpTmyV8Xc0tTtRkgVyJiKa83VGj2ENMnG28igBut6zTrzpZg/EsTMz6Nj5aUo0G3STlpibuG14bm6F4VlNoWI8hOjiT/TY6kupdYxApe6uhI9Uadmf5/Frh0eIstOgg2g7tk1vZQDB2wS4egAD7Prc+d+oBOVxx2taczyq3lO+GdLzY+XJWlo1cEWdXiWCQ+9Hw2/nn7biUcn7cC05F3b0hnctomsBc42gc6eTOalYCkSgmZm1SEkE9OPojsJN4EAO57UPM X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95feb3cf-de43-4739-6af5-08dcce69ad26 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 11:47:25.2534 (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: L1cuZXsBDb1x14h5ZCvo6JijXZFbbkq08ii1AblBzgqKlQMw7zcLCmE9NgJl9BO56neEmqzprbTTkgGzWbC8qg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB3466 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_044730_255848_60F0BFEC X-CRM114-Status: GOOD ( 14.86 ) 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 flag to build the given lib/io.c. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- lib/Kconfig | 3 ++ lib/Makefile | 2 + lib/io.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 lib/io.c diff --git a/lib/Kconfig b/lib/Kconfig index b38849af6f13..2ebdc41cf0a1 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -765,6 +765,9 @@ config GENERIC_LIB_UCMPDI2 config GENERIC_LIB_DEVMEM_IS_ALLOWED bool +config GENERIC_IO + bool + config PLDMFW bool default n diff --git a/lib/Makefile b/lib/Makefile index 322bb127b4dc..d231a1c49715 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -135,6 +135,8 @@ obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o +obj-$(CONFIG_GENERIC_IO) += io.o + lib-y += logic_pio.o lib-$(CONFIG_INDIRECT_IOMEM) += logic_iomem.o diff --git a/lib/io.c b/lib/io.c new file mode 100644 index 000000000000..c3385566a3e1 --- /dev/null +++ b/lib/io.c @@ -0,0 +1,101 @@ +// 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 + +#define NATIVE_STORE_SIZE (BITS_PER_LONG/8) + +#if IS_ENABLED(CONFIG_64BIT) +#define __raw_write_native(val, dst) __raw_writeq(val, dst) +#define __raw_read_native(src) __raw_readq((src)) +#else +#define __raw_write_native(val, dst) __raw_writel(val, dst) +#define __raw_read_native(src) __raw_readl(src) +#endif + +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) { + *(uintptr_t *)to = __raw_read_native(from); + 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) { + __raw_write_native(*(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; +#endif + + while (count && !IS_ALIGNED((unsigned long)dst, NATIVE_STORE_SIZE)) { + __raw_writeb(c, dst); + dst++; + count--; + } + + while (count >= NATIVE_STORE_SIZE) { + __raw_write_native(qc, dst); + dst += NATIVE_STORE_SIZE; + count -= NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(c, dst); + dst++; + count--; + } +} +EXPORT_SYMBOL(__memset_io); From patchwork Fri Sep 6 11:41:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13794086 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 C0DA6CD5BDD for ; Fri, 6 Sep 2024 11:51:05 +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=sZwwYglyrTx1lEXqvosLDhicGEulwOlV5lTFb70/X5Q=; b=k8nBEHzOAidAgBFjf/8AMCiw71 0zztgefAfXgfsrayPkBQBwmgnffbpzstSDk7tRtjIenyJTdFOgP8pAKNuHuX9rSGqS6dne4U8TTz+ QIsHWQstbmDe0ebYFdFzVId5ty9JxfX+G8ZRg9TX1ESUVkrgTCmH+/odBo+RDM/Owqh3zaETLQrop L4o05CRPJIMK0F55vfKYUmN5KaobstkRs99K03otXgH3CaCu9zKNg4e6PVXSxqBcdYU/bqaInvvIA G3ZpD1p0Dqk8sb8IEz3iQ8fpxqhKtBKiNm7vvJEUL+djU0ik2utaKHNS2csyQQ0rnOzGAisEbyWxq tr+vp1+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXUM-0000000C3GQ-1MqF; Fri, 06 Sep 2024 11:50:54 +0000 Received: from smtpout147.security-mail.net ([85.31.212.147] helo=smtpout149.security-mail.net) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXR5-0000000C2b6-1g4c for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 11:47:33 +0000 Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id B31B4349792 for ; Fri, 06 Sep 2024 13:47:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725623249; bh=EG4HiiP692ZZmlqeUGqIU7eU6XWTDQxHJUQszA7oXPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VaCD4eKRKdulwYnx73yvztjXmGEb7eBS+GN24/yBhS8E808mYvm4gaeuOXDqjvMDw ObZjsjtcncYgyvwyONtaGfPYSksTq2/UZAMFdgwpjYayKbm69TirlfB91hb59H12r4 p9V4eJ5UEMfofn1uJkimEEGXpL7zyzOnwHkze52M= Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 5AC913494C2; Fri, 06 Sep 2024 13:47:29 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011024.outbound.protection.outlook.com [40.93.76.24]) by fx409.security-mail.net (Postfix) with ESMTPS id 7790634948C; Fri, 06 Sep 2024 13:47:28 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB3466.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:14b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.26; Fri, 6 Sep 2024 11:47:27 +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.017; Fri, 6 Sep 2024 11:47:27 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BZnMoDXoITMbBTiBtPFVXwrnYaLNilVMUSg1Cps/r/P+hV6nKOE6U3RchYnGWhxkjP4eYeXSDkSYEjb+hQ2awB09vK/X64bxHje+YJXzeEQ0DQirWMBCWyeXKfAARSy+kgx49KhqAiLqB4Kavvp1aXoJAdG/2CMtMl7qGjeFaO9GpHeTIJ3JdgETcz6uYCZ+iwqrPKDdoWDVq9gnreYbR1o/JnnwhF+tAiKpy5T6iO2asaViFmPBtmXYYmdCcbmqux6v6c2a6iPv195damo+tax1cGy/Q4ok/HigLGDNBSHK82eTFiKrmGKrMred6lvrU2vEiyFkP+22d3mx9MEBtg== 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=sZwwYglyrTx1lEXqvosLDhicGEulwOlV5lTFb70/X5Q=; b=FVzbpJJ4NiGsotqd3p2i47ltU1PB5KKgv5aT0D7Sd/T/5iB+2hqDtQgixS4CyR8JYpX2VeMQPBG2a+sBeIVnoCNldsp+AluT1cle2J3PZqlo0DE9PSlW+aq/nV0Gej+RlSaskWg/HvFqqdZfIwtTHZLKA0UYHvUOpLbz3yh9UERk5NHJVmalBgQTm9zxLHHVMj5OQYudDervR4/n2A6B8HdqNTpkGteTI0SBmV6UxGr9QHuhraSt1jXoudElpY0qF1orktLIuh45GbagNZI9vfftwC+/C8L4i+DfCzSrTfGtMTdNP1kUMZGSrU7WJ+VzNxkpkTq9IbkSiS+glNORbg== 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=sZwwYglyrTx1lEXqvosLDhicGEulwOlV5lTFb70/X5Q=; b=BIcByiI4XG5VxeG/2j3cs4mDokKUUF+2Xr7aedAoQWlBOGz9VNWy2Ww8HmiM89FBEnWKNs0yGiFiYb5HZgyWjcufJ2SEpbn/ES2/4X5zhe0Yid3J8AaCoqXC6KH8UohWDAA2mFENe/QmLFT9s6y5WC0ZlOQzgtf7sRDz+CjBP8YAd2wMd1n/MRoYpofxffN8AUaVfstcamkkiNuD7Dc774/FDJTC1amczE8oo+tTCCRbKx5KNi/cvsd4qqw56lbIP6KzPIUe3LH1D8Mlgpep9HYeNOD1QP+T8DyfSst6TGxOdhZpoaCKmRY8rGuDOqzAFQAhMJzQf2+ZNFhoOQO3ag== 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 2/4] Activate GENERIC_IO for the arm64 architecture Date: Fri, 6 Sep 2024 13:41:49 +0200 Message-ID: <20240906114151.519028-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906114151.519028-1-jvetter@kalrayinc.com> References: <20240906114151.519028-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AM0PR02CA0021.eurprd02.prod.outlook.com (2603:10a6:208:3e::34) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB3466:EE_ X-MS-Office365-Filtering-Correlation-Id: ffb174bc-4785-4006-3e94-08dcce69ae92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 1STJgIdO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8ZSaPH9kenxbrdI5fh5ACg7guEIuMSqlnGPBvXEYL1VYopDOFnxiRM27b6QJkU0uxYqwDzSyyWwbRm9WzHs4Pl5YO9HDkDLiljBx8apzZ7Ukby91Jfn4pAejn4UcTyQaVvLh5+fw73CpfGrImY0j6NRfBpqbV5/kheqrTJs/jAKeIOuVjgYwO+DeZ2uVQcg1Y9ZEQE0VHirGpoz051vw8GmWuo4Zy2y9rLjqFkAvp0PAgsk9uKjcjFQNCTTNE6Dm0GVwxS5Y8rc+Aw6geJ/Q0Ex2y7OM6Ii+m20iPTDjjSarEvonJME4jsdP9vCYoHLTmxolyk0VoTxAtyJY3qKE7k+lTPCGsEMxA== 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)(366016)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c/xnib0RErbGpa31mYkUrrsv+iefpQ6n0rwqL8snrMYuSOvi0w50ZhhKvJFeHauE57BdZW/JgNELtb6caEBAjscOTWMywRq5rMWBlVnECwOw1/cWBjl9ezj/IH/I2oWAgCpUXX+d2oxams9Ukb1QPqm5qhC9eyqAkcaGIm4ckQ4bXHfNcM/R00qvLBjXJTlbAhszRrqrtL/L8UvTdJxBYDcTuL98+zJkRrLZB3mvdZ3nWn9NKt+eo4/RSVRPKz6PFkOnT7IJPAZSB21Oy8vsGwkRBcHYPNnQ9m/x+5naxz+7eQmS1R/GX2YtP+YBSwepkh/ELUPKZNQe/9pbX2U6brKAzkGwGF293AN/tVxrsF2pzphIfnDkA/MCCMbMSRhHSpxV9u8D5BQ0Pjm+xJmaM2BDT2+l+iFGkgU6aNBlFT3zYzUadVP49LXyuOrBd4hLT8Z5ygOiGp5u8drojt5L/Vr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JMCWs73h1XoqRKNmGin8A8K4zBFHSzyUbAtQGcDtoZ9pnmheRxrAxPSWblrWUpFLbsiUWK/w== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffb174bc-4785-4006-3e94-08dcce69ae92 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 11:47:27.6433 (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: MS6H4sPhjpgucxumoWqaCnmdN6+eePGQE9X43kJCfsomzHujyQY77jQTQEVB96Xeb89fd8O2qadA4ajo+M9d+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB3466 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_044732_027773_0DC1C2C4 X-CRM114-Status: GOOD ( 13.11 ) 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 for 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..3e5647597a03 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 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 Fri Sep 6 11:41:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13794087 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 C8E61CD5BDD for ; Fri, 6 Sep 2024 11:52:04 +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=1j0A+Mqhw/czNF4nL/vV83T4y27EkGSjAMRLvQaCIPM=; b=gr29Wa1r13yUn0ffhUmQ7n8nbl Yd8qHa3C2IMAPdmNKZiCT3okxGFtkIo8KfbUPMy/RCihXk7bwT31u8k1qiTVrxEWCu9JPduBnoSx7 MMLoEYl4hCclDKM5pwA6QZ2YC36f/CrCAuh6aWbGi2aIw1Ax4OMcE9zAXLJwHVNE4glsZ/LGF1fK2 KAMBnBWGLFPhiIauMgEv/1N1o+JruOJxUj1+ZIqRZjzS9aGkTroOBoMU3HDWk6Xuy+ruuNA9A6qdw PcXpib2wIPxc3+k7XuDJsRS0eUx0ksYqbUkiOGiiD6V21DgvKVYgKwuxKmiEc3/rUQMhWOD7soOl3 uM8gupEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXVK-0000000C3Vs-3ZC5; Fri, 06 Sep 2024 11:51:54 +0000 Received: from smtpout35.security-mail.net ([85.31.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXR6-0000000C2bL-0DoY for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 11:47:33 +0000 Received: from localhost (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id 2D8A730EB5F for ; Fri, 06 Sep 2024 13:47:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725623250; bh=U9+nDY8g39PXw4DtmuwHPasEG4a7/1rvjM/Fqb4DP08=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lvo6GBf6NCF0smJw2bsR1BlUnDoKq5zsI/FZQqQzvpJUvt6q1UzPdwP23ddnIVyM9 NQ86t7VeenNW26mVn2Es77Ho30+TYluPRd+YIh75PbITPCR3jSvmjD9+TuB5HDlNBs Bdt4X0tP8bLid8qYMSrlOvjY/mlFcArVhU+Qtn+I= Received: from fx305 (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id DC46530EA63; Fri, 06 Sep 2024 13:47:29 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012049.outbound.protection.outlook.com [40.93.76.49]) by fx305.security-mail.net (Postfix) with ESMTPS id 17C6930E9C1; Fri, 06 Sep 2024 13:47:29 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB3466.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:14b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.26; Fri, 6 Sep 2024 11:47:28 +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.017; Fri, 6 Sep 2024 11:47:28 +0000 X-Secumail-id: <9222.66daebd1.15d35.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZMFoi6HaE6iH8RVZRAuzXBu0QudeNVceCK7YFGXI/coFi74B4LfctECvIKDvAKf7xnPthd4sXsQx7agOip+TbBm10o4gkGZMfz6PS6qc1Yly1c8V0iJKVh5T2xBnU5tjfD8BFBZmAsRCSU45fP0T4EOWavO0niH1Nb9rWFmM8kNvHO3+97AbJBuZO4OGEgo/uodFxGq35GA1hpa7VfapG0KoNDEiU8z+/HS63CTd4ODIQLfa5Jn0xgv0UvgyIG3RJnMgBNAZotr0QuLk1o28FKUrveSMzC9ywRsosmFJ6Vnl5J+IvYhZalhzuUIBRC6u2JKNLvSFvb5VNIULC95+CA== 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=1j0A+Mqhw/czNF4nL/vV83T4y27EkGSjAMRLvQaCIPM=; b=CDWwyTsPj7LBOaFgquWIaxQGb5IothQbxdlxuUiiq8urk8dBIqC2pMjnP/Vygr5u6W6ZoyaujKXi0DettS3uDzDsZti4/jmXjcICCMuE6QOFiBVBvSx0WbolXciW5jUCAzBm72fSr3WyggPrhtEQvyGVlIOcAyvV+gAkg1HzAqX89XLOJVng5UG90a8I+xuV7XrSc1x6ZNqmuApNUksd87SbD6bgo5D3gISQ+8HjfHjDKNSNanHONM+tcpnmq3/y9m+koyOa7VI9h7fkH2mXyx15X8vTPZB5IifMPakpgXD2Mmvildu0iGjk+d0I3jxtX6w70qb3FC724Dbu/UCIyA== 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=1j0A+Mqhw/czNF4nL/vV83T4y27EkGSjAMRLvQaCIPM=; b=q9wtiRsKctKkMm+TtfsHEM4fjzkZMHdTicIs3IBZKKsCj9Oca/prqPxtLVoPxQ8t+6lfSCi78TmMICep+5Dg5xE7/pkjHy5yZ7wv22O06LcZSy9f1XKutJ/PTi0sflKCimxRxGC9y2zwf6EKGPm+K2Y46L8qYYNzEVrLLto1btBWeYX/o6BnCuzYzx3FzsYWCPzmNkA9OwL9aFsR1wgN4HTYEs8ZaI0aijLf2YaoXkJbzyTrEOl3DXt/I+A5+X8yRWNm4uStYJDydgVRGMJrjec38l0n+HQoHyVHws3H2xj3nSQtNfnY5HMHwEGGUQzdTpamUsSdccqOE+DqBxE2Gg== 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 3/4] Activate GENERIC_IO for the csky architecture Date: Fri, 6 Sep 2024 13:41:50 +0200 Message-ID: <20240906114151.519028-4-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906114151.519028-1-jvetter@kalrayinc.com> References: <20240906114151.519028-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AM0PR02CA0021.eurprd02.prod.outlook.com (2603:10a6:208:3e::34) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB3466:EE_ X-MS-Office365-Filtering-Correlation-Id: bb11cd3d-ca50-4d54-4565-08dcce69aeee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: AhLWn31Xngd9hQv84TsdaSCqLwi7n19bHlAwg9/9FCacEbRgBiu1bTJMao08wXtCXU8CpOZ20PFn5BZULNbK2drDeyI4wCF4X9uKijF6qo3h8t5fR6wr5Ps9aVl6Mx+pzj/R87R2ekjRiGooEgyUVme3qOOhA1jAWZe4SE3t77e+ZChjJGlzwX1jWXw80mj5C47VOwBQv//gqsulPKmNRMBlh9qylwjDWQbn7XdxdKAcOJtVDOMQya608L+10CM+5dOj3IALY7wjh0fvyKXGKcPdQEpLMxA5yVh6QNoEowL4cPQ0dmGzSPk0XUr+G3+6+xkgCtPhhC7f6rqE7YaWCz9c76Ph00GBjccPSTDYdkzLgV28N7GBagrdVq+ORkebH4wjCmGzddMgiJl5Hm4Xi4DGy8Zf4J1W82qqC9hIQgQ3/yvWHJBFLaCuS9ctHctydTkXO3vKuS7MYmott7vR6dKoydyCcbzy386970tUrxiDkIsPmfEHqwLV/Of6axuRx313uZaO3MT/eeUqxbwW+iRAe31QxJUg+wi+PyqLxiGJOnK8XyQLgalYXeMzaZeQF0EDSo+Z6TQ/4L/Q1VSw2Y8A8L2yWO8xq9iMWtrzPJWtMFonSYiOZW1DZdOi2C99s+ZP8WAwhJ6AbNLDZ1f9hi4J3JGy8sF6uNI3zYhWM2054S2FCJNeDRMVMZfKTqydM+ohcvMSExXY/doGT283l8htVEGhDS1QWWFC6Wyxn0pFLe9imyCtFNCP19SJyeDFJQDZT4nAJknPlk7QJiIC5h2/HPhse74GHLUDDoSsb6GofbLXk9DVU4oA7gS/fQI1R1DMYUV0eyAsCKv5C7/kxu3582BuAuIAMR1lzLSi2mCa3I2fgZAZxFVtlFAix2+Q2M5V9plag8ARhuCSXe7T8EMc+8oVw0HPfhM56UxRhuEh9BFfR4N6Yi1MDggMUz9PwA9 nQ98R7iiqkEwH49EsWK1+b+z75OWF44c4YvHd1gHJkAwtSqQTNRgYDoOVZwnSLk7PkBx4GO3KQwNACtynUcII6KiY1qR87YXqe3h0A6eEEj1U4L2/8v6Nk0xqCGYi7OPCyfKbhQ2wkx1wKO5SGHyUpp1DzP2xsThRaVPn1LP4JfXfcpakxB/6bYNn3uoKk7jJFxgyTG9hktUqW4wnujZsobTHwOAVQSdfFHu3lB/iTtfS66D0pZrOsW9AAhtKtdort436NdaaYm36k/oTBN4MhgAl35tAqILoP4sVni78pLJUCMa6eHUthADPE6qesEyDkw0OxwG/aGDOZP094HtSZbeYmjiSiunjG0QA8FIAkQGdO0RuLQIApB1tXxz5AMMTBRcs+Q6ic0mMjyZ15Ddc2zQpStd6wGBtNQFQqw4wo6dulLBMp7MmjLKl16uJIU/I6xLhf57yv1iiu5HmvA== 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)(366016)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dkVcrK7H65xdDv4+47cKb94vSZgjwF1DMx7zlPIoeh2sNoCNtrmHZllyJkM9xJwqQv/Y6/v7R/V/SVcMWbXkG0x+fwXSXF5sP8EjAuu35iTViaJWpRyay5kp8VIEdBi1sG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Emhrt5cBFZ6Usz0ERfqZmcjbSlfW6c8khQqJNB/TVCVJaHRk1WAw3zddDKkCOeab8su7PpqTOLkrZxOV6Sz7BQF95cbFEd4F5cE9Q2V7IygIMk5b+KnPkTvm4co8ub+wEvxbBZeD1FXjTFsy5OLN6XrADtXEk1Ph8BT0p0hn6Szr6XjHMCxrE4qtZAcynBv/hRP3MTqZTJFk0Tzm6A903Yabi2HQe97U3GM5k1GLvqUkqZ3yyrNu1/19OrJD1F/jhq3LYLuNdGHZBjktGw8NLdUViwu7moJEX36pp4OL13+c6xNZtt2kSJBj70hGPvXUu0JryTPlDo4mNkGYT20W9+OmFh8qtNiJ32wAlJ6cNdWTrHLkG7daDS7/0aBXD+L/L X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb11cd3d-ca50-4d54-4565-08dcce69aeee X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 11:47:28.2363 (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: PyJ7nCprp6cZ++52UV/pBRJ1gFlYfqiFzPys3j+DbLnb3sdFJBebiLmBCdBNRdRM7ER2UdmUdBKHYWyg1owwhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB3466 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_044732_389611_C02B5F84 X-CRM114-Status: GOOD ( 13.72 ) 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 for the csky processor architecture. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter Acked-by: Guo Ren --- 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..d64329b691f7 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 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 Fri Sep 6 11:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13794088 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 3F33ACD5BDD for ; Fri, 6 Sep 2024 11:53:06 +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=NrMZc/2URVOk97YU3sanaSq6eSIlf+YOvYHpH87r50k=; b=z8+03EN+7QXbitLsRJpQLFx+OR gULH05jxrHO0ahZU3IDcarLRSoiodnDjjxgCxVbrlPitC0b6fCC32pd4i2IDhqhGuyrG1dnuve0Z/ ELfxG7iubWnSpMguihdny/y7nDl0et9Vm+D8rFwHyXkaUiVvblCeEwVA5XBwSpdu9IsmHGm+DZ2+1 yUYCZXK2um57anvKS3lTSV7ac6uUikdv0HnDjLX7EiVcyIgyV/DieWsB6Ow/g+QTNSN1o2PpNkvro W5vTFpIOtTcDpkmQa8CKwP6qFqeQkc3twpgjQytuHgUtKOyL2FEq9ND9Y4jtim1P7zafiD43M5XeP 2KUEOXWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXWI-0000000C3li-1H6L; Fri, 06 Sep 2024 11:52:54 +0000 Received: from smtpout35.security-mail.net ([85.31.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smXR6-0000000C2bP-1mDy for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 11:47:34 +0000 Received: from localhost (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id 1E6A630EC72 for ; Fri, 06 Sep 2024 13:47:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725623251; bh=T0Fa8pGvpZhWa/TIa0csqoizV9XTmLf4rUAw4StyBuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C5xALkyGOhgdg3uSzC1JHSTLaOYP7MRfkJKtJyqVNoYlSmKbUyiT6wC2tPJ3g6pY6 6s06y1lppoawWysXe/t04uvpm5zu007TRtlNgYjg84ifq2yhCDWuiaA2ZOTSEHjx/F E0DgpAz4eGmqHFEokyYuJm2sY49oe01WMN7M6r5c= Received: from fx305 (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id B56C130EC42; Fri, 06 Sep 2024 13:47:30 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx305.security-mail.net (Postfix) with ESMTPS id C5C4A30EA38; Fri, 06 Sep 2024 13:47:29 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB3466.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:14b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.26; Fri, 6 Sep 2024 11:47:29 +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.017; Fri, 6 Sep 2024 11:47:29 +0000 X-Secumail-id: <7fe0.66daebd1.c383b.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WfMxhWGj/3YzUKN862eNBJ8zdliFA6fBpxQu7P6a9hbFow1N7vbMg43+pE7Md/8fYQEQXxqgLG2/t8TmoT8QqdCQ3qWmWvbXJY61XoY4qSFwfsC74NDUf8hd5gEjiuT7+gkNfD7X8TDrSdTnOmCtuo2nH4cmYswfY7LeHsu9wRh0656XsAznsOi2mCQeOkuda7TGS7ODOA2yIr+M+scROUBOgIP3C/nZEWF9P6ECxZcJytOfoJBlOEmKrcJgJm3f3NtRgTSBgh7m8N1Ez0POqolHsXdJEI7s+84ppjzHcLKW0pSzcPXabJgpk3SpYa/lWHMGsIJO9ThSjyW83nNOPA== 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=NrMZc/2URVOk97YU3sanaSq6eSIlf+YOvYHpH87r50k=; b=e6oxtSHQNNntaL1mkrlSel9Wl3tGJywNOBR18+oMEdtyydIGBWimKJvTZ8cFnl9zL+pT3P7LihD3XKi15BXbRbtPxtNFX9MCOf22l5SfndRYBrKnI8v/rShkPV2K607NakOjTZuSUTnGUEFfFyAO3EAelVvrZp5HeBXjo2Nm3KnY4YqoBDh+8chkzRg185FGsjcIc2BC0guwtXNMTmQvW8ckvSrZyIYtLCjfAN+SBIIrq+o8rvgL0fU5IRCoC+1wIMs6JenSO4hCYFL1TQIjGTIbRoL3vAfj852GuMTn0/qvkpt/AVMC6OU4sIiRMyPXy1kcKKxcVH6YXivgqWIvQg== 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=NrMZc/2URVOk97YU3sanaSq6eSIlf+YOvYHpH87r50k=; b=kVsiJbWrrQK05ICq7gOZIhQQ1FR3JGndw7GvNvviL33Ki0M5iaLvNQSQMbEFu6lZXrlHeAerZFMSKcfRNryM+dnbZyIfJUT/h3D4gElDEJLwevevLoIW2w7ASXEhhjjbs5k0DbyJkQ6Pp9+WV/nekD0bnPE7glUPT8BNl//eZWyI8XezjKnc0LfYDT8pNfv10KGdtOANGwURzfiJbw3PkOLPfMSXJATZoNGgyKaoueUhIoVauKjdbkX+nU01XL7+8uYO0hBpZtAGlv5lKJ3HkvMjMVU2Jh7c0DqwnGDdvQ+3S0fBiTYeI+ocehAvhuDm0EATAYIsGxZb1DQ1ZeYfJQ== 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 4/4] Activate GENERIC_IO for the loongarch architecture Date: Fri, 6 Sep 2024 13:41:51 +0200 Message-ID: <20240906114151.519028-5-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906114151.519028-1-jvetter@kalrayinc.com> References: <20240906114151.519028-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AM0PR02CA0021.eurprd02.prod.outlook.com (2603:10a6:208:3e::34) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB3466:EE_ X-MS-Office365-Filtering-Correlation-Id: 9524b9b6-7782-4579-3358-08dcce69af5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: SqN4Df6VyMvHXHJzvMMCmYy/hKrlL73ApliwTFwxot0n3cGNI1FrFHeFjS2DYpf8KWlvftEBGZDY14wNslW8ZuX8+e5aL2sEiW+4YVfjHGyQX4PE2NW6DMZA+9vqhxGPnnn0TGHoU015r0YbwpR4+m0Ui8Q6TczCkSeWMOyjxu4A1HE4Iqv3rWq6TsUxdWeJjxkHruTnrwy4Y+CdSPyMzIIf2XebkS94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XX9kHL3L6Po8dU2E/CZVq3j9qQ0OROwfVqjvkcHQBJgvr8TNIA+rF42iPC3gVc+BbuYbXVDFnk/hGTEbUnh8RDtc9/o0zZYWffgFz6Iv6cK4IZ0FdIYeADxzpGg== 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)(366016)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D+S7cxnb07PGpAYq3HHupw5uT35Sn+A39AvnDR9oI2vepZvV57dUU/x5dEkse1x2qdWAcNNXOuYd3cGZuqKGOQXVKVJi2dTftTjzsj5354FbZ/zwM88xLF2HPV/CPmdoZadotpKVBaVxcBv54cd1RKWlVjVIbKZk/dm+8f9Rj3/2qu+mcmbO5Fzs/zXSYH4NiKAZYRpbZf5xkfUsBOScV+JWeKuCJ90cSP5Gb2zygnHJ7gfZeWbmCae327CYbcMd68uUehJnzbRJ0JDhUTleDbW4uMe7TWqaI1mRHPenIfu0DDLAsg3ct5R7wa3KvVK+bQfWuCu8bWnfuGQ5hSQrA2C9l75xcad+1gsOSr1sJaxGwxHCP4dPL6UjvjvjCOXJUcGtwMA3/pap1nxu8s0Z0MNHlA3w+TdLkTvw6I9oBD5QGi6ZzzgPNByOUZikddmRT/IOOrEkkbTpuLHy2BQFk4LbPjARY+K/UqtnANmuJiU5EeHZQF+nwvC0bBlybekq+sIiwi9CuPDbAAjD9OZyl7DYztjdFwhjWdWucIkeyRckuX7Rd6id+D/zqy/ObGkPczH9+9huxxPA36qn3/lu5UsLPr2n6+Qp82VLLdU64G+NRuvLINFfJZxxLCREoRWCXjvBV6xTnGTKEpcL3CYlSW1mnHPkopAhtj7/qdwQypIEad05Bf0xJWF397Uz0zk6+qMC7PbcKn7OJ0emkNca9J/ny+vokaH55FpgFx1ezvcMOu+xV6/6FqqLb94IutPB2m5P/5/rLenH5MiVwyWJfaPguF/fQOosMuRoaq81wMf3ZxWSu7TroS0cWyH4dv6Zfxc3GbCCzwHtvxVQkVngiZzcka8NQB4UL1bh2U/YKrBuHcaJnGbu/e7rFnHPxZzXIVUCuuHyYfKI3OngQ/qDnPfGdbNmdfuB7nGtSOGl+VGm4zu5nZeen/zGw+EDUZ85 AMfHoCBe+z5ezBRnakqYjlOseQ1TpkNFouN52ICth+Wjpw5pI42JDKnQviQ4DgYvirBwQzRfPQunO0kVE4oEMgoFWTiGDmKk3PxgRrJFzOZbC1YI1rOJjAbVZi9Z4CfIqZAt+wysqSFelke5Q/c4bOpjY5lG3DKz0n9fsnbnuIsgg+j5lMu8JMbZGyznUH8qbjuqWCptPTS8ZEPpws0KXmdZKX7eKNxcbmvjwq8/gcPfJI3q7Qu+Vh/iP7CEvdCuq+8+HDm+89mud+1udlETMxTT3oSnpkQ3Hf2b34Ym5qAJ0Al4y/k7wbtyPTcMeOypQZovVG/mrXxrzahFCVLL5QSwC92lkw+h1BjKAR5qFT84iFtO10e30ukVnoqYoVh48m6uVXsVnD/nE9kC8NsYjADRNj1AvNx89v9NP/dsB4eiRUywWfv8qJC6nYdBOdzKbyjPeb3sETl2OpQhiIlhSOeJPxW09drFJ17EgoytuUNl8tkDRT3y00qLbJeqsXpdGesEaKANulb5QzOqwLpKBYq/rRxrS2CjpFkQlEbSHVT5IzH/IXp3kurZ+Kl23JRJUZDRCVGWiFE/YjQ9g8hVyxeQ74ylYN3KHVjOhebD8bhlVPHXiWJ8YC+gyDiI59yG X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9524b9b6-7782-4579-3358-08dcce69af5c X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 11:47:28.9698 (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: VvD0cXvN/SFEQuDsSXzfWF7kt9u2OqTawLhpD9IJEef0ryzyHQApMLkwYMc98bz//lfSO4K/iy85MrIgmLueCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB3466 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_044732_762388_2ED0FDD4 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic __memcpy_{from,to}io and __memset_io for 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..088137d75113 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 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);