From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiejun Chen Subject: [v7][RFC][PATCH 11/13] xen:vtd: create RMRR mapping Date: Fri, 24 Oct 2014 15:34:35 +0800 Message-ID: <1414136077-18599-12-git-send-email-tiejun.chen@intel.com> References: <1414136077-18599-1-git-send-email-tiejun.chen@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1414136077-18599-1-git-send-email-tiejun.chen@intel.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: JBeulich@suse.com, tim@xen.org, konrad.wilk@oracle.com, kevin.tian@intel.com, yang.z.zhang@intel.com Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org intel_iommu_map_page() does nothing if VT-d shares EPT page table. So rmrr_identity_mapping() never create RMRR mapping but in some cases like some GFX drivers it still need to access RMRR. Here we will create those RMRR mappings even in shared EPT case. Signed-off-by: Tiejun Chen --- xen/drivers/passthrough/vtd/iommu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index efd3390..07136df 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1856,10 +1856,15 @@ 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); - - if ( err ) + int err = 0; + if ( iommu_use_hap_pt(d) ) + { + ASSERT(!iommu_passthrough || !is_hardware_domain(d)); + if ( (err = set_identity_p2m_entry(d, base_pfn, p2m_access_rw)) ) + return err; + } + else if ( (err = intel_iommu_map_page(d, base_pfn, base_pfn, + IOMMUF_readable|IOMMUF_writable)) ) return err; base_pfn++; } -- 1.9.1