From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E77EE7849A for ; Mon, 2 Oct 2023 06:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbjJBGQi (ORCPT ); Mon, 2 Oct 2023 02:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235487AbjJBGQf (ORCPT ); Mon, 2 Oct 2023 02:16:35 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C416A7 for ; Sun, 1 Oct 2023 23:16:33 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 6614368D07; Mon, 2 Oct 2023 08:16:28 +0200 (CEST) Date: Mon, 2 Oct 2023 08:16:28 +0200 From: Christoph Hellwig To: Linus Walleij Cc: Jim Quinlan , Christoph Hellwig , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, Russell King , Arnd Bergmann , Geert Uytterhoeven , "Russell King (Oracle)" , Andrew Morton , Jonathan Corbet , Thomas Gleixner , Sebastian Reichel , "Mike Rapoport (IBM)" , Eric DeVolder , Nathan Chancellor , "Kirill A. Shutemov" , Christophe Leroy , "moderated list:ARM PORT" , open list Subject: Re: [PATCH v1 1/1] ARM: Select DMA_DIRECT_REMAP to fix restricted DMA Message-ID: <20231002061628.GC911@lst.de> References: <20230926175208.9298-1-james.quinlan@broadcom.com> <20230926175208.9298-2-james.quinlan@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 28, 2023 at 01:10:27AM +0200, Linus Walleij wrote: > (...) > > + select DMA_DIRECT_REMAP > > Christoph invented that symbol so he can certainly > explain what is missing to use this on ARM. > > This looks weird to me, because: > > git grep atomic_pool_init > arch/arm/mm/dma-mapping.c:static int __init atomic_pool_init(void) > kernel/dma/pool.c:static int __init dma_atomic_pool_init(void) > > Now you have two atomic DMA pools in the kernel, > and a lot more than that is duplicated. I'm amazed that it > compiles at all. > > Clearly if you want to do this, surely the ARM-specific > arch/arm/mm/dma-mapping.c and arch/arm/mm/dma-mapping-nommu.c > needs to be removed at the same time? > > However I don't think it's that simple, because Christoph would surely > had done this a long time ago if it was that simple. Yes, DMA_DIRECT_REMAP should only be used for platforms using the generic generic remap that plus straight into dma-direct and bypasses arch_dma_alloc. ARM first needs support to directly set the uncached/wc bits on the direct mapping for CMA, which should be fairly simple but require wide spread testing. I'd be happy to work with anyone who wants to look into this.