From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH for 4.6] x86/mm: make {set, clear}_identity_p2m_mapping() work for HVM guests as well Date: Mon, 14 Sep 2015 08:42:27 -0600 Message-ID: <55F6F8F302000078000A29F5@prv-mh.provo.novell.com> References: <1442240654-3456-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1442240654-3456-1-git-send-email-andrew.cooper3@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: Andrew Cooper , Malcolm Crossley Cc: George Dunlap , Wei Liu , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 14.09.15 at 16:24, wrote: > For Intel IGD passthrough, the guest driver programs the device to DMA > to/from its RMRR. > > c/s 619ecf8 "make {set,clear}_identity_p2m_mapping() work for PV guests" > was incomplete for pre-Broadwell systems which did not support shared > EPT. > > The correct check to use is iommu_use_hap_pt() not > paging_mode_translate() as IOMMU mappings also need to be created for > HVM guests with separate EPT and IOMMU tables. No, at least not without a very good explanation: > --- a/xen/arch/x86/mm/p2m.c > +++ b/xen/arch/x86/mm/p2m.c > @@ -957,7 +957,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn, > struct p2m_domain *p2m = p2m_get_hostp2m(d); > int ret; > > - if ( !paging_mode_translate(p2m->domain) ) > + if ( !iommu_use_hap_pt(d) ) Not only have these checks no reason to be in any way IOMMU dependent (no other function around here does so), but also both ept_set_entry() and p2m_pt_set_entry() take care to call iommu_{,un}map_page() as needed (as I had already pointed out back when we discussed the patch this one tries to complete). If anything, it would be those low level functions that may need tweaking (and which have a reason to consider IOMMU flags) if for some reason they don't actually do the expected calls. Jan