Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1044614rwl; Fri, 31 Mar 2023 06:06:36 -0700 (PDT) X-Google-Smtp-Source: AKy350YHbk9FR7ZlkzAak7myOOlOtX75dtgwQzJd+dJR4lGDdAENJF9gJN79wzijUC1yjjJEELrn X-Received: by 2002:a17:906:14e:b0:947:bff2:1c2d with SMTP id 14-20020a170906014e00b00947bff21c2dmr1166344ejh.3.1680267996149; Fri, 31 Mar 2023 06:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680267996; cv=none; d=google.com; s=arc-20160816; b=MnvbIR4gvupYsxTF466NPga2YBvkuxtJOoigG7/LAHhgiic/wJwn/kpbJB9aMuwSNX tJWmgj983nxnqhxxo2KWyQ06v6n3wXYxvC+TzGZRUqLs/DfzszqxpLp6AZVRCkB/BxCy sN2DTg78scUhWDAJkugeGgyKgpuxD/r03UwMv5GkKwLXuVwQMtMAiz7fmrkJgMYRA9uT nh3wL8j++jhDY1JnqbuWNEn+TexLRidyGukbWmyL1ZTJT//PzYWnihGQWEnt+jiuMTF9 VYddcH/RPkaCDJWPzQ3SZsYBgBDIS1uiRJxKKHzVyuospe3nT7Lp2VV+lclLJjUwzMlz o+gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=Yf6BPXqc5+4lmQ5wl2xtIuAGvUiY5BeudyAFy0EZ0G8=; b=tik93+7ZqvcNDevOZy5erubQIX5ZIxgm9FWkwLf5Ny12t+esRS7rq/drpNIE5FSB4X DTlDRJKA2BG0Nx0boSwNAKnRMG0KJzE5pXSL5dL/N/4Q/FBsSR0J76ts5aE4L29gU8BF uChLOQZAgUpkqMJ1tDPhRvDbLStaAAeF/uxBb9+whrXKm6yNT9ApWuXmZ4xY3Uxen7rM eUw4zDQetAI4AD45F3M7S5RTcT/CWlwVS34RZjv/2bCz003FJavWT6JSHoL6ucpCsruT 9lqJl4rlgScbLSvlBct1ZshEP09BKVSiawvtaxFYJQD3OayC7AUOAYOJmQuhaNxM101X kTJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=uZNEHaxz; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=KUzHmHuP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s20-20020a1709064d9400b0093ec7db2010si1830970eju.665.2023.03.31.06.06.07; Fri, 31 Mar 2023 06:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=uZNEHaxz; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=KUzHmHuP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbjCaNEv (ORCPT + 99 others); Fri, 31 Mar 2023 09:04:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232701AbjCaNEr (ORCPT ); Fri, 31 Mar 2023 09:04:47 -0400 Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3815B9D; Fri, 31 Mar 2023 06:04:46 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id BE5C8582670; Fri, 31 Mar 2023 09:04:45 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Fri, 31 Mar 2023 09:04:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1680267885; x=1680275085; bh=Yf 6BPXqc5+4lmQ5wl2xtIuAGvUiY5BeudyAFy0EZ0G8=; b=uZNEHaxzYCVqJlOAFe QyTGIrtKOzaG3cycJ6z13gjgQTZlhniIOf1HqwjYjO+LKgEQjawzudKts8yI8F6C s8uj/7ZqVN8UGH5ZgZFIXMyd5b75HqrmeNrZ8vsEJBVSpi2J3ZWlL4UkN8mHXtQA GGAWo9PRgMqmoTCuDthWrNh+w6KhXBpQbLLxMJMKAnJljfVDgqgBdZYQ1YQkl+H6 LZF9xoMeCYQEcBMHzHxAdJ1E4ywnG504K4JuUFuXrw0flCzwupmtajEoLwVwD19b WT1JJ6Nt4Zmjo8gqjmpMMSo4dacmgE9f6vIbQ+V6NrcMdQ2gozhdVyKm6v87HBEM ZV+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680267885; x=1680275085; bh=Yf6BPXqc5+4lm Q5wl2xtIuAGvUiY5BeudyAFy0EZ0G8=; b=KUzHmHuPZ/ods4YSgTzEfYrM3rPW4 wY1sW3YIixU8cPi3ERC0CqbsRY1SanLUJ0aZrBgOR4qWoyaz63HiFfoH3UAybnQT l28FyLxSxhC8yvKK0U29T5xndO1MnAOFIprhP3Ccq4nl8DZqPNjxy1R1RtNY8tPM 10Qj7i/N0QTRDJZBhjBFHWgb2R8ePLqUj5cPixNs1c/I5cS8MzaXIOWn+kPofhss o5aXvgsWtBzOhKzG5Xt8hpy17hyFm2BD/GRH9jCAvBdUli4r8v/AMdn17Lkc1Dnf 2N0OT3xREpdvfAtCeC38I5tHCQLbXD8KwEF4WisGqz7N4lPVjlEATH8EA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeiuddgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6B754B6008D; Fri, 31 Mar 2023 09:04:43 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-238-g746678b8b6-fm-20230329.001-g746678b8 Mime-Version: 1.0 Message-Id: In-Reply-To: <20230327222514.GA17904@lst.de> References: <20230327121317.4081816-1-arnd@kernel.org> <20230327121317.4081816-22-arnd@kernel.org> <20230327222514.GA17904@lst.de> Date: Fri, 31 Mar 2023 15:04:23 +0200 From: "Arnd Bergmann" To: "Christoph Hellwig" , "Arnd Bergmann" Cc: linux-kernel@vger.kernel.org, "Vineet Gupta" , "Russell King" , "Neil Armstrong" , "Linus Walleij" , "Catalin Marinas" , "Will Deacon" , guoren , "Brian Cain" , "Geert Uytterhoeven" , "Michal Simek" , "Thomas Bogendoerfer" , "Dinh Nguyen" , "Stafford Horne" , "Helge Deller" , "Michael Ellerman" , "Christophe Leroy" , "Paul Walmsley" , "Palmer Dabbelt" , "Rich Felker" , "John Paul Adrian Glaubitz" , "David S . Miller" , "Max Filippov" , "Robin Murphy" , "Lad, Prabhakar" , "Conor.Dooley" , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, "linux-oxnas@groups.io" , "linux-csky@vger.kernel.org" , linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, "linux-openrisc@vger.kernel.org" , linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org Subject: Re: [PATCH 21/21] dma-mapping: replace custom code with generic implementation Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 28, 2023, at 00:25, Christoph Hellwig wrote: >> +static inline void arch_dma_cache_wback(phys_addr_t paddr, size_t size) >> { >> + dma_cache_wback(paddr, size); >> +} >> >> +static inline void arch_dma_cache_inv(phys_addr_t paddr, size_t size) >> +{ >> + dma_cache_inv(paddr, size); >> } > >> +static inline void arch_dma_cache_wback_inv(phys_addr_t paddr, size_t size) >> { >> + dma_cache_wback_inv(paddr, size); >> +} > > There are the only calls for the three functions for each of the > involved functions. So I'd rather rename the low-level symbols > (and drop the pointless exports for two of them) rather than adding > these wrapppers. > > The same is probably true for many other architectures. Ok, done that now. >> +static inline bool arch_sync_dma_clean_before_fromdevice(void) >> +{ >> + return false; >> +} >> >> +static inline bool arch_sync_dma_cpu_needs_post_dma_flush(void) >> +{ >> + return true; >> } > > Is there a way to cut down on this boilerplate code by just having > sane default, and Kconfig options to override them if they are not > runtime decisions? I've changed arch_sync_dma_clean_before_fromdevice() to a Kconfig symbol now, as this is never a runtime decision. For arch_sync_dma_cpu_needs_post_dma_flush(), I have this version now in common code, which lets mips and arm have their own logic and has the same effect elsewhere: +#ifndef arch_sync_dma_cpu_needs_post_dma_flush +static inline bool arch_sync_dma_cpu_needs_post_dma_flush(void) +{ + return IS_ENABLED(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU); +} +#endif >> +#include > > I can't really say I like the #include version here despite your > rationale in the commit log. I can probably live with it if you > think it is absolutely worth it, but I'm really not in favor of it. > >> +config ARCH_DMA_MARK_DCACHE_CLEAN >> + def_bool y > > What do we need this symbol for? Unless I'm missing something it is > always enable for arm32, and only used in arm32 code. This was left over from an earlier draft and accidentally duplicates the thing that I have in the Arm version for the existing ARCH_HAS_DMA_MARK_CLEAN. I dropped this one and the generic copy of the arch_dma_mark_dcache_clean() function now, but still need to revisit the arm version, as it sounds like it has slightly different semantics from the ia64 version. Arnd