[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 20/39] arm/p2m: Make get_page_from_gva ready for altp2m
The function get_page_from_gva uses ARM's hardware support to translate gva's to machine addresses. This function is used, among others, for memory regulation purposes, e.g, within the context of memory ballooning. To ensure correct behavior while altp2m is in use, we use the host's p2m table for the associated gva to ma translation. This is required at this point, as altp2m lazily copies pages from the host's p2m and even might be flushed because of changes to the host's p2m (as it is done within the context of memory ballooning). Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx> --- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Julien Grall <julien.grall@xxxxxxx> --- v3: Cosmetic fixes. Make use of the p2m_(switch|restore)_vttbr_and_(g|s)et_flags macros to avoid code duplication. v4: Remove initialization of the old vttbr outside of the macro "p2m_switch_vttbr_and_get_flags". --- xen/arch/arm/p2m.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 16c7585ffa..20d7784708 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1470,7 +1470,24 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, p2m_read_lock(p2m); - rc = gvirt_to_maddr(va, &maddr, flags); + /* + * If altp2m is active, we need to translate the gva upon the hostp2m's + * vttbr, as it contains all valid mappings while the currently active + * altp2m view might not have the required gva mapping yet. + */ + if ( unlikely(altp2m_active(d)) ) + { + unsigned long flags = 0; + uint64_t ovttbr; + + p2m_switch_vttbr_and_get_flags(ovttbr, p2m->vttbr, flags); + + rc = gvirt_to_maddr(va, &maddr, flags); + + p2m_restore_vttbr_and_set_flags(ovttbr, flags); + } + else + rc = gvirt_to_maddr(va, &maddr, flags); if ( rc ) goto err; -- 2.13.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |