Skip to contentSkip to conversation

xen: arm64: save/restore domain type

RFC PATCH In review Chenxiao Zhao 1 participant 1 message Aug 5, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 4/4 xen: arm64: save/restore domain type

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.

xen/arch/arm/hvm.c +4 -0
index 3073b17..4702f60 100644
@@ -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;
xen/include/public/arch-arm/hvm/save.h +4 -0
index 80330dc..68b6136 100644
@@ -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
[email protected]
https://lists.xen.org/xen-devel