[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] gnttab: simplify page copying/clearing
commit 1549a9dac132d00a1e4a011e0c4e6ea5b42d23b8 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Jun 16 12:26:35 2015 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Jun 16 12:26:35 2015 +0200 gnttab: simplify page copying/clearing ... by making {copy,clear}_domain_page() available also on other than x86. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- xen/arch/x86/domain_page.c | 18 ------------------ xen/common/grant_table.c | 9 ++------- xen/common/memory.c | 20 ++++++++++++++++++++ xen/include/asm-arm/page.h | 2 ++ 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c index 8f3217b..d684b2f 100644 --- a/xen/arch/x86/domain_page.c +++ b/xen/arch/x86/domain_page.c @@ -230,24 +230,6 @@ void unmap_domain_page(const void *ptr) local_irq_restore(flags); } -void clear_domain_page(unsigned long mfn) -{ - void *ptr = map_domain_page(mfn); - - clear_page(ptr); - unmap_domain_page(ptr); -} - -void copy_domain_page(unsigned long dmfn, unsigned long smfn) -{ - const void *src = map_domain_page(smfn); - void *dst = map_domain_page(dmfn); - - copy_page(dst, src); - unmap_domain_page(dst); - unmap_domain_page(src); -} - int mapcache_domain_init(struct domain *d) { struct mapcache_domain *dcache = &d->arch.pv_domain.mapcache; diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 951f651..0538803 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1712,7 +1712,6 @@ gnttab_transfer( if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn ) { struct page_info *new_page; - void *sp, *dp; new_page = alloc_domheap_page(e, MEMF_no_owner | MEMF_bits(max_bitsize)); @@ -1722,11 +1721,7 @@ gnttab_transfer( goto unlock_and_copyback; } - sp = map_domain_page(mfn); - dp = __map_domain_page(new_page); - memcpy(dp, sp, PAGE_SIZE); - unmap_domain_page(dp); - unmap_domain_page(sp); + copy_domain_page(page_to_mfn(new_page), mfn); page->count_info &= ~(PGC_count_mask|PGC_allocated); free_domheap_page(page); @@ -2520,7 +2515,7 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARAM(gnttab_set_version_t) uop) /* Make sure there's no crud left over in the table from the old version. */ for ( i = 0; i < nr_grant_frames(gt); i++ ) - memset(gt->shared_raw[i], 0, PAGE_SIZE); + clear_page(gt->shared_raw[i]); /* Restore the first 8 entries (toolstack reserved grants) */ if ( gt->gt_version != 0 && op.version == 1 ) diff --git a/xen/common/memory.c b/xen/common/memory.c index 063a1c5..c84fcdd 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -1170,6 +1170,26 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) return rc; } +#ifdef CONFIG_DOMAIN_PAGE +void clear_domain_page(unsigned long mfn) +{ + void *ptr = map_domain_page(mfn); + + clear_page(ptr); + unmap_domain_page(ptr); +} + +void copy_domain_page(unsigned long dmfn, unsigned long smfn) +{ + const void *src = map_domain_page(smfn); + void *dst = map_domain_page(dmfn); + + copy_page(dst, src); + unmap_domain_page(dst); + unmap_domain_page(src); +} +#endif + void destroy_ring_for_helper( void **_va, struct page_info *page) { diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 3d89494..5ecfd07 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -264,6 +264,8 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn, unsigned attr) /* Actual cacheline size on the boot CPU. */ extern size_t cacheline_bytes; +#define copy_page(dp, sp) memcpy(dp, sp, PAGE_SIZE) + /* Functions for flushing medium-sized areas. * if 'range' is large enough we might want to use model-specific * full-cache flushes. */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |