Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2904922ybc; Wed, 20 Nov 2019 23:42:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz7bGjMmYUH9ktIMXFuKHyD9wUlkz9u/vEiP9FbZRvzAwI2NSFTUIPOPl9pOYXlEaXc5ScW X-Received: by 2002:a17:906:d0d2:: with SMTP id bq18mr11458098ejb.217.1574322152314; Wed, 20 Nov 2019 23:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574322152; cv=none; d=google.com; s=arc-20160816; b=TGoA+VCzMpeU/LIeBcMlw/0nbnm1Q3MYyjQ32aDOoG9daY4rH5ukvvCx/7ZVEO1Vq8 sHr4dbVJgNU3ud4fKill49+1H6D8CVr+IfexpsVoLQrm62hpGURZdNw/byQLFrpJ1jBj Gf7hSn5CvfHMmuN6+8hxIlRB1k5Ilc9mwgWizxM5im+c4g8c//Aow2CTrrNICnWCTTWJ bYl1VvrPQgaysQMboTNB5DrJSirAm5pSKsHtXfUkUDJ+umajnkZrNFci7233LaT4V2lo 90f/ImqK7fotjtKakNaOjVSXwX3tdGkDiaHT/KmajHq9pVnRf0q8o5+3KW7+tlQLoIIT edCw== 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:cc :to:from:date; bh=MwN0QTCtB913bCQ5YhkA/Oajymai1dhzbuvbcJq2L0M=; b=eAMHCSZa1h6QU0qlg8WQrHkpexMJx+mMvPBbITJxzAUK4UqDsp2FucO7Zq/roJEpE0 u8JL9yxkg87CDP1/RXUVM98XbdP3PrAglUyo1drRixIeaX6IIUwu1y9sOJ0Mk4UhzMeq eUl+akdpkIEJTOAe6ZBoVWEOuDHC0oT7xzrS6Ut4lIKyR1eaoEvuQ0Ul1P9vtkUZTAAO 7JdHnpzvHvdZayDscgK4mS9CcnZ1Myp5FTdUnzMVpvdPVzNyrnW4n7+wli9irP8LxTBh YxP0lFP7pVCDIwlEJsJi74DS/VgqTYo0GyDnmiWSz6iigaMHcCKr0iLoR+hOukD8FPDy waVQ== 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 o21si1157059ejj.188.2019.11.20.23.42.06; Wed, 20 Nov 2019 23:42:32 -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 S1726529AbfKUHlE (ORCPT + 99 others); Thu, 21 Nov 2019 02:41:04 -0500 Received: from verein.lst.de ([213.95.11.211]:44505 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfKUHlE (ORCPT ); Thu, 21 Nov 2019 02:41:04 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id E48C268B05; Thu, 21 Nov 2019 08:41:00 +0100 (CET) Date: Thu, 21 Nov 2019 08:41:00 +0100 From: Christoph Hellwig To: David Miller Cc: laurentiu.tudor@nxp.com, hch@lst.de, robin.murphy@arm.com, joro@8bytes.org, ruxandra.radulescu@nxp.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, netdev@vger.kernel.org, ioana.ciornei@nxp.com, leoyang.li@nxp.com, diana.craciun@nxp.com, madalin.bucur@nxp.com, camelia.groza@nxp.com Subject: Re: [PATCH v3 0/4] dma-mapping: introduce new dma unmap and sync variants Message-ID: <20191121074100.GD24024@lst.de> References: <20191113122407.1171-1-laurentiu.tudor@nxp.com> <20191113.121132.1658930697082028145.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191113.121132.1658930697082028145.davem@davemloft.net> 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 Wed, Nov 13, 2019 at 12:11:32PM -0800, David Miller wrote: > > This series introduces a few new dma unmap and sync api variants that, > > on top of what the originals do, return the virtual address > > corresponding to the input dma address. In order to do that a new dma > > map op is added, .get_virt_addr that takes the input dma address and > > returns the virtual address backing it up. > > The second patch adds an implementation for this new dma map op in the > > generic iommu dma glue code and wires it in. > > The third patch updates the dpaa2-eth driver to use the new apis. > > The driver should store the mapping in it's private software state if > it needs this kind of conversion. I think the problem for this driver (and a few others) is that they somehow manage to split I/O completions at a different boundary than submissions. For me with my block I/O background this seems weird, but I'll need networking folks to double check the theory. > This is huge precendence for this, and there is therefore no need to > add even more complication and methods and burdon to architecture code > for the sake of this. Unfortunately there are various drivers that abuse iommu_iova_to_phys to get a struct page to unmap. Two of theose are network drivers that went in through you (dpaa2 and thunder), additonally the caam crypto driver (which I think is the same SOC family as dpaa, but I'm not sure) and the AMD GPU driver. We also have drivers that just don't unmap and this don't work with iommus or dma-debug (IBM EMAC another net driver). That being said I hate these new API, but I still think they are less bad than these IOMMU API abuses people do now. If experienced networking folks know a way to get rid of both I'm all for it.