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

[Xen-changelog] [xen master] x86/mm: Rename get_page_from_pagenr() to get_page_from_mfn()



commit 4e0183b210d9d3029959cd870838eef309f7c84c
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jan 18 17:58:42 2017 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jul 25 15:31:06 2017 +0100

    x86/mm: Rename get_page_from_pagenr() to get_page_from_mfn()
    
    'pagenr' is actually an mfn.  Rename the function to use consistent
    terminology, switching it to use a typesafe mfn_t and boolean return type.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/mm.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 19f672d..6075be6 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -716,18 +716,18 @@ int map_ldt_shadow_page(unsigned int off)
 }
 
 
-static int get_page_from_pagenr(unsigned long page_nr, struct domain *d)
+static bool get_page_from_mfn(mfn_t mfn, struct domain *d)
 {
-    struct page_info *page = mfn_to_page(page_nr);
+    struct page_info *page = mfn_to_page(mfn_x(mfn));
 
-    if ( unlikely(!mfn_valid(_mfn(page_nr))) || unlikely(!get_page(page, d)) )
+    if ( unlikely(!mfn_valid(mfn)) || unlikely(!get_page(page, d)) )
     {
         gdprintk(XENLOG_WARNING,
-                 "Could not get page ref for mfn %"PRI_mfn"\n", page_nr);
-        return 0;
+                 "Could not get page ref for mfn %"PRI_mfn"\n", mfn_x(mfn));
+        return false;
     }
 
-    return 1;
+    return true;
 }
 
 
@@ -741,7 +741,7 @@ static int get_page_and_type_from_pagenr(unsigned long 
page_nr,
     int rc;
 
     if ( likely(partial >= 0) &&
-         unlikely(!get_page_from_pagenr(page_nr, d)) )
+         unlikely(!get_page_from_mfn(_mfn(page_nr), d)) )
         return -EINVAL;
 
     rc = (preemptible ?
@@ -795,7 +795,7 @@ get_##level##_linear_pagetable(                             
                \
     if ( (pfn = level##e_get_pfn(pde)) != pde_pfn )                         \
     {                                                                       \
         /* Make sure the mapped frame belongs to the correct domain. */     \
-        if ( unlikely(!get_page_from_pagenr(pfn, d)) )                      \
+        if ( unlikely(!get_page_from_mfn(_mfn(pfn), d)) )                   \
             return 0;                                                       \
                                                                             \
         /*                                                                  \
@@ -3001,7 +3001,7 @@ int new_guest_cr3(unsigned long mfn)
     }
 
     rc = paging_mode_refcounts(d)
-         ? (get_page_from_pagenr(mfn, d) ? 0 : -EINVAL)
+         ? (get_page_from_mfn(_mfn(mfn), d) ? 0 : -EINVAL)
          : get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0, 1);
     switch ( rc )
     {
@@ -3924,7 +3924,7 @@ long do_mmu_update(
                 xsm_checked = xsm_needed;
             }
 
-            if ( unlikely(!get_page_from_pagenr(mfn, pg_owner)) )
+            if ( unlikely(!get_page_from_mfn(_mfn(mfn), pg_owner)) )
             {
                 gdprintk(XENLOG_WARNING,
                          "Could not get page for mach->phys update\n");
@@ -4138,7 +4138,7 @@ static int create_grant_va_mapping(
         return GNTST_general_error;
     }
 
-    if ( !get_page_from_pagenr(gl1mfn, current->domain) )
+    if ( !get_page_from_mfn(_mfn(gl1mfn), current->domain) )
     {
         guest_unmap_l1e(pl1e);
         return GNTST_general_error;
@@ -4188,7 +4188,7 @@ static int replace_grant_va_mapping(
         return GNTST_general_error;
     }
 
-    if ( !get_page_from_pagenr(gl1mfn, current->domain) )
+    if ( !get_page_from_mfn(_mfn(gl1mfn), current->domain) )
     {
         rc = GNTST_general_error;
         goto out;
@@ -4357,7 +4357,7 @@ int replace_grant_host_mapping(
         return GNTST_general_error;
     }
 
-    if ( !get_page_from_pagenr(gl1mfn, current->domain) )
+    if ( !get_page_from_mfn(_mfn(gl1mfn), current->domain) )
     {
         guest_unmap_l1e(pl1e);
         return GNTST_general_error;
@@ -4528,7 +4528,7 @@ static int __do_update_va_mapping(
 
     rc = -EINVAL;
     pl1e = guest_map_l1e(va, &gl1mfn);
-    if ( unlikely(!pl1e || !get_page_from_pagenr(gl1mfn, d)) )
+    if ( unlikely(!pl1e || !get_page_from_mfn(_mfn(gl1mfn), d)) )
         goto out;
 
     gl1pg = mfn_to_page(gl1mfn);
@@ -4900,7 +4900,7 @@ int xenmem_add_to_physmap_one(
                 put_gfn(d, gfn);
                 return -ENOMEM;
             }
-            if ( !get_page_from_pagenr(idx, d) )
+            if ( !get_page_from_mfn(_mfn(idx), d) )
                 break;
             mfn = idx;
             page = mfn_to_page(mfn);
@@ -5440,7 +5440,7 @@ int ptwr_do_page_fault(struct vcpu *v, unsigned long addr,
     /* We are looking only for read-only mappings of p.t. pages. */
     if ( ((l1e_get_flags(pte) & (_PAGE_PRESENT|_PAGE_RW)) != _PAGE_PRESENT) ||
          rangeset_contains_singleton(mmio_ro_ranges, l1e_get_pfn(pte)) ||
-         !get_page_from_pagenr(l1e_get_pfn(pte), d) )
+         !get_page_from_mfn(_mfn(l1e_get_pfn(pte)), d) )
         goto bail;
 
     page = l1e_get_page(pte);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.