From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiejun Chen Subject: [v4][PATCH 03/19] xen/vtd: create RMRR mapping Date: Tue, 23 Jun 2015 17:57:14 +0800 Message-ID: <1435053450-25131-4-git-send-email-tiejun.chen@intel.com> References: <1435053450-25131-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: <1435053450-25131-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: xen-devel@lists.xen.org Cc: Yang Zhang , Kevin Tian 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. CC: Yang Zhang CC: Kevin Tian Signed-off-by: Tiejun Chen --- v4: * Instead of intel_iommu_unmap_page(), we should use guest_physmap_remove_page() to unmap rmrr mapping correctly. * Drop iommu_map_page() since actually ept_set_entry() can do this internally. xen/drivers/passthrough/vtd/iommu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 44ed23d..202b2d0 100644 --- 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) ) 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); if ( err ) return err; -- 1.9.1