From: "Jan Beulich" Subject: Re: [PATCH v2 2/2] xen/arm: introduce XENFEAT_grant_map_identity Date: Thu, 24 Jul 2014 07:48:40 +0100 Message-ID: <53D0C86802000078000255AF@mail.emea.novell.com> References: <1406135982-15487-2-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: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XACpY-0005Gp-Bz for xen-devel@lists.xenproject.org; Thu, 24 Jul 2014 06:48:44 +0000 In-Reply-To: <1406135982-15487-2-git-send-email-stefano.stabellini@eu.citrix.com> Content-Disposition: inline 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 , Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 23.07.14 at 19:19, wrote: > Changes in v2: > - rename XENFEAT_grant_map_11 to XENFEAT_grant_map_identity; > - remove superfluous ifdef CONFIG_ARM in xen/common/kernel.c; Looks like you forgot to add an is_domain_direct_mapped() stub for x86, breaking the build there? > @@ -727,7 +727,7 @@ __gnttab_map_grant_ref( > > double_gt_lock(lgt, rgt); > > - if ( gnttab_need_iommu_mapping(ld) ) > + if ( gnttab_need_iommu_mapping(ld) || is_domain_direct_mapped(ld) ) This is bogus: On x86 the right part is always false, while on ARM the right part is already part of gnttab_need_iommu_mapping(). IOW no need to change anything here afaict. > @@ -738,13 +738,23 @@ __gnttab_map_grant_ref( > !(old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) ) > { > if ( wrc == 0 ) > - err = iommu_map_page(ld, frame, frame, > - IOMMUF_readable|IOMMUF_writable); > + { > + if ( gnttab_need_iommu_mapping(ld) ) > + err = iommu_map_page(ld, frame, frame, > + IOMMUF_readable|IOMMUF_writable); > + else > + err = arch_grant_map_page_identity(ld, frame, true); Irrespective of the above this is inefficient too: If you used !is_domain_direct_mapped() as the conditional here, the compiler would be able to eliminate the arch_grant_map_page_identity() path on x86, making it unnecessary to have the stub as an inline function (a simple declaration without definition would then suffice as long as we don't ever build with -Od, which we already depend upon elsewhere). Jan