Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1765612rdh; Tue, 26 Sep 2023 02:59:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHDc3mHfs2ZQMawPYVIabHKunFcQor7M9crBhxjbWvH1t1mGf1YCgrcjJqVP2BKNf8rEet X-Received: by 2002:a1f:e182:0:b0:493:5363:d1dc with SMTP id y124-20020a1fe182000000b004935363d1dcmr5125662vkg.12.1695722384244; Tue, 26 Sep 2023 02:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695722384; cv=none; d=google.com; s=arc-20160816; b=CVRJs9Uzyh69ijZpX6eN3nA3Kyq6Wbb1GBXwNvHPu27xWTwruzb4CpHygV4vyUrn7G S2gLuAcJBxrgJJ5eYsVEdSO4Il1cKNoaqTFyAFpQtwGKQkGs0eB31spjeqV+NRMrUxPV kLT4G4B/EcMYNPZ5313tL589RlCWA1AQYb1Pr7aNwYiiTuAmtEkzrW54MIsDxdICU/ny edOUDTCU3aWMus1s84mHTczorMJTCFoMGTEWi4XmmmLdvT3gFwpRBCBDAJZrqA9l33Zi n33cYVkemPdtXwbz6N5px48YUhWNC/YDwjaQM+Ab8nFlmF3BQirG1ZOiVWvMGoPl7EYC ddvw== 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=RS8AP2+tHcGVBC2RWkvYhiLLyj7jsDNHzt6G+Lx8mpQ=; fh=hm3kZSUnoE1jYM5NMYFvegi2Z6+EkNyUKk3CbmHsmYk=; b=fUT96ozHHE2OMZTO40Dt6k87kpnPiSZJoIqLyS9P1szbjmiZ/1eQnQ/DOk6/AwutgK 37o5p3TmQ9HtcOY36kFwgnOHiBtPW/yMeHwJzPNafHxbwz5HDwq7w5Z3i1/A7TjDPJGc 5YAEJ8nDOE0Fn9gjAh22MpNVLxWXRrr/6eOq+/xOldyZbdGRc0c6HEOhXrQBiy8vL4E1 u3C4VT148olY8NdznqswduuBjtA/v673vUJDaJIOFmtWNG1kP5TTTe4gYTzEImOSnCS9 BIQephZNmovdbs/XNKYEbc5jAxn5W6OuB58IXo+HoHP9CR7UHZFFMHW5tTbSf5/N0kVH Pq6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m9-20020a654389000000b0056569ee3ae6si12038210pgp.798.2023.09.26.02.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:59:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 09FCC80D6AFC; Tue, 26 Sep 2023 02:46:35 -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 S234294AbjIZJqe (ORCPT + 99 others); Tue, 26 Sep 2023 05:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234114AbjIZJqc (ORCPT ); Tue, 26 Sep 2023 05:46:32 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91CF0B3; Tue, 26 Sep 2023 02:46:22 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 45ECF68D05; Tue, 26 Sep 2023 11:46:17 +0200 (CEST) Date: Tue, 26 Sep 2023 11:46:16 +0200 From: Christoph Hellwig To: Robin Murphy Cc: Christoph Hellwig , Tomasz Figa , Fang Hui , m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, anle.pan@nxp.com, xuegang.liu@nxp.com Subject: Re: [PATCH] MA-21654 Use dma_alloc_pages in vb2_dma_sg_alloc_compacted Message-ID: <20230926094616.GA14877@lst.de> References: <20230914145812.12851-1-hui.fang@nxp.com> <353919fd-932e-5d81-6ac5-7b51117366cd@arm.com> <20230926065143.GB5606@lst.de> <4d0f3de5-1d34-d998-cb55-7ce7bfaf3f49@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d0f3de5-1d34-d998-cb55-7ce7bfaf3f49@arm.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]); Tue, 26 Sep 2023 02:46:35 -0700 (PDT) On Tue, Sep 26, 2023 at 09:21:15AM +0100, Robin Murphy wrote: > On 2023-09-26 07:51, Christoph Hellwig wrote: >> On Wed, Sep 20, 2023 at 05:54:26PM +0100, Robin Murphy wrote: >>> As I mentioned before, I think it might make the most sense to make the >>> whole thing into a "proper" dma_alloc_sgtable() function, which can then be >>> used with dma_sync_sgtable_*() as dma_alloc_pages() is used with >>> dma_sync_single_*() (and then dma_alloc_noncontiguous() clearly falls as >>> the special in-between case). >> >> Why not just use dma_alloc_noncontiguous if the caller wants an sgtable >> anyway? > > Because we don't need the restriction of the allocation being > DMA-contiguous (and thus having to fall back to physically-contiguous in > the absence of an IOMMU). That's what vb2_dma_contig already does, whereas > IIUC vb2_dma_sg is for devices which can handle genuine scatter-gather DMA > (and so are less likely to have an IOMMU, and more likely to need the best > shot at piecing together large allocations). Let's just extent dma_alloc_noncontiguous with a max_dma_segments parameter instead of adding yet another API.