xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: julien.grall@citrix.com, tim@xen.org,
	Ian Campbell <ian.campbell@citrix.com>,
	stefano.stabellini@eu.citrix.com
Subject: [PATCH 05/17] xen: arm: precalculate VTTBR_EL2 for a domain when setting up its p2m
Date: Mon, 29 Jul 2013 13:20:54 +0100	[thread overview]
Message-ID: <1375100466-7564-5-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1375100431.14896.95.camel@kazak.uk.xensource.com>

Mostly just to help with upcoming vcpu_show_registers changes.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 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

  parent reply	other threads:[~2013-07-29 12:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 12:20 [PATCH v4 00/17] xen: arm: 64-bit dom0 kernel support Ian Campbell
2013-07-29 12:20 ` [PATCH 01/17] xen: arm: tweak arm64 stack frame layout Ian Campbell
2013-07-29 12:20 ` [PATCH 02/17] xen: arm: rename 32-bit specific zImage field offset constants Ian Campbell
2013-07-29 12:20 ` [PATCH 03/17] xen: arm: support for loading 64-bit zImage dom0 Ian Campbell
2013-07-29 12:20 ` [PATCH 04/17] xen: arm: support building a 64-bit dom0 domain Ian Campbell
2013-07-29 18:29   ` Julien Grall
2013-07-30  9:34     ` Ian Campbell
2013-07-30  9:43       ` Julien Grall
2013-08-02 16:07         ` Ian Campbell
2013-07-29 12:20 ` Ian Campbell [this message]
2013-07-29 12:20 ` [PATCH 06/17] xen: arm: improve register dump output for 64-bit guest (and more generally too) Ian Campbell
2013-07-29 12:53   ` Tim Deegan
2013-07-29 12:20 ` [PATCH 07/17] xen: arm: support dumping 64-bit guest stack Ian Campbell
2013-07-29 12:20 ` [PATCH 08/17] xen: arm: show less words in a line of a stack trace in 64-bit builds Ian Campbell
2013-07-29 12:20 ` [PATCH 09/17] xen: arm: Set EL1 register width in HCR_EL2 during context switch Ian Campbell
2013-07-29 12:20 ` [PATCH 10/17] xen: arm: some cleanups to hypervisor entry code Ian Campbell
2013-07-29 12:56   ` Tim Deegan
2013-07-29 12:21 ` [PATCH 11/17] xen: arm: refactor 64-bit return from trap path Ian Campbell
2013-07-29 13:01   ` Tim Deegan
2013-07-29 12:21 ` [PATCH 12/17] xen: arm: handle traps from 64-bit guests Ian Campbell
2013-07-29 13:49   ` Tim Deegan
2013-07-29 12:21 ` [PATCH 13/17] xen: arm: handle hypercalls " Ian Campbell
2013-07-29 12:21 ` [PATCH 14/17] xen: arm: handle 64-bit system register access traps Ian Campbell
2013-07-29 12:21 ` [PATCH 15/17] xen: arm: align some comments Ian Campbell
2013-07-29 12:21 ` [PATCH 16/17] xen: arm: document HCR bits Ian Campbell
2013-07-29 12:21 ` [PATCH 17/17] xen: arm: Handle SMC from 64-bit guests Ian Campbell
2013-07-29 13:53   ` Tim Deegan
2013-07-29 12:21 ` [PATCH v4 00/17] xen: arm: 64-bit dom0 kernel support Ian Campbell
2013-07-29 15:58 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375100466-7564-5-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).