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

[Xen-changelog] [xen master] xen/mm: Alter is_iomem_page() to use mfn_t



commit 2733b800c9a2086d46379d3eb3f480eb5fd433ea
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Feb 6 13:54:03 2017 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Feb 6 16:56:00 2017 +0000

    xen/mm: Alter is_iomem_page() to use mfn_t
    
    Switch its return type to bool to match its use, and simplify the ARM
    implementation slightly.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/arm/mm.c         |  6 ++----
 xen/arch/x86/mm.c         | 10 +++++-----
 xen/arch/x86/mm/p2m.c     |  2 +-
 xen/common/grant_table.c  | 12 ++++++------
 xen/include/asm-arm/p2m.h |  2 +-
 xen/include/asm-x86/mm.h  |  2 +-
 6 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 596283f..fbeed0e 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1349,11 +1349,9 @@ int replace_grant_host_mapping(unsigned long addr, 
unsigned long mfn,
     return GNTST_okay;
 }
 
-int is_iomem_page(unsigned long mfn)
+bool is_iomem_page(mfn_t mfn)
 {
-    if ( !mfn_valid(mfn) )
-        return 1;
-    return 0;
+    return !mfn_valid(mfn_x(mfn));
 }
 
 void clear_and_clean_page(struct page_info *page)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f35e311..f87c08f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -789,15 +789,15 @@ get_##level##_linear_pagetable(                           
                  \
 }
 
 
-int is_iomem_page(unsigned long mfn)
+bool is_iomem_page(mfn_t mfn)
 {
     struct page_info *page;
 
-    if ( !mfn_valid(mfn) )
-        return 1;
+    if ( !mfn_valid(mfn_x(mfn)) )
+        return true;
 
     /* Caller must know that it is an iomem page, or a reference is held. */
-    page = mfn_to_page(mfn);
+    page = mfn_to_page(mfn_x(mfn));
     ASSERT((page->count_info & PGC_count_mask) != 0);
 
     return (page_get_owner(page) == dom_io);
@@ -1209,7 +1209,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain 
*l1e_owner)
     struct domain    *pg_owner;
     struct vcpu      *v;
 
-    if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) || is_iomem_page(pfn) )
+    if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) || is_iomem_page(_mfn(pfn)) )
         return;
 
     page = mfn_to_page(pfn);
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 73d93ee..6548e9f 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1240,7 +1240,7 @@ int p2m_mem_paging_nominate(struct domain *d, unsigned 
long gfn)
         goto out;
 
     /* Check for io memory page */
-    if ( is_iomem_page(mfn_x(mfn)) )
+    if ( is_iomem_page(mfn) )
         goto out;
 
     /* Check page count and type */
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index a425a9e..1b7d236 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1259,7 +1259,7 @@ __gnttab_unmap_common_complete(struct gnttab_unmap_common 
*op)
 
     if ( op->flags & GNTMAP_device_map ) 
     {
-        if ( !is_iomem_page(act->frame) )
+        if ( !is_iomem_page(_mfn(act->frame)) )
         {
             if ( op->flags & GNTMAP_readonly )
                 put_page(pg);
@@ -1279,7 +1279,7 @@ __gnttab_unmap_common_complete(struct gnttab_unmap_common 
*op)
             goto act_release_out;
         }
 
-        if ( !is_iomem_page(op->frame) ) 
+        if ( !is_iomem_page(_mfn(op->frame)) )
         {
             if ( gnttab_host_mapping_get_page_type(op, ld, rd) )
                 put_page_type(pg);
@@ -3314,7 +3314,7 @@ gnttab_release_mappings(
             {
                 BUG_ON(!(act->pin & GNTPIN_devr_mask));
                 act->pin -= GNTPIN_devr_inc;
-                if ( !is_iomem_page(act->frame) )
+                if ( !is_iomem_page(_mfn(act->frame)) )
                     put_page(pg);
             }
 
@@ -3323,7 +3323,7 @@ gnttab_release_mappings(
                 BUG_ON(!(act->pin & GNTPIN_hstr_mask));
                 act->pin -= GNTPIN_hstr_inc;
                 if ( gnttab_release_host_mappings(d) &&
-                     !is_iomem_page(act->frame) )
+                     !is_iomem_page(_mfn(act->frame)) )
                     put_page(pg);
             }
         }
@@ -3333,7 +3333,7 @@ gnttab_release_mappings(
             {
                 BUG_ON(!(act->pin & GNTPIN_devw_mask));
                 act->pin -= GNTPIN_devw_inc;
-                if ( !is_iomem_page(act->frame) )
+                if ( !is_iomem_page(_mfn(act->frame)) )
                     put_page_and_type(pg);
             }
 
@@ -3342,7 +3342,7 @@ gnttab_release_mappings(
                 BUG_ON(!(act->pin & GNTPIN_hstw_mask));
                 act->pin -= GNTPIN_hstw_inc;
                 if ( gnttab_release_host_mappings(d) &&
-                     !is_iomem_page(act->frame) )
+                     !is_iomem_page(_mfn(act->frame)) )
                 {
                     if ( gnttab_host_mapping_get_page_type(map, d, rd) )
                         put_page_type(pg);
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 5ddad34..0905a3f 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -314,7 +314,7 @@ static inline struct page_info *get_page_from_gfn(
 }
 
 int get_page_type(struct page_info *page, unsigned long type);
-int is_iomem_page(unsigned long mfn);
+bool is_iomem_page(mfn_t mfn);
 static inline int get_page_and_type(struct page_info *page,
                                     struct domain *domain,
                                     unsigned long type)
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 93a073d..f0efacb 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -326,7 +326,7 @@ void init_guest_l4_table(l4_pgentry_t[], const struct 
domain *,
 bool_t fill_ro_mpt(unsigned long mfn);
 void zap_ro_mpt(unsigned long mfn);
 
-int is_iomem_page(unsigned long mfn);
+bool is_iomem_page(mfn_t mfn);
 
 void clear_superpage_mark(struct page_info *page);
 
--
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®.