ia64/xen-unstable

changeset 12270:ad8f0e049d63

[SVM] Strip down svm_do_launch() pending complete removal.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Mon Nov 06 20:47:10 2006 +0000 (2006-11-06)
parents 81c451bd398e
children f95c943adbeb
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Mon Nov 06 20:23:08 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Mon Nov 06 20:47:10 2006 +0000
     1.3 @@ -751,6 +751,8 @@ static int svm_vcpu_initialise(struct vc
     1.4      v->arch.ctxt_switch_from = svm_ctxt_switch_from;
     1.5      v->arch.ctxt_switch_to   = svm_ctxt_switch_to;
     1.6  
     1.7 +    v->arch.hvm_svm.saved_irq_vector = -1;
     1.8 +
     1.9      if ( (rc = svm_create_vmcb(v)) != 0 )
    1.10      {
    1.11          dprintk(XENLOG_WARNING,
    1.12 @@ -2503,7 +2505,6 @@ asmlinkage void svm_vmexit_handler(struc
    1.13      exit_reason = vmcb->exitcode;
    1.14      save_svm_cpu_user_regs(v, regs);
    1.15  
    1.16 -    vmcb->tlb_control = 1;
    1.17      v->arch.hvm_svm.inject_event = 0;
    1.18  
    1.19      if (exit_reason == VMEXIT_INVALID)
     2.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Mon Nov 06 20:23:08 2006 +0000
     2.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Mon Nov 06 20:47:10 2006 +0000
     2.3 @@ -93,6 +93,9 @@ static int construct_vmcb(struct vcpu *v
     2.4      segment_attributes_t attrib;
     2.5      unsigned long dr7;
     2.6  
     2.7 +    /* Always flush the TLB on VMRUN. */
     2.8 +    vmcb->tlb_control = 1;
     2.9 +
    2.10      /* SVM intercepts. */
    2.11      vmcb->general1_intercepts = 
    2.12          GENERAL1_INTERCEPT_INTR         | GENERAL1_INTERCEPT_NMI         |
    2.13 @@ -137,6 +140,9 @@ static int construct_vmcb(struct vcpu *v
    2.14      /* TSC. */
    2.15      vmcb->tsc_offset = 0;
    2.16      
    2.17 +    /* Guest EFER: *must* contain SVME or VMRUN will fail. */
    2.18 +    vmcb->efer = EFER_SVME;
    2.19 +
    2.20      /* Guest segment limits. */
    2.21      vmcb->cs.limit = GUEST_SEGMENT_LIMIT;
    2.22      vmcb->es.limit = GUEST_SEGMENT_LIMIT;
    2.23 @@ -178,11 +184,10 @@ static int construct_vmcb(struct vcpu *v
    2.24      vmcb->gdtr.limit = 0;
    2.25  
    2.26      /* Guest LDT. */
    2.27 -    attrib.fields.s = 0;      /* not code or data segement */
    2.28 -    attrib.fields.type = 0x2; /* LDT */
    2.29 -    attrib.fields.db = 0;     /* 16-bit */
    2.30 -    attrib.fields.g = 0;
    2.31 -    vmcb->ldtr.attributes = attrib;
    2.32 +    vmcb->ldtr.sel = 0;
    2.33 +    vmcb->ldtr.base = 0;
    2.34 +    vmcb->ldtr.limit = 0;
    2.35 +    vmcb->ldtr.attributes.bytes = 0;
    2.36  
    2.37      /* Guest TSS. */
    2.38      attrib.fields.type = 0xb; /* 32-bit TSS (busy) */
    2.39 @@ -203,6 +208,9 @@ static int construct_vmcb(struct vcpu *v
    2.40      __asm__ __volatile__ ("mov %%dr7, %0\n" : "=r" (dr7));
    2.41      vmcb->dr7 = dr7;
    2.42  
    2.43 +    shadow_update_paging_modes(v);
    2.44 +    vmcb->cr3 = v->arch.hvm_vcpu.hw_cr3; 
    2.45 +
    2.46      arch_svm->vmcb->exception_intercepts = MONITOR_DEFAULT_EXCEPTION_BITMAP;
    2.47  
    2.48      return 0;
    2.49 @@ -263,7 +271,6 @@ void svm_do_launch(struct vcpu *v)
    2.50      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
    2.51      int core = smp_processor_id();
    2.52  
    2.53 -    /* Update CR3, GDT, LDT, TR */
    2.54      hvm_stts(v);
    2.55  
    2.56      /* current core is the one we intend to perform the VMRUN on */
    2.57 @@ -272,51 +279,9 @@ void svm_do_launch(struct vcpu *v)
    2.58      if ( !asidpool_assign_next(vmcb, 0, core, core) )
    2.59          BUG();
    2.60  
    2.61 -    vmcb->ldtr.sel = 0;
    2.62 -    vmcb->ldtr.base = 0;
    2.63 -    vmcb->ldtr.limit = 0;
    2.64 -    vmcb->ldtr.attributes.bytes = 0;
    2.65 -
    2.66 -    vmcb->efer = EFER_SVME; /* Make sure VMRUN won't return with -1 */
    2.67 -    
    2.68 -    if ( svm_dbg_on )
    2.69 -    {
    2.70 -        unsigned long pt;
    2.71 -        printk("%s: hw_cr3 = %llx\n", __func__, 
    2.72 -               (unsigned long long) v->arch.hvm_vcpu.hw_cr3);
    2.73 -        pt = pagetable_get_paddr(v->arch.guest_table);
    2.74 -        printk("%s: guest_table  = %lx\n", __func__, pt);
    2.75 -        pt = pagetable_get_paddr(v->domain->arch.phys_table);
    2.76 -        printk("%s: phys_table   = %lx\n", __func__, pt);
    2.77 -    }
    2.78 -
    2.79 -    /* Set cr3 from hw_cr3 even when guest-visible paging is not enabled */
    2.80 -    vmcb->cr3 = v->arch.hvm_vcpu.hw_cr3; 
    2.81 -
    2.82 -    if ( svm_dbg_on )
    2.83 -    {
    2.84 -        printk("%s: cr3 = %lx ", __func__, (unsigned long)vmcb->cr3);
    2.85 -        printk("init_guest_table: guest_table = 0x%08x, "
    2.86 -               "monitor_table = 0x%08x, hw_cr3 = 0x%16llx\n",
    2.87 -               (int)v->arch.guest_table.pfn, 
    2.88 -               (int)v->arch.monitor_table.pfn, 
    2.89 -               (unsigned long long)v->arch.hvm_vcpu.hw_cr3);
    2.90 -    }
    2.91 -
    2.92      v->arch.schedule_tail = arch_svm_do_resume;
    2.93 -
    2.94 -    v->arch.hvm_svm.saved_irq_vector = -1;
    2.95 -
    2.96 -    hvm_set_guest_time(v, 0);
    2.97 -
    2.98 -    if (svm_dbg_on)
    2.99 -        svm_dump_vmcb(__func__, vmcb);
   2.100 -
   2.101 -    vmcb->tlb_control = 1;
   2.102  }
   2.103  
   2.104 -
   2.105 -
   2.106  static void svm_dump_sel(char *name, segment_selector_t *s)
   2.107  {
   2.108      printk("%s: sel=0x%04x, attr=0x%04x, limit=0x%08x, base=0x%016llx\n", 
   2.109 @@ -324,7 +289,6 @@ static void svm_dump_sel(char *name, seg
   2.110             (unsigned long long)s->base);
   2.111  }
   2.112  
   2.113 -
   2.114  void svm_dump_vmcb(const char *from, struct vmcb_struct *vmcb)
   2.115  {
   2.116      printk("Dumping guest's current state at %s...\n", from);