[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [v7][RFC][PATCH 08/13] xen/x86/p2m: set p2m_access_n for reserved device memory mapping
In case of shared-ept or non-shared-ept but 1:1 mapping, we need to set p2m_access_n to make sure all reserved device memory can't be accessed by any !iommu approach. Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx> --- xen/arch/x86/mm/p2m.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index efa49dd..97eb6fd 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -686,6 +686,30 @@ guest_physmap_add_entry(struct domain *d, unsigned long gfn, /* Now, actually do the two-way mapping */ if ( mfn_valid(_mfn(mfn)) ) { + + if ( !is_hardware_domain(d) ) + { + rc = iommu_get_reserved_device_memory(p2m_check_reserved_device_memory, + &gfn); + if ( rc ) + { + /* + * Just set p2m_access_n in case of shared-ept + * or non-shared ept but 1:1 mapping. + */ + if ( iommu_use_hap_pt(d) || + (!iommu_use_hap_pt(d) && mfn == gfn) ) + { + rc = p2m_set_entry(p2m, gfn, _mfn(mfn), page_order, t, + p2m_access_n); + if ( rc ) + gdprintk(XENLOG_WARNING, "set rdm p2m failed: (%#lx)\n", + gfn); + goto out; /* Failed to update rdm p2m. */ + } + } + } + rc = p2m_set_entry(p2m, gfn, _mfn(mfn), page_order, t, p2m->default_access); if ( rc ) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |