From nobody Fri Nov 29 02:32:18 2024 Received: from smtpout144.security-mail.net (smtpout144.security-mail.net [85.31.212.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35BD518D63C for ; Wed, 25 Sep 2024 13:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.144 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270686; cv=fail; b=XdEL7WXahwNQQ8vfjsDKW31Z5WiULvInwoqdFQbI8jPtT6RvoC2HM5tX45GMMTxIX6xccgtsrQ4P9LkQZ1qhSJzBU2ovxbXv17h7cMBM8tBcRncpoqauqeLTQuhv4AMVLMOcTWnjydF/Apr3a3mEX+/I7qISimW5IGBP5KJGO84= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270686; c=relaxed/simple; bh=eisW3SBIVwOZU6byfxqbeAuBkiCC3dpFYJhzGoq1knA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eNLpMMOksN0H8bdV8BrqQyeejDXKegDcAEOgpzNldp4L4KWo1nEoeghFdyIwId2aH1Jog9NWpeeFEk5+T9Df7Z13beDl+SHg1qUWy/1xTe9bI8vOn8M1AMs4yd9UThyW4U1E6f8WUdt+qJFt9WzQeLgxhlAM+5wX/TI0xq00EZU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=bbZT9dkA; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=EtH8K8tD reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="bbZT9dkA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="EtH8K8tD" Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 01564349655 for ; Wed, 25 Sep 2024 15:24:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727270677; bh=eisW3SBIVwOZU6byfxqbeAuBkiCC3dpFYJhzGoq1knA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bbZT9dkApxj08wdQ+wlCWgYdR1sFJH9vLkS2mH/Z+Md5raX6hQ6K41d5AfP6VIyic mJRoe+zQK8QFQ+XWAkQCxVhaiui0CxRZNwebjz3U3897AROWXYLgiFA7chk6eKMMZl LETupCl+3Jh6ODgXKJdZ0u1Wzjps4ML1RpnfXkhY= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id BA29134965C; Wed, 25 Sep 2024 15:24:36 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx601.security-mail.net (Postfix) with ESMTPS id 445FB349655; Wed, 25 Sep 2024 15:24:35 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PAZP264MB2543.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:24:34 +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; Wed, 25 Sep 2024 13:24:34 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n/KCqzohJEdvZgRbnrrmKoc4nc9xbnlHSvIBcapef2l5jUjTKFTrNXJjJz1+XM0p6E/BRvvZVMkLR4Dl1TsKu1/jBo+zQj8tvBmUpvicQARIclQWL0hprrCQafoEElwsnBmuiFvpSr4bBGdbRrq4SjkZsEHPdzc2+uXsVHTNe4xJ6jOdnJn1GvQOlfjZpgqfiefnjAQOW27HJ8RMyg7JgJ/qZDVYXHcLuk1iqdmuagPD8OeeutpGRBwjzDZJniCobOoRwyo8WArmAaQLQclUAw1VgLNmULRNyK0zX5hU88p+TgJLsqLiqcnpJmAnWHPudQpaL5ii6H5no+lJ32qjFg== 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=LXFM7S6Vi+7rJo9WQg8c5X/ZkfhFn5Zye+NI5Q+SVVE=; b=dqM+09NNv1E0wFpEB07emZBNYBQNMg0q0D1//FWuSjCjjmktFnFtK8WQUhYZhDEj7KJrikbzN8f9nhjhyrgF4imVzF45FEfqRR7bOhvb3te5nNOtARPO4hb1Tl6LIU3NCL7ztCKB95alxl6CjfndnZsnqs/DSYhZTglJFQIFWaI6DSGtJZVLwmNqfe0/4xyfyPjA9MxrnOUsGSsRagBD2mGr3RdITQPRgVUjEXDfLNBaj/OXxPEBeF960ySsHNUXOY6Gq0qDlUmeB5rkBcYFmURK1bEmAIAawoKMBHlkxHRREyM74UNnk1YGAcoWW6R2Z1aw9025nxt5hFmYztzv7w== 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=LXFM7S6Vi+7rJo9WQg8c5X/ZkfhFn5Zye+NI5Q+SVVE=; b=EtH8K8tDSddSks9PiSAM+GYdEOY0DPELcU0yWutPttmYVcZTrV4hlg4kgCwey14MQ5J1l1/Yfg03mvViEfKIH6FXzzxcDO1HhMOrskH043k1xsHOsr4GCDO16RobeCUMK52VSeSeXlLj/q7g9bl6mvEwIrsnNhQdv3yVbc04xt7SUann57g/ILNqz38VQgzVldxrnu83b2/fmz5cdlx4B7AnzPkCwByPEdClPNn4UlxQfr5XYNM6AHxJHhdJRwm1nkFfVZ8tXKqY7/OJ+Figs6iMPMDO8aoidmTLJmNcilM6bdRuZLl5R1gddw++nW9jAFBCqOr91hfm1yXcg6+V+A== 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 v6 1/5] Consolidate __memcpy_{to,from}io and __memset_io into iomap_copy.c Date: Wed, 25 Sep 2024 15:24:16 +0200 Message-ID: <20240925132420.821473-2-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925132420.821473-1-jvetter@kalrayinc.com> References: <20240925132420.821473-1-jvetter@kalrayinc.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0138.eurprd06.prod.outlook.com (2603:10a6:208:ab::43) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PAZP264MB2543:EE_ X-MS-Office365-Filtering-Correlation-Id: 30065667-2947-4e73-c280-08dcdd656556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: zDBlCoq9ijUe9lYrR+M6zFP7bC8ptRFCIzYfMEbW/b5yHpRW6bqvqn4jP4Awvg2rVx6B/8liHmGkKeWWMxcHbll5nipjFWo/Kf/OutJ8NTRCy1hyqEWG7Ho/4f1jtGaTyZp+E80bVxbN7V42ueA6h375uNqYtFSjlA5Q7WOdIaj2LF7PVIwYkmu/rjOSir0lHF5SouNiBXr+1l1eD6fyhcSfTen6fNZuIysJX4zpizMMq62JfkRLsRPwc5Xr9QKGKGgk94wm1ufrS+bjXK2akI/TverOgoxNYJK0cAD7FQOHu0N1IUe3o2UmsrIs/rVFpT+hwNkrliDFIbeG1CO2kmB73478+9LWTepFlACjvE0r9lQ7LlbAk1/Q/iyVae7bPVtb7ZDqfNpRYnbF7oQpoRSFpENSOyH0LvGRWqDH3/9Q7MZccRw7vrMj+2qXh4lewhQE0mtatjxGPGavIGVgifQAdQoJ0fHkOSlPC3a15MJQ2OfGFDtF5PuCb2cl6lv5p7rMqcF8AWoI6FU2yBX4XyGJDI1t0cc8zIuXdNI1l+WXwdDW8vGh9bffDvjdZtSxT8HMRR4EsrqTLX/b/QQR4y9myRfcm1lNGza6dl8993K3rAJQ6Cji9dSG30DJtnqp9rStn0czG2ysogOtQ4yyNL/Vs+Fp6GrZpIyR+9SKkPQhhpsDKe5VGcBOZ83qC8maOUa9NGtlqHVdQHnuk1U0oE/19DN53cSRTllhsiijLKiKHKgFB8GaxeSEXImqJavGvhFFp47W6G2VQhPPYkC9hgjMJQ08J13f54dBbikh8BzgoDZ5H3Kuv9cnOln9QAQjsvidWm+TmeBDFz2ZcXCk2UBrUKnAhlBQ9oguMwvJfXP0aJu1HaEMUywH1jg7PEHPVbPdpmtou+iVGDT++UEmyx2T1JOKIyD6wjamC1m8f6/Ro1Abw2qygv+gvpMnYH9NnHi jaAqpOgWU68R4OspR+vkJRMKvXzY7eaFQ/WpvtWh+GpqASJivxWgsY+btgO3yufDTPeXNCFohWnOVFUcIYHYvRhXXATqE7WH9X00zdF8s1+GtxfhFso+/+gJvSIOTu949v7vlooBnZ6Xmtm3o0PPbpXgIRS4B5oIU7KRNMFHX1eMAhw916NrrcznrZlCDV1kHLQNTxKwIM6bDCYKeUiGE+P4YCb30k4O3CCDXw5Gtwl7NKYRKNzGIIXo0d3ZQ4Q+1qlbPjGXyAavEMu/Jm5EEcC95cgiT6TZKWD8ZG2JiPza8g6O2CyMc4JFXq54t0EwBDJXVKMiSg00pQD4bwrEEgJoTSM8mJAeZGzT1WtV+PgnE+cxklTzv4z4jJ8GMNoanp/DaXX8CT0NV4ArcwE6M4u+8ng4kA259AsNWTAhGC953AeKaDoNCtTZ86BpFTul9BU2Uh8ZekQBt8IIhMw== 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)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A8/AFkQclqh0E6JNLZao2axZu2+pwkwVn/8+TLwIUBANlhaV2NfkghIbV3en7GG11I7tYbcR8y2Ks331QrECDy4q2YOVVUwrgSnoZVicKPaxv/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ll3WYb76CMD/NYxh5MoCJXiR401ByAUsw0dwHdNuPtEzyAG5yiJu0J9AKukuosx4Q5EclaFNiNyABpRdnUXG3jy6eSPvS5PGNHVjfAMWN37EPHtGD/FXqV7MgIoHEE3G38EbzD2zvhPADLIJp28LSOI89Y+gpQRmmYYmYTfm+qxq2O/S87oiheUXR5XI3IdqwRerwHKNxRKC4aBGVqrxsNrWcVF6Z436/N2Pyed+yoAr3PfJyv1jQQs43w0/o+HAB6zGc3Zgwr8WOjIUYSYSSGJl3wVJKvS47RHqB8fYSBsUYVMO8ayrBTI5EzTSeYDzZDbeTgZty2Smnbn4fbKneDfF5+bk+4l5qmxPJhjiWjgXiCblS7cScHuuSRZfhmkNS/zLwTR1nAGSo8Mw4nQGX4 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30065667-2947-4e73-c280-08dcdd656556 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:24:34.2239 (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: JaJrsY8jFtxjBTahp0KvK+Kbvh8OSxbuZ87OHu0JQNIdVm/COv6gMg9AXGTqZYHCM23BGiz58CHz5q0qFMnCSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2543 X-ALTERMIMEV2_out: done Content-Type: text/plain; charset="utf-8" Various architectures have almost the same implementations for __memcpy_{to,from}io and __memset_io functions. So, consolidate them into the existing lib/iomap_copy.c. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Signed-off-by: Julian Vetter --- Changes for v6: - Included linux/aslign.h - Replaced compile time check by ifdef to remove compiler warning --- include/asm-generic/io.h | 12 +++++ lib/iomap_copy.c | 109 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 80de699bf6af..9b8e0449da28 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -102,6 +102,18 @@ static inline void log_post_read_mmio(u64 val, u8 widt= h, const volatile void __i =20 #endif /* CONFIG_TRACE_MMIO_ACCESS */ =20 +#ifndef __memcpy_fromio +void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t c= ount); +#endif + +#ifndef __memcpy_toio +void __memcpy_toio(volatile void __iomem *to, const void *from, size_t cou= nt); +#endif + +#ifndef __memset_io +void __memset_io(volatile void __iomem *dst, int c, size_t count); +#endif + /* * __raw_{read,write}{b,w,l,q}() access memory in native endianness. * diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index 2fd5712fb7c0..c2cee6410151 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c @@ -3,9 +3,15 @@ * Copyright 2006 PathScale, Inc. All Rights Reserved. */ =20 +#include + +#include #include +#include #include =20 +#define NATIVE_STORE_SIZE (BITS_PER_LONG/8) + /** * __iowrite32_copy - copy data to MMIO space, in 32-bit units * @to: destination, in MMIO space (must be 32-bit aligned) @@ -76,3 +82,106 @@ void __iowrite64_copy(void __iomem *to, const void *fro= m, size_t count) } EXPORT_SYMBOL_GPL(__iowrite64_copy); #endif + + +#ifndef __memcpy_fromio +void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t c= ount) +{ + while (count && !IS_ALIGNED((unsigned long)from, NATIVE_STORE_SIZE)) { + *(u8 *)to =3D __raw_readb(from); + from++; + to++; + count--; + } + + while (count >=3D NATIVE_STORE_SIZE) { +#ifdef CONFIG_64BIT + put_unaligned(__raw_readq(from), (uintptr_t *)to); +#else + put_unaligned(__raw_readl(from), (uintptr_t *)to); +#endif + + from +=3D NATIVE_STORE_SIZE; + to +=3D NATIVE_STORE_SIZE; + count -=3D NATIVE_STORE_SIZE; + } + + while (count) { + *(u8 *)to =3D __raw_readb(from); + from++; + to++; + count--; + } +} +EXPORT_SYMBOL(__memcpy_fromio); +#endif + +#ifndef __memcpy_toio +void __memcpy_toio(volatile void __iomem *to, const void *from, size_t cou= nt) +{ + while (count && !IS_ALIGNED((unsigned long)to, NATIVE_STORE_SIZE)) { + __raw_writeb(*(u8 *)from, to); + from++; + to++; + count--; + } + + while (count >=3D NATIVE_STORE_SIZE) { +#ifdef CONFIG_64BIT + __raw_writeq(get_unaligned((uintptr_t *)from), to); +#else + __raw_writel(get_unaligned((uintptr_t *)from), to); +#endif + + from +=3D NATIVE_STORE_SIZE; + to +=3D NATIVE_STORE_SIZE; + count -=3D NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(*(u8 *)from, to); + from++; + to++; + count--; + } +} +EXPORT_SYMBOL(__memcpy_toio); +#endif + +#ifndef __memset_io +void __memset_io(volatile void __iomem *dst, int c, size_t count) +{ + uintptr_t qc =3D (u8)c; + + qc |=3D qc << 8; + qc |=3D qc << 16; + +#ifdef CONFIG_64BIT + qc |=3D qc << 32; +#endif + + while (count && !IS_ALIGNED((unsigned long)dst, NATIVE_STORE_SIZE)) { + __raw_writeb(c, dst); + dst++; + count--; + } + + while (count >=3D NATIVE_STORE_SIZE) { +#ifdef CONFIG_64BIT + __raw_writeq(qc, dst); +#else + __raw_writel(qc, dst); +#endif + + dst +=3D NATIVE_STORE_SIZE; + count -=3D NATIVE_STORE_SIZE; + } + + while (count) { + __raw_writeb(c, dst); + dst++; + count--; + } +} +EXPORT_SYMBOL(__memset_io); +#endif --=20 2.34.1 From nobody Fri Nov 29 02:32:19 2024 Received: from smtpout144.security-mail.net (smtpout144.security-mail.net [85.31.212.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC6081AE840 for ; Wed, 25 Sep 2024 13:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.144 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270686; cv=fail; b=WXaBfKTEuTHA8VqD85XgQWHg7Nt41MPtfBgsYsGcigxXnMB8DAqNjIvh9BNVA18vXX2dXXAjUmbRvEo8xSQNsquMFNKS1h5l535u2Sx8k8Lasz2V/hPXALRwrtbgs5jMHekcKJlOH1ga0+HsZp2wBqheT/m4dAu9yPQ60o8n1S0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270686; c=relaxed/simple; bh=zXkNG46BbYzpGMMLDAN/iEUBb17+6yn1qe9DLsAMZnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JD2Fyrh779BvtKEsbaC7AlqrDLWpGSVXBBdA0ren0YdiDDUK1oyIxdJMFgSPm9lxgD/0yYLWtvDOrD9n4UALJb91RQHkJnyjjovKqg5kXsqCRBsqi4My5mzL4eD2yXlMxQnJwtxMYHB3s3ogVFIp9qb+A0BtobRNFoauegysZdE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=PMIHaVzP; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=QprVEam2 reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="PMIHaVzP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="QprVEam2" Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 48F193498A5 for ; Wed, 25 Sep 2024 15:24:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727270678; bh=zXkNG46BbYzpGMMLDAN/iEUBb17+6yn1qe9DLsAMZnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PMIHaVzPKXOZlMS5qT9o+rYBRDfUvdw8fRucQls770n8Ch8HXjdxP11r9v5YRSXiS 6fu579300gpqmLLUYZmxEnPterM/1XS34B3AazzYq024sGZ9wpgEGHcWinOtZRiqky BbT9tuv331hVX/dlgJc5dfXEE1AKVbosyVyR3yFw= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 0B7B1349843; Wed, 25 Sep 2024 15:24:38 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx601.security-mail.net (Postfix) with ESMTPS id 6B421349608; Wed, 25 Sep 2024 15:24:36 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PAZP264MB2543.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:24:34 +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; Wed, 25 Sep 2024 13:24:34 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TgKuJ56s/mzAA05eOIPF0f58ROOdpdoto90aOc6GP0TkOr5iuil4xt+UXauaEnxPOVeOp14tsRb1l8QUYFgf5P8JQj4rRcOKDQdJoNvwRv3JU8omlX4ckz2nd5q3t4YXiOKwGy01MD2io9Y/wFE7bGzowmCgqlLnBHLEjtGRwXw64PWEM+b/6RhbLUUEIxrRsaePLnKhCu75wk0NPUYYDFrKIzyGhTUJ7acz38tqXrm7wpQJ89yd0QSt+K6G56wxJAQ6nTXneuV0jrZ1rVh+Psx6rKHQZY4+LMzMXVPPiDOUex7bX22UAUmcTCK+1SX/pNIE9U5JvuJDx3FXs9V1Ew== 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=2kreMTXDFdHxSgKTqM10ticlVWn9TtfUGl14nZSZMwg=; b=HQxTFkqTJ7W0JXZvi5XXCYqUxBcLa0efejjCzbXSnBAJsUGalFV+wS6KKaXEVta/ndaSZrYtnL5591R9krAZ1jN4+/8kIKGddAL/hKc807F1D/MVu3agSVt4LyXZUHAtHYJDLIa+ZmYAry7LLqmItt/ch1L9m5EdhfKhA9cbnLJZC3RKFxXZIMnsnf3h/30XvB/qZIEW8FgC59h1E+3d0CRvmnnnGMmxCIKE9oqG8rXtBfTfVQf4UsddIKK8OLppTGfpuQ7JnoYhzNDbkX7mSNpBGQ51dLL+hTf3fc8j3KZRXyvRddJ8nw+VM36aUEt4CpI/EblB1vLQDaRIzDRj6Q== 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=2kreMTXDFdHxSgKTqM10ticlVWn9TtfUGl14nZSZMwg=; b=QprVEam2YGpDGd6E//O5RifT5v/XpXNpHx3WyigSRqmGxQIO3a43iAsBEyKw6mW6E/NJLQ4MV2XzdgldzUKrz21PcD9RHZcW62oWkJdoK1I2Blxx9keGE3z5SBVfv/pqDaWj+NVp+jC/AcF+le5W+mnEmKttuoqf2yXuFj7sXVf88bbJdiz1Ha5zv1KrcYf9dTPK+2jwQxX+zRHaOf1Xl1ZOvms8/inNoO0NOiS4sp0agAEC6sZQddoSq8PkG40kOblIAZwWEx7fPh0m9oDkgLZanv+Qhjo9jGSQlFxB3VvzVM70gW9arHmT3ZkGa+2T/q0KP8rQiP8ZIp1xbl49kw== 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 v6 2/5] Replace generic memcpy and memset by IO memcpy functions Date: Wed, 25 Sep 2024 15:24:17 +0200 Message-ID: <20240925132420.821473-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925132420.821473-1-jvetter@kalrayinc.com> References: <20240925132420.821473-1-jvetter@kalrayinc.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0138.eurprd06.prod.outlook.com (2603:10a6:208:ab::43) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PAZP264MB2543:EE_ X-MS-Office365-Filtering-Correlation-Id: 03de4353-0b2c-42aa-ed59-08dcdd6565b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: xuwEcpuXQssjt4Uy1GJ4VRV5zv0WozvFG5k5T1K1FAZl6Z2v7UihvKAEEIRawn1KWZEfzE9gg7KZqCU2thd8VHaTla3eWRd9jhp6l/3V2czGiJuFhm/fYOpblC7FrpxJV1NQAAcE0j/NkfabMEXyLIw88wukhk5FUPGPiglloPOHrlpPqBfaCoYitM9lYvV38n4gFyZMLLc5oZaiS3vtH+anPZsc0gGekNxgH0sMAFaaQKbrucy4+CUEG5FadnF8nDrIEtlhViPUJB5E60C0MO0aztam5Tm/KFk2iSPWR5x1kwRoVqPJrLMaFO54DTKORRetV8DENNwv2iK9WhJgIYK+EpyKopo7QAkx/uWudpACNvGG4Qk0HIDWljEPGcySlpGWhiXvKR4ElwHgf5NRmxosKXE9eETmrGuH4tff51TfpTjjfkU+KxzwplsslrUJIGE2f14pCk0kBhEZxP3dPM7hoeeHWduOBdSSxdmd6lOyBDa3O+ZUvoQz9HdUdaZfsjN4OaYxPGr1dZMMtgXjAgJlRmcWrkFmBVQaNuReUqrhwBX8NrG5FuO4Jy9mgOLEFPZq35Tt1l+rDl3+SuAsO6y2Fh4bsgeV2Iqi0gbIhWCJ2bvki0fTKX+VqYMqpyBwbEK56OYn2sZkjZxWi+M7REQQ/o9rAsXdVOoXW5o1MAacf2J64inKy49ia3s6Lb+6UI3YnzleLUHf8NlR5+9Du9vjpIqyDHcgOzRA5CEcI2yRGQRPWJF9emJ5lD8t75NIejo3F0x/7OE//3n5/BkGHLyQ4g36yXbr0xQ9MBdNYi00sI2pZQQfxRyXm6c1ICsTHSzVpq1kGW8Uoiu3PAQtcc20a9dFuP61R0+iDXSCqiR0RpEj1sKKso0gFxpvPDArt/CrRd/dk5ucPsY+kyX6ktfI4grwdRvPYwI/xhlMQEO+T1k22W/DJ996AQv6gn0jqyM yQdk2eSOdlVAMrX6t/IaZ8ZCJr/kCqC3OvRDlZrzqhxf9Ok2sIWk/p9BPXZ/5TkyR5OQkf12/hY9NH5f1i1ApOoydlGwp/o03uUtyw4cObWRl0myCD3T/VTsldfQtHH4DCAQl2kg8no3S2iY+Ujd8zHegLNRkHzsgvtFX3miJkPwtBVDfjaLRpZOuqOtsKP2TP97EMQ0bmE8Zz5ax0lhFtxmyVf7XmpXGEy5fNItqIqpWbI7xUzDb3VOX2+QHRs4nq0GdPBYBIFdbYnD+1wUovBSEBQmIqilTyDHzDG0IckHAWbL5UH1deb/wQSDFxHWmUeEdX7JKQExditWYZvbXHRIKCDyiYh8jhIFuUWpFis/LrH6npOdonPhSR8sXhJ1+XVRNR9iuYGaCdnMszPYdWDWNYAOEoVFvM5ATfPGsvEdWYRZmgeh44SPnRDgCRHhFJ0lQfQTT7UFyNEBhTg== 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)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XuYG9tyQyQNZ6YjnXFKCuFHq7lFA78XTyudvLh5GOqLov1tRJjJsqQVIfIsxaTlqnv0moBfR6Wh/n21Osyn506PmhqTjds6LEIfO8v11kOqnteovczAR+3Bh+tSn8O2v3kQ2jEMttY9U4S70+K7gDjja7ZohbK2y+7ajCNvCDABkQ5Z5BCVNrLrWwQ+v7abS4hX9/OZUfA3jHpsbjWzfM57BWdAOhup8ULSmG2kAqZLmxjJD1a3VfqM8Z+sX90AcpXjDTUjNFVti3URlBQhKHMTTSXkdYNafI5kUXM/C3ipGSTg/g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etngR/+bn51+iVQDpVKgVKZzjpk2BFwv+usA9p/69+ntdv69ZjqkQ1LQXYPWY82vSd+ITNVfWV8Ejclpd+cpFcVDzu3gIRwOR0HDkFRGingjqpqp95hL5PFlw6PXCBSH5eMe7Dv08yYS18eKft3umSI0rjx6+whvZeFi4bzCFSdIl+MOjik4X4inID1sQeEocT7ybH9RZNvIWdKBD7NzxzBQAZD9C/h2S3g9rCn X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03de4353-0b2c-42aa-ed59-08dcdd6565b5 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:24:34.8428 (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: wdcAeQm46hRDCCjbEjnnC0dfWlr0k8JgMP6mSP/432qmfzQR861vYSpqUfkdi5VT+EjfM11o7THf7QHE9gSqtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2543 X-ALTERMIMEV2_out: done Content-Type: text/plain; charset="utf-8" Some architectures implement their own memcpy_{to,from}io and memset_io functions, because the generic memcpy_{to,from}io and memset_io just use memcpy/memset.This commit replaces the generic memcpy/memset functions by IO memcpy/memset functions that respect the given architectures alignment constraints. So, later we can get rid of the individual implementations and use the generic ones. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Changes for v6: - No changes --- include/asm-generic/io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 9b8e0449da28..3b7deb724a2c 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -1175,7 +1175,7 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t ph= ys, void *addr) static inline void memset_io(volatile void __iomem *addr, int value, size_t size) { - memset(__io_virt(addr), value, size); + __memset_io(__io_virt(addr), value, size); } #endif =20 @@ -1193,7 +1193,7 @@ static inline void memcpy_fromio(void *buffer, const volatile void __iomem *addr, size_t size) { - memcpy(buffer, __io_virt(addr), size); + __memcpy_fromio(buffer, __io_virt(addr), size); } #endif =20 @@ -1210,7 +1210,7 @@ static inline void memcpy_fromio(void *buffer, static inline void memcpy_toio(volatile void __iomem *addr, const void *bu= ffer, size_t size) { - memcpy(__io_virt(addr), buffer, size); + __memcpy_toio(__io_virt(addr), buffer, size); } #endif =20 --=20 2.34.1 From nobody Fri Nov 29 02:32:19 2024 Received: from smtpout144.security-mail.net (smtpout144.security-mail.net [85.31.212.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22C3618C933 for ; Wed, 25 Sep 2024 13:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.144 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270689; cv=fail; b=MrdU8mTz9CoD/Uop/dnkNx+lqkQhvFCSy5523w/Fsw4HWWNTVwUSPjrVrYiHY13GEa80xz6Ezyim6+94MA63JZ14DcfPvAVaOuyhN9uDIwgb9j/C3zsEAwBis4dUHksvNzmGiV3vJogl0Fi0yWE6KFrV3G0BvXgQ8lVsg4AKQt8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270689; c=relaxed/simple; bh=+p+S77kM14dl8jkDF2qDbZduMPFzmpo1uUeWISo9iQ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cnHDzJNEHkptX1nNdiEDx8FSO3TS6vfQeoroZxIrVpcZTHXj/5wfdTcU/VPmm8FnVay3C+pofh1ejMpnP0wSOQMCtuvpFsY7Oru2nbsSrlEUG2VU52zsbaJZIweFkQo2RMVuyP3BbsxMS/JrhOxiVjo2cu0G+muD8js7uOpSJnQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=Kf6NQD/E; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=c7ERJE3f reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="Kf6NQD/E"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="c7ERJE3f" Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 56EDB349A25 for ; Wed, 25 Sep 2024 15:24:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727270679; bh=+p+S77kM14dl8jkDF2qDbZduMPFzmpo1uUeWISo9iQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Kf6NQD/E+2wdH29CfQtc0EFHEgSlxNuTx04IWw+WB7JLE5ioYN6vZ3Mrw3KAymJXi lX7DbhFSnI3QlKGv9t412qnFMxwToTL169N1HhOkUkqfhPwgU+3LlVGNtNwP4wMjaj wYtiVCqkuhbap4GHin/+rr3jJI/oR8CepTHaw83U= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 1FBA23499A7; Wed, 25 Sep 2024 15:24:39 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx601.security-mail.net (Postfix) with ESMTPS id 87B00349817; Wed, 25 Sep 2024 15:24:37 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PAZP264MB2543.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:24:35 +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; Wed, 25 Sep 2024 13:24:35 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v2sOHsZCJfyfLMXMaIsOo8gtPK+RTA124+u2ZU0LmUePu78wSdsX6FPIpGY4eQrYpu4rNoxte+flWKmV3kwuP8JG2y1cukVcRPYZq2nkXh6u7tTDzjzl+yGPMzr+MvvtTuOlAeVqka5KL+3ENj1ZbEoJAnLZSgupFu/ELmr8Hf3IbfAPayO8+n9LQsXIhIJMBCTgUong0B2X1o7PKfgtCdKdUSYP465wW7yLyH7Q/kv3NYK7kUp+qd/7AQLypkl369/ZT2KSi2mG72m0zkcTXFGEKPHsPX0D/FjAljUxp0TnKBIHHpVr70+JKjQ3E+JN4MxyB3qz5JsvXAi/4nAIEg== 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=Ut08L4O7r8TPBHWlQDboYcOzmoTMwqPYwCivLnwoiB8=; b=mcs/AG/+iFOjDKEJzmSGgXHHsgG/P2saBLfMG2DsiVVX6TWRmO7ztjnuxw686FQYHw2wFk1etw/lKDwlTFkQXOgGVt1n3sikYLY2iZ2i8RnHkd6TWqCbEG0gCJd6l6JfW7fKtu+lwsUL+qbh6whmv6zqWI8FloLy0YOHxYt47Vh7NhferH0ZmRI2r8KIrxH5V4Pf/AbmpIngcIhBMUkCi0LP5BC8bpMSy/wD49YLtflGIk0g/FR7K7hRL3Q4Nj0ThWVdPfcZKxYZ2kwMr+Yvqm1dPx8m3FombBQPjFc7DJg9WEuJdv/zq4fJpU4E5qdvMYn4V2oMyTJ6EOyqSebLmQ== 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=Ut08L4O7r8TPBHWlQDboYcOzmoTMwqPYwCivLnwoiB8=; b=c7ERJE3f3t5Zzbm5ZdV0THHYlTuJLhPrH4PgqjMuCrI0JWZtwq4mrTRUkG9vyQ4PMzCEFb9pBq1OhTt8VrzKZIIFRdW+uyMcUojzkgkdHRro5A1dV2JqOBLfTyszHBjHkMGr2WK3+j2GXWkuOKYNtnUQHnrMWjG86M8MAjrzg14beUxYRYa+3WoqvurjG8HyberNBPzvYROoSETOHdV4FBvJeaNmuKLIa3hKqNIxlOa4xisS9Rm+vFQxDsnxdNBE0IevJnFIZmhQCo4ea57Re0oje5RuSpqDzKvYxhKJuM+iKvLGcRhz5tIsiDaiEiqD7rSd3NALGpnmz56SN0mTYA== 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 v6 3/5] arm64: Use generic io memcpy functions Date: Wed, 25 Sep 2024 15:24:18 +0200 Message-ID: <20240925132420.821473-4-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925132420.821473-1-jvetter@kalrayinc.com> References: <20240925132420.821473-1-jvetter@kalrayinc.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0138.eurprd06.prod.outlook.com (2603:10a6:208:ab::43) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PAZP264MB2543:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c459b6a-6703-4343-443f-08dcdd656613 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: NnIs0Ua9P+GjuOboi/8NBeSngkWf0ZCz0XbS4pQSnLWoQA4fFZ/+xHKGNj9m88u343jSOgidj350m3wkR6B9MOwmeqqk8rw7f6GozwyF3leWn/XxKuXpohg/xVUzj2LFZp9A0L003jx4nyiV+FJacfISK6ew0ssGdZWziE5U7rznzGfvcQj0FHCmMTDRrv+2/K29t12aJWffAScKvUD36YUomng3hmnSL3la41INHoZKQPZwg1jyPQ8YNtgl9YUjtmUb6oL2YhT7QKLh70EPyG937g0Nv2hKcCaCwC1ZhwPRKKIKASBxEDKbcLqZ1Gleil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sm+la3SFpu9MYqrdKS21yxQ== 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)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PmSliev0Se2XieXc8BFrQpMDI/GghURLAB7crP6VcGRn0/5MNMvtdbcJXphM/4F+rOc+n4vL0Rft99+7EvlCvAYWPDFeBSiDEQmiuJgxMeuHZsF1uhW2XM+kXnr33n5D+6+S+WUNSN9KVzdBbfjUxffo0aDxgkvawLzeKfXbrZDarQqlIjOLuaP36EAkxzwg+jU+f0qANnkN6pSWRdg5RsR2f2HDP1LdMqMI7Gvk4w1q3qOhalTU0stGADQo50vRkn2kGXAVzhTZEJ55ZscgnlzcynVexy3rwm9CrtebGhIFWEiXWH/t6TVO9p5AnxbIrvexx3c7wOzQxjdzf1HARLajFH42352BocN3i1+AdtehWNlpp6b3HV+mCAhqoyfz+mBoHhuK8oj+a58p++tgZwO+ghBrdzxxmJSH+fytiU3K/b8I5yFUndRXM2FOnCclZEx+dO3DxJfd0ruNGbWqLWGTCrstxw24fsxpmhEVdCJq7KRHdfo4Q+tabAbEBriUulKOYfPApx46pwOjseHrlClJfiOhnJKGR7elCkaXUqtUJQJGnDw5r6CIMRs8/J8dAzFiiE4XGVHbGhMcBBY71k2NNysHOlXvTbZyZ/m2pH8cl0pj7ln22FAMo+tFiIwm+CTc8H4/hrZh4FNoaPknF617SV4XdRQrPipSx+MESF7MRLj8TvyFLSTCKuFPRsHue+UDAgOWoZnsglvP8tE6WTG724bPBZZlbfjDNuN55EW8vJW1lOiYZn0lxB265GbYslyxUGrbYElPJcYeIDxQRf1rHPAb/TMe2zF8R8/1VfAEmkDnNziRSHEthuqoiu+IQPlaXmjfPZQQP7O3Or+T5lExnZ/JP56tBGgy910jntDZSwyGpG6JRit/dY7ihnAEAgHahfZ8lo6q6xFD3gEKrc24i7KaOzAKQyYqUFDYDiySSMDVzCa/25UY12fS0CoV 2l3Uxqd6pJ1AgUYQ8lF0Id5MmWzOslPp25ugMd0ZwzqrwnUwzB8PtwPK+nF1B57/4eX99MSBuF46y5Ee4gadUe5Xw8UIEuw3FE1KOzBimKYdHwi/8y09lqoviWFW7DoXI0ZHYoSRjsDOy6uVz/0ZprET46k9MKxC3aux1Aw2q0qlvi/QF7FWlMwbiAKN3sIU5Hadx08gfZ0CNVlNViKgG4lMwIPxPLReZZ4Vd6vhJ9VBNImSFbSCqdJuxUD0Lf3JgeaOxJL9hJs1CixYR8d2op6foUvGLX+qNAUOxDxlM62gsXMAdePfqHmLs7buzXQ3x1NQE6pZIooH4O+JYrcr0mDWlleyI4oMZ3xCYY4GymBhroaLkvSUPpSzKXhZuHfQDt8a8Kn3P3FY533DVOvOJbJv3flN/1dCOLWuGvEnW6LucJiAjIumHWfeWXIgI6Biw1RZ5HOCNmnuXiT28AG8aulBwjT27ZEd86BRtBaqv29OpObop6O80Jtvrr7eR0jjPkKG5E1TCtC93hJj96mvmC+MIYu73DWWlUzWuSoPSful/7CZdm1QpejKbDqHwgIt4+F/F1PQrwYW9P1LHG2kOctLEIfjS64f23xM7JofXlhFO0BSvvyx5zk5dH6QtD2L X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c459b6a-6703-4343-443f-08dcdd656613 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:24:35.4715 (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: 9cCqEHCc96IkQ6Br7tblSxcJrBs1ZAUTRwUyF+SsL7aR2mg4MNYQe2O3bSf1YUC9Oihimn/GISPw9qftEKD8ew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2543 X-ALTERMIMEV2_out: done Content-Type: text/plain; charset="utf-8" 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 --- Changes for v6: - Added proper commit header suffix: 'arm64: ...' --- arch/arm64/kernel/io.c | 87 ------------------------------------------ 1 file changed, 87 deletions(-) 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 =20 -/* - * Copy data from IO memory space to "real" memory space. - */ -void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t c= ount) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } - - while (count >=3D 8) { - *(u64 *)to =3D __raw_readq(from); - from +=3D 8; - to +=3D 8; - count -=3D 8; - } - - while (count) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } -} -EXPORT_SYMBOL(__memcpy_fromio); - /* * This generates a memcpy that works on a from/to address which is aligne= d 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 cou= nt) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(*(u64 *)from, to); - from +=3D 8; - to +=3D 8; - count -=3D 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 =3D (u8)c; - - qc |=3D qc << 8; - qc |=3D qc << 16; - qc |=3D qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(qc, dst); - dst +=3D 8; - count -=3D 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); --=20 2.34.1 From nobody Fri Nov 29 02:32:19 2024 Received: from smtpout144.security-mail.net (smtpout144.security-mail.net [85.31.212.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A33618C92D for ; Wed, 25 Sep 2024 13:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.144 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270685; cv=fail; b=XzQxYBDvcmPayPGIBAUIsFcOc1EKOChIYe9mRJmCiGWDtVDwr/Unp3/9tPz1BDjOxhDse5lzCIYwTGLHEJAEu4bJafXj2CkLwd9ukbL+1+eiS70KWAlIE7xjLjzJbbduWcLn/h58nBu5TfZWiA36eqtFOYRps684BPuaPdH5ry0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270685; c=relaxed/simple; bh=t3PIPDgFfa10k7lyBZOl7ja/PpTflkQ69xbt2ZyFTVU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RSObzYlU0tgLgM8R0/96ysJBTsLbeVI1fApI8uFw2l/j01gAwUBtU0QOS+4l6KLpYIS9GwJOrQ51JUcKTJxUgVD7JxeLbiv5fIZKJxYrtsX7f6FOWALh9HRPORe47U9p/DqV344jjDn820fCSpqtz3+hdFUsP2fvYhp0wlKwi4g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=JSXzGQa4; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=qzX7BSCp reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="JSXzGQa4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="qzX7BSCp" Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 81810349B2E for ; Wed, 25 Sep 2024 15:24:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727270680; bh=t3PIPDgFfa10k7lyBZOl7ja/PpTflkQ69xbt2ZyFTVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JSXzGQa41Tbc4puDGUDKif/g+ndpSXFJEDLFc9ceL0QFXcqFPfiHfK05h/Aa8Aerc 2l9AoDzz865tM4tMVYRIuhPEhr0Z0aW33w3k0I3zWOH9+GS6rMT8IgZBXEIfo1KJeP kqSGrkBhT74x+Uiv+Dx/ZOQNh2SYLjUol/r7muqc= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 502FF349B1E; Wed, 25 Sep 2024 15:24:40 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx601.security-mail.net (Postfix) with ESMTPS id A4FD834994A; Wed, 25 Sep 2024 15:24:38 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PAZP264MB2543.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:24:36 +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; Wed, 25 Sep 2024 13:24:36 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QEK1rz7wK97Lus+KvKa0VB1i9WEcVT/lnbSuJo5gaNs001ZJCDYEs6S9/PkWz6iib1sCPEwo7KIQvswbUyIFpBlRz599aJWLkZErWaRPIxvsNNbQE1f/CHQHDLfTZAIoyaab2sT5IA4VPhmAnLNStduzy0qnCZY9Yd+NGrmQD1qNc1ixTGxwBxCLL5HyLDLxEDKe9Pe86aVF5rjyiFsnDLtlU2Et6i60mWqsMbFCwIAsMjx6KH3W4nIMeDheZuMIGudUSKvlNeK18dBcZiep7j++HZXdJ8ZmZaStnwYD5cTB5h7S4J0tzSvMJt6LWGPD+FwYBDgUFIae2mujGSA3CQ== 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=oRQ3rJvYFZmP/8xJmPTzzsu1FS1rrxAq7oKbyf+3BLo=; b=gFhU+6QcrQjKgyJ7nSFfxD2u/AHzGRfvF2rWo6jRFIlKRx42nY22dKZDj1OEzwAFj5MKqEEA7nvgg4l5TaOFcRm8X7sHiTCo+GGSCx+MNoy0JOLrseupprPP5lMnYdH8HJ18KEQgFF3V2o1loa6aXRF08Pwc1fg7ORDsJNiF/qcDkab3j0v7J+Egy5H5bvbG7MyWxlqI+z4LlAkTQG4pNrqGiXjfTixeTqZvy/0qrLbfsAaI40TSsLbz1So/nE1iMylojOTmAa9/vjcuocaZ+GtBboUmN/AsI0szb4kznMT/OaDX4QOeRxgAlbVx6R+0XcK8yAjE6jV0R1grCnzwzg== 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=oRQ3rJvYFZmP/8xJmPTzzsu1FS1rrxAq7oKbyf+3BLo=; b=qzX7BSCpB96LcQXgt0d5P9gL0dXgAWzKC2xTQZBbRqE9h0ncWEW9Xuzsi1cMTKfmyIQPJjaiGVbwrxpYn6KARgHgU7sCrg3u5T0ntOs7/tGEWFHb1YfIs0KjXyq1Zfwfes8OH37Zg3Tel5nvMwBTnBmvJbUpnHDCcPR8nAIJ3gyHekdCp3xXMpCHeMS2rjFidMsP2ryHvLQYIU7hY5ZCW1PziGFjjK82XbDKo11x2dQJwyJHQEGhY13qBujtDUoZi56WPy5fuHscRyphm64DNpsUpx3qjH1lUZam/AnJE8OIgbho2hJeCOHxd4tFplhmgPO9egToGFUrzlUJdrfC6Q== 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 v6 4/5] csky: Use generic io memcpy functions Date: Wed, 25 Sep 2024 15:24:19 +0200 Message-ID: <20240925132420.821473-5-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925132420.821473-1-jvetter@kalrayinc.com> References: <20240925132420.821473-1-jvetter@kalrayinc.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0138.eurprd06.prod.outlook.com (2603:10a6:208:ab::43) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PAZP264MB2543:EE_ X-MS-Office365-Filtering-Correlation-Id: ac9a4111-7ac3-47cd-63d6-08dcdd656674 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: uJJCPlk0SB/680KuTPX1DwTIlyLGIvgUD/RshnMM/bFPYO/cj1Xgbf+JqKhASppTS8xPmzuf1DkZ0p0M60vfYRv7e2Mpt8ksZYCGeB8rDxKLnzNmBDemXlPzObHPoUgl9ZLRmiDi/EaCI7QD/JWp8NIa94/GxVM04blZYff8qv0HG4le4QmnL0dNzMV93UsvF7xzRJLGBcjfrGZVCan3N5zustapHAKyU4X9ctNkMannxJoaM8Y8qaJnIh2KhxaCQYsTe/yyx6lB1U+rZVXb+H3Io1pTAAcMTSbNAK13jhRXOnSoNvnpkL3ONo69Nn9Uo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jgN9o7Kev6hwgwlolQZYl2u0iKCG0Q== 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)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4qtZmVfOOh/wu2dAmdl975SM9KbYGclGXlOU2Z/q9w/IfjlwmrwF7P7sk3lYMZr25B6FF20TcOWKku9Enn37wrLumRAsRx2Q0ZavUzAJzNyoG1NsXEHvB+lVXfxKxmweK8FwClxyghfVT1knul/k5geIqhX5F5R0/JZOCSeGz44+OALXIp5hfqCwrkv/xnKFswH0dY7CVtqXksLZJHJAy2CiozyOAbfWnCfggEvWBic7Kd1mvk5Z1lV4EQOLfPJeCgzRCRVDQwjHS1HIWNUcSnJmk4XGlIxkc4kueQ6OPm7M7EE1Z8fX4fePxnMpGbQCXs+Be6aduvGxD0BEsi1wbdBGcGe83QirIi9vx1e/EoHcDmpE1SHnVmh1H/6E3IHMwdBniE5/rXv0TFD5dytz8J4kq1OMv5WHLKjQJ6gLbMI0Bj8VQwRuWyGPt+0CCIEtIQEkl4ff1AInpA4cGuvyX5+FUXHGvBvolfcrtEIwr5S97+Oh2uOUBFK9f4Q9goNYnSFBMmdS4vycq9lq3hRf19XNRd3OM4AZsDj+cYGzwSvaAym+TZ7j4biuorMc6puDNxSYnTCqeqVnGaSbT852oNIaKgfWb0sp533maFPl9dRQyUT8Dr+++06jGGL49TdSXangfiQqQX//aw9RxBo7Mn5wBzjYu9sfE7o/03wjgdc1YXsFWY833AQ5sehaN8zvrmxbnqNLeik1z4X0l7GwKvoBm1seSTN+beF/CT3bJmsQyojAX175X2mQc8mIRVx2GIrsVbZaAziIL1UUG4BWlN5+KPkNevkxoViRVSBeqrdeGsy9HEQgvRzzMyxOSImhGbX8bGrh/6zX/V7wNnpyqI/vIkaQG/rmIMhAx7uQqnCfwIFC5A55+BwcePCdAYIhV5ZgRqGH4kl4hwSwuEO9b3boDDMeQjxeBh6+tf8oPgVQF4Ft8XJ8B00aKELHkN2d Ximejv5rqI3k5/ahv45qq9ILWPxPoqgHwFR5v4hHHOoYmCO0aVPVkjb/bM2TV3AdkTQ78X/7X63unOZVSmP6TCl01PnRUZJFr3zZvRU4YyxRueHkovdqYmimbXIOtf5tJ3GT4XWvGYCG5CwXCMssuOY6OmI4Ia3zbKH7z8mm3g5ZFImF3ur4wN4Ng4k+hU26V8d8FbDSCM8mWXJUoZHls0No88QgZ9yfFPG4fToX0hwiDqBhT4+khZZL2tSZPveWH3rBA5qhZ6Q3eXxqh+VEvndkyWormuLn6UMi5dwQRATyZOu7gY8nezKA3YvYcvn+qtKWZURmKOJ9yQyrpuuIkyhI5xXtYPVmCD0nZNfuBAfqc0DzSDF+2ex0JVkiMThghXFFMlhUtBF2BKFYXXiQmKqY3L2xIF4e7G50Zs005WrlM3tTb3JkKqbMhWG/j6IKdv3DL7l5AbwGGOnmJr1cFOFyMxsfmYOr0zNvkP804UyDjs2mmk0wAGxlhCkVD1TqmOhGLeujpiDw7raoUaKBlFhKk3aFEcpx7Sl88+IbKp53bER6Ot+UBpByixO0gWWJ3NFjVoFeqxLzwamL901ZDm/ZqjURvd5sdPZevorZsTHgPU2V1wQ+ZtrjmTqt4Zm7 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac9a4111-7ac3-47cd-63d6-08dcdd656674 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:24:36.1311 (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: E7OHDMssSDe5D9iAC/0psPIX0ITiELyZsDgT7jUsio/hHc52mn3+dO8xptj6mza3JMmqPyxQF5uRSSuVPvq3KQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2543 X-ALTERMIMEV2_out: done Content-Type: text/plain; charset="utf-8" Use the generic __memcpy_{from,to}io and __memset_io functions. Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter Acked-by: Guo Ren --- Changes for v6: - Added proper commit header suffix: 'csky: ...' --- arch/csky/kernel/Makefile | 2 +- arch/csky/kernel/io.c | 91 --------------------------------------- 2 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 arch/csky/kernel/io.c 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 :=3D vmlinux.lds =20 obj-y +=3D head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vd= so/ -obj-y +=3D power.o syscall.o syscall_table.o setup.o io.o +obj-y +=3D power.o syscall.o syscall_table.o setup.o obj-y +=3D process.o cpu-probe.o ptrace.o stacktrace.o obj-y +=3D probes/ =20 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 c= ount) -{ - while (count && !IS_ALIGNED((unsigned long)from, 4)) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } - - while (count >=3D 4) { - *(u32 *)to =3D __raw_readl(from); - from +=3D 4; - to +=3D 4; - count -=3D 4; - } - - while (count) { - *(u8 *)to =3D __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 cou= nt) -{ - while (count && !IS_ALIGNED((unsigned long)to, 4)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >=3D 4) { - __raw_writel(*(u32 *)from, to); - from +=3D 4; - to +=3D 4; - count -=3D 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 =3D (u8)c; - - qc |=3D qc << 8; - qc |=3D qc << 16; - - while (count && !IS_ALIGNED((unsigned long)dst, 4)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >=3D 4) { - __raw_writel(qc, dst); - dst +=3D 4; - count -=3D 4; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); --=20 2.34.1 From nobody Fri Nov 29 02:32:19 2024 Received: from smtpout144.security-mail.net (smtpout144.security-mail.net [85.31.212.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C509C17BB26 for ; Wed, 25 Sep 2024 13:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=85.31.212.144 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270688; cv=fail; b=lDCCKX3c4wMxR/JiA3O6j3C0oDEb7A1hHE8r27OgV6cF4ttmSmS0fE8/w1me0UMVOfZWxiK2rO0CtZPDYtbfBGuy9d4wvLyrvO2URDPSh/IKs6c+HO8QeRwSXhsBsAQ4AdX5qdXSaHSnhVftenNovsTEc9yUfrGSjfjFMlnuWKQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727270688; c=relaxed/simple; bh=ebU2POQDrXM3XeAkQlxamwrbbopU2BjL2REyKYQt5NQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BxXMlT9ld/iW/x8YrDQ/+yayIkmYgblpr9v/zeiRntz31hAoBoD6xWhE9UUBd7F3ntAqgRgimY/Ylu9FgKucMpnzolA/hUpG57lWAeNby+NZre9nYb8b2gpLeOFjsR7Dcj/9IuKXBQOlQFIEidMSVl7dkqhi97nqoYDB+MCF9AY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com; spf=pass smtp.mailfrom=kalrayinc.com; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=UzxAhAUd; dkim=fail (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b=TaQouHs3 reason="signature verification failed"; arc=fail smtp.client-ip=85.31.212.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kalrayinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="UzxAhAUd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kalrayinc.com header.i=@kalrayinc.com header.b="TaQouHs3" Received: from localhost (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 68F77349B3D for ; Wed, 25 Sep 2024 15:24:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1727270681; bh=ebU2POQDrXM3XeAkQlxamwrbbopU2BjL2REyKYQt5NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UzxAhAUdVIVv2GgjTCns9xPzXFCcLbuBnju/ITr8jjNCiBRdTHBAXCXyEjo/SuyfN dR//yuIF4mQGMVKcsiKx9502HQd5G1Osx6pSnTREYNDo52Ual8plphBZ9Kf/IZ3Tww 3fglTUcPSLAaLbKkaqxK3cL3uZnu5fLkU5WGC5JE= Received: from fx601 (fx601.security-mail.net [127.0.0.1]) by fx601.security-mail.net (Postfix) with ESMTP id 3FB74349B1E; Wed, 25 Sep 2024 15:24:41 +0200 (CEST) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012048.outbound.protection.outlook.com [40.93.76.48]) by fx601.security-mail.net (Postfix) with ESMTPS id C2D42349AC7; Wed, 25 Sep 2024 15:24:39 +0200 (CEST) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PAZP264MB2543.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:24:37 +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; Wed, 25 Sep 2024 13:24:37 +0000 X-Secumail-id: ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a1ykKvAZvYd6B1kSZL5KHekgjG7Oh4LIQW53I0TnlGAjPB1B1xY8BIs6og+tL3ZDYW7fuUQ9m/H1CTHVkPjv9JErfgyiEMHKCNKyXVB9TFFW0Kwz5rzQ4Oa5iQr36yZA3tZhnUnOGzWpeJYz2rPN65w4Jjb4/vZqC/f65zg7quG5EWOkgW8x/UVQqJi+PfUEYht62oRyrbggjrEyT8aMba4peUQ0WTUul/B8qERzboATRHQ1JKOQq33VArtOe+Ltbhwx8rkn8TY4Cd2ATC7tQCQDs/bf5zH4uflXzpjYfwTudH/VKwNYKydFexOTp9BxNzDdp75J4reCJanyTzX1gw== 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=FkaRwNXM6Svs4joVTR3jwab5BELH3isYU09KvmxyX/E=; b=qCuwhXb/2Ipg1LsNXd4f7P/HzckplmVQh3mMy+RdAXouWEftJfehgRuBbUiDHStBmnAGL6f1dRKPJlCB6KALOZjbd8YJDBEAc5upwiO/WkC2po+T/y0U4wwBnqhDa9ODnxDDQK2NOUbxghaOJ1iRpdLNgz38l+VNhd5BNUW/Hz692FS+HOV8802MdmH9mpjMW67hgHiSbiTt+SxoiFC8VXlA2Nh5ki7ui99+lmL4XuUzmlGbVf4/MOSb5SCrvlq+b6Rr0YqhFhTJib+puxorxZkGdGYLc5PK8ZQibLiGHlgNCD8T32on9jtuvyTasIThQzIBx6CymgFN4dMMh24TLQ== 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=FkaRwNXM6Svs4joVTR3jwab5BELH3isYU09KvmxyX/E=; b=TaQouHs39eZ4vxkodcVVrbVfVsYVwnXOL5Dn/Tlq3qjdmnHMNeFljyPraa4+QigIxVWIWJfiPRXkfQ2yEz8w5vndaUtIrVEaQcziNMSwd1xEObUr3kT/nFBgDBzQ1QpOyoaa5+jD1nHvhDiQzF5eWQFRgV+k7MTmJGwOlM1TDWCazt2cskOWZJIoRre4n1BMpuBtsreEqq0DgduR3viDoxsi/3yTyyLW/QqOWrX7mTVgdqdE8XG8chWsX7FRl2yWA6uLRhXFlz9LoACRXDNX6J1e54Ojr5PCDGBXP/On0v2h+HvnOhnKCXv3YwQ46DpTPMkYKPBQNFXXNgFc9kJrUw== 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 v6 5/5] loongarch: Use generic io memcpy functions Date: Wed, 25 Sep 2024 15:24:20 +0200 Message-ID: <20240925132420.821473-6-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925132420.821473-1-jvetter@kalrayinc.com> References: <20240925132420.821473-1-jvetter@kalrayinc.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0138.eurprd06.prod.outlook.com (2603:10a6:208:ab::43) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PAZP264MB2543:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f68df9d-cefa-44b1-60a8-08dcdd656718 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: OOqTe/sV9XC1lVwEjfqyUhb8s/byamcad4/34xuj/GzFcaXUoN1tPGwFfE3w+Ff3KfnyQStuYfILeTnDQ2UNfC+tOi8EJp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OfDfY3a+EQtHfNGevqaf4+x0BrCeJ6Y+9iR0N/JtuzwtYqJUqRSiN64pczgA9kocGAE+Dlz2eHpy+pSSkq7NpTjXoIZwwniQnAp/E2jdPR7whWLPGHOeK7tGFZTNucZkRrP1RIvhKdXo9dnbYt0o4VG+qEIPR8o2cf0bHiyT0fkrw5tYxuw0N7fC79EM2L8pKhGpjzfaUlnBsUnXgwLGTbBhqSpg8DitKl1MuxRSxCxFYTHynmw== 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)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tOA9QU6uEeT3iB8UNRqtoc5vna0MOL3Z4irLOiluQW3Q6XjJ/CUXTxtbE4mpW1Q1sYnVkhOT6gu0agR61lzVdvxqyu2RQBzlb2c29J0lae8zlOugf4j01hEMlV96JnRXvJpGwUajn9wGGJnLyIQJPdj+uK2EFbDfAh9mMwT16fH1oKP1QuHGTz02CRj2ssAFMIraC0NdOHY2JQuaoqqq0+3bCZ1JVcdwmkSFfNfmDAM2Tl0gUE/3/QRV1sRmInBrprg2YRtrjpQK47oB/gYDtq+ZMnhpmRHAqsfIsrw5hOGtLFUIlznLgucY77T6hIbux3zhrb6kpJQvq1JPxnMGT5tS1Qd6nb87Uz9fKcvCJLaVO5vKw9ywZEP3XYHwlU57men2vOae/WwPLZYfVb200to79kWjdaXBTBnK3FNLCAPIyGTEOe5pNzAqDiswPG6RTQOoO8Q6sNSGChpdBEEJuQ5EEJa0Jn69UDQ7rluZDErrIrTDWQYZ/cxCjVjcRWG8ExfHQiV7DzfRi4xLIzieCIc6Ft6ULuMpkxm9+qtJ5dfN1D9CE27Vz2jIUFrcaXKVBfO6ZLX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44b1-60a8-08dcdd656718 X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:24:37.1824 (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: xyJN44p8Rvu/G72lZw6BAxk+6GxUhAwFj2ZYiNChV8ysRGOkHKW1TU7rU+yrfAKdDNPM2q+3tyWpUIpRTRfq2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2543 X-ALTERMIMEV2_out: done Content-Type: text/plain; charset="utf-8" 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 --- Changes for v6: - Added proper commit header suffix: 'loongarch: ...' --- arch/loongarch/kernel/Makefile | 2 +- arch/loongarch/kernel/io.c | 94 ---------------------------------- 2 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 arch/loongarch/kernel/io.c 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 :=3D y extra-y :=3D vmlinux.lds =20 obj-y +=3D 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 =20 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 c= ount) -{ - while (count && !IS_ALIGNED((unsigned long)from, 8)) { - *(u8 *)to =3D __raw_readb(from); - from++; - to++; - count--; - } - - while (count >=3D 8) { - *(u64 *)to =3D __raw_readq(from); - from +=3D 8; - to +=3D 8; - count -=3D 8; - } - - while (count) { - *(u8 *)to =3D __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 cou= nt) -{ - while (count && !IS_ALIGNED((unsigned long)to, 8)) { - __raw_writeb(*(u8 *)from, to); - from++; - to++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(*(u64 *)from, to); - from +=3D 8; - to +=3D 8; - count -=3D 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 =3D (u8)c; - - qc |=3D qc << 8; - qc |=3D qc << 16; - qc |=3D qc << 32; - - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { - __raw_writeb(c, dst); - dst++; - count--; - } - - while (count >=3D 8) { - __raw_writeq(qc, dst); - dst +=3D 8; - count -=3D 8; - } - - while (count) { - __raw_writeb(c, dst); - dst++; - count--; - } -} -EXPORT_SYMBOL(__memset_io); --=20 2.34.1