From patchwork Tue Sep 24 09:22:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A964BCF9C6B for ; Tue, 24 Sep 2024 09:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ap33tf5qZZ62I8NJEWvBds9aSZQ+d7OzAL26H+fuCc8=; b=prbTxXqnzu6lLoxg51r78kZTEA bdcB4OOoKNooElnKiYa7DvF72gvC066cqh0oqk/Qe+T4Zio8sDApm1ga27PeVoCRVqVJicIwJkn0r SD6vviFV5cNfoX8lYpWemOcRcExGblnzjyTlwb9IWrfexfxtDVBrUTNnwnd0MK2JXo+4YEl5L1MJk bJB4n69HtaPL4kRjS4WhB/5xy+GtknCtt4VNMvB0y5k5Qlpn747Sc4NA/W+URw6WZ6eBjmvQJTlbZ g62AOQvSoJmtda0jpyU4ZCGL3swzOZ3ntBpO+Wg5yVjoaDso4GfleN31X1TPpyp0/rNwmyW3L1t8h 3+wzwwVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1qp-00000001ne2-0R5O; Tue, 24 Sep 2024 09:28:55 +0000 Received: from smtpout144.security-mail.net ([85.31.212.144]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st1lA-00000001mYM-12gR for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:07 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 54B9C3497C3 for ; Tue, 24 Sep 2024 11:23:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169782; bh=T5uSHgkmAwvTJQWgMDrPyQnAF/YeHQaaCcpuB+cWki0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eIplAb5PYMJiPhM+zEjD09Fe1nc9swQPwUK3u96zyo5CU26dnWpdESlHp+konHPjl wvdnhXoKuBVVfDD8vmXEMMpVdDPJlGAoRzJ+QMykXBVqePasYdRzM4/Zq1v9ut2Nkh +P5D+q38LAzwSIVGvLojwHid1gRqpg7SgHeKKa+U= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 2EBC134976F; Tue, 24 Sep 2024 11:23:02 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011025.outbound.protection.outlook.com [40.93.76.25]) by fx601.security-mail.net (Postfix) with ESMTPS id 76B59349570; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:23:00 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 09:23:00 +0000 X-Secumail-id: <16471.66f284f5.74345.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iR59ryZlXi0NOCk0VgPCx3yhA3ZpWbYdEkZ73RTimncbO+Ur1mugIQGAuyZTucXWbrSDCFa//sGiPdNWyVCgs3Y8bhj2VOme4tLCLWU7axglceAb8yUBTCLKoaAaEl+F6xkHFmCufAoCosi/qwhiWoMsMobU9QGN1A5QYUSiGrUbLhjAFGUUt/1+CL5YE97dWfzFuzkOmeWK7QfecVW7PDoJr9a7iHuMjsLlH6MqBDKgd1QHu3CjiROtW4wVneK2tV0IiPAaot4r+HzPOlaOecj+ptJqlvVtD3ERoB5Pqa/wjgIrdcuCHojuYzj1K66IHIdEc+ffiqtlJFsCh78Tsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ap33tf5qZZ62I8NJEWvBds9aSZQ+d7OzAL26H+fuCc8=; b=oHVV3G9reGkIsHSea1cr4vwcxmkVETdd6LqBTu4yAGtPbxv0pS7xop0XXhkATC0PGHEN+AfTr+lDeC8S9TmcOH6EvrlaqLrL5StIolVBUExkgjQHj6ayqtUCIqf9tyfGvMwjRbuDZa0bOVyWEjD4RObYM+uvoLj2H0cAW5ZlAhejb8sdtGv6MeXi4tZxytw/+rBUz6cWS0vwhK0WegGVHwTi4Ef4tdX+IMjgD47cVVYu0jsZnwfjAKbsykDi0/4lG9l/LVOG5EQrjdc4a4NyuczYxz2DLBN2hMV2wz/3oImunvt7uQSgXHLfMFHSoHmEpoKoQwPFIZk4Apcb+oo9Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ap33tf5qZZ62I8NJEWvBds9aSZQ+d7OzAL26H+fuCc8=; b=sKD/UN8elYWrJHK0oreZ4rM1vqb/ihd0ZDcd539hImuqHoWDhv16W0P/V3XAbfdBnHSKnIYNobDoiFvGjhdtpc6WyAk5njsZvivm/1hKRop7OTk4kKrK3XlUzjJyLdbJ3+rGoKHN76Qt4T9R+OlbosLo/H7A4wg+W6VSFQhTczF6QmOFTnHQO3awwsLSod0PEdc488oCCk+cNjWNFmvF1gn+9WeB3f3xpP2+ZS421pxIS+5jU/yfi5ozfFbt3+S1JWPrUrzczdmywovsnRIDhvEQOPef7bvQTNwgtb8jeOANbEImpC3CqJoCmqlpStTsfpoQqiLMw7xFNNCaIlDrKQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v4 5/5] Use generic io memcpy functions on the loongarch architecture Date: Tue, 24 Sep 2024 11:22:23 +0200 Message-ID: <20240924092223.534040-6-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: 557af0dd-54de-4834-96d1-08dcdc7a7bf3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: ClE0vi6dd6acGpZk7qmFmvVqn+jN1TesnT5i5M4nxDzFzyuizG6G6tIjesBY5zWKidmCQapMELWW9lnAIkMIpTDZP33SuB0JkhZjIHojs1inTIiVyFLZ84WUS0mDcrn08XkbntLz1QTtbK5aJr/X4+JoNXKT1qG+Hi/ww0xtb1EKpzBMigYe4ieB+7eIUGOYxc1lngwV80Gfm6rZJiTYJmp+MVbqnZeKAoKtXro+jE6ahhj9P4JThJCeEHY4w9SQ8SAiwAEFNXDaNGghEyL8PJkWA6GL/zEUa6vD/sKNBfYhUQzPdv9khoHBoZpGhJK8u9Rw/DkKP5QyIPVMMjgjI0UIixWDzQQtwnOxYCFvGE00tHnrE61dcAJe0mRdwrL+tcSY4qMGf53RWDGVqyF9QMMT76qAsnKnyf8gTWp7iB2YKbQWjpQexKZeyAC9Ml0xURmV0JTueIXMfISyCguAeVoR8azdqiTsrat8W4DZOculJMKC0SSpo4YxxQ4p6GERigXkzd7+xIOxCXEtKsulxhzAdLNQ+We2wfUFJP0njmS5ddo3ovBIQA019m7GGD4sNjmSn36NBohPj+c/SB5Aiqcc6EXpDa5pTrGvN7OvhPfwURvS7jv6COv3n00+2eRcchIL+vv0Q4+Xzt0ePT1dBHS1fC3sF8T/ML20bFSJFFM0iPg0Xt9AL3W9qTzBlhbLOiwnu39fPL9Cjt289VRIugeyTKWNwHJTapndU6VFmTadJ9okqQPNuN1KqeoMjdxSEoRYyyAWPX7tYRaeM0GceE06k1yKt6nr3U94qQTDaIWBcarreCVdbA8PsndBXL8ue62V7WxeovXaD/dNks13YgZHBcAGt5rj40yNMFE8BUuxH3i/71yVmslUIdQzmLdt1anvlflTaozfToeoRs6X/7qJepi8ZBfSTAeHpTlBHhWgKSjSzIDYR0sonFaXfxnzDcL mRLmjqY8OCPs9L2fWS3zPaN7/2Btk7mggf21nv0aOSgxtEXrXj48dfHQwwCnulZLhZCqjtDFP0vE+BdU8mD9qJ+esj+YqQYI/AHSnA+sjOJ0JHxFaGZDkAQE2vZnWwBS95MylrbWJFnrGR/nn+xdYkKG2L3iXTgC967VBro+Qsnn8vIMxMx0xmEqt37VfXODapFjFw75FBDW3iuMeN/L8S89V3Kp6QnGRIN38Z7vgMif/07gfqHX9intiumyjiAcFiQ5D1FfFyBLbZBSILMv9xr9GyLF0AYqRUI8xWHarSFmPqDREvgXcy8MLgqfcaYB/gnEGi5gAFaX/YmR3gfRzBrWIRQ6ygMk3UI36XWE+r22my1uMv5mDqYkXvhP5pWax+qg6M+bZcPdAHHWojw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AsHJ9KRUZvnsp6R8TOAgsuT6LUjM1H/t6yUHyAz9odBXCax2RYt5EGowLNpOwjUjtitL/nIuqcmwChI6u90lvjbsoZtngN99D4q+FXTb4r2NzomMDs2nCTun64RPbB88JzOTwWVB3iph1jLpZ+GOaP3bp+HHMGzjMGIRUD4a4IWyo8BglGXqlf9NzKy8XvdN0grfcPUrRmur2B0Ty+43ctqxXWo3jtmXkqsVKtT3Oe/Il4uJ/Amyzak21eKhJk54Vlk12PZIqhbTWjpG60gf8it2hU8pqnuwPQgtssxDOKnWaj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zJPe6EIkE3WRQBBbGUZVEpJz1Sma7qSp4aAWkwZ8h7rKyhmky5iHw5ODdYOyFxDaJJ4Zg5hA1/3ZnIos7wwXW0b3NnUzZg81W9kGFq6jw1lIrFXhHn+EhgJp7MJSiChOdzxzW7eqfruWTbd+qMMcTiQI0F6KUXjMU3Hi86bQI4xY3tpuQpCw2AsAnuZSvIHyIclMB9vgdNfaKsd9/aBbT2vqPAI X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 557af0dd-54de-4834-96d1-08dcdc7a7bf3 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:23:00.4393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: exUCptaH5lhbs5eJudIQlgtkq4fjqEX1fWKXrqtFJX7TLCV1tH8LoZm6n39ff5a8saBwmObIaU7U6TClNb8n3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_576958_B2D6899F X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic __memcpy_{from,to}io and __memset_io functions on the loongarch processor architecture. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- arch/loongarch/Kconfig | 1 + arch/loongarch/kernel/Makefile | 2 +- arch/loongarch/kernel/io.c | 94 ---------------------------------- 3 files changed, 2 insertions(+), 95 deletions(-) delete mode 100644 arch/loongarch/kernel/io.c diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 70f169210b52..bc97b09efd16 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -84,6 +84,7 @@ config LOONGARCH select GENERIC_CPU_DEVICES select GENERIC_ENTRY select GENERIC_GETTIMEOFDAY + select GENERIC_IO_COPY select GENERIC_IOREMAP if !ARCH_IOREMAP select GENERIC_IRQ_MULTI_HANDLER select GENERIC_IRQ_PROBE diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile index c9bfeda89e40..9497968ee158 100644 --- a/arch/loongarch/kernel/Makefile +++ b/arch/loongarch/kernel/Makefile @@ -8,7 +8,7 @@ OBJECT_FILES_NON_STANDARD_head.o := y extra-y := vmlinux.lds obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \ - traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \ + traps.o irq.o idle.o process.o dma.o mem.o reset.o switch.o \ elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \ alternative.o unwind.o diff --git a/arch/loongarch/kernel/io.c b/arch/loongarch/kernel/io.c deleted file mode 100644 index cb85bda5a6ad..000000000000 --- a/arch/loongarch/kernel/io.c +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited - */ -#include -#include -#include - -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } - - while (count >= 8) { - *(u64 *)to = __raw_readq(from); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - -/* - * Copy data from "real" memory space to IO memory space. - */ -void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >= 8) { - __raw_writeq(*(u64 *)from, to); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_toio); - -/* - * "memset" on IO memory space. - */ -void __memset_io(volatile void __iomem *dst, int c, size_t count) -{ - u64 qc = (u8)c; - - qc |= qc << 8; - qc |= qc << 16; - qc |= qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >= 8) { - __raw_writeq(qc, dst); - dst += 8; - count -= 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io);