ia64/xen-unstable

changeset 16367:8d8d179b9b05

vmx: Enable WBINVD intercepts to avoid real WBINVD for non-vtd guests.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Fri Nov 09 12:59:58 2007 +0000 (2007-11-09)
parents 837f83225153
children afd7d5c96e09
files xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmcs.h xen/include/asm-x86/hvm/vmx/vmx.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Fri Nov 09 12:08:37 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Fri Nov 09 12:59:58 2007 +0000
     1.3 @@ -106,7 +106,8 @@ static void vmx_init_vmcs_config(void)
     1.4      if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
     1.5      {
     1.6          min = 0;
     1.7 -        opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
     1.8 +        opt = (SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
     1.9 +               SECONDARY_EXEC_WBINVD_EXITING);
    1.10          _vmx_secondary_exec_control = adjust_vmx_controls(
    1.11              min, opt, MSR_IA32_VMX_PROCBASED_CTLS2);
    1.12      }
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Nov 09 12:08:37 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Nov 09 12:59:58 2007 +0000
     2.3 @@ -2909,11 +2909,21 @@ asmlinkage void vmx_vmexit_handler(struc
     2.4      }
     2.5  
     2.6      case EXIT_REASON_INVD:
     2.7 +    case EXIT_REASON_WBINVD:
     2.8      {
     2.9 -        inst_len = __get_instruction_length(); /* Safe: INVD */
    2.10 +        inst_len = __get_instruction_length(); /* Safe: INVD, WBINVD */
    2.11          __update_guest_eip(inst_len);
    2.12          if ( !list_empty(&(domain_hvm_iommu(v->domain)->pdev_list)) )
    2.13 +        {
    2.14              wbinvd();
    2.15 +            /* Disable further WBINVD intercepts. */
    2.16 +            if ( (exit_reason == EXIT_REASON_WBINVD) &&
    2.17 +                 (vmx_cpu_based_exec_control &
    2.18 +                  CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) )
    2.19 +                __vmwrite(SECONDARY_VM_EXEC_CONTROL,
    2.20 +                          vmx_secondary_exec_control &
    2.21 +                          ~SECONDARY_EXEC_WBINVD_EXITING);
    2.22 +        }
    2.23          break;
    2.24      }
    2.25  
     3.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h	Fri Nov 09 12:08:37 2007 +0000
     3.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h	Fri Nov 09 12:59:58 2007 +0000
     3.3 @@ -131,6 +131,7 @@ extern u32 vmx_vmexit_control;
     3.4  extern u32 vmx_vmentry_control;
     3.5  
     3.6  #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
     3.7 +#define SECONDARY_EXEC_WBINVD_EXITING           0x00000040
     3.8  extern u32 vmx_secondary_exec_control;
     3.9  
    3.10  extern bool_t cpu_has_vmx_ins_outs_instr_info;
     4.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h	Fri Nov 09 12:08:37 2007 +0000
     4.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Fri Nov 09 12:59:58 2007 +0000
     4.3 @@ -71,18 +71,15 @@ void vmx_vlapic_msr_changed(struct vcpu 
     4.4  #define EXIT_REASON_IO_INSTRUCTION      30
     4.5  #define EXIT_REASON_MSR_READ            31
     4.6  #define EXIT_REASON_MSR_WRITE           32
     4.7 -
     4.8  #define EXIT_REASON_INVALID_GUEST_STATE 33
     4.9  #define EXIT_REASON_MSR_LOADING         34
    4.10 -
    4.11  #define EXIT_REASON_MWAIT_INSTRUCTION   36
    4.12  #define EXIT_REASON_MONITOR_INSTRUCTION 39
    4.13  #define EXIT_REASON_PAUSE_INSTRUCTION   40
    4.14 -
    4.15  #define EXIT_REASON_MACHINE_CHECK       41
    4.16 -
    4.17  #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
    4.18  #define EXIT_REASON_APIC_ACCESS         44
    4.19 +#define EXIT_REASON_WBINVD              54
    4.20  
    4.21  /*
    4.22   * Interruption-information format