From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3 3/3] xen/arm: introduce XENFEAT_grant_map_identity Date: Thu, 24 Jul 2014 14:50:38 +0100 Message-ID: <53D10F2E.7040009@linaro.org> References: <1406208666-23547-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: <1406208666-23547-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/24/2014 02:31 PM, Stefano Stabellini wrote: > diff --git a/xen/common/kernel.c b/xen/common/kernel.c > index 7e83353..dacbe38 100644 > --- a/xen/common/kernel.c > +++ b/xen/common/kernel.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -325,6 +326,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) > break; > } > #endif > + if ( gnttab_need_identity_mapping(d) ) Actually even platform the IOMMU support needs to have this flags on. With this solution you break platform where not every DMA-capable device are behind an SMMU. > + fi.submap |= 1U << XENFEAT_grant_map_identity; > break; > default: > return -EINVAL; > diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h > index eac8a70..6f7ccd9 100644 > --- a/xen/include/asm-arm/grant_table.h > +++ b/xen/include/asm-arm/grant_table.h > @@ -36,6 +36,9 @@ static inline int replace_grant_supported(void) > #define gnttab_need_iommu_mapping(d) \ > (is_domain_direct_mapped(d) && need_iommu(d)) > > +#define gnttab_need_identity_mapping(d) \ > + (is_domain_direct_mapped(d) && !need_iommu(d)) > + Why didn't you drop the need_iommu(d) in is_domain_direct_mapped? Hence the name is confusing. You may think that we don't need identity mapping when IOMMU is used while it's actually the case, but we use a different function. -- Julien Grall