Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp469352ybv; Wed, 19 Feb 2020 03:15:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwCWAMTSlFpTen23z4MGyiqInk3M+6CA+V4COFituQ9Zow6i2kKU0pIQFmZwqrRsRsxPzSs X-Received: by 2002:aca:c1c2:: with SMTP id r185mr4392274oif.19.1582110940754; Wed, 19 Feb 2020 03:15:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582110940; cv=none; d=google.com; s=arc-20160816; b=SV2I7Qzai2qEx2D/hGExCdgKJBgOfuTUxbOyqIhP0dM04GSPsD1wpSvsAJJoMCG/xv SA5Pnz5MxzAjM0iXEAa0N7ktySkhuyHoE7PKIJedUzw1gTfp1MNien/0oEZGUvfRRmoy kCwuChQrJ8BiWbChgZM/VJ+sE1xuTMuRjNvD22j+U+krAUhtRLzFXhmgPTfRYKUsw4dh F8XbEDTHOAVC6Iuzc3vf6zCMRouP4JjHZUfYdPnIEdi89YzbMCrYgadH2rr1rLE+hwiO DYrpRIAip20RPRF9D95HITwbJ8XZUTnUjOzDCp53IhnVL82lTvC4G9ox1ly5RQFjMU8x iDsA== 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:dkim-signature; bh=/f1ngmz2Y6eQYbHH+pibCXhHJC/jt+o11vHCayIHrLY=; b=d0SHVEBVbC9zozM64Z6vaFl63pLiBcC/kCIhFgV7cRdaqaEWawrRxXXMGkdtwwwUxw 5DhX0/4TRnH26DgiG3qp54n3idF/shPcEFTp4gWVoCXY+UyXFy+JMRxleyIp1I+s50QJ QrvO4erzY4t6iuc3s5avrzQ9XCJPnYIFyy7hE2s5tyItSsZqxw5zSmKgN8KCP4Sngw2k vqerlEIL2ywaJvPvS1DSxibb7IJallbnagSeYeVP0GgmIZu0jhq4QPnc+iIF12SLb+ek UncY7zh4/+tFYbJjFkBAtQsBqZS33coXsdnvmHi2551d1WZ4BPX2rAacjk1p3DdeAYzL ZEDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ywq963r6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si925689ota.230.2020.02.19.03.15.27; Wed, 19 Feb 2020 03:15:40 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Ywq963r6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbgBSLPH (ORCPT + 99 others); Wed, 19 Feb 2020 06:15:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:60344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726636AbgBSLPH (ORCPT ); Wed, 19 Feb 2020 06:15:07 -0500 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1531F2067D; Wed, 19 Feb 2020 11:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582110906; bh=VrtmvhAEzN6b003vnaoKuVG14IEQHmRL14jqXjioLEE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ywq963r6rr3QXJ8K+Kdq9md8IGCU6LJ8X9byT2d/5qrp03Uj2pFHy1S7HV4Hu9d3b /jmBpIsLqYVEgqlvU2A2YuhjKMkx76TqlQc8qFC4ylaTX5+R22i2kN0Py3eC8SdHh1 BehTpWPebhqUIWr7+Tf9Jekp1FQFeCUBruxXK1FY= Date: Wed, 19 Feb 2020 11:15:01 +0000 From: Will Deacon To: isaacm@codeaurora.org Cc: Robin Murphy , Christoph Hellwig , pratikp@codeaurora.org, linux-kernel@vger.kernel.org, Liam Mark , iommu@lists.linux-foundation.org, kernel-team@android.com Subject: Re: [RFC PATCH] iommu/dma: Allow drivers to reserve an iova range Message-ID: <20200219111501.GA19400@willie-the-truck> References: <1581721096-16235-1-git-send-email-isaacm@codeaurora.org> <20200217080138.GB10342@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 05:57:18PM -0800, isaacm@codeaurora.org wrote: > On 2020-02-17 07:50, Robin Murphy wrote: > > On 17/02/2020 8:01 am, Christoph Hellwig wrote: > > > On Fri, Feb 14, 2020 at 02:58:16PM -0800, Isaac J. Manjarres wrote: > > > > From: Liam Mark > > > > > > > > Some devices have a memory map which contains gaps or holes. > > > > In order for the device to have as much IOVA space as possible, > > > > allow its driver to inform the DMA-IOMMU layer that it should > > > > not allocate addresses from these holes. > > > > > > Layering violation. dma-iommu is the translation layer between the > > > DMA API and the IOMMU API. And calls into it from drivers performing > > > DMA mappings need to go through the DMA API (and be documented there). > > > > +1 > > > > More than that, though, we already have "holes in the address space" > > support for the sake of PCI host bridge windows - assuming this is the > > same kind of thing (i.e. the holes are between memory regions and > > other resources in PA space, so are only relevant once address > > translation comes into the picture), then this is IOMMU API level > To make sure that we're on the same page, this support alludes to the > handling in > dma-iommu.c that reserves portions of the IOVA space for the PCI host bridge > windows, > correct? If so, then yes, this is similar. > > stuff, so even a DMA API level interface would be inappropriate. > Does this mean that the driver should be managing the IOVA space and > mappings for this device using the IOMMU API? If so, is the rationale for > this because the device driver can have the information of what IOVA ranges > can and cannot be used? Shouldn't there be a generic way of informing an > IOMMU driver about these reserved ranges? Perhaps through a device tree > property, instead of deferring this type of management to the driver? Before we dive into designing that, can you please clarify whether the reserved IOVA range applies to all DMA masters mastering through a particular SMMU, or whether it's just about one specific master? I was assuming the former, but wanted to be sure. Thanks, Will