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

[Xen-devel] [PATCH 05/17] xen: arm: precalculate VTTBR_EL2 for a domain when setting up its p2m



Mostly just to help with upcoming vcpu_show_registers changes.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/p2m.c           |   16 +++++++++-------
 xen/include/asm-arm/domain.h |    3 +++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 9fc5534..307c6d4 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -23,13 +23,10 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr)
 
 void p2m_load_VTTBR(struct domain *d)
 {
-    struct p2m_domain *p2m = &d->arch.p2m;
-    paddr_t maddr = page_to_maddr(p2m->first_level);
-    uint64_t vttbr = maddr;
-
-    vttbr |= ((uint64_t)p2m->vmid&0xff)<<48;
-
-    WRITE_SYSREG64(vttbr, VTTBR_EL2);
+    if ( is_idle_domain(d) )
+        return;
+    BUG_ON(!d->arch.vttbr);
+    WRITE_SYSREG64(d->arch.vttbr, VTTBR_EL2);
     isb(); /* Ensure update is visible */
 }
 
@@ -301,6 +298,9 @@ int p2m_alloc_table(struct domain *d)
 
     p2m->first_level = page;
 
+    d->arch.vttbr = page_to_maddr(p2m->first_level)
+        | ((uint64_t)p2m->vmid&0xff)<<48;
+
     spin_unlock(&p2m->lock);
 
     return 0;
@@ -332,6 +332,8 @@ int p2m_init(struct domain *d)
     /* Zero is reserved */
     p2m->vmid = d->domain_id + 1;
 
+    d->arch.vttbr = 0;
+
     p2m->first_level = NULL;
 
     return 0;
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 1049282..89f88f6 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -62,7 +62,10 @@ struct arch_domain
     enum domain_type type;
 #endif
 
+    /* Virtual MMU */
     struct p2m_domain p2m;
+    uint64_t vttbr;
+
     struct hvm_domain hvm_domain;
     xen_pfn_t *grant_table_gpfn;
 
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.