From patchwork Tue Sep 24 12:14:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13810885 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 1060ECF9C6F for ; Tue, 24 Sep 2024 12:18:41 +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: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:In-Reply-To:References:List-Owner; bh=xMTQCS6YqrcBW2B3U1sogQqmX0jrdwYKxadXhJpwyik=; b=WVGNMUxUBQn5Scc77BRHT5fSLm gvwGMrp2mWVIqSYlHi+3ux17EYnY+/BAR3Uy09TCW2HvpvY+RDtEn5MFV22fCuW3qM9gWg6VngWvr R9wVcMNrZZhy4Ikzsj36CthbzRAF7G7jIERaoWUEfGFryQHafjvyl5xoRrtiuG333yM0E0Ydm2YDh J3cIGtNwyc21MZob69q0/pdtgLOuD9UzeeRRXELyzlclS9cqbztG85pp+slsrR+VuolHSsYwRyk7c Vzexci+BbRVysjmUaKPPP+EmyWoactIBHvixmiba68CzYdl9hHcXtGTMYB0NF/W2CyNoAoVEl4as+ pwt3ydPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1st4Us-00000002Iei-2SFj; Tue, 24 Sep 2024 12:18:26 +0000 Received: from smtpout143.security-mail.net ([85.31.212.143]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1st4RM-00000002Hcj-3CcP for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 12:14:51 +0000 Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 49496903A38 for ; Tue, 24 Sep 2024 14:14:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727180086; bh=3ECi8fHQVDRG+KsymMA1Fxv2KmgGeKalYuq4swiCZGM=; h=From:To:Cc:Subject:Date; b=dAHdPo2W8/YcgzYc710G2KvdKjxy+sRDNEClWzpkRifg2luh1ebSzm9L2mfYPMgBu n3hABaZ/A6Kj6heduD13XEutt6zY4bOWego293fIyGypOh2DYepUpBbAWhmEtVbCnr TNgUSYyd4dkwbeM04yZMjEvBL3aG09lK5SCxLF/8= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id F3E1F903B1E; Tue, 24 Sep 2024 14:14:45 +0200 (CEST) Received: from PAUP264CU001.outbound.protection.outlook.com (mail-francecentralazlp17011029.outbound.protection.outlook.com [40.93.76.29]) by fx403.security-mail.net (Postfix) with ESMTPS id 11C8A90327A; Tue, 24 Sep 2024 14:14:45 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PR0P264MB2391.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 12:14:43 +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 12:14:43 +0000 X-Secumail-id: <183d4.66f2ad35.febb.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UT7v7ix5dGjWofkygb0HxAzhpW46PBc+oSNpOzqb+zmcMg/c8ysq2d4nGgnjtVSIBM3hA9usXdvsTH+c3+e9yW7voAdUacDVQL5grS8OXFkqeVSJa9tH5hooADtDOieUUdh6QtjgAUzc5GQkVo4atiNl0aD7nnviUyBgFec7P+EiJ1PZLVRBavR5W3BeUygiw3P649WU12NtTbB4x2QowThZ43N/PjC79PFSekJjb0+2hXFnb2kPfjG4mgjqXIUioLTFK871FUXrVzCf4dAs74Dj5QTHIP+fkaXcjZPF1FaH65yqutBvci1b+kW1n3KWxmyLk6b1DLrnWncCqGhKNg== 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=xMTQCS6YqrcBW2B3U1sogQqmX0jrdwYKxadXhJpwyik=; b=HAak/zhvdLK+aMVbq5iNwee5gC2JMMci7gUBr6gZbg8ICNqe3d10QUgZnfC7iJ0sKlJpd77MsSNMgqHyW36lgJsN8KesnkjgFLSbLuCW6TYHtQ8fjF+27wsCG250QYpr852j0NR96KxyVWZQSAxFykSArmDTiW+xbN29uSG1P8uMWkragLxNuA2jAV7Ur9Mt21MLg4wwRnL8CW0acqUgVnQc0hbqSFg//tKVQvn49/jcl2PmsIqna6RomLsoJSbddBDVbaohZfM6fmLD09jaDTRi04gKvoXHI9dJVxUG4iROeX27POeqjidvLkZMWE0J+g8vOjJwU6sgrrqBDiqe+A== 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=xMTQCS6YqrcBW2B3U1sogQqmX0jrdwYKxadXhJpwyik=; b=qldkJg+50aeAv+p0Iisxpb4aVYrAd5lo/wgrcWca4CYhsnLlKPpJUkpEw8CtuukDY2PCSCBlohw6ANzfuGlz99Zgwk6c3X1IttpTsTlsPgKHx9xclitdKeWf6U6dJAvYctm/B/nzK4IIOx99PlXQD6acqVCMxlYaGFpSWkD6Qu8EAVR343iPmvFmWUjYLdDeBaw9JKjn7YGq+v0hSoGp8Lbfv0yEtqr9kt2ZJYrbTOdF8uZwaQA2/SDq7geeSKG659segnshF/dnX5GNDyrs0y9edIr4Cxw2W9WuldNPg4qPuGPJQtQkc029oKiUhPyoJBFkgMBV8alr6rZSTGwb8w== 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 v5 0/5] Consolidate IO memcpy functions Date: Tue, 24 Sep 2024 14:14:27 +0200 Message-ID: <20240924121432.798655-1-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: PR3P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::10) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PR0P264MB2391:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e28ec95-4b41-4e99-423f-08dcdc92790d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: 3bELz1oyao4EPwaJLdsIWaBY4vJ6aBSYWiL9VbP5tsLWEKyKcZKqzFERcabcd/HTrCKXJufmSYwt919uk/PeicdS2mOFm6iJt2nBRXaUyql5VkHkT6i04QXh497QEXbJO0G3QOJqMn35ph7vLq7+rj8Z7SlvPZZQJ4OyNIeJea1BqKneYt31cHrU2JTUiShzzDJuW9+2NdMdiYpqouLO09k7fa4LOAOLgUXqv9p3HcWicgKVa57qf6+nipYjArQlDst8QIBlmHITjKXucrAVJaCt+8WhcnB54BBrrzE5jKgc0mSIe2Xrg5/tERWBNTvzqO4yc0/h+TkiVyTYXJQjL9gxU5cdhjibrnfLKY9N/OITXBYBhEelablr/5xLgjw5V7U1A5a2AGbs/QD3AoGpTs0mTds8MPtJgYlRvJ0xwKiGORYRQ9uNuUvr9C9FCTEj8lS+4LaSjUDZBoKYc0AZDL6iDvAHGONtXTya5W0Du7Zp98P433MN4Qu01zWJUk3c9o6sjDqEX5Ui3lkLRDZsiMQSXTJrXabfV7Za3hlpcBHl6Q5nOUD6Y3uZlRv+UoldWsUeJ2pFyouOCGM4XgI7QvP//JzQhZVZSTKW6bUcqLgArvZN6Vd1FEM2x/TsgPDstVL2HQFyyOb1cG9QXQ3FdjcwvqoHGuh0NIknAfFBC7YtG3J0CaqnkP8ldcdxya0W8w3DambzvQr4K3/JlSTTblbVPmzR6mtMukciLVCmZ9nWDo0qk660lXauwDe9B2OKH+4zwMFlVP7AhhMHAcFrUS8nNruRjx1VdXP8AjLCngYLP5bMx0gRhezic9/FmWOcvkNF7zHgCnCVpky/WTbpcVcCD57Qn4uYzh0JUTNHcn/gRxU1jiKPoVZOrZCN4KGuk74e8nal0FH4teOUaAktJeDy6VHQDjd1rbMmEIoM9i4x2j3CEL5yKs0IKjDdwc4FzaC uRuaq40usIlHWBdkUe97V5PFIqmV4bzcnBquHIekj184MYMKlzpcO/UZewICXNErTlCIqii36PCfiY8jGNe4npypGxrOeyXinH70k7CZ5sqPxuicm8wj6iVLrUH8MRlZrCci4YQ9o7I9Pz1AU4epuVUJNlPbj29Pmp7AMFKeRCqvQPSA2DE2y+PucZ1nNlrsAr504wmO5jWDgP1z41T79zxxVqg90Cg1eK0GL0ohdUBAlsD2D+QbwkHczKFwQGmtPU3mEX5pWeoEMmJmrNfGysWov7PTaO8C3JalwhHbgSxOZ6AYYG04iSaHm9yRJUZntG3N6uOYy4pEh8iDh1W4RJCpx+wd7PZPLfZoCNVLT2Z7R/+Fl1muxaD+G4bzctryR3WdOHL8OKnEqwvOy6xlHMPbryxriwxcxi0tzVLcE426R7514MRXnblJF9tmQUBXywJOYwszDd6mJW6M0IQ== 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)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ThJq4zjTb6O6YzLlVHk1s//HUvTFipnjTAjRK2+OAcA7dmC7R9AGtjokeweX/SDNXACO/7CWe6WXpbYftGQsLiVgA3cXK0G6k3KRaf4QfTx6mHvk+dhN8QC9lK83dIZSHs/9sfp8kIaKd9JUZAlMa6Mjy3BDhVijsSiwHEpzQ8LUk+CxBQJfEgQNqdh/9lhbJgPCU7u8cqZNzq+kwukF9s6UzLOBwKK3MhhS7qT2KECTdyR2zdiOCDdYjaFVp8IgUy1AYqrfzCWPvq6uhHKjHfvTERX1sw24O0i6IuPqoAV3LfkxJof+57tV4KilAbRZoEnhGo2QEhgKRTKAs5Ly5MlprMz3h6pFSp1UYcdkLOhias+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h1A+NsUzTqW6wPaWhiq9n/sLc0WkCuSomQNg9e/R/u1RQLZTKG5+HDfral1nYvWVSdqbvXzhuGChePwO1rYB8YWkC34VWR4pia9mSv3En4DuPLUD8UjLLAMc6VRQvJJtX2WhJG74Tc64FZGtxa7EN5wsFiu79x2cxHdM5RHlxZfAqaZ9adw== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e28ec95-4b41-4e99-423f-08dcdc92790d X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 12:14:43.4870 (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: u9/X+tddNIVPad1FnoqqDsL96NxkAd5MZzQ+vNRrVpDENdaTpys1iFeZsXF5/6NS+8Mv68D692+ZLh08yiEIGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2391 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_051449_529054_43FB1CEF X-CRM114-Status: GOOD ( 11.20 ) 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 Sorry for spaming the mailinglist with new patches. But please forget my previous patchset. It was broken. I didn't fully understand your previous comments/feedback. Now, I added the new functions to iomap_copy.c (as you proposed before already). I guard all of them with an '#ifndef __memcpy_toio', etc. So, if an architecture already has its own implementation it will use it. If not, it will either call the new '__memcpy_{to,from}io' and '__memset_io functions' from 'iomap_copy.c' or directly the 'memcpy_{to,from}io' and 'memset_io' functions from 'asm-generic/io.h' which are just a wrappers around the __xxx functions. Signed-off-by: Julian Vetter --- Changes for v5: - Added functions to iomap_copy.c as proposed by Arndt - Removed again the new io_copy.c and related objects - Removed GENERIC_IO_COPY symbol and instead rely on the existing HAS_IOMEM symbol - Added prototypes of __memcpy_{to,from}io and __memset_io functions to asm-generic/io.h --- Julian Vetter (5): Consolidate __memcpy_{to,from}io and __memset_io into iomap_copy.c Replace generic memcpy and memset by IO memcpy functions Use generic io memcpy functions on the arm64 architecture Use generic io memcpy functions on the csky architecture Use generic io memcpy functions on the loongarch architecture arch/arm64/kernel/io.c | 87 --------------------------- arch/csky/kernel/Makefile | 2 +- arch/csky/kernel/io.c | 91 ---------------------------- arch/loongarch/kernel/Makefile | 2 +- arch/loongarch/kernel/io.c | 94 ----------------------------- include/asm-generic/io.h | 18 +++++- lib/iomap_copy.c | 107 +++++++++++++++++++++++++++++++++ 7 files changed, 124 insertions(+), 277 deletions(-) delete mode 100644 arch/csky/kernel/io.c delete mode 100644 arch/loongarch/kernel/io.c