ia64/xen-unstable

changeset 17717:21422854b9f8

x86: Fixes to VLAPIC and S3 state resets.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri May 23 11:46:36 2008 +0100 (2008-05-23)
parents 5cc5b9c37c6d
children ef7525e87030
files xen/arch/x86/domain.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vlapic.c xen/common/domain.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Fri May 23 11:15:19 2008 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Fri May 23 11:46:36 2008 +0100
     1.3 @@ -825,8 +825,15 @@ int arch_set_info_guest(
     1.4  
     1.5  void arch_vcpu_reset(struct vcpu *v)
     1.6  {
     1.7 -    destroy_gdt(v);
     1.8 -    vcpu_destroy_pagetables(v);
     1.9 +    if ( !is_hvm_vcpu(v) )
    1.10 +    {
    1.11 +        destroy_gdt(v);
    1.12 +        vcpu_destroy_pagetables(v);
    1.13 +    }
    1.14 +    else
    1.15 +    {
    1.16 +        vcpu_end_shutdown_deferral(v);
    1.17 +    }
    1.18  }
    1.19  
    1.20  /* 
     2.1 --- a/xen/arch/x86/hvm/hvm.c	Fri May 23 11:15:19 2008 +0100
     2.2 +++ b/xen/arch/x86/hvm/hvm.c	Fri May 23 11:46:36 2008 +0100
     2.3 @@ -2123,6 +2123,8 @@ void hvm_vcpu_reset_state(struct vcpu *v
     2.4          v->domain->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset;
     2.5      hvm_funcs.set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset);
     2.6  
     2.7 +    paging_update_paging_modes(v);
     2.8 +
     2.9      v->arch.flags |= TF_kernel_mode;
    2.10      v->is_initialised = 1;
    2.11      clear_bit(_VPF_down, &v->pause_flags);
     3.1 --- a/xen/arch/x86/hvm/vlapic.c	Fri May 23 11:15:19 2008 +0100
     3.2 +++ b/xen/arch/x86/hvm/vlapic.c	Fri May 23 11:46:36 2008 +0100
     3.3 @@ -22,18 +22,19 @@
     3.4  #include <xen/types.h>
     3.5  #include <xen/mm.h>
     3.6  #include <xen/xmalloc.h>
     3.7 +#include <xen/domain.h>
     3.8  #include <xen/domain_page.h>
     3.9 -#include <asm/page.h>
    3.10  #include <xen/event.h>
    3.11  #include <xen/trace.h>
    3.12 +#include <xen/lib.h>
    3.13 +#include <xen/sched.h>
    3.14 +#include <xen/numa.h>
    3.15 +#include <asm/current.h>
    3.16 +#include <asm/page.h>
    3.17  #include <asm/hvm/hvm.h>
    3.18  #include <asm/hvm/io.h>
    3.19  #include <asm/hvm/support.h>
    3.20 -#include <xen/lib.h>
    3.21 -#include <xen/sched.h>
    3.22 -#include <asm/current.h>
    3.23  #include <asm/hvm/vmx/vmx.h>
    3.24 -#include <xen/numa.h>
    3.25  #include <public/hvm/ioreq.h>
    3.26  #include <public/hvm/params.h>
    3.27  
    3.28 @@ -259,6 +260,7 @@ static void vlapic_init_action(unsigned 
    3.29  {
    3.30      struct vcpu *v = (struct vcpu *)_vcpu;
    3.31      struct domain *d = v->domain;
    3.32 +    bool_t fpu_initialised;
    3.33  
    3.34      /* If the VCPU is not on its way down we have nothing to do. */
    3.35      if ( !test_bit(_VPF_down, &v->pause_flags) )
    3.36 @@ -270,15 +272,12 @@ static void vlapic_init_action(unsigned 
    3.37          return;
    3.38      }
    3.39  
    3.40 +    /* Reset necessary VCPU state. This does not include FPU state. */
    3.41      domain_lock(d);
    3.42 -
    3.43 -    /* Paranoia makes us re-assert VPF_down under the domain lock. */
    3.44 -    set_bit(_VPF_down, &v->pause_flags);
    3.45 -    v->is_initialised = 0;
    3.46 -    clear_bit(_VPF_blocked, &v->pause_flags);
    3.47 -
    3.48 +    fpu_initialised = v->fpu_initialised;
    3.49 +    vcpu_reset(v);
    3.50 +    v->fpu_initialised = fpu_initialised;
    3.51      vlapic_reset(vcpu_vlapic(v));
    3.52 -
    3.53      domain_unlock(d);
    3.54  
    3.55      vcpu_unpause(v);
     4.1 --- a/xen/common/domain.c	Fri May 23 11:15:19 2008 +0100
     4.2 +++ b/xen/common/domain.c	Fri May 23 11:46:36 2008 +0100
     4.3 @@ -637,7 +637,7 @@ void vcpu_reset(struct vcpu *v)
     4.4  {
     4.5      struct domain *d = v->domain;
     4.6  
     4.7 -    domain_pause(d);
     4.8 +    vcpu_pause(v);
     4.9      domain_lock(d);
    4.10  
    4.11      arch_vcpu_reset(v);
    4.12 @@ -653,7 +653,7 @@ void vcpu_reset(struct vcpu *v)
    4.13      clear_bit(_VPF_blocked, &v->pause_flags);
    4.14  
    4.15      domain_unlock(v->domain);
    4.16 -    domain_unpause(d);
    4.17 +    vcpu_unpause(v);
    4.18  }
    4.19  
    4.20