[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC PATCH 1/2] xen: introduce arch_iommu_grant_(un)map_page



Hi Ian,

On 16/07/14 16:56, Ian Campbell wrote:
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?

The function is protected by gnttab_need_iommu_mapping which check if the domain use direct mapping for the memory.

Regards,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.