From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [v3][PATCH 1/1] xen:vtd: missing RMRR mapping while share EPT Date: Thu, 24 Jul 2014 19:25:15 +0800 Message-ID: <53D0ED1B.80107@intel.com> References: <1406199618-21574-1-git-send-email-tiejun.chen@intel.com> <20140724111143.GF1817@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140724111143.GF1817@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, JBeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 2014/7/24 19:11, Tim Deegan wrote: > At 19:00 +0800 on 24 Jul (1406224818), Tiejun Chen wrote: >> 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 > > For the interaction with p2m code: > > Acked-by: Tim Deegn Thanks a lot. > > though I am still worried about what happens if this overwrites an > existing mapping. > As I understand RMRR should be specific. Its unlikely created for different mapping since this should be fixed in BIOS phase. And this is why that function is named as rmrr_identity_mapping(). Tiejun > Tim. > >> --- >> xen/drivers/passthrough/vtd/iommu.c | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> v3: >> >> * Use set_mmio_p2m_entry() to replace p2m_set_entry() >> * Use ASSERT to check >> >> v2: >> >> * Fix coding style. >> * Still need to abide intel_iommu_map_page(), so we should do nothing >> if dom0 and iommu supports pass thru. >> >> diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c >> index 042b882..f08a1fc 100644 >> --- a/xen/drivers/passthrough/vtd/iommu.c >> +++ b/xen/drivers/passthrough/vtd/iommu.c >> @@ -1867,8 +1867,14 @@ static int rmrr_identity_mapping(struct domain *d, >> >> while ( base_pfn < end_pfn ) >> { >> - if ( intel_iommu_map_page(d, base_pfn, base_pfn, >> - IOMMUF_readable|IOMMUF_writable) ) >> + if ( iommu_use_hap_pt(d) ) >> + { >> + ASSERT(!iommu_passthrough || !is_hardware_domain(d)); >> + if ( set_mmio_p2m_entry(d, base_pfn, _mfn(base_pfn)) ) >> + return -1; >> + } >> + else if ( intel_iommu_map_page(d, base_pfn, base_pfn, >> + IOMMUF_readable|IOMMUF_writable) ) >> return -1; >> base_pfn++; >> } >> -- >> 1.9.1 >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xen.org >> http://lists.xen.org/xen-devel > >