[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 01/13] x86/mm: export {get,put}_pg_owner
Prefix them with "mm_" and add declarations to asm-x86/mm.h. They will be needed when we split PV specific code out of x86/mm.c. No functional change. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/mm.c | 20 ++++++++++---------- xen/include/asm-x86/mm.h | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 4dbd24ff87..c0bdc667bf 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -3025,7 +3025,7 @@ int new_guest_cr3(unsigned long mfn) return rc; } -static struct domain *get_pg_owner(domid_t domid) +struct domain *mm_get_pg_owner(domid_t domid) { struct domain *pg_owner = NULL, *curr = current->domain; @@ -3068,7 +3068,7 @@ static struct domain *get_pg_owner(domid_t domid) return pg_owner; } -static void put_pg_owner(struct domain *pg_owner) +void mm_put_pg_owner(struct domain *pg_owner) { rcu_unlock_domain(pg_owner); } @@ -3153,19 +3153,19 @@ long do_mmuext_op( if ( unlikely(!guest_handle_okay(uops, count)) ) return -EFAULT; - if ( (pg_owner = get_pg_owner(foreigndom)) == NULL ) + if ( (pg_owner = mm_get_pg_owner(foreigndom)) == NULL ) return -ESRCH; if ( !is_pv_domain(pg_owner) ) { - put_pg_owner(pg_owner); + mm_put_pg_owner(pg_owner); return -EINVAL; } rc = xsm_mmuext_op(XSM_TARGET, d, pg_owner); if ( rc ) { - put_pg_owner(pg_owner); + mm_put_pg_owner(pg_owner); return rc; } @@ -3640,7 +3640,7 @@ long do_mmuext_op( MMU_UPDATE_PREEMPTED, null, rc); } - put_pg_owner(pg_owner); + mm_put_pg_owner(pg_owner); perfc_add(num_mmuext_ops, i); @@ -3716,7 +3716,7 @@ long do_mmu_update( } } - if ( (pg_owner = get_pg_owner((uint16_t)foreigndom)) == NULL ) + if ( (pg_owner = mm_get_pg_owner((uint16_t)foreigndom)) == NULL ) { rc = -ESRCH; goto out; @@ -3951,7 +3951,7 @@ long do_mmu_update( MMU_UPDATE_PREEMPTED, null, rc); } - put_pg_owner(pg_owner); + mm_put_pg_owner(pg_owner); domain_mmap_cache_destroy(&mapcache); @@ -4571,12 +4571,12 @@ long do_update_va_mapping_otherdomain(unsigned long va, u64 val64, struct domain *pg_owner; int rc; - if ( (pg_owner = get_pg_owner(domid)) == NULL ) + if ( (pg_owner = mm_get_pg_owner(domid)) == NULL ) return -ESRCH; rc = __do_update_va_mapping(va, val64, flags, pg_owner); - put_pg_owner(pg_owner); + mm_put_pg_owner(pg_owner); return rc; } diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index e22603ce98..e2baffa9a4 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -602,4 +602,8 @@ extern const char zero_page[]; /* Build a 32bit PSE page table using 4MB pages. */ void write_32bit_pse_identmap(uint32_t *l2); +/* Grab the domain lock of target domain after passing checks */ +struct domain *mm_get_pg_owner(domid_t domid); +void mm_put_pg_owner(struct domain *pg_owner); + #endif /* __ASM_X86_MM_H__ */ -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |