[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [SVM] Strip down svm_do_launch() pending complete removal.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID ad8f0e049d633eb9c24ed10633e0669352816bd0
# Parent  81c451bd398e950f9df8819ab7fab4b847815c82
[SVM] Strip down svm_do_launch() pending complete removal.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c  |    3 +-
 xen/arch/x86/hvm/svm/vmcb.c |   64 +++++++++-----------------------------------
 2 files changed, 16 insertions(+), 51 deletions(-)

diff -r 81c451bd398e -r ad8f0e049d63 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Mon Nov 06 20:23:08 2006 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon Nov 06 20:47:10 2006 +0000
@@ -750,6 +750,8 @@ static int svm_vcpu_initialise(struct vc
     v->arch.schedule_tail    = arch_svm_do_launch;
     v->arch.ctxt_switch_from = svm_ctxt_switch_from;
     v->arch.ctxt_switch_to   = svm_ctxt_switch_to;
+
+    v->arch.hvm_svm.saved_irq_vector = -1;
 
     if ( (rc = svm_create_vmcb(v)) != 0 )
     {
@@ -2503,7 +2505,6 @@ asmlinkage void svm_vmexit_handler(struc
     exit_reason = vmcb->exitcode;
     save_svm_cpu_user_regs(v, regs);
 
-    vmcb->tlb_control = 1;
     v->arch.hvm_svm.inject_event = 0;
 
     if (exit_reason == VMEXIT_INVALID)
diff -r 81c451bd398e -r ad8f0e049d63 xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Mon Nov 06 20:23:08 2006 +0000
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Mon Nov 06 20:47:10 2006 +0000
@@ -93,6 +93,9 @@ static int construct_vmcb(struct vcpu *v
     segment_attributes_t attrib;
     unsigned long dr7;
 
+    /* Always flush the TLB on VMRUN. */
+    vmcb->tlb_control = 1;
+
     /* SVM intercepts. */
     vmcb->general1_intercepts = 
         GENERAL1_INTERCEPT_INTR         | GENERAL1_INTERCEPT_NMI         |
@@ -137,6 +140,9 @@ static int construct_vmcb(struct vcpu *v
     /* TSC. */
     vmcb->tsc_offset = 0;
     
+    /* Guest EFER: *must* contain SVME or VMRUN will fail. */
+    vmcb->efer = EFER_SVME;
+
     /* Guest segment limits. */
     vmcb->cs.limit = GUEST_SEGMENT_LIMIT;
     vmcb->es.limit = GUEST_SEGMENT_LIMIT;
@@ -178,11 +184,10 @@ static int construct_vmcb(struct vcpu *v
     vmcb->gdtr.limit = 0;
 
     /* Guest LDT. */
-    attrib.fields.s = 0;      /* not code or data segement */
-    attrib.fields.type = 0x2; /* LDT */
-    attrib.fields.db = 0;     /* 16-bit */
-    attrib.fields.g = 0;
-    vmcb->ldtr.attributes = attrib;
+    vmcb->ldtr.sel = 0;
+    vmcb->ldtr.base = 0;
+    vmcb->ldtr.limit = 0;
+    vmcb->ldtr.attributes.bytes = 0;
 
     /* Guest TSS. */
     attrib.fields.type = 0xb; /* 32-bit TSS (busy) */
@@ -203,6 +208,9 @@ static int construct_vmcb(struct vcpu *v
     __asm__ __volatile__ ("mov %%dr7, %0\n" : "=r" (dr7));
     vmcb->dr7 = dr7;
 
+    shadow_update_paging_modes(v);
+    vmcb->cr3 = v->arch.hvm_vcpu.hw_cr3; 
+
     arch_svm->vmcb->exception_intercepts = MONITOR_DEFAULT_EXCEPTION_BITMAP;
 
     return 0;
@@ -263,7 +271,6 @@ void svm_do_launch(struct vcpu *v)
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
     int core = smp_processor_id();
 
-    /* Update CR3, GDT, LDT, TR */
     hvm_stts(v);
 
     /* current core is the one we intend to perform the VMRUN on */
@@ -272,50 +279,8 @@ void svm_do_launch(struct vcpu *v)
     if ( !asidpool_assign_next(vmcb, 0, core, core) )
         BUG();
 
-    vmcb->ldtr.sel = 0;
-    vmcb->ldtr.base = 0;
-    vmcb->ldtr.limit = 0;
-    vmcb->ldtr.attributes.bytes = 0;
-
-    vmcb->efer = EFER_SVME; /* Make sure VMRUN won't return with -1 */
-    
-    if ( svm_dbg_on )
-    {
-        unsigned long pt;
-        printk("%s: hw_cr3 = %llx\n", __func__, 
-               (unsigned long long) v->arch.hvm_vcpu.hw_cr3);
-        pt = pagetable_get_paddr(v->arch.guest_table);
-        printk("%s: guest_table  = %lx\n", __func__, pt);
-        pt = pagetable_get_paddr(v->domain->arch.phys_table);
-        printk("%s: phys_table   = %lx\n", __func__, pt);
-    }
-
-    /* Set cr3 from hw_cr3 even when guest-visible paging is not enabled */
-    vmcb->cr3 = v->arch.hvm_vcpu.hw_cr3; 
-
-    if ( svm_dbg_on )
-    {
-        printk("%s: cr3 = %lx ", __func__, (unsigned long)vmcb->cr3);
-        printk("init_guest_table: guest_table = 0x%08x, "
-               "monitor_table = 0x%08x, hw_cr3 = 0x%16llx\n",
-               (int)v->arch.guest_table.pfn, 
-               (int)v->arch.monitor_table.pfn, 
-               (unsigned long long)v->arch.hvm_vcpu.hw_cr3);
-    }
-
     v->arch.schedule_tail = arch_svm_do_resume;
-
-    v->arch.hvm_svm.saved_irq_vector = -1;
-
-    hvm_set_guest_time(v, 0);
-
-    if (svm_dbg_on)
-        svm_dump_vmcb(__func__, vmcb);
-
-    vmcb->tlb_control = 1;
-}
-
-
+}
 
 static void svm_dump_sel(char *name, segment_selector_t *s)
 {
@@ -323,7 +288,6 @@ static void svm_dump_sel(char *name, seg
            name, s->sel, s->attributes.bytes, s->limit,
            (unsigned long long)s->base);
 }
-
 
 void svm_dump_vmcb(const char *from, struct vmcb_struct *vmcb)
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.