From patchwork Tue Sep 24 09:22:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EAB8CF9C71 for ; Tue, 24 Sep 2024 09:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DveJr7zsBccpWvAJKIk+kTDfNX03apt1gxEBBsrHIOA=; b=uyJhAqFtA5TfYrr4W+d2llxb19 eV8p6r+jKS89gdgCosGKs8avkrsNpLbzKr3faInn56hEJ3LKIizBT0TFkanNQA/WBLlAv1/NbUbkc I6rXDspby2HhYuXgjyL6TJseeG8yvMN8KAYliBTtDK0sVlhn1dkWPZOXZVHNDRr5uB6XL8pAnLbz9 kZ49jmHGJ2srGpj2jq+PfiVFJxYtHsrxaD+cIIJJaWbaJlLTlS0NYZ7SA/95Gq+LT8eS2Vu/aBVbh KF03KeBD47dGSo+0qRL9m4278DrO60hSi1Df1dbkxOH2f3fYrWNekIpp8N7b5krPy70J/XDBIpcSB NqM0GZFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st1ph-00000001nQC-2rUp; Tue, 24 Sep 2024 09:27:45 +0000 Received: from smtpout144.security-mail.net ([85.31.212.144]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st1l9-00000001mYJ-27ht for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 09:23:07 +0000 Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id CADE13496A2 for ; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727169781; bh=DlBtsP+yHL6mWeXFHedZo7xJcnsxHLkO3HTJki7kIVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RfENmUancePRdo/hd0M8dyRwt1BbuTbp7EgN+wHec2+sVZrbn9PuXoay3uXqp4ctH 5RH5jIxkf0nJ7ihsfoNALEoPGemgzCyO1l76WlV2GrC01be2xpftCfVn+t+KtD3DZC 9Jf93EBxNh9phEwwXGgM6e5d8GHOMuSCfykOSpiQ= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 98BCF349604; Tue, 24 Sep 2024 11:23:01 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011030.outbound.protection.outlook.com [40.93.76.30]) by fx601.security-mail.net (Postfix) with ESMTPS id D54AD3494DF; Tue, 24 Sep 2024 11:23:00 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by MR1P264MB3073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Tue, 24 Sep 2024 09:22:59 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 09:22:59 +0000 X-Secumail-id: <107b3.66f284f4.d35ae.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pqBIvzM50VDRloMgMfvDBh/vtIFonuZOFeZmFt66jZax+YmzH24MhKPr1YURFq11tyTntmUhMLcB4Z3SwidHage/U2QtGW9A1ytIgVZ4Rm/1i5tDwIBV51WTC6x6bpMgnMRTdNhmkIS8aP5U8ByWt/0KuTOFvPXojZcxfKUs9GjMMN9LQgodoi/FsbLm+/pnLi0O9AXk5Orf+R0tRYRE1O5hL8FvrNopEKVNGp0RKaHH5HOXIOiyxcB+C9eRM6EnXJrARWBFUHzE7XQpYerQ7YUiYeASPqrc4CyNunfLEME1MwIHCFttqA5IzoG5AMZdwu2nxWiVqllLLvzMqnPi4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DveJr7zsBccpWvAJKIk+kTDfNX03apt1gxEBBsrHIOA=; b=yXar0Vf2X+3gzRGO/xjfszRe0K5HxKb4zdsyA1RR8x3RT8nFCfao2+ug6gqyfqRCDHf5bUdfzLpUnOUHc6rU9yeZeRBwTkO4oJWEgJXvOLODzKH0CepcHbrYDwqJpmvIwvD7WDC4GN9gvJX+xfyNIyaUkbK3H4CTeB6urpMeszS309PJfK2GFPRgb5SbZdeb9WLDlm4FHkFUhRLQ44dlKQDw2XfCiE49VwHftuuAU9RX2lBm/UTdBhKPogJ5KUQ/6YsstnLv9KPM4RKQqQEkUytLQ7whfsTDY2nzaEOE/qkZDtBfwqKTr8IOEauckWrd2PltNhXncRUeut5QzOpy9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DveJr7zsBccpWvAJKIk+kTDfNX03apt1gxEBBsrHIOA=; b=dBnuKBBVGt0X/9wOo1F0BD1hOTrbDBnRiZAFLwGArDuXsaNkndsXpJXBlQpL56e6ca1UvpLMymlGn006+j6Kh8jv6TaN1MOMIOMc5RlrkMX3Pv5FRc+pYzpAuBzPQ1ek674z4/zn4E5T7jb3DaVV/MKEe1C7YfTUkbXcnG4OGc6msYPQi4iWC2YQmJBbA64+V83RZKisQfZiOyacir07f/cgrKmeSji6mN/wZwjdsXIxbZMT/V53vcwc+98s04j8tJMswZsF43PvxRw8acp1s9lzAqukBKDuCeULSj5POvOvgv/yPfDXwTKKzVnp26jIuZPjvTA2bIOtM2g/49v+sw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Julian Vetter To: Arnd Bergmann , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , WANG Xuerui , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, Yann Sionneau , Julian Vetter Subject: [PATCH v4 4/5] Use generic io memcpy functions on the csky architecture Date: Tue, 24 Sep 2024 11:22:22 +0200 Message-ID: <20240924092223.534040-5-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924092223.534040-1-jvetter@kalrayinc.com> References: <20240924092223.534040-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::20) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|MR1P264MB3073:EE_ X-MS-Office365-Filtering-Correlation-Id: be752e5a-3cef-4c19-63f4-08dcdc7a7b94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|7416014|366016|38350700014; X-Microsoft-Antispam-Message-Info: LJknpAN1hrh4UqAiufM+3Z5IHFe0kQVITMzI0hNyYXm6RCHFeM2yVukVBlM116hgbhTESST2Zb41n0hY/WtgjW52iz46P0DTLQSbyEP+4VAPz50SOtpGKHmFATLBIKud3VttgpDYWF0/f6eM6bSW7fAflv/8bTX2D/kDIo4sqfmQnojitkFPRGlWWGREopstfKCAwKQ9zuHyORoA61oLnIijyaE+dOYKqEt0eWr4ywiv7+0k7EbTJUXP201jukGNt4oIEwmd+97ivCpuzVQIs3SZUKGQ7LNKa8YP4KNNWqHAjUV/kAUaIIKI5F7khbm5CeZMdrcylhnn7ckFBMZn/KYHl5e6+H5o0QpsgDIteN/PlNL02NhThVsrrmPqBCRnDsg82DUqJW5MQr6OnKXGYGhn+KZJO2Il4z6tF3ryH4qDjtNEl3AE7hGbvQlNJUFRB5GTFs9iYtE/4CmkpHbpo7quxSH6rYNPgPA+u+TKmrDL1NhMWSr84ZNk9XJr+40Q4lN1OrkFaGQAEeH/w8BaYAhg6m3GkN4yXJIWFjkxi8QPBKDTttOCLwTtigqbs8eIIcBTmnIuO1aNtKC7PR8w7V0v9Ob1dTsEGg4QXCfZpnx9MUMWRXWNtNUNfjD4i1RS7DwyztrvEd4XqqrQhQ4hUVWK/tY0W9EOy7tZWmP7pnKaVQY5x2gSSCF8vXoGqOvABcFmUuuIKfxBWpdah2KWBZQMlw4SlcoJKLsbft8wAATsIIC3bnJPtKyjfIcT7xO5lj4nIZ01GDOK664TDn2Ib2prwACqsdwdiu8ESh3LbloEEMCTFNlWEwzovzWeFjw9r+ih3qt7TdhgKHts8TOdgXkgzy4gaRg6VXtWswu7VFeVzrYHYM7sKfCUglbe/1nGhNtjJmpSh3PSwdlm65hq6xopIbgtBa95BP7HW5O8zy9culS0DItZr3mr2Mmhwuh+hdb WGNlKQiTA2KYv4kWdfHQhi2hjPM4ovsaYzNthuViXVAY3+davxaUIyvqmDSqe0MI1zemS/TeXvZLiuKFl+ojnrjbGTQoAyn4JQ438heNakdae2RriW8Wuk4Flr7ZVGNtiBHTah4VvTlUO1W3F6lLJoDByDk8JWsaFwh0RnKs7a/UFSoyjQvCmoBq+M93/MuoURj8aSAFyEoM4TVXvDtOjTopWCdKp/+OnCjiP2H8r1wFAXFfkD+EpyZv0ysC/n2U1QKtLDyzJ7MIkZU9kfiGbHHlY2g9mPlOD5jLx4ahpNHBbP+T0Ke0Y1OGrjLiMAPs9mgn7p6FJKC8zz8sKo4JHsTZEUfnBD3Ka1Y9wPGu6J0Z4hBNzGj+fvPUB7DnuRn+YnAZN3064kUG0qCjBMg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(376014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dr5JUvSeEbjbMZGuPmoCfH7ZAjnWvZ3Z4/j/OJjpFlWoS99RL7Fuh19OUbuV8eTNwW5xDWIwqtBUXvJa+wSQU6bRteo0WqlVkfMGJD+IWso7ucT7t4sNB8SxV5rwIGk0qkUWZALEC2ZvAnvXo6UZ/zQBu3ssstQCD2O/vdfl8XGymYrjf4NooeVQMzbmyBGa3s7SOpeSIAz1Wu+GhFqRZfMS8LwW9erNuXmENieGcF8XHhxchDA7LQT2p5sCk8uYVqggULVKGDkBv5wIizz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F4CGLUcpSd0ecyIvhRctaO5V/R758dmvpyvEi9O4gjAAPazRwr/m6g9dDFT5GTEh/gy7Aix5YTedYqZHfFv+PHxc4rxnXeK0NvD/Tbf3uI30NXTO6JXO90widGn7sRLBx0aIfblw/aMoBWFcvWziCi3YBAMbVN+0McNmyHJsJjhAqNka7xN1AbqaxJY4pvZ1fEl5bi2UI2Yi2BayBIdZE7WFpWz4Re+Hb4LewSJFIwX8HToDWWwnNDU0 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: be752e5a-3cef-4c19-63f4-08dcdc7a7b94 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 09:22:59.8094 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oLcz/WHNRXMry78gvqFQ1dzHiSt7kdiMai+QzVhPs23rgJ+h3+txKcekyDr3Qw07tuwyfbsLubi10t0Z99h6vQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB3073 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_022304_149646_D7C51D66 X-CRM114-Status: GOOD ( 14.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic __memcpy_{from,to}io and __memset_io functions on the csky processor architecture. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- arch/csky/Kconfig | 1 + arch/csky/kernel/Makefile | 2 +- arch/csky/kernel/io.c | 91 --------------------------------------- 3 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 arch/csky/kernel/io.c diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 5479707eb5d1..59d4051b2a83 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -48,6 +48,7 @@ config CSKY select DMA_DIRECT_REMAP select IRQ_DOMAIN select DW_APB_TIMER_OF + select GENERIC_IO_COPY select GENERIC_IOREMAP select GENERIC_LIB_ASHLDI3 select GENERIC_LIB_ASHRDI3 diff --git a/arch/csky/kernel/Makefile b/arch/csky/kernel/Makefile index 8a868316b912..de1c3472e8f0 100644 --- a/arch/csky/kernel/Makefile +++ b/arch/csky/kernel/Makefile @@ -2,7 +2,7 @@ extra-y := vmlinux.lds obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/ -obj-y += power.o syscall.o syscall_table.o setup.o io.o +obj-y += power.o syscall.o syscall_table.o setup.o obj-y += process.o cpu-probe.o ptrace.o stacktrace.o obj-y += probes/ diff --git a/arch/csky/kernel/io.c b/arch/csky/kernel/io.c deleted file mode 100644 index 5883f13fa2b1..000000000000 --- a/arch/csky/kernel/io.c +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include -#include -#include - -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)from, 4)) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } - - while (count >= 4) { - *(u32 *)to = __raw_readl(from); - from += 4; - to += 4; - count -= 4; - } - - while (count) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - -/* - * Copy data from "real" memory space to IO memory space. - */ -void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)to, 4)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >= 4) { - __raw_writel(*(u32 *)from, to); - from += 4; - to += 4; - count -= 4; - } - - while (count) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_toio); - -/* - * "memset" on IO memory space. - */ -void __memset_io(volatile void __iomem *dst, int c, size_t count) -{ - u32 qc = (u8)c; - - qc |= qc << 8; - qc |= qc << 16; - - while (count && !IS_ALIGNED((unsigned long)dst, 4)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >= 4) { - __raw_writel(qc, dst); - dst += 4; - count -= 4; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io);