From patchwork Mon Oct 28 13:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Vetter X-Patchwork-Id: 13853494 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 28BC1D33981 for ; Mon, 28 Oct 2024 13:52:45 +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=0QkuTHZTyP/OL+vuMUAVq++z1k090MBBOJMEXDdFz2c=; b=TNNnpv0Kj/EvASp7TP+6ocW6OA nK0NH4Oq4QvPX4l3AC1WW30zmSa3zycJATl1cNFjsGY0nmCbk5/HOFzWFs917e85e2fZu497uGz66 HkjkxUN/ljsXYaVM238dW3jHylmXJ2xN80qr/84r6zGYXHpTaKUfn9JGvrJIsOsXmQ6GR+W4jcqzf F7tSKFiBWKbNcNEF/x478WCFfIU2f0/ECiAqVOarU2WemLwD6kf1Q42xbW+pXrsCW4LVrDFxQKTYc E8MOAipr+/cyEn0YaDH9BfvIk8TPJ5khLByqNtocVmbJ+hZOVpkHENr7lPVz10nN4VsYag0Elc3O+ NQBfKx/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5QAb-0000000Azpe-02wu; Mon, 28 Oct 2024 13:52:33 +0000 Received: from smtpout35.security-mail.net ([85.31.212.35]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5Q1x-0000000AyIX-14Bc for linux-arm-kernel@lists.infradead.org; Mon, 28 Oct 2024 13:43:39 +0000 Received: from localhost (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id 1B91F30F2D5 for ; Mon, 28 Oct 2024 14:42:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1730122967; bh=SK40+kQmmYe34MUXIQFA+C1X8leWHhF6rdjFQ/RSa14=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q2Gh5pwqBmk3qWEtGleAFpdQXAOaajbVHvYeh5gEbLZJyQ7lI+Ls/LDxdiyifB6RA pej1m6VD5DwVKwrDZp9fyRdtVNp2kP3OE+W5UVY6+PUt8piWdEMxFcAr5hlSIBnPte 3/dWMRK0TY173qjGoI0Ep7KXPqlFjJ2R3ITuD6XU= Received: from fx305 (fx305.security-mail.net [127.0.0.1]) by fx305.security-mail.net (Postfix) with ESMTP id 8D61E30F2CE; Mon, 28 Oct 2024 14:42:46 +0100 (CET) Received: from PR0P264CU014.outbound.protection.outlook.com (mail-francecentralazlp17012055.outbound.protection.outlook.com [40.93.76.55]) by fx305.security-mail.net (Postfix) with ESMTPS id 8C78130F097; Mon, 28 Oct 2024 14:42:44 +0100 (CET) Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) by PAZP264MB2397.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 13:42:42 +0000 Received: from PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626]) by PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM ([fe80::6fc2:2c8c:edc1:f626%3]) with mapi id 15.20.8093.024; Mon, 28 Oct 2024 13:42:42 +0000 X-Secumail-id: <125b6.671f94d4.899d0.2> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i+RW0ezMThZ0S9oCV6hxhsJqsD8AZjXzHQJXQEaiV694HfaFqOBGh0CD6Pv+EOWokX2FTR/ORzkrQ9wZ9YJCvPZHO6tGnPIoW/ieRMXUtqrN8wA5Bskb43PvmUxhLngA66YQjS4wqESe7wVrqSqH5X4rftMAWMFOJ+Q3klu3clfdcQXnM968CZm0J1W4zOvN7H4VAVK+Qr3Mp3Yecl3aMOd1t/Eo0vjtOGNn3Rz1mY394qfUvjBuROMaCcK3XKd/cdOAmZkhHKA2VtnK9JjjrvKzRaT/GInnp1ri8gAdVOhwqSraqHjp8+2PJXfGEtMTAu5gl0u4VaqEwj8aSF3Z9g== 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=0QkuTHZTyP/OL+vuMUAVq++z1k090MBBOJMEXDdFz2c=; b=Wc7GhSD6lQFjGU+SuIEJyI/rdZq3NDyi1PB0ZF0f8BDtxcElOJnvLtp1vRntzwFDlI1s903pVGbXgR8imSMldJEE+mjmMtmK5Jpz8VI15Chb8kT+gDTy/jCu9Pb4GASso9PWxsZB1SyYlamzkIG63cykEG44SZc34ISSazflE98iajQwBl1J6EbLM22UEYQ6+kPw1bEAlsZwXaCbjHhlLrST9fcKqDBm20A4vu/2aPvvdBgP3l03K2Ox3g2kO6/UD1dcSeV59inY+lebTXpnMomikdzrOsAEXd/6Z42f9jnk1gk9D1Kce2LQTrNMq6vYsZDDOG5wOanmp7t3bXaP+Q== 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=0QkuTHZTyP/OL+vuMUAVq++z1k090MBBOJMEXDdFz2c=; b=g8l0aSxoTPojjY4Xa0iPWvblOwUxpKqEm6Yvog0ttHoohT261Q1ImG7kdNo2d8TYjeuOa/Hw4sk00N1C1mufYExNcG5yCa4jeGfQfHfEQwiPOqbuOtpHm75bXzDUQXft9NiVJ3Gept9IqUNGj6K0aHQ3jI80gvye3zJajkG4hLnA7Tb023rf4KGJy5KKVjm5kcmpuOGNwmvO3PtNk5vGeZiZ2UKHWvDmsh7zW7mVoPswfP3c5MgLTrbOpzgqNclT8rbBRi7LInBPYHzRb6frb1Z5A48QN78xI0UQia7C80WYPSmKjUZX+3mEiOy2LGP1euaBHn0a8fs+Dhuzu1Vanw== 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 , Geert Uytterhoeven , Richard Henderson , Niklas Schnelle , Takashi Iwai , Miquel Raynal , David Laight , Johannes Berg , Christoph Hellwig Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Yann Sionneau , Julian Vetter Subject: [PATCH v11 2/4] arm64: Use new fallback IO memcpy/memset Date: Mon, 28 Oct 2024 14:42:25 +0100 Message-ID: <20241028134227.4020894-3-jvetter@kalrayinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028134227.4020894-1-jvetter@kalrayinc.com> References: <20241028134227.4020894-1-jvetter@kalrayinc.com> X-ClientProxiedBy: AS4P195CA0037.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:65a::26) To PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:118::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAYP264MB3766:EE_|PAZP264MB2397:EE_ X-MS-Office365-Filtering-Correlation-Id: 97681da1-0ec8-4773-16b6-08dcf75665ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|7416014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: M7NdEqZdvzUNRZZSJDcDDXMgG98bsYNdONhWHvabSMTAEf4AIU77FPnePDL47S88ql6OhQwonOLOnUyFzEhkiAi7jSTWdoWVbzJsuyeBjX1mXXzGQsvSB0a43KDKYKvfwhDchymG2isehCZ/uI8PpcgsL+JmyVRF/EOrX7X25PAplZnmiwNVZyLLzsUMev9we4ISQX3QOzV1W1E2YZ+cGjLylio0Lkq6AbaqUVrMmbtelIPyYck5MJAW1oYUkEJvCsp7pfsSCdGTx+SzNOX2PfVe4i1AOH2LMDF+Dg79njZa0dUdTF+UQ03Z63FU50JFTkzQrinjVIy5Epx9w60P1wLY3ai84OqFg9FDQJCq5xgEtCAdDtiG6GDNOIG+P8OEwUvQZ/9IHsSTdPWiS1gIgt2DDttAk5n0HTBs66LwVcz18k6iL0hrusiyJOwvnGSx6PVXEh4gA3pu8YSVGHPCo7tSy8UEoO1fznvo0SUkpWAuYD4o/OkoLz6piLpvOFlysfnfOye0AvBUubkNe2R9saYyngl1jnsmkAc7fj7/YnnlwVLreNa29htjTBciPweXyTMJMLr6Qjbxj6y6/Lu9FTKLJN9Mf+toppT0QpCqYOnUMjj5n8gx9itqpUsoBumHGqj1g7V3h+zFLGdc9TgWsnWHF92sZ8uAW0B2Phx+9CHjCTKnxUmpA/ixyDsNnxtN8YdyjX4q5ZCcX9ZKzU5ScBNEnPViU54jr9sfvj0D8K83vTXs/cBER79yACYBM2aURKu7G8oTl0gpDsiz+yGp8Qps4HOSelKcO0Z9fGoE89Ts/e218+2yGcWRwFGf/PLnSsYGwP4J1TmUo++BG5R8zZ86Ks80IYOjGq0Pj/R5Ur/hvFE3F4/x2DZ/4rQGUk0wvV0eo7eVmDMXvhZORUtiUbJB5uYnBkudF/xvCehqUKOvciKug8B9ojouRU9qQlma4Gv 4l/UbLdR78AZ7clNIDWjPQR9Syou8sdPIHMjnfgoT9HdGsHTZ/pEkHAX64K4BO7VFD0iIwRgSzxW8b6CETc1e0CF2eUKy9H0dHj5NPSmiiMFqZAXV589JhTi1MtldkflI4I4ndzsw710iK6MJ53JYSZd87BMOsOFjkEIO6gu6qvEKSq0RvIYMr/v5yUTJROwGavWg4yLv1KE0HjKR7Gjk0BzxN97dQ8qpv08KtrrTn3wi0miqM6yQ+Na20QVzPyZcPsuyfO4rRGsiU3sZtph600gN3UMFVOon9kf3+UGgGYUN6G1AJmLs86c5dN5lXn8O1Z4x0RP6sw8cgnfsrEb+S/6tScJxYtuXNhnyFKs1nS9KxC3axu2ueNVVArWFbIXKNOG3R8yvBQPKHOSIUBEvcb7PiOkHwNbwVpgkTSq9xSCOyw1PxCJULPwhboMr 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)(1800799024)(52116014)(376014)(7416014)(366016)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TGyYVr2+y9tW75auuQKk9nOKRo0KZ9zcabxPt37mlS27vcIz+Vr/K6zb3jxD/35kvmcnv0aqFpM3aikD0s8Zk8vBxGnGoeiGd7LnbZMGdAGsP5AIDMBtUT6gUafSJ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r0hQPgU9YyGck6VSC3BMS+kRvS36JOF3AKZb4cpLqtx2HJYSNspBR11GadTpTUga3bn5SdUCgEYlSUWpRSlfiSlaaxRQHUEyHshFBa8p+X4QwFgf7xIfJECuPGFsimPKlvgtiHPTwLoUWe2OhUJg0vR700vdT4JLJlbQ/PG7Jeo4QozNF4BocFQgDO9P0iraysIEDB1k6FpMKHzliCNUcA6tBdgNWMcEAlY+iNPp54fHFELjZAD+HfdQJsdgNxuFLvP/EuByzAG3/M9uolEt8kFymk75Yu2+icPxULlw1YxsuSKBDkmoh9LH9Uf/MDfTa7vN3DMaldmsCKvRPHvJYvatFgiwg+9uFILUdywGnbuZXubzg+Jf2nrLLo1ojLTBV1 X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97681da1-0ec8-4773-16b6-08dcf75665ba X-MS-Exchange-CrossTenant-AuthSource: PAYP264MB3766.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 13:42:42.6766 (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: 8J+QfXw4XLffdYJ5GDuCOogtEVjMevR9UIG9Tp0b+5fdVQcletKsrVWb1350bcof5RTllVRJecFfoFLtMG2c/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB2397 X-ALTERMIMEV2_out: done X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241028_064337_459907_5CD745BD X-CRM114-Status: GOOD ( 14.69 ) 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 new fallback memcpy_{from,to}io and memset_io functions from lib/iomem_copy.c on the arm64 processor architecture. Reviewed-by: Catalin Marinas Reviewed-by: Yann Sionneau Signed-off-by: Julian Vetter --- Changes for v11: - Updated commit message --- arch/arm64/include/asm/io.h | 11 ----- arch/arm64/kernel/io.c | 87 ------------------------------------- 2 files changed, 98 deletions(-) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 1ada23a6ec19..463067bffdfd 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -128,17 +128,6 @@ static __always_inline u64 __raw_readq(const volatile void __iomem *addr) #define IO_SPACE_LIMIT (PCI_IO_SIZE - 1) #define PCI_IOBASE ((void __iomem *)PCI_IO_START) -/* - * String version of I/O memory access operations. - */ -extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t); -extern void __memcpy_toio(volatile void __iomem *, const void *, size_t); -extern void __memset_io(volatile void __iomem *, int, size_t); - -#define memset_io(c,v,l) __memset_io((c),(v),(l)) -#define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l)) -#define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l)) - /* * The ARM64 iowrite implementation is intended to support drivers that want to * use write combining. For instance PCI drivers using write combining with a 64 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);