[HVM] save restore: shadow fix
authorTim Deegan <Tim.Deegan@xensource.com>
Thu, 18 Jan 2007 16:48:09 +0000 (16:48 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Thu, 18 Jan 2007 16:48:09 +0000 (16:48 +0000)
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
fix 2 shadow issues:
* restored guest's mem type_info are not correct
* remove annoying warnings when restore

enable smp:
turn on the vcpu when set_vcpu_context in restore as cpu hotplug is not feasible for HVM

xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/multi.c
xen/common/domain.c

index 115ad74d72dace8c4e4b9ba3489dcfb97c27c8f9..609fa6e122cd602f1da49b1c4b510e10d8b6d173 100644 (file)
@@ -2187,7 +2187,7 @@ int sh_remove_all_mappings(struct vcpu *v, mfn_t gmfn)
         /* Don't complain if we're in HVM and there's one extra mapping: 
          * The qemu helper process has an untyped mapping of this dom's RAM */
         if ( !(shadow_mode_external(v->domain)
-               && (page->count_info & PGC_count_mask) <= 2
+               && (page->count_info & PGC_count_mask) <= 3 /* vmx restore add one extra mapping*/
                && (page->u.inuse.type_info & PGT_count_mask) == 0) )
         {
             SHADOW_ERROR("can't find all mappings of mfn %lx: "
index 0546cb1a66eae796f26a4e3f534d46c380b2f23a..6a594682a548436c883df90c009a0dc2ee88b0fb 100644 (file)
@@ -1628,6 +1628,14 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
         }
     }
     
+    {
+        struct page_info *page = mfn_to_page(gmfn);
+        /* XXX: add it to emulate a touched page */
+        if ((page->u.inuse.type_info & PGT_type_mask) == PGT_none){
+            page->u.inuse.type_info |= (PGT_writable_page | PGT_validated);
+        }
+    }
+
     shadow_promote(v, gmfn, shadow_type);
     set_shadow_status(v, gmfn, shadow_type, smfn);
 
index 28530c40d5bb3c2cb0fbd2a9bd6423e4175aebca..de7892d6b57be7e8b692aba390d73b78f1b7a103 100644 (file)
@@ -24,6 +24,7 @@
 #include <xen/percpu.h>
 #include <xen/multicall.h>
 #include <asm/debugger.h>
+#include <asm/hvm/support.h>
 #include <public/sched.h>
 #include <public/vcpu.h>
 #ifdef CONFIG_COMPAT
@@ -505,6 +506,14 @@ int set_info_guest(struct domain *d,
     if ( rc == 0 )
         rc = arch_set_info_guest(v, c);
 
+    /*XXX: hvm smp guest restore support */
+    if ( rc == 0 &&
+            v->vcpu_id != 0 &&
+            is_hvm_vcpu(v) &&
+            test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) {
+        vcpu_wake(v);
+    }
+
     domain_unpause(d);
 
     xfree(c.nat);