From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v4 3/3] xen/arm: introduce XENFEAT_grant_map_identity Date: Mon, 28 Jul 2014 13:05:47 +0100 Message-ID: <53D63C9B.5090300@linaro.org> References: <1406542610-18724-3-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406542610-18724-3-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , xen-devel@lists.xensource.com Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Hi Stefano, On 07/28/2014 11:16 AM, Stefano Stabellini wrote: > The flag specifies that the hypervisor maps a grant page to guest > physical address == machine address of the page in addition to the > normal grant mapping address. > > Frontends are allowed to map the same page multiple times using multiple > grant references. On the backend side it can be difficult to find out > the physical address corresponding to a particular machine address, > especially at the completation of a dma operation. To simplify address completion [..] > if ( err ) > { > @@ -941,9 +951,18 @@ __gnttab_unmap_common( > int err = 0; > mapcount(lgt, rd, op->frame, &wrc, &rdc); > if ( (wrc + rdc) == 0 ) > - err = iommu_unmap_page(ld, op->frame); > - else if ( wrc == 0 ) > - err = iommu_map_page(ld, op->frame, op->frame, IOMMUF_readable); > + { > + if ( is_domain_direct_mapped(ld) ) > + err = arch_grant_unmap_page_identity(ld, op->frame); > + else > + err = iommu_unmap_page(ld, op->frame); > + } else if ( wrc == 0 ) > + { > + if ( is_domain_direct_mapped(ld) ) > + err = arch_grant_map_page_identity(ld, op->frame, 0); > + else > + err = iommu_map_page(ld, op->frame, op->frame, IOMMUF_readable); With this solution, iommu_map_page will never be called on ARM. It's because gnttab_need_iommu_mapping is checking the domain is using direct mapping. So, I think you can drop the iommu_map_page callback of the SMMU in patch #2. Regards, -- Julien Grall