Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3960505pxu; Wed, 9 Dec 2020 05:10:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeJusrrWEXr9topA2Q6TcF0yL55zyhWVICLqOYynaI7axaRYETmvk6m8jGScV/G/AzrkSc X-Received: by 2002:a17:906:b79a:: with SMTP id dt26mr1911050ejb.337.1607519453556; Wed, 09 Dec 2020 05:10:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607519453; cv=none; d=google.com; s=arc-20160816; b=y55bWrGP68cj5wTUo3ItpYAb1puGgNflMD/dAHgHOYjREma85TcFmK9o4ExXM95kMx cBdIU2y2gBLvnRLS3oCCCudnFrrIq2sLGtVa01qfdeNpSQ3J9ZgnZtvGgIGC+ApmVSze ucHk+BXtiwOUIa/6Er/hZIPd2A5lmmubY36MDQ0iSWIedauhLAr4eA/OkDtdhBCq6WKa +0K0dNzbL9VH6ev1eVwuY5uE23GD00Y2wWgIVcBPy0az6kPvhOkjT0e0/RIm4zJgrhiT 58ymUOa1cTMlAsFkUxf2edQRGzxSZlbvsve8u92w0ykx19+uiEtu0GT2R6BmOy85yRs9 sODA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=6l8IBi8++I/uWh2BonXhxTzgf3Kdpdlh3SxQ4MuLQqY=; b=w1z25Mjz+Rs/cGMVn9aC1VEHR7QyzSYFCSFPB9RvkPsO9lOnkevbcNzbVmUrlJ95J+ cLAiVffHsj6lyiUCGMyzfBPDmDyOXq271APpMcEXd1MMXrgH85CkN0+p6gKXWXBPClc1 D2EISay5jRfzrM2jICvPP8dCd5knI3EjKjcms7ApnWuQyKWTso5VWErkMHNHq/uDx4kH 8jb8RQ9be31GiNtGECbmVOGhp6AMRqrKx5YN7P/4Hqk6b8SMpinIqWYB5oEOrqz3NOw6 WRqXsFTWK4PYVP9SQsB/4ZctdyzYAzEG9moN8odueB/Q/3IPB5rw1Mm94slbuj07TyPb KSPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si821503eda.177.2020.12.09.05.10.31; Wed, 09 Dec 2020 05:10:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732168AbgLINHq (ORCPT + 99 others); Wed, 9 Dec 2020 08:07:46 -0500 Received: from foss.arm.com ([217.140.110.172]:34310 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732116AbgLINGH (ORCPT ); Wed, 9 Dec 2020 08:06:07 -0500 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 9D4AC31B; Wed, 9 Dec 2020 05:05:16 -0800 (PST) Received: from [10.57.61.6] (unknown [10.57.61.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB3F73F66B; Wed, 9 Dec 2020 05:05:14 -0800 (PST) Subject: Re: [PATCH v3 5/6] media: uvcvideo: Use dma_alloc_noncontiguos API To: Christoph Hellwig , Tomasz Figa Cc: Sergey Senozhatsky , Ricardo Ribalda , Marek Szyprowski , Mauro Carvalho Chehab , IOMMU DRIVERS , Joerg Roedel , Linux Doc Mailing List , Linux Kernel Mailing List , Linux Media Mailing List , Sergey Senozhatsky References: <20201125221917.150463-1-ribalda@chromium.org> <20201130083410.GD32234@lst.de> <20201201033658.GE3723071@google.com> <20201201144916.GA14682@lst.de> <20201209111235.GA22806@lst.de> From: Robin Murphy Message-ID: <6b34596d-34c4-bd99-c5a7-5a4742c5b886@arm.com> Date: Wed, 9 Dec 2020 13:05:11 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20201209111235.GA22806@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-12-09 11:12, Christoph Hellwig wrote: > On Tue, Dec 08, 2020 at 01:54:00PM +0900, Tomasz Figa wrote: >> >From the media perspective, it would be good to have the vmap >> optional, similarly to the DMA_ATTR_NO_KERNEL_MAPPING attribute for >> coherent allocations. Actually, in the media drivers, the need to have >> a kernel mapping of the DMA buffers corresponds to a minority of the >> drivers. Most of them only need to map them to the userspace. >> >> Nevertheless, that minority actually happens to be quite widely used, >> e.g. the uvcvideo driver, so we can't go to the other extreme and just >> drop the vmap at all. > > My main problem is that the DMA_ATTR_NO_KERNEL_MAPPING makes a mess > of an API. I'd much rather have low-level API that returns the > discontiguous allocations and another one that vmaps them rather > than starting to overload arguments like in dma_alloc_attrs with > DMA_ATTR_NO_KERNEL_MAPPING. Agreed - if iommu-dma's dma_alloc_coherent() ends up as little more than a thin wrapper around those two functions I think that would be a good sign. It also seems like it might be a good idea for this API to use scatterlists rather than page arrays as it's fundamental format, to help reduce impedance with dma-buf - if we can end up with a wider redesign that also gets rid of dma_get_sgtable(), all the better! Robin.