[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xenmem_add_to_physmap_one() has no need to know of XENMAPSPACE_gmfn_range



commit a3da661ad4b5331ef3a4398898c2f5d47b5a0698
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 31 12:34:08 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 31 12:34:08 2018 +0100

    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>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/mm.c   | 11 ++++-------
 xen/common/memory.c |  2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c732734..66ea822 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -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 )
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 09549ab..59d23a2 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.