From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiejun Chen Subject: [RFC][v2][PATCH 06/14] xen:vtd: create RMRR mapping Date: Fri, 22 May 2015 17:35:06 +0800 Message-ID: <1432287314-4388-7-git-send-email-tiejun.chen@intel.com> References: <1432287314-4388-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: <1432287314-4388-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, andrew.cooper3@citrix.com, kevin.tian@intel.com, yang.z.zhang@intel.com, ian.campbell@citrix.com, wei.liu2@citrix.com, Ian.Jackson@eu.citrix.com, stefano.stabellini@citrix.com Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org RMRR reserved regions must be setup in the pfn space with an identity mapping to reported mfn. However existing code has problem to setup correct mapping when VT-d shares EPT page table, so lead to problem when assigning devices (e.g GPU) with RMRR reported. So instead, this patch aims to setup identity mapping in p2m layer, regardless of whether EPT is shared or not. And we still keep creating VT-d table. Signed-off-by: Tiejun Chen --- xen/arch/x86/mm/p2m.c | 5 +++++ xen/drivers/passthrough/vtd/iommu.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index c674201..3574521 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -925,6 +925,11 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn, gfn_unlock(p2m, gfn, 0); + if( ret == 0 ) + { + ret = iommu_map_page(d, gfn, gfn, IOMMUF_readable|IOMMUF_writable); + } + return ret; } diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 6a37624..31ce1af 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1856,8 +1856,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); if ( err ) return err; -- 1.9.1