arm: rename gmfn_to_mfn to gfn_to_mfn and use gfn/mfn typesafe
authorJulien Grall <julien.grall@arm.com>
Thu, 23 Jun 2016 15:50:19 +0000 (17:50 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 23 Jun 2016 15:50:19 +0000 (17:50 +0200)
The correct acronym for a guest physical frame is gfn. Also use
the recently introduced typesafe gfn/mfn to avoid mixing the two
different kind of frame.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/p2m.c
xen/common/grant_table.c
xen/common/memory.c
xen/include/asm-arm/p2m.h

index 65d8f1af585ebac782f7373134d315a474f4724f..ab0cb41e036f5a0c8e4759a634c8f705106972de 100644 (file)
@@ -1481,10 +1481,10 @@ int p2m_cache_flush(struct domain *d, xen_pfn_t start_mfn, xen_pfn_t end_mfn)
                              d->arch.p2m.default_access);
 }
 
-unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn)
+mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn)
 {
-    paddr_t p = p2m_lookup(d, pfn_to_paddr(gpfn), NULL);
-    return p >> PAGE_SHIFT;
+    paddr_t p = p2m_lookup(d, pfn_to_paddr(gfn_x(gfn)), NULL);
+    return _mfn(p >> PAGE_SHIFT);
 }
 
 /*
index 8b22299d87b7fe9a057170673644cc5b84901ecd..3c304f4bb84569e0ba20aa60d1127fda63993b48 100644 (file)
@@ -256,7 +256,7 @@ static int __get_paged_frame(unsigned long gfn, unsigned long *frame, struct pag
     }
     *frame = page_to_mfn(*page);
 #else
-    *frame = gmfn_to_mfn(rd, gfn);
+    *frame = mfn_x(gfn_to_mfn(rd, _gfn(gfn)));
     *page = mfn_valid(*frame) ? mfn_to_page(*frame) : NULL;
     if ( (!(*page)) || (!get_page(*page, rd)) )
     {
@@ -1788,7 +1788,7 @@ gnttab_transfer(
                 mfn = INVALID_MFN;
         }
 #else
-        mfn = gmfn_to_mfn(d, gop.mfn);
+        mfn = mfn_x(gfn_to_mfn(d, _gfn(gop.mfn)));
 #endif
 
         /* Check the passed page frame for basic validity. */
index 46b1d9f5126f791358c203d1025903d123d63cd2..b54b076249c755803d4e61bb5c0d1b328fb2db67 100644 (file)
@@ -264,7 +264,7 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
         return 1;
     }
 #else
-    mfn = gmfn_to_mfn(d, gmfn);
+    mfn = mfn_x(gfn_to_mfn(d, _gfn(gmfn)));
 #endif
     if ( unlikely(!mfn_valid(mfn)) )
     {
@@ -488,7 +488,7 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg)
                     goto fail; 
                 }
 #else /* !CONFIG_X86 */
-                mfn = gmfn_to_mfn(d, gmfn + k);
+                mfn = mfn_x(gfn_to_mfn(d, _gfn(gmfn + k)));
 #endif
                 if ( unlikely(!mfn_valid(mfn)) )
                 {
index d240d1e861992a4a4b7529efd9de1eb880b8fe89..75c65a831ce6c471d36b753773302100a5f9e1f9 100644 (file)
@@ -178,7 +178,7 @@ void guest_physmap_remove_page(struct domain *d,
                                unsigned long gpfn,
                                unsigned long mfn, unsigned int page_order);
 
-unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn);
+mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn);
 
 /*
  * Populate-on-demand