Received: by 10.192.165.148 with SMTP id m20csp76114imm; Fri, 20 Apr 2018 03:19:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+m3FRzsJM2FlCXoXL29/MS6XvW682H45Q9H3Na3eoV3ibPL+NZ8kxo26OkiYk4UYdLLv2m X-Received: by 10.101.69.1 with SMTP id n1mr7899650pgq.175.1524219568419; Fri, 20 Apr 2018 03:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524219568; cv=none; d=google.com; s=arc-20160816; b=gJFD7cX/pkjqTbetgYVn/FviZdjI9ypHdkq2H0F1hMMWoOVo3T8/IbpQJRITdATvQJ AgWsG2GzfDlCUNJTFh4T4LUA0W5fmmLeQrtxD7uxFQlOWSFoshnOel2ysbb0ItiPXqes EQVV97a49z4RKp3XZZIEZPgP5a2Cd0+tfmJdf1OGTTFKe2ZXm8IjDyx5+MT/TVsR6I5d 8JxvfXawYorOWqzRnWYxX249NFeIn9mu2k4NkVvCAmNhYYhNsfHlxyepG0kd4P79xjBm X1o4H3VkfSlJ2blSMrENk2kXvnXcYLlba9gDGuZ/uHOjkhe+vmjrGLFTzl2RhUcPQ3W9 BaYw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=Q3genx0lg3BJhuXT7anXKL3eeZIsR6PKBzKeMuGqF/s=; b=SnkGIXaf1F5qMYKuRVFjKMEBltvroeYSASMjxhpHlGDXsShf1Vm/Il8ZotmFYZeuI4 X1A38XM5B7gMoP8jDYrKAGjCtuxmeJxVQlsnIKo1Yu6i4V/2ztye5NlPbQP1k41R8gmQ 4toj4vCwRT7/TjSovq89UdgBxtfdPyCICXVf7v0mYgZY1vQmvQzBfJOcMz5PWGbnMu+L 6Vri2/wJ13i153WHsczT4XOlt810oC9AXtDDZ43r6xpkPSegcv66VpP0tR5iVKTfVx4o vrAS5HmEAlL2s4I04mAxbkiMHj1gImGHoOgHCJyvDCAxyg88r8I5I8tmGhkNUmIIWiuD TiDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bSQzjzpG; 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 d10si4809069pgu.626.2018.04.20.03.19.14; Fri, 20 Apr 2018 03:19:28 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bSQzjzpG; 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 S1754553AbeDTKSA (ORCPT + 99 others); Fri, 20 Apr 2018 06:18:00 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55838 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754469AbeDTKR6 (ORCPT ); Fri, 20 Apr 2018 06:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q3genx0lg3BJhuXT7anXKL3eeZIsR6PKBzKeMuGqF/s=; b=bSQzjzpGB7B0iAMynH+7PU+WGs f7TYrAZPXu3ToYMYdA8BIrYDHYwvxE2qloo5TqHQCRzKGkacekYhKzr9b7194M50+oBKwmPcDzMpG WBpJo/HRdvr89r59mMrPfoaKMBpQjq/ELhJWlHrZQC9Qy8nmZVXAj60OzI0PcHGcnoifznOfVoUqi 75Acy7MABNJmeExKnCnP7muXQJq/NuWUuxHi+yW99M4LihGnfavxTjAvZ33EoXcQCrewVQhBlxA5g JdEvWn0o9qWJ1Zbfb+8tTCW5MPEt+HKDutqr44h/qQOhmiiFKIU8tYyiRWx7r5Xwho7P+gOAgOmSq 28m3mIHw==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9T75-0005r6-M8; Fri, 20 Apr 2018 10:17:55 +0000 Date: Fri, 20 Apr 2018 03:17:55 -0700 From: Christoph Hellwig To: christian.koenig@amd.com Cc: Christoph Hellwig , Jerome Glisse , "moderated list:DMA BUFFER SHARING FRAMEWORK" , "open list:DMA BUFFER SHARING FRAMEWORK" , dri-devel , amd-gfx list , Linux Kernel Mailing List , Logan Gunthorpe , Dan Williams Subject: Re: [PATCH 4/8] dma-buf: add peer2peer flag Message-ID: <20180420101755.GA11400@infradead.org> References: <20180329065753.GD3881@phenom.ffwll.local> <8b823458-8bdc-3217-572b-509a28aae742@gmail.com> <20180403090909.GN3881@phenom.ffwll.local> <20180403170645.GB5935@redhat.com> <20180403180832.GZ3881@phenom.ffwll.local> <20180416123937.GA9073@infradead.org> <20180419081657.GA16735@infradead.org> <20180420071312.GF31310@phenom.ffwll.local> <3e17afc5-7d6c-5795-07bd-f23e34cf8d4b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3e17afc5-7d6c-5795-07bd-f23e34cf8d4b@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 20, 2018 at 10:58:50AM +0200, Christian K?nig wrote: > > Yes there's a bit a layering violation insofar that drivers really > > shouldn't each have their own copy of "how do I convert a piece of dma > > memory into dma-buf", but that doesn't render the interface a bad idea. > > Completely agree on that. > > What we need is an sg_alloc_table_from_resources(dev, resources, > num_resources) which does the handling common to all drivers. A structure that contains {page,offset,len} + {dma_addr+dma_len} is not a good container for storing {virt addr, dma_addr, len} no matter what interface you build arond it. And that is discounting all the problems around mapping coherent allocations for other devices, or the iommu merging problem we are having another thread on. So let's come up with a better high level interface first, and then worrty about how to implement it in the low-level dma-mapping interface second. Especially given that my consolidation of the dma_map_ops implementation is in full stream and there shoudn't be all that many to bother with. So first question: Do you actually care about having multiple pairs of the above, or instead of all chunks just deal with a single of the above? In that case we really should not need that many new interfaces as dma_map_resource will be all you need anyway. > > Christian. > > > -Daniel > ---end quoted text---