xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Chenxiao Zhao <chenxiao.zhao@gmail.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Julien Grall <julien.grall@arm.com>
Subject: [PATCH RFC 04/04] xen: arm64: save/restore domain type
Date: Fri, 5 Aug 2016 10:54:30 +0800	[thread overview]
Message-ID: <a6ede731-6426-7ece-11d7-9c80521e016e@gmail.com> (raw)

On arm64 VM uses d->arch.type to indicate if the domain is 32-bit or 
64-bit. This value is set while parsing kernel image. while restoring 
VCPU state, it will use this value to decide the VCPU type. I can not 
find a proper place to save/restore this value in state file, this is 
surely not a good implementation.

Signed-off-by: Chenxiao Zhao <chenxiao.zhao@gmail.com>

diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index 3073b17..4702f60 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -108,6 +108,7 @@ static int cpu_save(struct domain *d, 
hvm_domain_context_t *h)
              continue;

          memset(&ctxt, 0, sizeof(ctxt));
+       ctxt.is_64bit = is_64bit_domain(d);
          ctxt.sctlr = v->arch.sctlr;
          ctxt.ttbr0 = v->arch.ttbr0;
          ctxt.ttbr1 = v->arch.ttbr1;
@@ -188,6 +189,9 @@ static int cpu_load(struct domain *d, 
hvm_domain_context_t *h)
      if ( hvm_load_entry(VCPU, h, &ctxt) != 0 )
          return -EINVAL;

+    if(ctxt.is_64bit)
+           v->domain->arch.type = DOMAIN_64BIT;
+
      v->arch.sctlr = ctxt.sctlr;
      v->arch.ttbr0 = ctxt.ttbr0;
      v->arch.ttbr1 = ctxt.ttbr1;
diff --git a/xen/include/public/arch-arm/hvm/save.h 
b/xen/include/public/arch-arm/hvm/save.h
index 80330dc..68b6136 100644
--- a/xen/include/public/arch-arm/hvm/save.h
+++ b/xen/include/public/arch-arm/hvm/save.h
@@ -53,6 +53,10 @@ struct hvm_hw_cpu
      uint64_t vfp[66];
  #endif

+#ifdef CONFIG_ARM_64
+    uint32_t is_64bit;
+#endif
+
      /* Guest core registers */
      struct vcpu_guest_core_regs core_regs;

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

                 reply	other threads:[~2016-08-05  2:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=a6ede731-6426-7ece-11d7-9c80521e016e@gmail.com \
    --to=chenxiao.zhao@gmail.com \
    --cc=julien.grall@arm.com \
    --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).