xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 04/04] xen: arm64: save/restore domain type
@ 2016-08-05  2:54 Chenxiao Zhao
  0 siblings, 0 replies; only message in thread
From: Chenxiao Zhao @ 2016-08-05  2:54 UTC (permalink / raw)
  To: xen-devel@lists.xen.org; +Cc: Julien Grall

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-05  2:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05  2:54 [PATCH RFC 04/04] xen: arm64: save/restore domain type Chenxiao Zhao

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).