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

[Xen-changelog] [xen staging] xen/arm: p2m: Introduce a new variable removing_mapping in __p2m_set_entry



commit 1cd5d824c716280db4b5799d9aa64ca2f0730f72
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Mon Jul 16 18:27:10 2018 +0100
Commit:     Julien Grall <julien.grall@xxxxxxx>
CommitDate: Wed Aug 22 16:38:29 2018 +0100

    xen/arm: p2m: Introduce a new variable removing_mapping in __p2m_set_entry
    
    This is making the code slightly easier to understand.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/p2m.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index e0904bcf1d..56b5474625 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -778,6 +778,8 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
     unsigned int target = 3 - (page_order / LPAE_SHIFT);
     lpae_t *entry, *table, orig_pte;
     int rc;
+    /* A mapping is removed if the MFN is invalid. */
+    bool removing_mapping = mfn_eq(smfn, INVALID_MFN);
 
     /* Convenience aliases */
     const unsigned int offsets[4] = {
@@ -803,9 +805,9 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
     {
         /*
          * Don't try to allocate intermediate page table if the mapping
-         * is about to be removed (i.e mfn == INVALID_MFN).
+         * is about to be removed.
          */
-        rc = p2m_next_level(p2m, mfn_eq(smfn, INVALID_MFN),
+        rc = p2m_next_level(p2m, removing_mapping,
                             level, &table, offsets[level]);
         if ( rc == GUEST_TABLE_MAP_FAILED )
         {
@@ -816,7 +818,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
              * when removing a mapping as it may not exist in the
              * page table. In this case, just ignore it.
              */
-            rc = mfn_eq(smfn, INVALID_MFN) ? 0 : -ENOENT;
+            rc = removing_mapping ?  0 : -ENOENT;
             goto out;
         }
         else if ( rc != GUEST_TABLE_NORMAL_PAGE )
@@ -911,7 +913,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
     if ( lpae_is_valid(orig_pte) )
         p2m_remove_pte(entry, p2m->clean_pte);
 
-    if ( mfn_eq(smfn, INVALID_MFN) )
+    if ( removing_mapping )
         /* Flush can be deferred if the entry is removed */
         p2m->need_flush |= !!lpae_is_valid(orig_pte);
     else
--
generated by git-patchbot for /home/xen/git/xen.git#staging

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