Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2812898imu; Thu, 29 Nov 2018 10:36:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/UVv08KMRaDcSX0ShgIPgC8ZHzGxFAMBNIQTYj1bM70Qw0glsLsctGplbrludZu4Wm++jPe X-Received: by 2002:a62:7796:: with SMTP id s144mr2473151pfc.26.1543516607481; Thu, 29 Nov 2018 10:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543516607; cv=none; d=google.com; s=arc-20160816; b=zAf3/emXLZYMLEUjodc48DOOvoR3ad3moe5Jgm9H5cx2zs1yrh7PXv//rPqPUQghJF xNw8bdxKJoFrX8xaDB2M4vu3cRrYu5Ij9c3fH6n2PuPs+8F1R+zagFlbGwQFf8+Qh50g My7Oc/GTuX0Iql7xWVkIzDGldwW3nlNSmmedcCw+xTE6v8/C4jdPa6pYWXchF0ZejLyr ulrnM98a8bVG1Z5qv25GhekK0R4jWhKpHdb096FW8y30RyxPkPTDwOIBt2DebRGBx2HH nxKUjmohzaiBoz09+qn8xygZXyOO+Fke5/TOcwo7N1mJ+mxB4Gfeg+D0Lo6VjfZD5blP hJfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date; bh=gJGrVhTWhR38VNIFL/VOWJbJ0+7KGjwTlLR2JNTqF8M=; b=yLxtW3p6OPxfi5eM9cS1nZRuBt6egO2l16GcpUMa/DEs+USOdWjUZ+DMwzcfuecXVb S9Le32gXl2HhOv6fwm03zE+Uc1PCiwLj+poBvqRkzHC/wB6zLqwHu+zoCqa/DS1rj3r1 8MuKSccMVcdJK26iaYiUQUDqFPydx4E520P59kCGyR0gbxjKsZ3+6gJG+fJ06rFziLNx afLfuahOXiUahdG/R/gWDsIxqU4Bo5XNdKRwloOHwQyF0fSsguuy1agUrsEHVKql6pFn XlvdFK+yKcEf00tgGmMm/4xIlvmnn1NF/ld85yebXGjKve2ssy3T4SyTbDWD/PrhPWCV dbNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si2674409plz.427.2018.11.29.10.36.31; Thu, 29 Nov 2018 10:36:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730201AbeK3EDS (ORCPT + 99 others); Thu, 29 Nov 2018 23:03:18 -0500 Received: from verein.lst.de ([213.95.11.211]:44682 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729818AbeK3EDS (ORCPT ); Thu, 29 Nov 2018 23:03:18 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id 3133B68B02; Thu, 29 Nov 2018 17:57:15 +0100 (CET) Date: Thu, 29 Nov 2018 17:57:15 +0100 From: Christoph Hellwig To: Christoph Hellwig , "Clark, Rob" , Dave Airlie , linux-arm-msm , Linux Kernel Mailing List , dri-devel , Tomasz Figa , Sean Paul , vivek.gautam@codeaurora.org, freedreno , Robin Murphy Subject: Re: [PATCH v3 1/1] drm: msm: Replace dma_map_sg with dma_sync_sg* Message-ID: <20181129165715.GA27786@lst.de> References: <20181129140315.28476-1-vivek.gautam@codeaurora.org> <20181129141429.GA22638@lst.de> <20181129155758.GC26537@lst.de> <20181129162807.GL21184@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181129162807.GL21184@phenom.ffwll.local> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 05:28:07PM +0100, Daniel Vetter wrote: > Just spend a bit of time reading through the implementations already > merged. Is the struct device *dev parameter actually needed anywhere? > dma-api definitely needs it, because we need that to pick the right iommu. > But for cache management from what I've seen the target device doesn't > matter, all the target specific stuff will be handled by the iommu. It looks like only mips every uses the dev argument, and even there the function it passes dev to ignores it. So it could probably be removed. > > Dropping the dev parameter would make this a perfect fit for coherency > management of buffers used by multiple devices. Right now there's all > kinds of nasty tricks for that use cases needed to avoid redundant > flushes. Note that one thing I'd like to avoid is exposing these funtions directly to drivers, as that will get us into all kinds of abuses. So I'd much prefer if we could have iommu APIs wrapping these that are specific to actual uses cases that we understand well. As for the buffer sharing: at least for the DMA API side I want to move the current buffer sharing users away from dma_alloc_coherent (and coherent dma_alloc_attrs users) and the remapping done in there required for non-coherent architectures. Instead I'd like to allocate plain old pages, and then just dma map them for each device separately, with DMA_ATTR_SKIP_CPU_SYNC passed for all but the first user to map or last user to unmap. On the iommu side it could probably work similar. I have done some preliminary work on this, and want to get it into this merge window, but there is a few other bits I need to sort out first. > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch ---end quoted text---