From: Ian Campbell Subject: Re: [RFC PATCH 1/2] xen: introduce arch_iommu_grant_(un)map_page Date: Wed, 16 Jul 2014 16:56:38 +0100 Message-ID: <1405526198.1087.45.camel@kazak.uk.xensource.com> References: <1404834794-16055-1-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: <1404834794-16055-1-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 Cc: julien.grall@citrix.com, xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Tue, 2014-07-08 at 16:53 +0100, Stefano Stabellini wrote: > +int arch_iommu_grant_map_page(struct domain *d, unsigned long frame, > + unsigned flags) > +{ > + p2m_type_t t; > + > + /* Grant mappings can be used for DMA requests. The dev_bus_addr returned by > + * the hypercall is the MFN (not the IPA). For device protected by > + * an IOMMU, Xen needs to add a 1:1 mapping in the domain p2m to > + * allow DMA request to work. > + * This is only valid when the domain is directed mapped. > + */ > + BUG_ON(!is_domain_direct_mapped(d)); What stops a non-1:1 guest from trying to map a grant reference and ending up here? Ian.