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 16:24:00 +0100 Message-ID: <53D66B10.4030805@linaro.org> References: <1406542610-18724-3-git-send-email-stefano.stabellini@eu.citrix.com> <53D63C9B.5090300@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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 Cc: julien.grall@citrix.com, xen-devel@lists.xensource.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On 07/28/2014 04:21 PM, Stefano Stabellini wrote: > On Mon, 28 Jul 2014, Julien Grall wrote: >> 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. > > OK. Should I keep your acked-by on that patch? Yes, I'm fine with one of 2 solutions (i.e either keep as it is or removing the {,un}map_page callback). Regards, -- Julien Grall