[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xenmem_add_to_physmap_one() has no need to know of XENMAPSPACE_gmfn_range
As its name says, it handles a single GMFN only anyway. Note that ARM needs no adjustment, as it doesn't handle the two types at all. Also take the opportunity and clean up the handling of XENMAPSPACE_gmfn a little: There's no point in going through "idx" when capturing the MFN. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4111,20 +4111,18 @@ int xenmem_add_to_physmap_one( if ( rc ) return rc; break; - case XENMAPSPACE_gmfn_range: case XENMAPSPACE_gmfn: { p2m_type_t p2mt; gfn = idx; - idx = mfn_x(get_gfn_unshare(d, idx, &p2mt)); + mfn = get_gfn_unshare(d, gfn, &p2mt); /* If the page is still shared, exit early */ if ( p2m_is_shared(p2mt) ) { put_gfn(d, gfn); return -ENOMEM; } - mfn = _mfn(idx); page = get_page_from_mfn(mfn, d); if ( unlikely(!page) ) mfn = INVALID_MFN; @@ -4162,8 +4160,7 @@ int xenmem_add_to_physmap_one( /* Unmap from old location, if any. */ old_gpfn = get_gpfn_from_mfn(mfn_x(mfn)); ASSERT(!SHARED_M2P(old_gpfn)); - if ( (space == XENMAPSPACE_gmfn || space == XENMAPSPACE_gmfn_range) && - old_gpfn != gfn ) + if ( space == XENMAPSPACE_gmfn && old_gpfn != gfn ) { rc = -EXDEV; goto put_both; @@ -4176,8 +4173,8 @@ int xenmem_add_to_physmap_one( rc = guest_physmap_add_page(d, gpfn, mfn, PAGE_ORDER_4K); put_both: - /* In the XENMAPSPACE_gmfn, we took a ref of the gfn at the top */ - if ( space == XENMAPSPACE_gmfn || space == XENMAPSPACE_gmfn_range ) + /* In the XENMAPSPACE_gmfn case, we took a ref of the gfn at the top. */ + if ( space == XENMAPSPACE_gmfn ) put_gfn(d, gfn); if ( page ) --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -780,7 +780,7 @@ static int xenmem_add_to_physmap(struct while ( xatp->size > done ) { - rc = xenmem_add_to_physmap_one(d, xatp->space, extra, + rc = xenmem_add_to_physmap_one(d, XENMAPSPACE_gmfn, extra, xatp->idx, _gfn(xatp->gpfn)); if ( rc < 0 ) break; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |