From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [v4][PATCH 03/19] xen/vtd: create RMRR mapping Date: Wed, 24 Jun 2015 09:11:41 +0800 Message-ID: <558A03CD.3090206@intel.com> References: <1435053450-25131-1-git-send-email-tiejun.chen@intel.com> <1435053450-25131-4-git-send-email-tiejun.chen@intel.com> <55894D4902000078000881D3@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55894D4902000078000881D3@mail.emea.novell.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: Jan Beulich Cc: Yang Zhang , Kevin Tian , Tim Deegan , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 2015/6/23 18:12, Jan Beulich wrote: >>>> On 23.06.15 at 11:57, wrote: >> --- a/xen/drivers/passthrough/vtd/iommu.c >> +++ b/xen/drivers/passthrough/vtd/iommu.c >> @@ -1839,7 +1839,7 @@ static int rmrr_identity_mapping(struct domain *d, bool_t map, >> >> while ( base_pfn < end_pfn ) >> { >> - if ( intel_iommu_unmap_page(d, base_pfn) ) >> + if ( guest_physmap_remove_page(d, base_pfn, base_pfn, 0) ) Yeah, I also thought this may bring some confusions in this context. >> ret = -ENXIO; >> base_pfn++; >> } >> @@ -1855,8 +1855,7 @@ static int rmrr_identity_mapping(struct domain *d, bool_t map, >> >> while ( base_pfn < end_pfn ) >> { >> - int err = intel_iommu_map_page(d, base_pfn, base_pfn, >> - IOMMUF_readable|IOMMUF_writable); >> + int err = set_identity_p2m_entry(d, base_pfn, p2m_access_rw); > > Shouldn't the two continue to be the inverse of one another? Initially, instead of using guest_physmap_remove_page, I was trying to introduce a new, clear_identity_p2m_entry, which can wrapper p2m_remove_page(). But Tim just thought we'd better avoid duplicating code, http://lists.xenproject.org/archives/html/xen-devel/2015-06/msg02970.html > Maybe guest_physmap_remove_page() does what you want, Note actually we just need p2m_remove_page() to unmap these mapping on both ept and vt-d sides, and guest_physmap_remove_page is really a wrapper of p2m_remove_page(). Thanks Tiejun