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

[Xen-changelog] [xen master] xen/arm: p2m: Clean-up mfn_to_p2m_entry



commit 4b11387906fdcc3ad66de1038699b9293144ab8b
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Wed Jul 20 17:10:47 2016 +0100
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue Jul 26 15:28:27 2016 -0700

    xen/arm: p2m: Clean-up mfn_to_p2m_entry
    
    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@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/p2m.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 79095f1..d82349c 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -327,7 +327,6 @@ static void p2m_set_permission(lpae_t *e, p2m_type_t t, 
p2m_access_t a)
 static lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr,
                                p2m_type_t t, p2m_access_t a)
 {
-    paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
     /*
      * sh, xn and write bit will be defined in the following switches
      * based on mattr and t.
@@ -359,10 +358,9 @@ static lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned 
int mattr,
 
     p2m_set_permission(&e, t, a);
 
-    ASSERT(!(pa & ~PAGE_MASK));
-    ASSERT(!(pa & ~PADDR_MASK));
+    ASSERT(!(pfn_to_paddr(mfn) & ~PADDR_MASK));
 
-    e.bits |= pa;
+    e.p2m.base = mfn;
 
     return e;
 }
--
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®.