From patchwork Tue Sep 10 13:43:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13798545 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 711EEEB64DE for ; Tue, 10 Sep 2024 13:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SVUX+6s45Z0ge65VzI3FZt7ZlDdHSX5oJ+Km/4ciA+s=; b=OgGj6F6ySWLg6ysrYDFiahnmB5 4ImaagaMtNxBM3lwbimSCe5TCSg03b5i3GXdFrzxdpAfcNJRhVQ+1XxBGIhd8Rh5Uxk8l9j9erTov /xsQgR/szYtlbPWuxWkBAa/pHQp/B3arcEbIljUcAe645JseFfn48ReNa3m9dTj/DgZz+kXBsVQqr 6tyEJ3Gtbg6Uk748XwF6DOEyL32CU8Du7NTb7dBINOIgoRTUf8TZmhvwWdiqbybjs1nrfdFzcvdiZ /LSrFbNmd2y9Apo0duqEzGZ465Z0h8RiZ23aW0zYPRoEhJMsV6pMlcJJlb2C+00InBLcHgROH3+O8 OvksLvfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so1B3-00000005lEp-0qEx; Tue, 10 Sep 2024 13:45:05 +0000 Received: from smtpout147.security-mail.net ([85.31.212.147]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so19z-00000005ky4-1jIk for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 13:44:02 +0000 Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id BB787349BB9 for ; Tue, 10 Sep 2024 15:43:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1725975836; bh=fm74sZv+wQupqd1aA35tAP0V73LJDMRwcbwSpgpGSEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cjGi3+w+HlaHKxH9aF7yNmE9QBjyldeCW5BOc7a5uKvboDWwj0BAJrTmyP4WH1QK9 59YZvznORUD/hkcrC8Kx88kXAP5nMCx0cO5mrMd5lAXVvHe/lhNQK0AcN0pmk3aOsR dhzeFTaB1y2WN2rycD4iAN2zuS5AJQXjBbIfDqLg= Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 7D038349BAD; Tue, 10 Sep 2024 15:43:56 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012050.outbound.protection.outlook.com [40.93.76.50]) by fx409.security-mail.net (Postfix) with ESMTPS id CA5EC349B96; Tue, 10 Sep 2024 15:43:55 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PATP264MB5061.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:3fe::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Tue, 10 Sep 2024 13:43:55 +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; Tue, 10 Sep 2024 13:43:55 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dUQ88BgDpG2+xQKfyk4YH9e9xoTSBgWecL55/QF+vYrX+yXco5AjoQa72hFNULzWSBmFwVNyjFaCHKZEyiWjc8W6ZoYK/LMGpH1V4MC77WC19HTCC83XcnpgyibjrCTR2qrtVjlTWMIrYxvuRRO3nFpZPyG5lqLOucqtHIWt+fPY3UXFzEYdAhAlEOh0B6JdLbzINGEtUaaYIQCmMHadqxrLLlOeFOlGpdBKBah0ULbidIDjVEOmOlhf7o2uUiV6Cy9ROOpKs8tqH2NbWsrHzgjUTqRvr34BhlFxv0zFVgFSqh8l848mu79qG3JAUew6SxwJknIR4Lhcbgd6tZppvQ== 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=Y3zn4ueocN7zuJv3UEqUXPb3zTt1fIPlkuKLVktdlEuq8B60ZOGrsXTXhuBnI+yqbBVBZILBXoRpNLIylYcRAn9QpY2PqndpxdkSXRJf8Aj+lxNWE3QGFApB4q+CxvwR4/j0MFtCXflQNEVfoOE9J6OuO4kePOWMHUrlAmzOg1rQKBZi+ZKpONLHdgSyWXScRdl1PN3DcFqF8H79oVln4UsZZODhypwYWijS6K/52rjcd6y3ZYfJjWPT3COS6AX/gyjJcgCwgL8hl1NjRmjBNBN795qCDHBOpGNJGv7wYiVngeaL5hmc/VNKJ0DKR849GUqeU1aMUKM/e5NLRYkzCA== 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=Zw1o5HhpSys4v5vGeASRreJY6Pn8or2gPIGz3iRhx1tJx2by9Jz9/4ZIylWf45ZkgTSJVXaV7clvudqRItPaH6b+055eWvRPLdo6kZ1NbB7PnfiBI1GBT/dXJ0dWlclE93o72pueDYesmaQqSxDushdXgT4fDEAxkak0O2knIHSsZXdwdj7IVt5Qh6J7pgZlzPlvQBQLM7qP6S6qleuti8gKu3ihhqBnuZGt5CSlrNJgUL5AYOSn9JPOHeWkb7G6DAy6CZr4HcpOvSXBWHTCPYpjpVd4IgDbITLZZhs9Tjyj9LtgRW4+U56zlSPT0bXrrAKGxP3nepryPnJEi2tc5Q== 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 v3 2/4] Use generic io memcpy functions on the arm64 architecture Date: Tue, 10 Sep 2024 15:43:39 +0200 Message-ID: <20240910134341.2537407-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240910134341.2537407-1-jvetter@kalrayinc.com> References: <20240910134341.2537407-1-jvetter@kalrayinc.com> X-ClientProxiedBy: PA7P264CA0210.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:36d::16) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PATP264MB5061:EE_ X-MS-Office365-Filtering-Correlation-Id: b998ad41-e969-4308-0ab3-08dcd19e9cf6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|7416014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 31UafPGHuOZCxg1bE+0ndFxvDPbeoffnwLHMxpdBthre/FPBakmM5DCW8nEA7qQ6bQZmNPr67rq6xjRbOI4LxjQsGlYT61rl6Mstc6Gz5OmQfSgr/4U+MooZ91gJmFbeWg/aePs7bV+7qck828xOuFs1KFbZKh52l/pJn/Z9N9M2gFQX/7Gb4fq/DbS98pS2uT2qn6KYFZPOYfxUpAO59SYoAqifZkUzFuRpvuCQdin4dY7OEVmwjqUb/TvECvL+9+6Y/7EK8ukfANsQ3BRY/2iYtmcf2Tz77ujHo7Tys2pEtawvgySCMeVaQULdlrudNYQ3JwwJhhFSLt0RIKLN6UgkV1+k8n9DjNlXwPkD3xHZsCZryG/475y3wOjdA4KoLUqDm6IwAlva2ew/rzMA7eXkzf8BgX8flOJFZyGxOoEUIi2s5pxEf19Ot8yy7Ywr0zOAxAUDPe2AP21ULX6kBdQuyWRTntgHkm6PLvQWrjCJOtkYxQInMZxCgpDtVXPRkVBhAw/Q+0aMzgXygJ4XPOPZSX91o04lhMwQfGsYppKili8zfvG3C6xiHQTyQSUMS9axHpQxOFe2rjEIj7s3AaNKp3C7dVspvO27stIyKneiIF2fhqA1WM9r9jxA09GmvyV4vjKG6kwLg1Y+vQ2HuyC0vpRwxoqTnx+ZrXtvLG/wKlIBrtDGdXzXMRfnxg5DKNeZSN0/+e97BUdC6aVHOLx/rk1nf2YH95BlqIzj/6AW6IlUTNNMstOccPtQd7kfWBTy6ldNFVC7t0eyNKLyyugsdo605eKjBtiygKyLSm7rBrP/CZ7qhRwi5ZCMLBUUzSgkgYg/+XcQisBZTzdOy/o/223PQkG8WGRNk53ZdC7u9PEopKMxwqBI7/ALOfvnSl+4ryWpRoXEhOe0Z5BG+bIlJIzMVUISCLGlkX8T3sjjlTljUM8eGWU86L1rzGuGzf7 sKMKMg/G7lWwQD+Zv3LoMuwKlx5P8pNxQlQSmzQROhjDZSF7RqEnDdXTcvpLkaJFPPSANuiQLlozGthu9jOB5JHQOLo/w1W6TrJTeU37WhMcYg3bSRxQOxDXgGBi/Pqvh+pcrJROvbb9y4h0KiTmtN66FwZ/JYsrc9kd9ZUgJ2orpEfhndPmjfVtESarnj98YnCvqbZjQXlctk7l+FUCPpUHWhYE5ifITyR52Zbcs5fmAW5+i4N8rp/Xeu7RTD8/E7G3Dsw/krufokGnKDvMhoPA8ck3gduTzpuZLE1nSRWVCNXtLza1WT3FBZXWSyku/vRtI1QnpTNnTGCLqtEOIJS7XPd6GjGmLk3K1RdnF/G/xBAuSLrXTLzpsaatUaSoAXzgEXfJ+GWkz1xrZ88gkbKfTtxcu9YuVVZHTinCZHXdEGbzeLvUU7NdQjaYAwMqkBEkbwPsNq4ofyTgszg== 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)(52116014)(376014)(7416014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tG+4y7dXq0CRyeeyf9e5DJCZV91kHohZaXW3Z9Ffw3rx/WOKuNd7tPLaD7qzf6iKqT+EC6+CWp9q6jDDUNpytDB2OJ8JBqybg+xoNE4LVIlfeRRxsPrfDmhhWbtObZxNtMQVPThLMXJTfWbuJfKGP1VkrFVXRRvFSglj3lKgwuz2DLdjok6ED9pMHixeDy3D2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Qs9+VZq/Jrx7UHzr8pCLFFhTj/Dgm8qcK2q+lLX/t/X2RE/C+bWQkY9ZRR4u3JkCpyVeWq1MtCarqIeyaVdWGrMWk3Dbw5dVRHn1QRN5lFO4E+LC4fQMx3hSZ4OYMyNqTjOpeC1avTyw+DPQxwDVRCbJaVwDVXaHvD8u0Clw6RH5VaAhtFp/mxbE4i47Qej4R/ZI8wcKHKGIAKomWmDMl1f7XxHAA9Yeps236lIk62MO5Nb83IKS3E1Zb6mHffiTZLedD2bFBWsXRzNV8mzfp+2eanqJTlfJlbnZ1UQr/7AKOvjAgPpSPgGhFKbJYVx3SNzDGxuxeWw== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b998ad41-e969-4308-0ab3-08dcd19e9cf6 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2024 13:43:54.9523 (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: Pi+dE+Ex49HAFI+RljkGXDPfv4Emtu1nilNlIa88VshU/xnF9motSu4Kowtuyy0VfbOSvMAaDfXrIjccn3cv1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PATP264MB5061 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_064400_109982_42861B8A X-CRM114-Status: GOOD ( 13.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Catalin Marinas --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/io.c | 87 ------------------------------------------ 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a2f8ff354ca6..cfb1c729c9a1 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -140,6 +140,7 @@ config ARM64 select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP select GENERIC_IDLE_POLL_SETUP + select GENERIC_IO_COPY select GENERIC_IOREMAP select GENERIC_IRQ_IPI select GENERIC_IRQ_PROBE diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c index ef48089fbfe1..fe86ada23c7d 100644 --- a/arch/arm64/kernel/io.c +++ b/arch/arm64/kernel/io.c @@ -9,34 +9,6 @@ #include #include -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } - - while (count >= 8) { - *(u64 *)to = __raw_readq(from); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - *(u8 *)to = __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - /* * This generates a memcpy that works on a from/to address which is aligned to * bits. Count is in terms of the number of bits sized quantities to copy. It @@ -78,62 +50,3 @@ void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count) dgh(); } EXPORT_SYMBOL(__iowrite32_copy_full); - -/* - * Copy data from "real" memory space to IO memory space. - */ -void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >= 8) { - __raw_writeq(*(u64 *)from, to); - from += 8; - to += 8; - count -= 8; - } - - while (count) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_toio); - -/* - * "memset" on IO memory space. - */ -void __memset_io(volatile void __iomem *dst, int c, size_t count) -{ - u64 qc = (u8)c; - - qc |= qc << 8; - qc |= qc << 16; - qc |= qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >= 8) { - __raw_writeq(qc, dst); - dst += 8; - count -= 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io);