Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3341867rdb; Tue, 29 Aug 2023 12:14:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaS6TuAaPa8T0zbu3m59up1OPUthn9whAHpV7/i9wOqpnCOIQIyVtGJCjg3r59UZHcLAvk X-Received: by 2002:a2e:9b55:0:b0:2b9:ecab:d924 with SMTP id o21-20020a2e9b55000000b002b9ecabd924mr186602ljj.18.1693336469745; Tue, 29 Aug 2023 12:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693336469; cv=none; d=google.com; s=arc-20160816; b=uXzOFczOO3pm/K1Ths919cYO5EGY81L83NuYSjERQUmYJ2dVBURHQXIDq6uc7Djry/ Y0K+v4oK1J6TNvAGDZOHnWYMJOXyC6bTQZQnz5nvH0lEC8KMgwbGevNfwC5OUZL0TWGg cMoPCMYZifKO9e5QIW14cZd2eVz+usygp19NhCnX46YyiAtaO4TOlzTg1w0ax5myRF81 k/QQdjkwDgxZnzNLx7sX56XM8ZQE4MpmngRt/Hsh8DgLWe1w4junLW3RFkEnzSzCejIP WtNfWA/humXfDzx2+SmEp7CzuVTICDC5epYLqmx7kOf4okRRZXep8TWwonAFP/jf1nId WJ8A== 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=zrvV1kbxDOMpAt3YLb+zAaQnpHIGXowRRKHNTDbfWu8=; fh=JIPXQIkW5p1TmEjQTzYT/zunBf4+vx4A0evr3+GzW/U=; b=G5zUNPpn4ZYu8tmIWMq5U9UDqFo5KRdqj6xG4hX7HQ5SULBELQ0MTsUmBUQ4yVL/RV RAuPAptiU6WiPLFnWQ5Gnaf/nQnGRQ0fZn/ZUMT15hwVfGFX8y799czwO0COFvdozC8D u8eKZFJj8MQJw2/bhy1al0w+IfDFHiWozniA9PisKt/dCmO+8LKURsj4mOpw4DCkHZkX xSBkPa0HQ8YHB+XQfhb5ZBHh03DyKDqPh70NhuQ7CCskU7DKloKcYyN6tSzmmIippm7h a19PAtSNIyheOPd6W9kEtLXv4oXXexWib0Sspu7sJyjMb7hy2T/IoWE/YB6207YtgIbQ ttbw== ARC-Authentication-Results: i=1; mx.google.com; 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 r22-20020a170906365600b009a2154511ebsi4290829ejb.147.2023.08.29.12.13.57; Tue, 29 Aug 2023 12:14:29 -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; 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 S237045AbjH2PEx (ORCPT + 99 others); Tue, 29 Aug 2023 11:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237174AbjH2PEt (ORCPT ); Tue, 29 Aug 2023 11:04:49 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 200BEC9; Tue, 29 Aug 2023 08:04:47 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id C41C46732D; Tue, 29 Aug 2023 17:04:42 +0200 (CEST) Date: Tue, 29 Aug 2023 17:04:42 +0200 From: Christoph Hellwig To: Robin Murphy Cc: Tomasz Figa , Anle Pan , Christoph Hellwig , m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hui.fang@nxp.com Subject: Re: [PATCH] media: videobuf2-dma-sg: limit the sg segment size Message-ID: <20230829150442.GA3929@lst.de> References: <20230828075420.2009568-1-anle.pan@nxp.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) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 On Tue, Aug 29, 2023 at 12:14:44PM +0100, Robin Murphy wrote: > dma_get_max_seg_size() represents a capability of the device itself, namely > the largest contiguous range it can be programmed to access in a single DMA > descriptor/register/whatever. Yes. In a way it's a bit odd that it ended up in a field in struct device, as the feature might actually be different for different DMA engines or features in a device. If I was to redesign it from scratch I'd just pass it to dma_map_sg. >> Generally looking at videobuf2-dma-sg, I feel like we would benefit >> from some kind of dma_alloc_table_from_pages() that simply takes the >> struct dev pointer and does everything necessary. > > Possibly; this code already looks lifted from drm_prime_pages_to_sg(), and > if it's needed here then presumably vb2_dma_sg_get_userptr() also needs it, > at the very least. Yes, there's tons of them. But I'd feel really bad adding even more struct scatterlist based APIs given how bad of a data structure that is.