direct-io.hg

changeset 14313:b46a92ba0b61

[SVM] Don't free HSA and root vmcb when disabling SVM
since we're no longer allowed to free pages in an interrupt context.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Mar 09 11:45:19 2007 +0000 (2007-03-09)
parents c75d1acd18c8
children 101a1ccfc3f7
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c xen/include/asm-x86/hvm/svm/vmcb.h
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Fri Mar 09 11:14:03 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Fri Mar 09 11:45:19 2007 +0000
     1.3 @@ -107,22 +107,10 @@ static inline void svm_inject_exception(
     1.4  static void stop_svm(void)
     1.5  {
     1.6      u32 eax, edx;    
     1.7 -    int cpu = smp_processor_id();
     1.8 -
     1.9      /* We turn off the EFER_SVME bit. */
    1.10      rdmsr(MSR_EFER, eax, edx);
    1.11      eax &= ~EFER_SVME;
    1.12      wrmsr(MSR_EFER, eax, edx);
    1.13 - 
    1.14 -    /* release the HSA */
    1.15 -    free_host_save_area(hsa[cpu]);
    1.16 -    hsa[cpu] = NULL;
    1.17 -    wrmsr(MSR_K8_VM_HSAVE_PA, 0, 0 );
    1.18 -
    1.19 -    /* free up the root vmcb */
    1.20 -    free_vmcb(root_vmcb[cpu]);
    1.21 -    root_vmcb[cpu] = NULL;
    1.22 -    root_vmcb_pa[cpu] = 0;
    1.23  }
    1.24  
    1.25  static void svm_store_cpu_guest_regs(
    1.26 @@ -1058,8 +1046,9 @@ int start_svm(void)
    1.27          return 0;
    1.28      }
    1.29  
    1.30 -    if (!(hsa[cpu] = alloc_host_save_area()))
    1.31 -        return 0;
    1.32 +    if (!hsa[cpu])
    1.33 +        if (!(hsa[cpu] = alloc_host_save_area()))
    1.34 +            return 0;
    1.35      
    1.36      rdmsr(MSR_EFER, eax, edx);
    1.37      eax |= EFER_SVME;
    1.38 @@ -1074,8 +1063,9 @@ int start_svm(void)
    1.39      phys_hsa_hi = (u32) (phys_hsa >> 32);    
    1.40      wrmsr(MSR_K8_VM_HSAVE_PA, phys_hsa_lo, phys_hsa_hi);
    1.41    
    1.42 -    if (!(root_vmcb[cpu] = alloc_vmcb())) 
    1.43 -        return 0;
    1.44 +    if (!root_vmcb[cpu])
    1.45 +        if (!(root_vmcb[cpu] = alloc_vmcb())) 
    1.46 +            return 0;
    1.47      root_vmcb_pa[cpu] = virt_to_maddr(root_vmcb[cpu]);
    1.48  
    1.49      if (cpu == 0)
     2.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Fri Mar 09 11:14:03 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Fri Mar 09 11:45:19 2007 +0000
     2.3 @@ -79,11 +79,6 @@ struct host_save_area *alloc_host_save_a
     2.4      return hsa;
     2.5  }
     2.6  
     2.7 -void free_host_save_area(struct host_save_area *hsa)
     2.8 -{
     2.9 -    free_xenheap_page(hsa);
    2.10 -}
    2.11 -
    2.12  static int construct_vmcb(struct vcpu *v)
    2.13  {
    2.14      struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
     3.1 --- a/xen/include/asm-x86/hvm/svm/vmcb.h	Fri Mar 09 11:14:03 2007 +0000
     3.2 +++ b/xen/include/asm-x86/hvm/svm/vmcb.h	Fri Mar 09 11:45:19 2007 +0000
     3.3 @@ -460,7 +460,6 @@ struct arch_svm_struct {
     3.4  struct vmcb_struct *alloc_vmcb(void);
     3.5  struct host_save_area *alloc_host_save_area(void);
     3.6  void free_vmcb(struct vmcb_struct *vmcb);
     3.7 -void free_host_save_area(struct host_save_area *hsa);
     3.8  
     3.9  int  svm_create_vmcb(struct vcpu *v);
    3.10  void svm_destroy_vmcb(struct vcpu *v);