]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xenmem_add_to_physmap_one() has no need to know of XENMAPSPACE_gmfn_range
authorJan Beulich <jbeulich@suse.com>
Wed, 31 Jan 2018 11:34:08 +0000 (12:34 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 31 Jan 2018 11:34:08 +0000 (12:34 +0100)
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@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm.c
xen/common/memory.c

index c732734ac19185e2b27a2c7c63d74a0567478b2a..66ea8225a7e3f3efbf47d1c1b90474e4043006f5 100644 (file)
@@ -4105,20 +4105,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;
@@ -4156,8 +4154,7 @@ int xenmem_add_to_physmap_one(
     /* Unmap from old location, if any. */
     old_gpfn = get_gpfn_from_mfn(mfn_x(mfn));
     ASSERT( old_gpfn != SHARED_M2P_ENTRY );
-    if ( (space == XENMAPSPACE_gmfn || space == XENMAPSPACE_gmfn_range) &&
-         old_gpfn != gfn )
+    if ( space == XENMAPSPACE_gmfn && old_gpfn != gfn )
     {
         rc = -EXDEV;
         goto put_both;
@@ -4170,8 +4167,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 )
index 09549abec50f2d59fad5af356fd0847dfe85128f..59d23a2a98012943d4e1b5d2d66640e66ade04e8 100644 (file)
@@ -800,7 +800,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
 
     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;