From: Malcolm Crossley Subject: [PATCH for 4.6] VT-d: Create IOMMU mappings for RMRR regions if shared EPT is not being used Date: Wed, 26 Aug 2015 16:49:25 +0100 Message-ID: <1440604165-23738-1-git-send-email-malcolm.crossley@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZUcxb-0005Jp-GZ for xen-devel@lists.xenproject.org; Wed, 26 Aug 2015 15:49:59 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, Malcolm Crossley , JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org Add RMRR 1:1 IOMMU mappings to IOMMU page tables if EPT page table are not being shared with the IOMMU. This is a regression in behaviour versus Xen 4.5. Signed-off-by: Malcolm Crossley --- xen/drivers/passthrough/vtd/iommu.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 836aed5..89de741 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1839,8 +1839,16 @@ static int rmrr_identity_mapping(struct domain *d, bool_t map, while ( base_pfn < end_pfn ) { - if ( clear_identity_p2m_entry(d, base_pfn) ) - ret = -ENXIO; + if ( iommu_use_hap_pt(d) ) + { + if ( clear_identity_p2m_entry(d, base_pfn) ) + ret = -ENXIO; + } + else + { + if ( intel_iommu_unmap_page(d, base_pfn) ) + ret = -ENXIO; + } base_pfn++; } @@ -1855,7 +1863,16 @@ static int rmrr_identity_mapping(struct domain *d, bool_t map, while ( base_pfn < end_pfn ) { - int err = set_identity_p2m_entry(d, base_pfn, p2m_access_rw, flag); + int err; + if ( iommu_use_hap_pt(d) ) + { + err = set_identity_p2m_entry(d, base_pfn, p2m_access_rw, flag); + } + else + { + err = intel_iommu_map_page(d, base_pfn, base_pfn, + IOMMUF_readable|IOMMUF_writable); + } if ( err ) return err; -- 1.7.12.4