Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1932565rdh; Tue, 26 Sep 2023 07:42:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+gCtuXk4Ynw+05gakThu9jo/pTVNhyPJVJKS6XQOuuLqJCHXihCL9ph7lyfyq46CjNnRW X-Received: by 2002:a05:6a00:230b:b0:690:2ad9:144b with SMTP id h11-20020a056a00230b00b006902ad9144bmr12098107pfh.12.1695739347645; Tue, 26 Sep 2023 07:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695739347; cv=none; d=google.com; s=arc-20160816; b=o16kjvh5fxvQmMYEKtjA+a/MnDfFB1qdsie+6iuLAlaxZSV3bFktCuFxpKMc4PR2yI +IA2JGhaWi6vwUJlnMRvHDyGREelBO8cwya2EgwDRfGQzVhPh6W38qzqWiJ9C19/f3UC KK6fBcHnnSKbTVWdrreZeyDldxSRv2Yezy25qD5fxes7PkkI0JizSb+e9jru8yusk8gt U5otjYAfe1MM29Bt45qtLh65p6SZOYNpu1nwS9xxK/nfBIiC4Sz0t5eRsPV7msyBAjpk wUmG8KlnOqREg+IbD/+ZNV2M2i+8qP9cYbshrq8ZVpZtk6QwGvd+c+fs25n/OFGroiwb 3+7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=iwEcE7AWNgHHzXJTfIfYL/wmI7nYQq4fnQekbWWVQqY=; fh=CmbLQMLhJ4m/wheaE9zjp8PV3iQNdbnp6NuPXCitHCY=; b=wBGdOWIkrESsUUQYLUmtfyLecv1jmoOYnapnnq/U66idP1lhUVEtwzOFtUo35Uhs2+ IfiGuqmG4Ru8ZvDNGCIHFK7jRPVbq9EhPbU6GxPtVd1Q+XOGg8O25e4XUR3ZypZs0T0V t0ig7bG/LmBCbVjBp38fNxkmAi95kPBjo0ZkUh+bpsXPk8obOa1I2HxAC1W8OMz6TAge TXXwIAt4swhillq2wu4YEUWQmjXrT5g0iYLWtLeRbBYcq2bG5tGUpo+DdXcLGKpscD12 Ra6pHpr8t1y/FptNA+vAM6iF10YvceTELcBbfoQ9qmJEecJS7Zi9j+iK0TWLzz8Zkqwg /fcQ== 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:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y18-20020a056a00181200b00690a75a318asi13956404pfa.67.2023.09.26.07.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6201982A41C4; Tue, 26 Sep 2023 07:38:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234659AbjIZOir (ORCPT + 99 others); Tue, 26 Sep 2023 10:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234417AbjIZOip (ORCPT ); Tue, 26 Sep 2023 10:38:45 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E01CFE6; Tue, 26 Sep 2023 07:38:38 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 79E101FB; Tue, 26 Sep 2023 07:39:16 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 36D223F5A1; Tue, 26 Sep 2023 07:38:37 -0700 (PDT) Message-ID: <06d476e5-ba85-1504-d69b-a8c1cf617d54@arm.com> Date: Tue, 26 Sep 2023 15:38:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] MA-21654 Use dma_alloc_pages in vb2_dma_sg_alloc_compacted Content-Language: en-GB To: Christoph Hellwig Cc: 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 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> <20230926094616.GA14877@lst.de> From: Robin Murphy In-Reply-To: <20230926094616.GA14877@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 07:38:44 -0700 (PDT) On 26/09/2023 10:46 am, Christoph Hellwig wrote: > 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. Sure, that could work equally well, and might even help make its existing usage a bit clearer. Cheers, Robin.