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

[Xen-changelog] [xen master] xen/arm: p2m: Fold p2m_tlb_flush into p2m_force_tlb_flush_sync



commit 7d66b02639fd2189de310e481e402d2c9d73e5f1
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Tue Dec 12 19:02:09 2017 +0000
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue Dec 12 12:11:49 2017 -0800

    xen/arm: p2m: Fold p2m_tlb_flush into p2m_force_tlb_flush_sync
    
    p2m_tlb_flush is called in 2 places: p2m_alloc_table and
    p2m_force_tlb_flush_sync.
    
    p2m_alloc_table is called when the domain is initialized and could be
    replace by a call to p2m_force_tlb_flush_sync with the P2M write locked.
    
    This seems a bit pointless but would allow to have a single API for
    flushing and avoid misusage in the P2M code.
    
    So update p2m_alloc_table to use p2m_force_tlb_flush_sync and fold
    p2m_tlb_flush in p2m_force_tlb_flush_sync.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/p2m.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 15711a4..22165ae 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -131,11 +131,18 @@ void p2m_restore_state(struct vcpu *n)
     *last_vcpu_ran = n->vcpu_id;
 }
 
-static void p2m_tlb_flush(struct p2m_domain *p2m)
+/*
+ * Force a synchronous P2M TLB flush.
+ *
+ * Must be called with the p2m lock held.
+ */
+static void p2m_force_tlb_flush_sync(struct p2m_domain *p2m)
 {
     unsigned long flags = 0;
     uint64_t ovttbr;
 
+    ASSERT(p2m_is_write_locked(p2m));
+
     /*
      * ARM only provides an instruction to flush TLBs for the current
      * VMID. So switch to the VTTBR of a given P2M if different.
@@ -156,18 +163,7 @@ static void p2m_tlb_flush(struct p2m_domain *p2m)
         isb();
         local_irq_restore(flags);
     }
-}
-
-/*
- * Force a synchronous P2M TLB flush.
- *
- * Must be called with the p2m lock held.
- */
-static void p2m_force_tlb_flush_sync(struct p2m_domain *p2m)
-{
-    ASSERT(p2m_is_write_locked(p2m));
 
-    p2m_tlb_flush(p2m);
     p2m->need_flush = false;
 }
 
@@ -1142,7 +1138,9 @@ static int p2m_alloc_table(struct domain *d)
      * Make sure that all TLBs corresponding to the new VMID are flushed
      * before using it
      */
-    p2m_tlb_flush(p2m);
+    p2m_write_lock(p2m);
+    p2m_force_tlb_flush_sync(p2m);
+    p2m_write_unlock(p2m);
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.