Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1032110rda; Sun, 22 Oct 2023 23:16:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvMn6u+hqFvft1grR3PuwqjPXrnPkqQj9apZSDzbwknrjrQsg2wyxdm5IrpHoaYCOQcr9i X-Received: by 2002:a05:6a00:9381:b0:6b3:aded:7e9a with SMTP id ka1-20020a056a00938100b006b3aded7e9amr6430773pfb.27.1698041807299; Sun, 22 Oct 2023 23:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698041807; cv=none; d=google.com; s=arc-20160816; b=oXBsd39FQshLMkoP3piLXzI7NXPewNGYkVChtPcyUdiZ1HDjq90MLUZI+eYoYnR41N 1duMlkjcR1kOOsbaTmN/hEqkHE4BXcAWEMn8FBPJWBQDA4MWe+IitmDIN0rYwi+buT5o vAvkhu9PM2DpDIIdccmJgvlSmukYauRo4uY2StBlA5kjE4mb9ojYQmGOnOzGsX2ZVyTu 6UdwAo2GJ8Y0Ru/iHcZjmvOYhPp1EE0JI0/sm1Txf9kRCNv++k3ve2K9hwR6TGmJRS7h 48Y51NB2VrsO9xlPPRJlgOhsT41BAM6imzXpgpUf0TM/Wyj1dHgvabO9+dwzhve73+B2 zg4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BoVg24xlcncpByAkfB7zfz/kN4dfgNAGqCDbem5xQPU=; fh=odJsHxOwq6WubGqEGxb9u2el/P2jg3swoDotiDHDvB8=; b=iSfufN9HLruBsgumKv7UKD0L7Z5kCYlitRAS47I/0T9w1EevkDWn5One0est30Appr eHEPtw7pT+xWPwkWI4u+xzjP1Rrv1CThNfdUU6BAmUci5gBN3yBwdlDy60yE1YJL4lPg VkMhJw2+hMszD3XIljG1avA/SG6NB2UWGzWV4FFDEQR6nupiHXD+D/B89bccsu7Sp5Rv Wyf2NhZze6WbRy6968ZVmeOjmEgyVUItnGSr0gwrnB74we+DOqb3Nd5qW2rR000czBbj HoR/xs6SokDg5OMnuYQUydKes4CLchIAzdNcUWQEKYLD/KcRTo4GWz0M1Hu86tKqgUeQ vm9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id j1-20020a056a00130100b006bc2cf9872fsi5927372pfu.317.2023.10.22.23.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 23:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 48248806821B; Sun, 22 Oct 2023 23:16:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233258AbjJWGQM (ORCPT + 99 others); Mon, 23 Oct 2023 02:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjJWGQL (ORCPT ); Mon, 23 Oct 2023 02:16:11 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7EA3E8 for ; Sun, 22 Oct 2023 23:16:09 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id DB32968AA6; Mon, 23 Oct 2023 08:16:01 +0200 (CEST) Date: Mon, 23 Oct 2023 08:16:01 +0200 From: Christoph Hellwig To: Marek Szyprowski Cc: Christoph Hellwig , Jim Quinlan , Linus Walleij , 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: <20231023061601.GA12056@lst.de> References: <20230926175208.9298-1-james.quinlan@broadcom.com> <20230926175208.9298-2-james.quinlan@broadcom.com> <20231002061628.GC911@lst.de> <20231006074045.GA15303@lst.de> <3515448c-8a4b-4669-9f80-2f55c5100674@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3515448c-8a4b-4669-9f80-2f55c5100674@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 22 Oct 2023 23:16:44 -0700 (PDT) On Fri, Oct 20, 2023 at 10:16:46AM +0200, Marek Szyprowski wrote: > For historical reasons (performance and limitations of the pre-ARM v7 > cores), on the 32bit ARM the whole kernel's direct mapping is done using > so called 'sections' (1MiB size afair). Those sections are created in > the per-process MMU page tables (there are no separate MMU table for the > kernel mappings), so altering those mappings requires updating bits in > all processes in the system. Practically this means that those mappings > has to be static once created during boot time. That's actually the same on many architetures, and matches the explanation I heard from Russell before. > That's why when no CMA > is selected, the whole dma_alloc_coherent() allocations are limited to > rather small region, which is already remapped as non-cached during boot. But this does not match my understanding of the code: - arch_dma_alloc calls __dma_alloc with is_coherent set to false - __dma_alloc then selects cma_allocator if CMA is supported for the device / allocation, else remap_allocator if the allocation is allowed to block and only if blocking is not allowed pool_allocator to allocate from the boot-time pool This very match matches the dma-direct flow with DMA_DIRECT_REMAP selected. The major exception is the direct mapping of the CMA allocations done by arm32.