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 15:51:01 +0100 Message-ID: <53D11D55.705@linaro.org> References: <1406208666-23547-3-git-send-email-stefano.stabellini@eu.citrix.com> <53D10F2E.7040009@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/24/2014 03:14 PM, Stefano Stabellini wrote: > On Thu, 24 Jul 2014, Julien Grall wrote: >> 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. > > I see. > > >>> + 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? > > I guess you mean why didn't you drop the need_iommu(d) in > gnttab_need_iommu_mapping? > > Because how can you need an iommu mapping if an iommu is not present? I would invert the name of the 2 macros. And drop !need_iommu(d) in the second. The code would look like: if (gnttab_need_identity_mapping(d)) { if (gnttab_need_iommu_mapping(d)) iommu_map_page else arch_ } On x86, the gnttab_need_iommu_mapping would be equal to 1. Regards, -- Julien Grall