From patchwork Wed Feb 21 01:17:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13564834 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 5C367C54764 for ; Wed, 21 Feb 2024 01:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=FI2+mvgL67OYPJ2MFVNFohIeDBRVJf/DkkYf0YFTcR4=; b=5Ajf17dMyK2+9s 7M55VLGohgQG+Oh7OSAx+IIREM/MnYpnIce3ArLljCUdlHRI7hVq+wmz3iFBVDSZllMCWW8LGKDuY nPOk8eJ3EtnLVIONewXR0QtkiwolkXqZzqSaae5SBGl7rdKudx/zTiUhcsGTmMqR9KcXg+QE9Mi5O pZITBXA9a8JxzCfDkyzl2UtIZ0BbVkFWdHd9TXF4+Lb7kGHZDR9nDnX3efNfQ8fa7tGsfl/zLgjjW XPCDGEGbmHPPT0oGdSTbT2f5cjdtQPdu/H1kxFuPUWWBV6iJvltTwwdCODqH7J99UGfts9pSNvMvY f20vROOmSNY5nIjCgvVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbF2-0000000Gip8-2XNr; Wed, 21 Feb 2024 01:17:44 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEm-0000000GieH-2k0W for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 01:17:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wu44itpysA6MKOHG5dqg2EpZKPfEhh8fsjXxfllOmptnlZpXAkIxfJyUaQVQrK2V5TvGdB3OfhMoD4HxbSCsu3oJctdvIwJ+3pTKFHCK+g1MbwqNIXQmh4E/DgJPjtv9aIK8wIIQp0j+wE6BFl+mMB748F1+pD+IcaNR/VGlRtkRugAXnWyGQxwTE0PKiOdEB60Szl84BFNhfKjeLRVUZ7J8ZRl9Y7QrbNbNbHnwbdSXvgIEtOcihmODXbJP4xWjGzIDFgVMEqNUp7Z3V3td1TINuS5F6C8HyDmlzxFyVZQwYID8NFNHEugo9CV4G2qHwcGRlTAGqOULzV/5vA6c1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=T73MyyVmjQxk598poK2sg47B3XiSs68eQEg/tDbSpMw=; b=DkQ3DgWdjfkAwsBPWeioYBR2NPP98w4aHwNE/t7SoFvpIyCvri3dk2Q4PHUjsFQRhnKvplwWMeanM3g0uVXQRQfhq1Me3qLub97lbu7rE5kSNTwYxp1iE5Eqz4nR+UZXSkn9xYY7YAtbbzF0stJwqHGkR8YJH+VrLRn1XUjIwgBskq/FMKMAN1vrothHeGBVFkiVXwo2EG/vsW6pcYNedjoT/cjHHfKb7x4QTbFGvHnFmpQgh9f1v0IooW+JCLkDD7960Oa2Awk6mfr6a2b1lLr7SVHcNbWFtkZ9uZMgzsY/Wa5QR6Dv7QMD9jsvJ8GpWbEjq2hgH9+FaiyKUuYlww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T73MyyVmjQxk598poK2sg47B3XiSs68eQEg/tDbSpMw=; b=DTo9HzqmZM1AGykT2yFC3c71fOz66fHk9t8odayR/d2YYRyPvf/RsLNw0GYams+ntkpVxCF8ntvgO3NTyD1lTXJVkgILK5CxWC/wMCblWESEhH/M8xABMYGaQZmx6eQgnlZbesPE8ySi7QWrQMDc5/El1BIq0ybq0vp/uKDTN46c+gHS2G5N5IIPhKKT/gW+lxfkDrE+p/Q5Ie3v9843Hk67icUyQ0WkIMx1denlymJj4G4oqchUCv6S+6XlueXyqBInc+dCik+2HDmItBcQtcw8e5PgRO1d5CvXQ15MX5gaf0BL3unkLZQjCkaOlpR+3ZwZCZeGJmnfqRik2fOnzA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB5714.namprd12.prod.outlook.com (2603:10b6:208:371::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Wed, 21 Feb 2024 01:17:14 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7316.018; Wed, 21 Feb 2024 01:17:14 +0000 From: Jason Gunthorpe To: Alexander Gordeev , Andrew Morton , Christian Borntraeger , Borislav Petkov , Dave Hansen , "David S. Miller" , Eric Dumazet , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Justin Stitt , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev, Ingo Molnar , Bill Wendling , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, Paolo Abeni , Salil Mehta , Jijie Shao , Sven Schnelle , Thomas Gleixner , x86@kernel.org, Yisen Zhuang Cc: Arnd Bergmann , Catalin Marinas , Leon Romanovsky , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , Michael Guralnik , patches@lists.linux.dev, Niklas Schnelle , Will Deacon Subject: [PATCH 1/6] x86: Stop using weak symbols for __iowrite32_copy() Date: Tue, 20 Feb 2024 21:17:05 -0400 Message-ID: <1-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> In-Reply-To: <0-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR01CA0064.prod.exchangelabs.com (2603:10b6:208:23f::33) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB5714:EE_ X-MS-Office365-Filtering-Correlation-Id: 2382273e-caf0-49eb-e778-08dc327ad4ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fof1/7hPJgq85HlZOvdeyTNRI63XLJ8gm1vgWM0MeSnzmvbST2u6olyzwVpjMCLIRsKG2Q1jgYoJzr5/FDLsqygzZp/eiJ6n792qd5RTeP0NM7XnvormHfnZzncrdlkEYBvUapijKi1P/tG4HIbCKAQ6hoc41IJYDTdkqIjgwKxJw8a92OK9mFD5x67tPi/ogXAcnuIPiRt2ZQ9Br3WE9cezGqDSauhdl8zUgRGQ0cDhhN5r5AwjjxlwyQlwJOjtTxt0Yiolc0DctwlcyvGxDyTtoHtSu6HhN5JpxPkdJw1feGA7XIfcuX5gppoGnchZFBKWfUgH56Pfnn/pptf8NCRt1mIUmE27EiJNpzTuj4Y94mr5MB1S1hkc4LUP5+qP4Q8hj2Rem/2VWWIg3JGg27ul/RUw9pAksGNkyavcQxWq4FYzeTRAiMPt+YMuLy4oJ27H8XtVlH/VhJt2If/OjR0VsANjEr6+Mj4ydzte9rTaHWKa4Lje6P98uJwwknySpBmo1agOsivDZ0VkVM/EdDUHpzK/isp+gpAvuzgtRHNAw7r6maNb9VnkOEGpowMb77G0yorWLSACpaPS/w9Hgi98v2z6Bq9pegstXniXIyM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LbHs7xuZIEYRHsHORUssNSBw6nAtyQnTnwc2IJBcyT/S/ID04o2phiAaByybivXA2/U5+VrHqhug6YrYloBgqdUgeZPoEDAtyMJG/VbaW9jT5oh9WhlSkYRGrSq93lYzqWlGx4Sr0ck+TGDXxNtbGtzgW50dgd51R+sjPxq5qj+boEIw46in1L5AG7SUBBbzvAXnMTcRQ4CtP+SrPaxdqTPzW6C1vgW+b0ahbos0KHYNZsD4kAAs3qMmY7l5GroMpY2dxhku32t5aVM7vA1q7t/TbYJLeNqhvul6sGXKLx07L/fUrFVNt057FIp4AFw1DZKbBAMH4b6yS2lPAwegogZIxPuADa222gcKnxZWbGC9xUN1+QHtlYwsbITiHwoLz++35k3lCSKKU0FG9REJkqiz1J06ZEhoOtkfK9BmPRTsoH3rsyfOhYkVum0XHj/8xD7ELSZZlhqFDbjAnL9litoyAQR3H/TweHy9+Odr7dl+5eC3kwqITfuO3eQR06dLkj4ikQS7XTFG0RXE+fQIHVoNWPP7pPz0TNti0tsTI1u2BAeMnrZXW26v22z1Xr1UU8bQ50Etht9lmuo/9DbCDUkA2hjTIc4Nw78sLheNgDXQi1g1KICuIReoH7AVImoE6jknGuUrNvopqOALM0z7puO7tM0d7sPMohnloRnp0xk4rXb0ppXkthnxpaAGUKDNMK8IoRwS135ds3HpLIqRSylCE8EN/t+WU3ue9kYg4EnvWFgimX+ObreExqAgpxUAp1dEgXMF9o3hDmf9u2zEqZxNRkmBvfScG5QUJjGd4vM38HSIukZiizeJm2TtL2ht2/LKMBlqBu8rinspm16Dlq60lk72IgQBxBdmwLUb/ZLpWHulN02XVWoncP5D93C12qyOUV71PvmEHcusLGwbqCgTwYUTib2Vc1ksIKW7/hqr3TW7M/a1ZgWl3cw8Vt96+H6CIpkcl+Zqogzmcvc2joyPHgjELFpD4kL610Mw3fJAa1hReeZGWaYT78sdg9OcWEROQvPr4Ypv1ek54efrJSw/eD84OyB48wxnfbSecTgQGD5DLf7RValDenKG5fdeWpFjlHl7ogib2Un5yuz1k6r8F8I0bsrPXXvkhKqZ/69owSr63g3Wk8XuKgF7x0KOD9SIZxY5wrJUHVlAGbT736UXZZnVAHtjRK6UjfZdcBiky7IBnQwc/FbEGJ9Nb/HL7uKhq7oZtUEQ7Egj+U7gQwlStNh/AaZ1QqdKKh2OkWRZG7HyFFkFM0DIJr5R9tq8uq/zCW+zfb/x6od6jHI6mXnvr6YU3ypkkIrkoh+CN1z8TBvjeU3NBwFVTTRauRz5g4dq7rWjcvw8E+nGAXOfdTi/UGfRXVeRemGI/kGWyKge3v5PhHdiPH0KrEMyhZ9HbNI5vJHnAKu4qm0sDNpiDz1p/8W4I1vg0NDmwjyxD8VdkderiFMjfptYhbDBnFelaEQ/PQEg111AraZA5ot9GAKKywF1mhOB4DE6BYIhnIqrH3TZ7lVH1ElElxmJeTRaRTBoYH9axYsH1wUlNIrGY0NOtLey/fWB/+wgOL1nH4qjrdqnTIEXER3Nh0CtzXU8 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2382273e-caf0-49eb-e778-08dc327ad4ec X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 01:17:12.0901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iU7t9ar6pCH4LUBnlF3zaqOHNzEFN6UzRuKx1AqOmRdkwBy9hiSLZM/kvQ1pHSnh X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5714 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_171728_810335_60EFDA36 X-CRM114-Status: GOOD ( 16.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 Start switching iomap_copy routines over to use #define and arch provided inline/macro functions instead of weak symbols. Inline functions allow more compiler optimization and this is often a driver hot path. x86 has the only weak implementation for __iowrite32_copy(), so replace it with a static inline containing the same single instruction inline assembly. The compiler will generate the "mov edx,ecx" in a more optimal way. Remove iomap_copy_64.S Signed-off-by: Jason Gunthorpe --- arch/x86/include/asm/io.h | 17 +++++++++++++++++ arch/x86/lib/Makefile | 1 - arch/x86/lib/iomap_copy_64.S | 15 --------------- include/linux/io.h | 5 ++++- lib/iomap_copy.c | 6 +++--- 5 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 arch/x86/lib/iomap_copy_64.S diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 3814a9263d64ea..2483988f0b7f7b 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -209,6 +209,23 @@ void memset_io(volatile void __iomem *, int, size_t); #define memcpy_toio memcpy_toio #define memset_io memset_io +#ifdef CONFIG_X86_64 +/* + * Commit 0f07496144c2 ("[PATCH] Add faster __iowrite32_copy routine for + * x86_64") says that circa 2006 rep movsl is noticeably faster than a copy + * loop. + */ +static inline void __iowrite32_copy(void __iomem *to, const void *from, + size_t count) +{ + asm volatile("rep ; movsl" + : "=&c"(count), "=&D"(to), "=&S"(from) + : "0"(count), "1"(to), "2"(from) + : "memory"); +} +#define __iowrite32_copy __iowrite32_copy +#endif + /* * ISA space is 'always mapped' on a typical x86 system, no need to * explicitly ioremap() it. The fact that the ISA IO space is mapped diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index ea3a28e7b613cc..af4ea3d83ba1f6 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -66,7 +66,6 @@ ifneq ($(CONFIG_X86_CMPXCHG64),y) lib-y += atomic64_386_32.o endif else - obj-y += iomap_copy_64.o ifneq ($(CONFIG_GENERIC_CSUM),y) lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o endif diff --git a/arch/x86/lib/iomap_copy_64.S b/arch/x86/lib/iomap_copy_64.S deleted file mode 100644 index 6ff2f56cb0f71a..00000000000000 --- a/arch/x86/lib/iomap_copy_64.S +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright 2006 PathScale, Inc. All Rights Reserved. - */ - -#include - -/* - * override generic version in lib/iomap_copy.c - */ -SYM_FUNC_START(__iowrite32_copy) - movl %edx,%ecx - rep movsl - RET -SYM_FUNC_END(__iowrite32_copy) diff --git a/include/linux/io.h b/include/linux/io.h index 7304f2a69960a3..68cd551b6af112 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -16,7 +16,10 @@ struct device; struct resource; -__visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count); +#ifndef __iowrite32_copy +void __iowrite32_copy(void __iomem *to, const void *from, size_t count); +#endif + void __ioread32_copy(void *to, const void __iomem *from, size_t count); void __iowrite64_copy(void __iomem *to, const void *from, size_t count); diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index 5de7c04e05ef56..8ddcbb53507dfe 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c @@ -16,9 +16,8 @@ * time. Order of access is not guaranteed, nor is a memory barrier * performed afterwards. */ -void __attribute__((weak)) __iowrite32_copy(void __iomem *to, - const void *from, - size_t count) +#ifndef __iowrite32_copy +void __iowrite32_copy(void __iomem *to, const void *from, size_t count) { u32 __iomem *dst = to; const u32 *src = from; @@ -28,6 +27,7 @@ void __attribute__((weak)) __iowrite32_copy(void __iomem *to, __raw_writel(*src++, dst++); } EXPORT_SYMBOL_GPL(__iowrite32_copy); +#endif /** * __ioread32_copy - copy data from MMIO space, in 32-bit units From patchwork Wed Feb 21 01:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13564831 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 6D607C48BC3 for ; Wed, 21 Feb 2024 01:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=wUXGYijAs24nHgVJacM/drOHCOc/6HjG4Px23VYn2XM=; b=PAzWh0aPRvY1Ns xJYvXCJ40LaJfAfilrB78yCi9V4PhIj6lcciGCadB4igdvZz915/oPwhW/9tjiyGCV8wDPsob7MDd OS8Jms5+dNafpo62GUoZLS93gqidp+7DbvdgzW1qw/1Z5LCy3P5BTJS0pTVLqpYr8CERBG8nFwKS+ Bi2g2e4VgpaQ/Bz96BQgl6of7IuhAWEk2oQIT7irBAe+xWb0RgHjQxRSwZrVKrPtO3HvYHtCMqPHl ZqiNjwg/Hxy69phGYiIupvb8pKsJ1NEtAfa8Pz6bdrZKw9QfbWT0iLr+n/sG7CasF0J9K6c0+Jgsy gUQpTsIrL65U0xxrKjnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbF0-0000000Gimo-3lyi; Wed, 21 Feb 2024 01:17:42 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEl-0000000GidV-2jkf for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 01:17:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OVtwZz62wdgWteFNDOyItC5grrOL1Tj4/7ieud8SZsYQZMJldoY7hTfILSIw06DaHR4J3bVUpN3+h/8AYdB4woixifCf9SRv/HeRbEVOyMLMD6+eNeDXQdrhBya5I08aMNDO8KE9I6xVdCjRm1dW+/KTTh5pkXYDWE2/ptutxA8kRJ/pJf9Lo8tzg3LQSFAKmUK1wyaNyiIc+pbPTqBbgsW7b9yVuaaewZH6+k+SJ4htX4oaqhH5JGX/BU3XsIAjTQmOt2S22Z4j7OrnD9RGNAHJsO0hub+VBSHyPNUsXMEMTh4WkiLPovR/Eqlke5qhC9z56xzQP+I0xJeiwrUeew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=PRPh4dhsyZVmxVVomsPWCtm81IAZr2FMm5Xc6ZHkaQc=; b=OZ/YuBkZDNLcU5tMyls3jz04VSGkxj3mDUgrlOjA+5G+nkVAVJ7IRxXSJXXWffv8vEM3wurMU5OFDUCB0bQ+PengpC4bXw+zVqJLTMF6j2DpHJCKDEWwQK+AS5O6i0FDGDIUuKSGbbhOy6SAOy3ikIkuTqstaIp6DRENC7tdHj0KpCIlsp7Hs0H3NLc3OeG7TNI/uvxJSszbIOKda9dr9IbTs7ArM2VIJKmatUk+qBfboRza2gpTdPFPJa5/PdgMQpX6O5lOEhi7sGjAwKEXQb9uwiGB6LOQlA3FsPdvJStVVyxTdQUa5COVhRir4D6KYGqVEYuCF17dbp3cpbapfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PRPh4dhsyZVmxVVomsPWCtm81IAZr2FMm5Xc6ZHkaQc=; b=AlnvEmJ3js910k80SZfRiFl3lnuIhA813nk7syRboWIwlzprjGt9BCwqcTn2oInMG3x1Ohw+w5TgcMAYwWsy9jKUSOhWvEhep+wvFvwhM5RhQp/EtU9QtjQU4r5hSKwT0gdVCtZwalgAwE9Z2jg3tO6q2GJbCIq0/z2GMgz0f0PACA+PjgvonJs9+T8h0fAWjc97dTZ1fKzoQYHq+s08atJDnr1O9gnkey68ln/jF/sgBpEgJf/jKpSREo9sAvrD0OF/gj4/oQFzHeYdrWzWw+qPdGLb7V5OpVEIjMADcvgJw7hciYM97odIgos/tlm3fee34c8y6SNUDCzNM7SwoQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB5714.namprd12.prod.outlook.com (2603:10b6:208:371::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Wed, 21 Feb 2024 01:17:13 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7316.018; Wed, 21 Feb 2024 01:17:13 +0000 From: Jason Gunthorpe To: Alexander Gordeev , Andrew Morton , Christian Borntraeger , Borislav Petkov , Dave Hansen , "David S. Miller" , Eric Dumazet , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Justin Stitt , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev, Ingo Molnar , Bill Wendling , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, Paolo Abeni , Salil Mehta , Jijie Shao , Sven Schnelle , Thomas Gleixner , x86@kernel.org, Yisen Zhuang Cc: Arnd Bergmann , Catalin Marinas , Leon Romanovsky , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , Michael Guralnik , patches@lists.linux.dev, Niklas Schnelle , Will Deacon Subject: [PATCH 2/6] s390: Implement __iowrite32_copy() Date: Tue, 20 Feb 2024 21:17:06 -0400 Message-ID: <2-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> In-Reply-To: <0-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR20CA0064.namprd20.prod.outlook.com (2603:10b6:208:235::33) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB5714:EE_ X-MS-Office365-Filtering-Correlation-Id: 86fdd14e-590c-4538-a4bb-08dc327ad4c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3yxRJxO5aIbj3hDw6tlkBvfl/bHS/toyc0WPFpJn7I/p4qar7U4TVNN77AMvfjdV1WeRhUbg8Yqlz2ogZhKh9FhfLfzYdjYYRpqQd4pq4ZUrGqbgmxiBRSd21KMIlt/Pk4K3icKslGo4eE1uskxPWUdt7rHVf3XGaD9FLgdKlcTEt6M8UHc9vdVrw3wRJPZdcUvDXztpWqQr+NgZpUajskPcwmZvkkkEsxM5uMgvHdrWirzZT05sCar3kdbEWh3cPrOdLQhC7olmYB8FH6JSAJT3lqDaSsycdULfQtmAQDm7Ve86qyIlBS6+rlOLfA/cQsg/JGZzYdbr5cNGeztpqiuo8M5vB4dQAld5uDGr3P9jTDK2qq/pIxDLWMhyeIYqvRhF29HM31jl23ItHjuXtrGk0HUXdUib4/9t63VTheCga88CxuOMFTw0XbIX+t5vK09M+KDvrFy6p2h/s+yFtUVSPA2e/ncrVnw9ZlVMZliRF+VeulRQnrGZ6HBccTJd0jGzqsnIa1iHoqqptWPQ42gqsSH63m96+0RI2OaeADOwEOrTmC9qsgz8n0bUduIuPxC6XCm/iaUkxcv6VhRXfLsTB8oN2HjCItjAf6/3N2w= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YTmOas5ayFNIiC+T9hc0t8eaVEE1/d8RO4aKgENd7USt9TyGZn+k83VSpHUQXYjr7pSWQUm0Zm4MN2ztkjI2k9aOZBqVIImVgIMRXlBPcLuFEUgFBMtRocN/V29DhrJKroq/H9igV8UF7SL9CJG8FiP0jcZVI24LnwB9kzk1DHOHOwKDZU1Qyde7QXwsgIKVQIIrMkn1CSqalOZ2uLBbnksyZw7g2ML429qjAEm3K7to4d0/9VrrcNet1pJk3s0QP/4VHHiVA3Puacb5W8vCY94FnlPx8wVtXAA8LU6umHIGNI8stIaTas+yOaB3pPvV6VlWBi+WaGE8mAdpvlsf/WYcUcXefmxTxuCx4PCXzlC5kcDjtxtpDImK4aKdQkwN/EmozjbsKpUfOuNP8e7OJF6Qk6B2b98XBOc46STcLhYlhL+ivZZZwfx/v+q9zwTHhDS5+Fl1Bc/iNH5P/KVuJ6KDbKkDAiBKgDy/JlQZH4L+3E9xO4U0Ylbh1bh41zrBJcXctaC00kPlZ0ioEeh/SV/nvdvksB3YjoVH6E1JOAWxbZmmTm5KqsVvGyZ+/vhr2I72hcEvaGohzKj0pg+DTUBmKgBrccQOjs3kEyvbqDmGJHRjqbPF/8jlatTFCiaSPuIVW3HsY7XBV7KL5V+w97NjEhzKIQW3JsqaxCMyBaZ/l+4b0QAoOlCcQdvQXOkzsCd5a/9uuHTre68Fd6OlGst+hBCJYy3EX7mnPfQFWhvfMaaf61UWgZgdekpzAobQipt+4Ty8DpWwysiik+gU1wyViqpKhdObu0fUopE5t9u7ZysP3Nmp1kMLyjeviFznMBgHxcsCYqChlWzXnQIaEb57zKPh5csCj1Xrgev122RJmqI9KgIkk9FFXrY5/TZWdse3GLmYcPdBGXuwij8jkWwQNcHBe51/nzhLR4NQjki7WQdyjE4cQFT5l6luaMani9Nx5uYE/jsaEwm6pXZAG2b7+KiN2bndH0t98TEtHj1vIVQNg+3Gm/1boh8RrRy8GjvgrtAUdNzV4AYHstFUqwfGMC/bWTLBkpgpp2zaSIraAfN1U6UJDkDievt2Wd++ldJTZ2YJzUHqHMzMCa6FpgQ8Da0dHG2elEvH7DIIPDY241GixjlcD6aLXrWBO3S3UFZtfmG+12jRZArGKZAhc2eL5hZ2KzPFeEmUtxpWr57P5N2shXY3Tfbr3ENjPboE1CVf+k06WKBq+DWE+z//nuLXaqYzLitMLkbPJKRRs233lpse3hc5YY6/nkjNaw5cUAZkPtgUwq/syN92HQqQZ1vmn2+0rMJsH83lrHhseXrLx9a0FczbjsEMEEs7GXgoQT8sdqxPzSOsU5TGzceF5HCIW1Tk9uwBt8DsTbCSzDOQyCWy8/GjmEGS+sZytJ7qU1ov4d/63MPn8/F6KTmlubuPrkzRk6Y+i292kB8TBBlAkh6IZQfKWpiH0hiZCcTH5ef9cmt/6jdx2QHWBSWWVSuE0fv5KTBuq+HN9Cavu+Uk71Ve1G2y8ot/vSE8ZIokKRm0abFnSirovycAgwtiH4Pi/SOeituRddD0Qqqpxfxz2s1QckFuu8EqLLLSjyZx X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86fdd14e-590c-4538-a4bb-08dc327ad4c5 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 01:17:11.8061 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tg73HYJbMGHhYEl58jh/6me1JvXLicZLpyJN7/bN9FgQygsnZgoI3UgK3JmE1O5z X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5714 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_171727_803573_8AF7117B X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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 It is trivial to implement an inline to do this, so provide it in the s390 headers. Like the 64 bit version it should just invoke zpci_memcpy_toio() with the correct size. Acked-by: Niklas Schnelle Signed-off-by: Jason Gunthorpe --- arch/s390/include/asm/io.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h index 4453ad7c11aced..00704fc8a54b30 100644 --- a/arch/s390/include/asm/io.h +++ b/arch/s390/include/asm/io.h @@ -73,6 +73,14 @@ static inline void ioport_unmap(void __iomem *p) #define __raw_writel zpci_write_u32 #define __raw_writeq zpci_write_u64 +/* combine single writes by using store-block insn */ +static inline void __iowrite32_copy(void __iomem *to, const void *from, + size_t count) +{ + zpci_memcpy_toio(to, from, count * 4); +} +#define __iowrite32_copy __iowrite32_copy + #endif /* CONFIG_PCI */ #include From patchwork Wed Feb 21 01:17:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13564830 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 65016C48BC4 for ; Wed, 21 Feb 2024 01:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=qNu11H2vAcjZwxXYtahWXxucEChQm9jgLnAn+92Y81Y=; b=rtN3yrWiZgFnqq UGIW8GAl1Q8LOsrrEfL9LL0b/PM56rVgfRPgXUZ+UGMpXsh+/Y380NMzdUeqGjiW67GieGPHf3qvz EVuHlab33WSX0H2toH5iM2H8eP0mauMmHFX96dt3tD3YTOPVBGzkYOV4sPTWRTt2SzpiNu4HF1KwN CYNP5LjO/TqDIEPAMD96Q2q9jLkAkQKtDnRiqkBK4HLYPME5dhH7ryiPSP7v0olAfTJKUi9soc6FV A4gTIZjBe+9FIau8RFvv4GnaW4yG1eWWU4ncxmFRWHhRHSdX3583q7wvF8zVC5VPqKdWRUf5XHgWq OLYzeKcX9rCXhR0nyOzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEy-0000000GilF-47Hs; Wed, 21 Feb 2024 01:17:40 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEk-0000000GidV-06Al for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 01:17:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IF9YtUOOKUKaj+suKxk3wzvlTWIk+QK3nt/dOeBhws7A8o4Ixi9023GzMR9y4pMz3aBi5Ep8bKi3Ej7wIKA3CP1Ct1B8TCYwx1U5KbQU89xy8Lv6PaYisbTSalP8z40lZVoWMQjGJPKypH6fyrUgBfJX+ely8qCc2JOu0oRL4DnvWXgqbFvh5p5gu9Dum84NTP11b5Ka2YNOe21HtKfisBLPO7OT8naBClkLcRErTASF6IpUQDxe3iqv9HdXvTCrCDiv8tRp03SqHagc+Z2O3U9eFFP4gPPrurgr994O8I/oy/8tqmf1yE+kIW5a6qYTr/PqYBfL5EMl8qUMEcbdIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=A8AAjccZiDocpI+iUhnHuPYfPmCAn0tQ1el49HyzkKg=; b=BKbI5vgc3+vYcBLDfBxIeGVXiN5mrbXgFQZLE87wFRDhf79dYMNpKc85V+bssSifzpSduYe3uQD0s4X+EbywMY2Nx0Xq/UhqL18RnZgXDDvRPh0Yu8LzdwPD7EC2HP0sjw8oWqZ3kEJsqe+9s1lSXp12yRWzrN7Z/zMgqVxMxlUJvO0XjBHQFTM3J7WnIVDE8lutrpAt0GjV4JWHnsajLy1Dt/Ntq/Iog4xp+Gr4W/Xs8MPBxYdekvgI0TaEBt4hkEcaSLmRoQqOV2b8gGyEbBms5Wjlv4onIum/3zGw+yzp6dhhoUoS/C7wsOwK/wmvxp56XhZE4PJLKcL9a8MV7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A8AAjccZiDocpI+iUhnHuPYfPmCAn0tQ1el49HyzkKg=; b=DTuRs4RuO3kRZ7VQ0o+K6SVfOREsUKEVc3nii+UbQr4jgMr33fcd01Kj9cpgXPeKADtt3rox1POh9L9U0EitZ5eIL+1TwLM1BFbqyUp8P6T8IhXTd9FHzvMREt+5NEnZG6FaMLBk22TlESRHOOlMWMhNfHwGZmWAyyuDpRXU9eWOLo+o8DoJCcdzhmRC4WnJVKhloUCh6nLv3EyNVxQdHEqy/2ShAWncGr7tRBnIBwLl0rOhQPwqTJYdRpDPddAUUoyNAokPO/3eeiPJ0IBYGgdhvPPRmOhwT6d8z6lTRQ8DNebEHq1Elx/sevt6Ijx8viW/coWljBdA6otgjuglFg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB5714.namprd12.prod.outlook.com (2603:10b6:208:371::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Wed, 21 Feb 2024 01:17:13 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7316.018; Wed, 21 Feb 2024 01:17:13 +0000 From: Jason Gunthorpe To: Alexander Gordeev , Andrew Morton , Christian Borntraeger , Borislav Petkov , Dave Hansen , "David S. Miller" , Eric Dumazet , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Justin Stitt , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev, Ingo Molnar , Bill Wendling , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, Paolo Abeni , Salil Mehta , Jijie Shao , Sven Schnelle , Thomas Gleixner , x86@kernel.org, Yisen Zhuang Cc: Arnd Bergmann , Catalin Marinas , Leon Romanovsky , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , Michael Guralnik , patches@lists.linux.dev, Niklas Schnelle , Will Deacon Subject: [PATCH 3/6] s390: Stop using weak symbols for __iowrite64_copy() Date: Tue, 20 Feb 2024 21:17:07 -0400 Message-ID: <3-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> In-Reply-To: <0-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR01CA0065.prod.exchangelabs.com (2603:10b6:208:23f::34) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB5714:EE_ X-MS-Office365-Filtering-Correlation-Id: e4e41e24-5250-43a7-18e4-08dc327ad4c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2obyQZaplIdlx9P1Oz/M8pb2d/0l3SYhM14cNXw+bZRp5q94u9zpGeU7u3PR+UWuEk26Q5VRDB11o5FmCtHAPiws4tcCzvd0QnS3ZM5YyGFnXL3yEvRVOmwhKoRm2NPch1ckyWWAtdQ63DdUllPaORwkAJM/70Yeg07wys+bPmFQups9tMp+8aR4DG78dsOG5pzECeNym8WbFt2I8cqzxgnmzwP6jmRyoHhQm4VYebGER/8mYY7Qn/Y2d9BtR3QuSmDBz81e3vmp7U5C7JYlbODqLU9jM+nkppY9x18vH9ujil48MEDhFuQxnrGUnckElNP+hEcIHmumfcTu3ejz8tT4GX44eZ6LAThp5blMiTnFNqOL7MOVF3syWmaSJJJmwssnLDbrltJ4YERoZVHk2sN6M6d+3+38g7r8B9hSDuzlSK5XtaVRM60eXNfK/tmP+5S5rQ01wubPi8x8TWJDbY+EAEqnUwCtCCdE4yBlihRLsF9vow43GCQ7Ic+75MRbPZ7higvmnRYOcDoKEtoqNI5410ANO9cOoBgIOuemES7H/FNDTEq92iHVfLBOuu8si9mroc1B6M9I74yX1U2jhxsLfL7l1LgZYZsSp6SIAII= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6QCh+3B4LZsdWASkKEXEQAaJ0ED+UcF0U4GCBjOfLcLx75/9jnIUF2ARb33Hf6yeWP712AEZ8hFTu3iRTtyo6dD29WsVaU+QJzmRno9eY1M/Vg/669LNtwbCZuOIu6SpJkwR328H9X3H9uG6FhGqzui/ipU3JTej7VWHrA50niCyMr5GTVKeKH6NX/OBYw67lydZnnWUa655l53PkuuOiy+GqpkDEL0GMwFCQf8jUPVxgmy4zAEdFSa4hct9d9VTwjxSy97xHxyc/ydfRMOgqcHh7dsuxdg3A0+YOsyMSPA7R4FrWp7QTj7Gq2eszmEb048NSQl1EI4iDQ79P9w5G9R8cqFIhK6PbmHBaaPO5/1tt/1jGXLgIrq/60tHS0ecyf4eUfQLVMUAuEMilUSbkSXzj9YvSK+1cidBkgxPnRR3oYdIf/iGj+eWMenWL5+y3q5ljq+FAaTrQYEgHq6GZvagYppK+qsFjmu4LY8EtU05iv0jSxSG5lM+oTHm4x0K0cEFlh7yamDdeoViKFrGbsVXUzxQxSVjW7msgkXlRDPVO9yBYH0SuwjQrLfx2nFSgMMf1sooCezLVzC8W6e+mlxG5xVJinD2wySbljohKwZJ1zALrCFOl0MIzAIqHvZtmpuIo0GLhYpsHuOpVbse4bJIpTju3/eA4o4dQz3DNAaEa/krJwZTLqrP9ic5UH/UvfyFOjjX6+T2a3pPOsMPsr4qd5QeqrzMeiBiBUOpRT5Uwm7TKUDAwe8vdxgMgqz1CI045XwkGly/fbPC724c6+teOAo/FC7J+vemTthW6j8VqUHyUSeMHsJ34RV6AnXp//Sj6PrcNV07xRBSnbbFZXf+Is9whnaUSmUb+HNaMt7mK6hniBNgp2L3l7BwVuUhkNDvZIYYUs8/q0303YM4C55p3XUBMtDEXYTPhd2SXacX2J98OV/jjzuw489a05tH7Yty6BFsHI7HGIBMuMnr2WOUZDcnEhCDeBNWFMKgIaFkEKQunpVJ/BRlIVhSaNWNhkSCWi6TTLYzLHD3Sjb965yODbIBaTqVOl8zQrJdEiX7RrOBdJ2G2T8uQtm41MVud/wYPkqw6AkPZP/LaBNHdC2NT/eWfTHiGVjhEHhT7+K2q5oioFdmKtORKGsR/kYfxxW+YcA8+LdL7sSS6ur2Knw0gZKBL/F25xoX03IbAE8JUSqcdBDaJh0CyOaODmT/B657u63mZvQThIuDkg7mbEPbvLfiOZpBbS+ekJL6lXvrGyWo2l3817qlWDwQGlGcN1KNXjY5uIOFG5BWjPaICC5+mk9MA38BOuy98BoaboK4xIpNRDq+6XSEoEqEoJnUWHgGeR/srdZLJrggl+Q5Geb7tMIYIVYFHmmJqmZHI46F/FzGg1ViPeMyFeZz9RGEVRivNSipjEFsPtFiPEDu68qFpsEPYZAnzjSHEuaQLLWHSgFngwQedRmoY1kixidX4P/Gks+w427U/P+SStnzK6m1blbaXQlujQUyjS2rt1kxSjOCCDnQ1RX1FIc0NCIJJiRgXn2gmf+qIIFY5KtTNm0wHSkyXCXxdzFnGT6wXrTmYANYJlqpCQfbquB1Usoj X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4e41e24-5250-43a7-18e4-08dc327ad4c7 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 01:17:11.8126 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yL3XbDf/mk345/2Zj4GGpRePm34LGu0jbT17qVuDzUMY4Q4pVgiTWc5QL9hYMB6T X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5714 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_171726_139522_A976C3FB X-CRM114-Status: GOOD ( 11.78 ) 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 Complete switching the __iowriteXX_copy() routines over to use #define and arch provided inline/macro functions instead of weak symbols. S390 has an implementation that simply calls another memcpy function. Inline this so the callers don't have to do two jumps. Acked-by: Niklas Schnelle Signed-off-by: Jason Gunthorpe --- arch/s390/include/asm/io.h | 7 +++++++ arch/s390/pci/pci.c | 6 ------ include/linux/io.h | 3 +++ lib/iomap_copy.c | 7 +++---- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h index 00704fc8a54b30..0fbc992d7a5ea7 100644 --- a/arch/s390/include/asm/io.h +++ b/arch/s390/include/asm/io.h @@ -81,6 +81,13 @@ static inline void __iowrite32_copy(void __iomem *to, const void *from, } #define __iowrite32_copy __iowrite32_copy +static inline void __iowrite64_copy(void __iomem *to, const void *from, + size_t count) +{ + zpci_memcpy_toio(to, from, count * 8); +} +#define __iowrite64_copy __iowrite64_copy + #endif /* CONFIG_PCI */ #include diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 52a44e353796c0..fb81337a73eaab 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -249,12 +249,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, return 0; } -/* combine single writes by using store-block insn */ -void __iowrite64_copy(void __iomem *to, const void *from, size_t count) -{ - zpci_memcpy_toio(to, from, count * 8); -} - void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, unsigned long prot) { diff --git a/include/linux/io.h b/include/linux/io.h index 68cd551b6af112..fe12be9de6f7a6 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -21,7 +21,10 @@ void __iowrite32_copy(void __iomem *to, const void *from, size_t count); #endif void __ioread32_copy(void *to, const void __iomem *from, size_t count); + +#ifndef __iowrite64_copy void __iowrite64_copy(void __iomem *to, const void *from, size_t count); +#endif #ifdef CONFIG_MMU int ioremap_page_range(unsigned long addr, unsigned long end, diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index 8ddcbb53507dfe..2fd5712fb7c02b 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c @@ -60,9 +60,8 @@ EXPORT_SYMBOL_GPL(__ioread32_copy); * time. Order of access is not guaranteed, nor is a memory barrier * performed afterwards. */ -void __attribute__((weak)) __iowrite64_copy(void __iomem *to, - const void *from, - size_t count) +#ifndef __iowrite64_copy +void __iowrite64_copy(void __iomem *to, const void *from, size_t count) { #ifdef CONFIG_64BIT u64 __iomem *dst = to; @@ -75,5 +74,5 @@ void __attribute__((weak)) __iowrite64_copy(void __iomem *to, __iowrite32_copy(to, from, count * 2); #endif } - EXPORT_SYMBOL_GPL(__iowrite64_copy); +#endif From patchwork Wed Feb 21 01:17:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13564832 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 EF340C48BC4 for ; Wed, 21 Feb 2024 01:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=Cep/oi/Bk/Fxlgbo1R4yEOOhnOvd8mF+Lbi9t6MkLpU=; b=hhtKSDtbI2vx4U Wdm/p74hwFvuLLWjcSToIqwFk6S8KGHryGAAnct7QeF3+b49ZyKV9o8I7L9PTvGehfjm95likee3A 6vo2vnzFZq25G9ivzHRkpTC0/kg9xLsdOUerXvqsWLwjq2lIWL/HDG8QhIby2PwxP9qPHTxHpcSgg HqE2YNlgi4ntyvsT7sl5Wm5EM4KhxWx9bMDIgjSvuLxYez/LlYlB5V5ySQftztNbZdGwzX8FU0/11 5TPqGAQ+iaTtmjeDpoYJGEekPvxzecfGD6I4Rnm2HPaJXjvwcSWBUoUd85cNz9QpLrrLTp19vszQn jxZYzLtTO4/lvSdsTPHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEz-0000000Gilz-2y0m; Wed, 21 Feb 2024 01:17:41 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEk-0000000GieH-19et for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 01:17:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fM6xmXTuPhpoXTezl3nyRFgTTu9ieZHHxPXfAphh2is8bOPb0itrxMfJWwhH9iX1MT+CobgoSiQjCbGKS99dh6pF1YpmYSWAoGlUMp9w724xZVx8YsbRP71BqsK/6OxVHmxTLmzrT0Qlm4fMSH57JPpLmXFTd4asHV7cmrlk91RKGfAnx53euzVf7orEQsiQSILiwaSR3AoM66h6a7HLX58UFi6uEso/Vr5zCSRLQZwa6LYYixpf34GdF28cSKZ08R0trXAVBiVKR2tiaIRCQAKQt4bb1ADkrCg0501mQDDZ5yHvgFKIqP0m/ghtHOn5jUJIi+UCJH1FXAxaXVdzIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DeUvBgwCcpebIW23s2L/TrJooqO0xbExf7wkitmek/g=; b=U7wAqpcpmN8nrFClkz0SrdLA6CT8ncmcEYoPu6y7RiYcVAQox5V006duEVUfGKbUxm6ndINF7qMaBgtlpcZpgUyJyjBReaQwLBVv2HhGg6Kcfd3zFL4zy3CR63xw3IdRP9RxSTPfR2ZsjT1/7crwmrJ17s1Szpu4YVz3ftaFNJkTrx5UY0jJCkR3OWuPLvzr7upUa14IEDQXw2mNPlvp0+3lHR9xHmjKiU9LYZwvV6qtEFI3G7b7oDP50uBngotXCZzXKX9arzjxnzK6V4Efnt0uYKQUSGGm8RuupPaacoWqPec/qd9YXr9KyKIdF0dilZAywRrGKz/L/zYiE0T5Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DeUvBgwCcpebIW23s2L/TrJooqO0xbExf7wkitmek/g=; b=N1xDzRondN5/j2fREWE+TN47HfeHVrRBpCZVH8fpWYB4hU4lKZJtPrkw3xvhY8MYE2zsEKcI3kkPiFhzZfqyRjN/9Rv6ADwaXED6PFri0eEqiC7zv9v1w1ve1LTdDWnzDbXJsQeznxIyrO5V86P0KhgHVMQ2RVtyGEj0JGyQx/RkvHIXmSYfHxvkAOzoFXNhZ2MtNFhZ67wKJmJH08yS77yKLYoSvI11V1NddLZekhpphqHy2sBjCjlpoQixJEWFWRqOrvR+nvgg7aTkFNdvBenEFrCM3xYxz64OksQ2bpCFgvxd9Yqeh+PU2lKBYD6Oad5pgkeYGeGlnxBYm2//QA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB5714.namprd12.prod.outlook.com (2603:10b6:208:371::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Wed, 21 Feb 2024 01:17:13 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7316.018; Wed, 21 Feb 2024 01:17:13 +0000 From: Jason Gunthorpe To: Alexander Gordeev , Andrew Morton , Christian Borntraeger , Borislav Petkov , Dave Hansen , "David S. Miller" , Eric Dumazet , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Justin Stitt , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev, Ingo Molnar , Bill Wendling , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, Paolo Abeni , Salil Mehta , Jijie Shao , Sven Schnelle , Thomas Gleixner , x86@kernel.org, Yisen Zhuang Cc: Arnd Bergmann , Catalin Marinas , Leon Romanovsky , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , Michael Guralnik , patches@lists.linux.dev, Niklas Schnelle , Will Deacon Subject: [PATCH 4/6] arm64/io: Provide a WC friendly __iowriteXX_copy() Date: Tue, 20 Feb 2024 21:17:08 -0400 Message-ID: <4-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> In-Reply-To: <0-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR20CA0065.namprd20.prod.outlook.com (2603:10b6:208:235::34) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB5714:EE_ X-MS-Office365-Filtering-Correlation-Id: ee8bb608-b44c-4789-e6f6-08dc327ad477 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N0uu+jLwQteFY7HwpWZ0ppv8y9zJYgtCXw8ISzp4Q9pSpZA4O3hvT8UkOP0u0d9fzEEtzdmANIZT1pKbZGksT3CRD+an3+g6P2D3S0hnxDvIPeUD9uQqyd8qCF9ZM3+KhfLQ7ta5h3Gzt8ZIKDZPHQmWBBwJrXdTjuUxpo+pqdu/Xgz04/6ti+pqkZMsKaO0yF0Cc670hP7HTzYIWPenTyNd0KgEXsfIMF2bG1hF8i80nlAcwtE2m0nEWKF92XIA9jKJ6XFpQG/hRCw9v7Ng40v7PH1dOKmsORESU6qiS6Q2mE8BAIpKtQRt9g2ndm75BJB2Lx9EhH7nYnEkmIQ4HMforYtASggOlf/v9TGlZkfOdQwhq1A57yN10p1gBJgUwgoYz5+dpk15hOT03pCLflhIZ7fMK5VvaXGUF46Cf7q5Fs2mlvCH0LP41IbylHTMJgg3oGNd+IZG3p811QVUflAGf+BThMWvmzCKykRVo1bz1DNkY/cJGQ7lcdH7Q+kbwEAIakSqvFrSQIZdBE9MKe6/TpjkJ1Vj+CgCvpQ1xLrZvPsMbTGKP5e3GWLUCxIGFjfp4DLqZj7C0XZ0lwcOGDDds9aY8a1xVmMvUpOVpWY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hpMUTpat2HTX8duJ3kVmO0MWjpAggq/l+skVbksfhjqZiHx+yoi4M2L+du7T2JpdOlw9olYcz55REghDsc4halB3oOYHRIhCChTpGT8iKomINGiQIMd0j0WKmMrN4UAC8+mu3TzHnBO2tUB+fdcUxAdTucnXZr8arTUsX48qh5uazPXY7Kg0L3wujgEb7o9GFD2Dtdd6EKs9TaYqj+i9eRu7XANbw2wP0Vnjc3X+98AQdWQ58wsZ+Ts2XWQHuPksVp7BF7hW+VIHU5EHKCCOYAGKGFrehJdIdkFENjKx+sxNtEvoV65qaEezOnjH2chR0OLfTwT01lZDkdX20Uzv0Tj/T7BZJZLh6BrFXnsys+qJ5YdOSduaIGcczqU8TIsHrnAPd5l97VlZmrIP/hcihOBQIwtOh1FobMnGB7s/WHIC2cB39kquWsrlUBzvbVzFity5eNgiYja3ddV6Tss7cQUlZZONkb1IprOvR9GyGAyBkqJiypqoi/A+fyfaKiBOJ0JOJ4D0MFq3x0prfl1e9cMJk9WYe/9ip+biCgU0tAyXktRjHOJv031MNFxpnWPe9qgQa0bDG9YFZfRFrF1WVew00BLFj1WNTnzfEujiJdshSB4YtYw8d8OM4pbAyweqr8KuShyaoZJwa7qK8rxWojOA0iGE0qkQy6eKFAoa/xtEoKFLZ3SfDV3kgCI7QQaHdBs3u8+A8X2jPP8ZSz3+ZUWb1hzp3GxxbUl3LepNoWGNUZldhEbFD30Ez83WD+W3d0Gf8708k4aMwadYrHuffK7R5Vq1/NYw39+pJ1bmvxPBDO72jKlvMWlQbEl60t0rrxraCMcC1IvZB/OwcBUZaGtWkSOiMF1e6ZG3jK2ikGwL0F8nlmyBgryJEA7LyM1PEGSq8uFs/+M/Am+MwlW9AhReI+vjZRo0L/ZS0CpX4kWPnOc/64re7244WfP7OqYbvMPGCVIavN0meos2tCKPfUYGY8blPbHZIR10CPNo8awt47Q7U5/cc1EQBjVJpp2a9AKZ5/TMbBKX8C956nCd/yCyw3tHOv7RM85QzSFiK0x80sL1+T7cNaQS7I2Y0uEK13P7p0k8y8+uIOJwMbLEs1UY1o8VYg+iPRzGQcarY/o/cKDGNRr8d7g1AdqlpkEB1VYl4owt+Ov6Id7hhsfbPgi4+I3FcoZOn4Ek53B2Rs+Xn4z2AOG1I1zWlJzZpFkrGcy+Y6gAgCfRzbzMmKz+fpPdLVhJ3t++d96kyk7HKf0xde0v3a7vgmPGPcI9rGT++R/nDggotNZaTogEm/epbpg0LkXpKcNskHrMyImr/65z45AMXi+9Z4NMgqj7vFgJGV/k6Wf5k2noasAP66iW3GnzapWYQWxwp0QUzUAsdNESBIeU5i4byzhj0CL44j31ef3kYRvrjnQuOFeZiMT53UqijD60M7SzN6MLhxQyuKHMEwUeFRZMBKShg6bBJA39dpMZKG+jMEW4IlBJFvd8C0IgyGRUQMl0ofDSGW0QFNydlWvErhHk0UMmt9r/pQodA32o69Q03zxskrHkO6FFUpVuO4g1oKb2LxOJajGG81yTPYFjHEJKycDEqWMMZK0U X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee8bb608-b44c-4789-e6f6-08dc327ad477 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 01:17:11.3678 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tt1ppLxSslR0zCEME2szRXW8B7PYk7hVyxFuDt2eeeTIscZJjY7DnJm5cpF/TyaF X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5714 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_171726_406053_BB3B61F8 X-CRM114-Status: GOOD ( 19.36 ) 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 The kernel provides driver support for using write combining IO memory through the __iowriteXX_copy() API which is commonly used as an optional optimization to generate 16/32/64 byte MemWr TLPs in a PCIe environment. iomap_copy.c provides a generic implementation as a simple 4/8 byte at a time copy loop that has worked well with past ARM64 CPUs, giving a high frequency of large TLPs being successfully formed. However modern ARM64 CPUs are quite sensitive to how the write combining CPU HW is operated and a compiler generated loop with intermixed load/store is not sufficient to frequently generate a large TLP. The CPUs would like to see the entire TLP generated by consecutive store instructions from registers. Compilers like gcc tend to intermix loads and stores and have poor code generation, in part, due to the ARM64 situation that writeq() does not codegen anything other than "[xN]". However even with that resolved compilers like clang still do not have good code generation. This means on modern ARM64 CPUs the rate at which __iowriteXX_copy() successfully generates large TLPs is very small (less than 1 in 10,000) tries), to the point that the use of WC is pointless. Implement __iowrite32/64_copy() specifically for ARM64 and use inline assembly to build consecutive blocks of STR instructions. Provide direct support for 64/32/16 large TLP generation in this manner. Optimize for common constant lengths so that the compiler can directly inline the store blocks. This brings the frequency of large TLP generation up to a high level that is comparable with older CPU generations. As the __iowriteXX_copy() family of APIs is intended for use with WC incorporate the DGH hint directly into the function. Cc: Arnd Bergmann Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arch@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Jason Gunthorpe Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/io.h | 132 ++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/io.c | 42 ++++++++++++ 2 files changed, 174 insertions(+) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 3b694511b98f83..471ab46621e7d6 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -135,6 +135,138 @@ extern void __memset_io(volatile void __iomem *, int, size_t); #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 + * byte __iowrite64_copy() expect to get a 64 byte MemWr TLP on the PCIe bus. + * + * Newer ARM core have sensitive write combining buffers, it is important that + * the stores be contiguous blocks of store instructions. Normal memcpy + * approaches have a very low chance to generate write combining. + * + * Since this is the only API on ARM64 that should be used with write combining + * it also integrates the DGH hint which is supposed to lower the latency to + * emit the large TLP from the CPU. + */ + +static inline void __const_memcpy_toio_aligned32(volatile u32 __iomem *to, + const u32 *from, size_t count) +{ + switch (count) { + case 8: + asm volatile("str %w0, [%8, #4 * 0]\n" + "str %w1, [%8, #4 * 1]\n" + "str %w2, [%8, #4 * 2]\n" + "str %w3, [%8, #4 * 3]\n" + "str %w4, [%8, #4 * 4]\n" + "str %w5, [%8, #4 * 5]\n" + "str %w6, [%8, #4 * 6]\n" + "str %w7, [%8, #4 * 7]\n" + : + : "rZ"(from[0]), "rZ"(from[1]), "rZ"(from[2]), + "rZ"(from[3]), "rZ"(from[4]), "rZ"(from[5]), + "rZ"(from[6]), "rZ"(from[7]), "r"(to)); + break; + case 4: + asm volatile("str %w0, [%4, #4 * 0]\n" + "str %w1, [%4, #4 * 1]\n" + "str %w2, [%4, #4 * 2]\n" + "str %w3, [%4, #4 * 3]\n" + : + : "rZ"(from[0]), "rZ"(from[1]), "rZ"(from[2]), + "rZ"(from[3]), "r"(to)); + break; + case 2: + asm volatile("str %w0, [%2, #4 * 0]\n" + "str %w1, [%2, #4 * 1]\n" + : + : "rZ"(from[0]), "rZ"(from[1]), "r"(to)); + break; + case 1: + __raw_writel(*from, to); + break; + default: + BUILD_BUG(); + } +} + +void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count); + +static inline void __const_iowrite32_copy(void __iomem *to, const void *from, + size_t count) +{ + if (count == 8 || count == 4 || count == 2 || count == 1) { + __const_memcpy_toio_aligned32(to, from, count); + dgh(); + } else { + __iowrite32_copy_full(to, from, count); + } +} + +#define __iowrite32_copy(to, from, count) \ + (__builtin_constant_p(count) ? \ + __const_iowrite32_copy(to, from, count) : \ + __iowrite32_copy_full(to, from, count)) + +static inline void __const_memcpy_toio_aligned64(volatile u64 __iomem *to, + const u64 *from, size_t count) +{ + switch (count) { + case 8: + asm volatile("str %x0, [%8, #8 * 0]\n" + "str %x1, [%8, #8 * 1]\n" + "str %x2, [%8, #8 * 2]\n" + "str %x3, [%8, #8 * 3]\n" + "str %x4, [%8, #8 * 4]\n" + "str %x5, [%8, #8 * 5]\n" + "str %x6, [%8, #8 * 6]\n" + "str %x7, [%8, #8 * 7]\n" + : + : "rZ"(from[0]), "rZ"(from[1]), "rZ"(from[2]), + "rZ"(from[3]), "rZ"(from[4]), "rZ"(from[5]), + "rZ"(from[6]), "rZ"(from[7]), "r"(to)); + break; + case 4: + asm volatile("str %x0, [%4, #8 * 0]\n" + "str %x1, [%4, #8 * 1]\n" + "str %x2, [%4, #8 * 2]\n" + "str %x3, [%4, #8 * 3]\n" + : + : "rZ"(from[0]), "rZ"(from[1]), "rZ"(from[2]), + "rZ"(from[3]), "r"(to)); + break; + case 2: + asm volatile("str %x0, [%2, #8 * 0]\n" + "str %x1, [%2, #8 * 1]\n" + : + : "rZ"(from[0]), "rZ"(from[1]), "r"(to)); + break; + case 1: + __raw_writel(*from, to); + break; + default: + BUILD_BUG(); + } +} + +void __iowrite64_copy_full(void __iomem *to, const void *from, size_t count); + +static inline void __const_iowrite64_copy(void __iomem *to, const void *from, + size_t count) +{ + if (count == 8 || count == 4 || count == 2 || count == 1) { + __const_memcpy_toio_aligned64(to, from, count); + dgh(); + } else { + __iowrite64_copy_full(to, from, count); + } +} + +#define __iowrite64_copy(to, from, count) \ + (__builtin_constant_p(count) ? \ + __const_iowrite64_copy(to, from, count) : \ + __iowrite64_copy_full(to, from, count)) + /* * I/O memory mapping functions. */ diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c index aa7a4ec6a3ae6f..ef48089fbfe1a4 100644 --- a/arch/arm64/kernel/io.c +++ b/arch/arm64/kernel/io.c @@ -37,6 +37,48 @@ void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t 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 + * optimizes to use the STR groupings when possible so that it is WC friendly. + */ +#define memcpy_toio_aligned(to, from, count, bits) \ + ({ \ + volatile u##bits __iomem *_to = to; \ + const u##bits *_from = from; \ + size_t _count = count; \ + const u##bits *_end_from = _from + ALIGN_DOWN(_count, 8); \ + \ + for (; _from < _end_from; _from += 8, _to += 8) \ + __const_memcpy_toio_aligned##bits(_to, _from, 8); \ + if ((_count % 8) >= 4) { \ + __const_memcpy_toio_aligned##bits(_to, _from, 4); \ + _from += 4; \ + _to += 4; \ + } \ + if ((_count % 4) >= 2) { \ + __const_memcpy_toio_aligned##bits(_to, _from, 2); \ + _from += 2; \ + _to += 2; \ + } \ + if (_count % 2) \ + __const_memcpy_toio_aligned##bits(_to, _from, 1); \ + }) + +void __iowrite64_copy_full(void __iomem *to, const void *from, size_t count) +{ + memcpy_toio_aligned(to, from, count, 64); + dgh(); +} +EXPORT_SYMBOL(__iowrite64_copy_full); + +void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count) +{ + memcpy_toio_aligned(to, from, count, 32); + dgh(); +} +EXPORT_SYMBOL(__iowrite32_copy_full); + /* * Copy data from "real" memory space to IO memory space. */ From patchwork Wed Feb 21 01:17:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13564829 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 C5B30C48BC4 for ; Wed, 21 Feb 2024 01:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=NZxlIrolZpDTNZ4G2wXHZyBjMYukoScEEHziAHgPUdk=; b=Dgh56PdCaLhvi2 /57ob4L5IMbV3TFnWNmZRyla9RiVW6K2UoL9xDECTfonnHOvDx3zku09/JBn38pU9YxYm7+IOJ3Pq PuVDMeASrOyiM+JKg+mqtUNXfjQXjdtcf9biOYKPiviYz4oOiY+TadK7rh7uRfz+miXazW59XH9qe ZkR+5ecPMHmVoeH93eRCAEb5QHHpfxnofd9MOyHN2NiiHmPbAZBKGO1QKDLK85HrGVBGlZ/EQ/Wuh B/0yNSxhOcPmgZchuQzDo/wSzTZUyeGzliCTRE16iwPTGdUMlpGhm1vxk2KtKLLXzAGGjteyN1eVc hup6I0EKYOTnkiwCF8HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEm-0000000GihG-2ae6; Wed, 21 Feb 2024 01:17:28 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEi-0000000GieH-2KMl for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 01:17:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oM8NrTQ66jERFiZtDH7XbAj9uBemMPkdD5wWN+9tHvyzPUe/pwJuIEkXFo3ZuF9NtLzmzdk+1IVotk8eORNS7XVrKEghzl9wymqI125fKJ2zL0pmmD1jKz/k3e8toVrn/EySPdpA+fXy5KsSteZ4/6Hey1w7TF+fUpNA9/vorT5q0vYyAEVbQzoTg8RaDgujRD/zIw8ppvWbMwKqktxGTpUzjSCzWKKDYWB5aD9ugM0EaWC8wDnJKBd0iiNCFtSrX8a0bFEGHhNRwzUjaPTAf1a4CEfKM17Q0YJB/yWM9V3SovzGatqaHPxw20PKl51Y2PZI8O/A5HPvEP59N3Iavg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=eVx8ZHtyQ2mJAYsBPQbCm/vB3XwsGVOaRto1ttd02Po=; b=Q//ztglfRh4J7l/K53kbH3KIjWUldAQbaKUf/nELDuyBLn4LJrQbgdAIcjnH698DkfRudSf+GDJp6awoXrgV8m8QkHfQxd27FxA288feMlgLmfEJ+aZKyccBiIaZsjUAXdq7Vf1abi7jM+/s2T20MCdSq397ml6Q0uxbjx4kn/1ygsYARFcgAqstBomrvd59eD9jnN614T0ANUj9xr/Hit8kanejPwgBy6n8FHzK6A0BMHSnhWUNraAxZw1Br/qoptD64czAGO/faQ8YJNRyU7mCJNRHjtdRfFxH4TXn10+IOFe5+wjUmgWNrcntaHTNg1eJoxj1IvgKPONIt7ql7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eVx8ZHtyQ2mJAYsBPQbCm/vB3XwsGVOaRto1ttd02Po=; b=GTda1vpTZB1x5UgizbvA7xRJbbb8Ls5VC8kTqObIg8zs19GdBs4fOIn98JkgwJpfAPDw/e2Q7H6V6VY412AZpuq/yUnJWUuJmp+Cl9cAxOTsD/jZ2+eHpJVz3kaehCTojUsx9PgF3mfVDhjlirRMJoCbRxmv2zY+yrILt4lLV1tv/uJ8cchMmYeo7i46coXe6/vCmUHcnUlfNnVo34l47TwkJFjsXpc9cp1waOsBfN3s4vv1tXMlMf5x6K0h+udnkOINXdncjmpbhp4SbfKvrlP2cFaZNWmIVIO6uFzx4f3PFeRvfk1Q13LTmsJ13TaOthz0PG4eTc5CfxDLhpuAug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB5714.namprd12.prod.outlook.com (2603:10b6:208:371::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Wed, 21 Feb 2024 01:17:11 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7316.018; Wed, 21 Feb 2024 01:17:11 +0000 From: Jason Gunthorpe To: Alexander Gordeev , Andrew Morton , Christian Borntraeger , Borislav Petkov , Dave Hansen , "David S. Miller" , Eric Dumazet , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Justin Stitt , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev, Ingo Molnar , Bill Wendling , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, Paolo Abeni , Salil Mehta , Jijie Shao , Sven Schnelle , Thomas Gleixner , x86@kernel.org, Yisen Zhuang Cc: Arnd Bergmann , Catalin Marinas , Leon Romanovsky , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , Michael Guralnik , patches@lists.linux.dev, Niklas Schnelle , Will Deacon Subject: [PATCH 5/6] net: hns3: Remove io_stop_wc() calls after __iowrite64_copy() Date: Tue, 20 Feb 2024 21:17:09 -0400 Message-ID: <5-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> In-Reply-To: <0-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> References: X-ClientProxiedBy: BL1P223CA0001.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::6) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB5714:EE_ X-MS-Office365-Filtering-Correlation-Id: dff2ebf8-f514-48e1-b9df-08dc327ad476 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SUYm0LcrRTVi6ZmbVICMh1j3dXQOcxtnwMHx2eueW0Neva5BTpE++HHvmY6Egm6G9rnlKrqL4MGhGFKitiSMACdqX51idLjsAxiCnVNUyyGiMLdsicNljXE9P1TyzCxaf5YM+BRB0pI+ORxTmShFPRMj3MfKoUD0mvCASrjJJCQhvX7SiiYwAL0SknzRynMflYV6XKlymdeXYZC+wrLjD9i5JLrGeTY7ZIZTb9nqmXGC8ExeckUsxXqHeC5wHY3LN5iotKSk/93qNlwMOeIzUBTKZs+V9KItRYToObQwrZ11ceKS4+3GrZXmsB+zpLjGXnVaI68mjoZzdeQjjfxswfxDT22ATk9k2CvLMHyg2EideKssQwgsTeUdNLgtLOplpVzJ9ehlGRjihlv8mfVV9ZGraSWW3/ztV5z1XCU/scmLdAtz6b0itDw1sQ2v8PHyKSTIf/3/rKqdwMNVqvR9tv1i8Ub6DlUlqLHbrfYaAp6mEhWTzZWZqcC7M5pNb/gHVeVTfffgvBpCoOPBAzp6VXp6iXu57LdkoyWIV/UlM2gR3rX7kFyp/n2l2Lb0vdUn0KGNEhPxLrqldSJMIQkbdSc3w/vKtlbM94cdBgy/ef0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2wIpvvUj6hi97HpuRveI83cGVfJZu8lYkjGWsdJPN70+6UlGAMUcGaGhX35XQMSPvxzW6LXKpHMYITvhxGYakTRpdv8dTfXW+u5zbjqTJAStu/xNaCxL2VnD3fDf5ecVwarYThu8uNvS4CEaXTZLIV9cDqlyfB/3yjM1uyAxms/tY9PxKgzaasyeoje/VSB3+x67ZnxmputXwK8mi3v5CDNmdxohGIKzxogf4dukz7N+Lklh0yNvfCOACZpNZ8mqwbIyS3r40pQQC+RaYn7RpHL7qyHydxxZqnDgW13o//aPd92qTQyzv95qo+HVnmPi0qbd7yVgfJA5k7yp9tVK35PpkREjRUq+lhZccxZQmQkojO4Q2ca9xuKoxXKivHjNv2Fnsi4uw9M1JCUD+aBKRfVUJITwuGr8JXPWoiyU4C6k+KdwgX7J+McJQR+XIv75+OE8Hagfg4RgqavBORUDVG27Lcryb0X/hp4HLUlTYrTKpgyHwrLXICfdbwVHfkUskQcaeVmfOwrGmcd6vTS/oUaHMFBWCbV8DPZbqiQc5bItoYpNLKYMOyXCuWOB1D1nnd1RmJr11FYlPq4XgVP2RzOvVAZ3s9cd/gdYcKhFRjD9YZ/Oa5tBbrBXDdOuyOq4EZaSJZJRP7iEAVH7XHie+4IoHeP0WkbgwpMuWJXM9pEdtqtLXlOOJhf4MFpBC09ehE6ZbGTfc5J3LE26S1awAgRhJ3TAESIVNO1oqh7dW6FAcWVWqxSDOHyRfcd4Rz7zwu7gGkRQe94vzg8+HFP0dprQTnV2OoOJTa3pphZn69HwISrEbVxadNGNWw4ZvxP49KUSND/Hwsau7H+gP1ZnUGaDuoleXQtOftlSyDqoBXm76kSbj4GhMUplJKYu/MzjtY7Yu7d809g4HzRHBRio72DWRQ1yc8ucMTgRkmMV7R8kt1e04enGi85oy8MyWb2lL4dhE1jyMz+hjBXeiP7yIexwbDIjtyZcCE6Nq+uN9B9NCRSSYbom+FdTAOYh8PSy2A5Bv0wgyDMimAcmhBKef5EZfRru5PWQPDxAW2Zic+pO+kKPXIZSEhGs48z+NjwOFvtUBRVtEKS55+5qqiwXqbFBsnv+x4jayh22P2EW++mMiCNPS6dTmAm3sKA+lGlwi48JljzdV6KBChsUPjJ7tftrV9X1BMatp6aJG+wIMt6vdsuulS08Vv5LJgeJ6NaEcBCt1615bTzQ94j9KKpBzYRlZSvBWh9Msc0KLPwLsMomovCBUPPWtgGPZGXPCxoYOVHHe22uBY8QqrtcwFLUrlVeXv7mF/rM1+jxSW0D5GeU1+hoc9o3ddYtLy4GASwaRzPCdmXD0wlxmGXs2/j/T390gQEZactOlbscF//2B9vI0L3vWl8Um3mYxfPS+oP6vr/z/6pe6tBMXlFglFv3tJkz/CTnLfw91gisci48Ds1KpPPdDnP/bDKrLDi0ccmZ1AS9qRgB1SMZ87K6shg9Sp26jS0wGiuslQuw/09mpfx1G2txAvNWp+s8VfL23jloRIZLDaWlirRLK+mfk2whtt7pyN+1nC8EHuNg4OvABxV2F2ehbNj1kIF9iKk5nPeU X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: dff2ebf8-f514-48e1-b9df-08dc327ad476 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 01:17:11.3342 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v5LgyTOVv825kQghPkcnCtymbkdgi2WgvQTEqFJhv6pL8ulD/iTEOXT9wFWQB7k0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5714 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_171724_604030_C966AC84 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. 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 Now that the ARM64 arch implementation does the DGH as part of __iowrite64_copy() there is no reason to open code this in drivers. Signed-off-by: Jason Gunthorpe Reviewed-by: Jijie Shao --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index f1695c889d3a07..ff556c2b5bacb4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2068,8 +2068,6 @@ static void hns3_tx_push_bd(struct hns3_enet_ring *ring, int num) __iowrite64_copy(ring->tqp->mem_base, desc, (sizeof(struct hns3_desc) * HNS3_MAX_PUSH_BD_NUM) / HNS3_BYTES_PER_64BIT); - - io_stop_wc(); } static void hns3_tx_mem_doorbell(struct hns3_enet_ring *ring) @@ -2088,8 +2086,6 @@ static void hns3_tx_mem_doorbell(struct hns3_enet_ring *ring) u64_stats_update_begin(&ring->syncp); ring->stats.tx_mem_doorbell += ring->pending_buf; u64_stats_update_end(&ring->syncp); - - io_stop_wc(); } static void hns3_tx_doorbell(struct hns3_enet_ring *ring, int num, From patchwork Wed Feb 21 01:17:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13564828 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 B3222C48BC3 for ; Wed, 21 Feb 2024 01:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=kyOv+YTZOIom8LPjRnW/MgiN4Hpp2rwMOyyxw8rAQNI=; b=j50F0IYAInMqBZ BWATn4sARfYwVdABKKeQSj5KJ9pHI8enGBMgDuVDX58CzZJhX3grKU2SAMmj2sl9Wvhp1EZRdrneo q9hE8WusNEj3536l8Zn5mTnDTi6wviNAl/sizckX+deO9irVMwY7eajnZur+ROFv6S0rVJUqJQj5C aLb+RCQESVKWecpdadkQcuKjVbAqhD82XgdlRfCUVzsPl5sIYGO1bXia+WEApW2B/yYwlP5c16n9M EiXogg8HlzyexpQVbtxFFj92R4VgzCVudlk2CEe2JpoUmuQB00HiGWXeRbQQ3MKVgjmm1UYg+VHTK lfukMayoWzgfSY5MYYSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEl-0000000Giga-1ytz; Wed, 21 Feb 2024 01:17:27 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcbEi-0000000GidV-1ZBG for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 01:17:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iDB55eS+bouWFN+xyXFRhLARlZ4Fma8s3liDcpgHM+FZrfj3qP8EmjDsZeRZ8KzuuF3DEoAtgSn9aEHQL7rxTa8PvqYZgqDWX/YhGVleVakh9OOJP/uWpn6SUwRcpeNF9FX1NB7m+PHaQgggRbUcZRYJFmQ5UfCRPaaIQsk4/WXB22DnSFk797KUXgGClUqbZh0CwQgTC7QnYfEusYHtIgTbbbQGs0kmoxAYerUAsuAGGONTU9I6X1lXDR+/qlziK2FMRAif+U61aKNtpvsQfXoK5d1Nty8up6eM2nAkN4teJxW5xtNwLzexs9FpgCmHPoh8OSRqFygqUEQwtk06gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=mCBJ6dLMHu5mQWHFWQoqDEbAiF7nN/N1UtwVHyaeXCw=; b=XpCQx51J1YZGt4g2DQ0N8hW7RHp5UreK1PhtzcpHJCT4bMTpU8RRLJEMm06oc+KuHr+AN8AkzofH7MKIXoeGrukes63VCHLAWR2m1KXugLbfu/S9o7P2CJ93RY2bbYwfp2x1IgNJZ/BpNm3ZliX7C4K0+qHroaj+65SVOO9NqpeyN18Rs2VwP37YgTsVFheQEM1w42LzaxEiqINb2sFK8mnxDkSKnB0CfYrHJ1ceNmbAfpCMqmVbgwj0PNZEhVw/bfrjMYq0IHYG6XnW76Rm/OuhOUSZcmNRCmplm7Ep9n4lLOMo1qJdQTJxNAp4h8dAh1HKR10Q2qe44B+729X5iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mCBJ6dLMHu5mQWHFWQoqDEbAiF7nN/N1UtwVHyaeXCw=; b=HbZcq4o9kuGdg+hDYwdPbKTPnq4Zc8wBz0Y+ad4dRclXlvM8bF251R/wbZyAf8ouQ8lUva6hHe5s85ZFlENZPsJhUXXdHLXm13TmL1Agly2+i/32UH4FAd9Ot4j/8y2TIa2qjDwYPujdmktc0EU0w3aaBk0LfUF2OK5kWmtQbzq4tTJWwlfxDjThI1E0PPRWWbsESxAhnbbwxnfaq8TtPh7jB63x3c9ko/EnaS1cjI7v6eysimkVUbUKMS1Xeo+Hzx25hv5Sg595Bg9jkx/fOUn/mr9Oyr/obnCQQcIHZHAE2tihcS8oZkqA1OCqmfT7UuY+byv8VzrAnGNnD33IHw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN0PR12MB5714.namprd12.prod.outlook.com (2603:10b6:208:371::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Wed, 21 Feb 2024 01:17:13 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7316.018; Wed, 21 Feb 2024 01:17:13 +0000 From: Jason Gunthorpe To: Alexander Gordeev , Andrew Morton , Christian Borntraeger , Borislav Petkov , Dave Hansen , "David S. Miller" , Eric Dumazet , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Justin Stitt , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, llvm@lists.linux.dev, Ingo Molnar , Bill Wendling , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, Paolo Abeni , Salil Mehta , Jijie Shao , Sven Schnelle , Thomas Gleixner , x86@kernel.org, Yisen Zhuang Cc: Arnd Bergmann , Catalin Marinas , Leon Romanovsky , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , Michael Guralnik , patches@lists.linux.dev, Niklas Schnelle , Will Deacon Subject: [PATCH 6/6] IB/mlx5: Use __iowrite64_copy() for write combining stores Date: Tue, 20 Feb 2024 21:17:10 -0400 Message-ID: <6-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> In-Reply-To: <0-v1-38290193eace+5-mlx5_arm_wc_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR01CA0058.prod.exchangelabs.com (2603:10b6:208:23f::27) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|MN0PR12MB5714:EE_ X-MS-Office365-Filtering-Correlation-Id: 503a11ce-3472-4f39-23b3-08dc327ad479 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZUsP4uuZRvvTyQEjP7oHdxAB1tkCb7TpqlW2j4G5uZlzlbhe4Q4NaVIZ7HlVICFi9LCImyQiikFEOJLPq1hzGFCurb503Z2uRL07JcROZSsmWXOxpCnEoGXui2IAZrY6aspiTckhaywZ/I5AQ2uLgjURThmUxhzashoA+wBwX+wQvgl9fgnqMd2GNEYT723i2+DclRsyYoTiVZVubfRBl16EQ27TaAwu2UXLIw4oF7rD0HxYo/+5bFWGD4GsLvuKCxIA5RmNiSdg1l9BG3ULR93xngb/s69jHXMGtEYdGW7WHHrRtSIyypIzclKPkOtxojbWVLFLvnfdSoGHWCAtCwumu3rdwhc1aQTeGppfbl8y+WCSatLvHezRTPsBLUe9kOfQeHV/ahagNzQ9HBonzap3PmGO86QWXUe9mWhoPICK6+HRpPgQhNnSqRrEPwS+egknvQBCFwK+Th9IQYl6FpDtFsg3AUJaWrv9OiI6Z9JLSPobGSFbIsz6XScqtZ4yreook+czjbKj00GVMySOBJPsScVZghD0wU3Ud8D2UEEuVNEPtH/RA/EOhDk49pvxiWfV0vDDBzBW+a9cPgu9f72IhaMBS/8xMLP4ur4mcac= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vH3EaakA7dN2Nb9Ba3nth8A5rVVBLRhGUfmxVZy547Xt9fZHEwFhNxDNK6HRj4tYW+tfpJ2fLQnYVoQ3s7A54392a4kWLJYbN/yS/fukmB14hJnNamnJIzeRRu3thkfInLPm9bPnEyOlidJd1NH9CiHwtfcjW6m8Z0KIiGSuf/JrbWlViI4LyqqfEHz6rtcLWDsonF2QOgGZnkzkXkb3ZyE8e+lRrkrspENaDbEZ8ohl96EWIUIbqO5rIO0NW4or0Zj4kV3jcVh3tbatXEBLKsN9hrvsh/v+0GsORBiVe8lysH7fVHB9Jf/wOQpjdOq+J8q2dvyDwRQ+Rkt/liFy/tU3qH9nKQ+hUzd7etUMNqtvI9mctiOJyfltY188qQkp7dPnSZcIncpSkOJetUOeMsrkD+TvDASsFfjrufU+6En2yX2S5tj0T0ei4Cht9K4qJ5XP85x6fLDqAWqKFVpeyt6DYywBra3Z4SNPDQ6o1OCYJZDJl7xp/0Tf2go8WV7xmjq4XQNSkF5zvMDnvJ8TWcdYWcNSjLkqTElYmDhjSayJBp21LQBa40kWCI1vijGG70V3kxIfKAOACYNBCc1ikHqIAqQuo/Epo2DT2Hex/QIYBZZUvIwmv4kZuAA9FYbNSKnyCsB+kDcre5ywxBhOJpTX2V+4Qqx1hUT5ojbmi7xbplpRmV+RW8dcG3NKthxeSJoVFU3HzzW24hAKeu3Gh4F1V07qjjD2/E6DUQwmGyE4vTWVr1+XrWy3uNK1VUH7A8WhwnlWVaAjmxXdR4RwUyId/5ZWBjel7R6z/Z5hYABeSEQqje6CAkFAKrwOanTC378FuHXe54NhRK02OLJjXLlzRIu4OGAViP+lh/0j6vUfe7bRkoHCSCZAcB4gDBhz+8I2nF1j1vRj8Cezwi26eAV1VaLBDHPI7vchrSbWaQQn6GxC8CBqlYgEJO1vl/xE0khS2+gCUiN/cZ5UHVB4B2DFehDVToqTZIfRz+lShBy7HqL4MdVsAFvyMOw1dnq/72JL8ce69Bj9SCegtIZe5+LqIKcTQa8fbkt7v12yTVGDZZ5ZTthD5lvKgwpYlR+c195g3qhtwgbrUGPd6b43D0ZFKYZVEBIdd3SLhFpwsSrph+WnMRGEex/z02SqMqUlnV4s71bZB/frLHqs3pNoqxkiOgI1bfgRR/a3k9r5ww4rjncM3jLD6rWu5Tfwnd2A3NqfN0wCmlyB/GhHtf0iyd2Zfwh1eBYUYhkXPwQbfi9fqQCfcWWQDuJnQGC0oOIP65yJuDH/b8VEEh6+LG97sUv7FX1B2/W/LSZ0GecG7X/3LQnXbvLrAx9DxaBnbVE1Wn5NgmnqdjPlryVJ2KNSxmx3dh18IblpnLL7UgZLK/K9zEbYGcR13NEElFNIWVx8XXXQVv+sI2envwI0p/Hd3Gum601jNdxaOSyJ4HwWKBxwnooaA2n8yBd1jxjYoxbu7EQWoG5w53Q7rjlSfaVNxhPR9qMdrOSw4kFvV6HZ4eqUrI33trRH+SXsN6vqWnRUGnTxB4yqRq/OeuF6T9yFiaxPsnW1oy90bpkqO89Vy70U+Qj7GCSE4THN34l3uOS8 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 503a11ce-3472-4f39-23b3-08dc327ad479 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 01:17:11.3595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yvWSN6lmGu0W1uttJ3UWfg1mTQE9md1EXmngsOpBZVajtZBEe8Fe4AU4spOmCSOm X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5714 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_171724_436509_3A098F8C X-CRM114-Status: GOOD ( 16.05 ) 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 mlx5 has a built in self-test at driver startup to evaluate if the platform supports write combining to generate a 64 byte PCIe TLP or not. This has proven necessary because a lot of common scenarios end up with broken write combining (especially inside virtual machines) and there is other way to learn this information. This self test has been consistently failing on new ARM64 CPU designs (specifically with NVIDIA Grace's implementation of Neoverse V2). The C loop around writeq() generates some pretty terrible ARM64 assembly, but historically this has worked on a lot of existing ARM64 CPUs till now. We see it succeed about 1 time in 10,000 on the worst effected systems. The CPU architects speculate that the load instructions interspersed with the stores makes the WC buffers statistically flush too often and thus the generation of large TLPs becomes infrequent. This makes the boot up test unreliable in that it indicates no write-combining, however userspace would be fine since it uses a ST4 instruction. Further, S390 has similar issues where only the special zpci_memcpy_toio() will actually generate large TLPs, and the open coded loop does not trigger it at all. Fix both ARM64 and S390 by switching to __iowrite64_copy() which now provides architecture specific variants that have a high change of generating a large TLP with write combining. x86 continues to use a similar writeq loop in the generate __iowrite64_copy(). Fixes: 11f552e21755 ("IB/mlx5: Test write combining support") Tested-by: Niklas Schnelle Signed-off-by: Jason Gunthorpe --- drivers/infiniband/hw/mlx5/mem.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/mem.c b/drivers/infiniband/hw/mlx5/mem.c index 96ffbbaf0a73d1..5a22be14d958f2 100644 --- a/drivers/infiniband/hw/mlx5/mem.c +++ b/drivers/infiniband/hw/mlx5/mem.c @@ -30,6 +30,7 @@ * SOFTWARE. */ +#include #include #include "mlx5_ib.h" #include @@ -108,7 +109,6 @@ static int post_send_nop(struct mlx5_ib_dev *dev, struct ib_qp *ibqp, u64 wr_id, __be32 mmio_wqe[16] = {}; unsigned long flags; unsigned int idx; - int i; if (unlikely(dev->mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) return -EIO; @@ -148,10 +148,8 @@ static int post_send_nop(struct mlx5_ib_dev *dev, struct ib_qp *ibqp, u64 wr_id, * we hit doorbell */ wmb(); - for (i = 0; i < 8; i++) - mlx5_write64(&mmio_wqe[i * 2], - bf->bfreg->map + bf->offset + i * 8); - io_stop_wc(); + __iowrite64_copy(bf->bfreg->map + bf->offset, mmio_wqe, + sizeof(mmio_wqe) / 8); bf->offset ^= bf->buf_size;