]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: mm: Clean-up mfn_to_xen_entry
authorJulien Grall <julien.grall@arm.com>
Tue, 13 Jun 2017 16:13:06 +0000 (17:13 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 15 Jun 2017 23:52:59 +0000 (16:52 -0700)
The physical address is computed from the machine frame number, so
checking if the physical address is page aligned is pointless.

Furthermore, directly assigned the MFN to the corresponding field in the
entry rather than converting to a physical address and orring the value.
It will avoid to rely on the field position and make the code clearer.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c

index 6f63e4315ac3201eafedd697a7200e53fa40bbd6..d164ed2edac266b9adae0c8062941ed2d65a10a7 100644 (file)
@@ -261,7 +261,6 @@ void dump_hyp_walk(vaddr_t addr)
  */
 static inline lpae_t mfn_to_xen_entry(unsigned long mfn, unsigned attr)
 {
-    paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
     lpae_t e = (lpae_t) {
         .pt = {
             .valid = 1,           /* Mappings are present */
@@ -316,11 +315,9 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn, unsigned attr)
         break;
     }
 
-    ASSERT(!(pa & ~PAGE_MASK));
-    ASSERT(!(pa & ~PADDR_MASK));
+    ASSERT(!(pfn_to_paddr(mfn) & ~PADDR_MASK));
 
-    /* XXX shifts */
-    e.bits |= pa;
+    e.pt.base = mfn;
 
     return e;
 }