Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
vmx.c File Reference
#include "irq.h"
#include "mmu.h"
#include "cpuid.h"
#include <linux/kvm_host.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/sched.h>
#include <linux/moduleparam.h>
#include <linux/mod_devicetable.h>
#include <linux/ftrace_event.h>
#include <linux/slab.h>
#include <linux/tboot.h>
#include "kvm_cache_regs.h"
#include "x86.h"
#include <asm/io.h>
#include <asm/desc.h>
#include <asm/vmx.h>
#include <asm/virtext.h>
#include <asm/mce.h>
#include <asm/i387.h>
#include <asm/xcr.h>
#include <asm/perf_event.h>
#include "trace.h"

Go to the source code of this file.

Data Structures

struct  vmcs
 
struct  loaded_vmcs
 
struct  shared_msr_entry
 
struct  vmcs12
 
struct  vmcs02_list
 
struct  nested_vmx
 
struct  vcpu_vmx
 
struct  vcpu_vmx::msr_autoload
 
struct  vmcs_config
 
struct  vmx_capability
 
struct  kvm_vmx_segment_field
 

Macros

#define __ex(x)   __kvm_handle_fault_on_reboot(x)
 
#define __ex_clear(x, reg)   ____kvm_handle_fault_on_reboot(x, "xor " reg " , " reg)
 
#define KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST   (X86_CR0_WP | X86_CR0_NE | X86_CR0_NW | X86_CR0_CD)
 
#define KVM_GUEST_CR0_MASK   (KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)
 
#define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST   (X86_CR0_WP | X86_CR0_NE)
 
#define KVM_VM_CR0_ALWAYS_ON   (KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)
 
#define KVM_CR4_GUEST_OWNED_BITS
 
#define KVM_PMODE_VM_CR4_ALWAYS_ON   (X86_CR4_PAE | X86_CR4_VMXE)
 
#define KVM_RMODE_VM_CR4_ALWAYS_ON   (X86_CR4_VME | X86_CR4_PAE | X86_CR4_VMXE)
 
#define RMODE_GUEST_OWNED_EFLAGS_BITS   (~(X86_EFLAGS_IOPL | X86_EFLAGS_VM))
 
#define KVM_VMX_DEFAULT_PLE_GAP   128
 
#define KVM_VMX_DEFAULT_PLE_WINDOW   4096
 
#define NR_AUTOLOAD_MSRS   8
 
#define VMCS02_POOL_SIZE   1
 
#define VMCS12_REVISION   0x11e57ed0
 
#define VMCS12_SIZE   0x1000
 
#define VMCS12_OFFSET(x)   offsetof(struct vmcs12, x)
 
#define FIELD(number, name)   [number] = VMCS12_OFFSET(name)
 
#define FIELD64(number, name)
 
#define VMX_SEGMENT_FIELD(seg)
 
#define NR_VMX_MSR   ARRAY_SIZE(vmx_msr_index)
 
#define VMXON_CR0_ALWAYSON   (X86_CR0_PE | X86_CR0_PG | X86_CR0_NE)
 
#define VMXON_CR4_ALWAYSON   X86_CR4_VMXE
 

Typedefs

typedef u64 natural_width
 

Enumerations

enum  segment_cache_field {
  SEG_FIELD_SEL = 0, SEG_FIELD_BASE = 1, SEG_FIELD_LIMIT = 2, SEG_FIELD_AR = 3,
  SEG_FIELD_NR = 4
}
 
enum  vmcs_field_type { VMCS_FIELD_TYPE_U16 = 0, VMCS_FIELD_TYPE_U64 = 1, VMCS_FIELD_TYPE_U32 = 2, VMCS_FIELD_TYPE_NATURAL_WIDTH = 3 }
 

Functions

 MODULE_AUTHOR ("Qumranet")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DEVICE_TABLE (x86cpu, vmx_cpu_id)
 
 module_param_named (vpid, enable_vpid, bool, 0444)
 
 module_param_named (flexpriority, flexpriority_enabled, bool, S_IRUGO)
 
 module_param_named (ept, enable_ept, bool, S_IRUGO)
 
 module_param_named (unrestricted_guest, enable_unrestricted_guest, bool, S_IRUGO)
 
 module_param_named (eptad, enable_ept_ad_bits, bool, S_IRUGO)
 
 module_param (emulate_invalid_guest_state, bool, S_IRUGO)
 
 module_param (vmm_exclusive, bool, S_IRUGO)
 
 module_param (fasteoi, bool, S_IRUGO)
 
 module_param (nested, bool, S_IRUGO)
 
 module_param (ple_gap, int, S_IRUGO)
 
 module_param (ple_window, int, S_IRUGO)
 
u64 vmx_read_l1_tsc (struct kvm_vcpu *vcpu)
 
void prepare_vmcs12 (struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
 
void load_vmcs12_host_state (struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
 

Variables

const ulong vmx_return
 

Macro Definition Documentation

#define __ex (   x)    __kvm_handle_fault_on_reboot(x)

Definition at line 48 of file vmx.c.

#define __ex_clear (   x,
  reg 
)    ____kvm_handle_fault_on_reboot(x, "xor " reg " , " reg)

Definition at line 49 of file vmx.c.

#define FIELD (   number,
  name 
)    [number] = VMCS12_OFFSET(name)

Definition at line 451 of file vmx.c.

#define FIELD64 (   number,
  name 
)
Value:

Definition at line 452 of file vmx.c.

#define KVM_CR4_GUEST_OWNED_BITS
Value:

Definition at line 102 of file vmx.c.

#define KVM_GUEST_CR0_MASK   (KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)

Definition at line 96 of file vmx.c.

#define KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST   (X86_CR0_WP | X86_CR0_NE | X86_CR0_NW | X86_CR0_CD)

Definition at line 94 of file vmx.c.

#define KVM_PMODE_VM_CR4_ALWAYS_ON   (X86_CR4_PAE | X86_CR4_VMXE)

Definition at line 106 of file vmx.c.

#define KVM_RMODE_VM_CR4_ALWAYS_ON   (X86_CR4_VME | X86_CR4_PAE | X86_CR4_VMXE)

Definition at line 107 of file vmx.c.

#define KVM_VM_CR0_ALWAYS_ON   (KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)

Definition at line 100 of file vmx.c.

#define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST   (X86_CR0_WP | X86_CR0_NE)

Definition at line 98 of file vmx.c.

#define KVM_VMX_DEFAULT_PLE_GAP   128

Definition at line 122 of file vmx.c.

#define KVM_VMX_DEFAULT_PLE_WINDOW   4096

Definition at line 123 of file vmx.c.

#define NR_AUTOLOAD_MSRS   8

Definition at line 132 of file vmx.c.

#define NR_VMX_MSR   ARRAY_SIZE(vmx_msr_index)

Definition at line 701 of file vmx.c.

#define RMODE_GUEST_OWNED_EFLAGS_BITS   (~(X86_EFLAGS_IOPL | X86_EFLAGS_VM))

Definition at line 109 of file vmx.c.

#define VMCS02_POOL_SIZE   1

Definition at line 133 of file vmx.c.

#define VMCS12_OFFSET (   x)    offsetof(struct vmcs12, x)

Definition at line 450 of file vmx.c.

#define VMCS12_REVISION   0x11e57ed0

Definition at line 326 of file vmx.c.

#define VMCS12_SIZE   0x1000

Definition at line 333 of file vmx.c.

#define VMX_SEGMENT_FIELD (   seg)
Value:
[VCPU_SREG_##seg] = { \
.selector = GUEST_##seg##_SELECTOR, \
.base = GUEST_##seg##_BASE, \
.limit = GUEST_##seg##_LIMIT, \
.ar_bytes = GUEST_##seg##_AR_BYTES, \
}

Definition at line 663 of file vmx.c.

#define VMXON_CR0_ALWAYSON   (X86_CR0_PE | X86_CR0_PG | X86_CR0_NE)
#define VMXON_CR4_ALWAYSON   X86_CR4_VMXE

Typedef Documentation

typedef u64 natural_width

Definition at line 172 of file vmx.c.

Enumeration Type Documentation

Enumerator:
SEG_FIELD_SEL 
SEG_FIELD_BASE 
SEG_FIELD_LIMIT 
SEG_FIELD_AR 
SEG_FIELD_NR 

Definition at line 436 of file vmx.c.

Enumerator:
VMCS_FIELD_TYPE_U16 
VMCS_FIELD_TYPE_U64 
VMCS_FIELD_TYPE_U32 
VMCS_FIELD_TYPE_NATURAL_WIDTH 

Definition at line 5384 of file vmx.c.

Function Documentation

void load_vmcs12_host_state ( struct kvm_vcpu vcpu,
struct vmcs12 vmcs12 
)

Definition at line 7083 of file vmx.c.

MODULE_AUTHOR ( "Qumranet"  )
MODULE_DEVICE_TABLE ( x86cpu  ,
vmx_cpu_id   
)
MODULE_LICENSE ( "GPL"  )
module_param ( emulate_invalid_guest_state  ,
bool  ,
S_IRUGO   
)
module_param ( vmm_exclusive  ,
bool  ,
S_IRUGO   
)
module_param ( fasteoi  ,
bool  ,
S_IRUGO   
)
module_param ( nested  ,
bool  ,
S_IRUGO   
)
module_param ( ple_gap  ,
int  ,
S_IRUGO   
)
module_param ( ple_window  ,
int  ,
S_IRUGO   
)
module_param_named ( vpid  ,
enable_vpid  ,
bool  ,
0444   
)
module_param_named ( flexpriority  ,
flexpriority_enabled  ,
bool  ,
S_IRUGO   
)
module_param_named ( ept  ,
enable_ept  ,
bool  ,
S_IRUGO   
)
module_param_named ( unrestricted_guest  ,
enable_unrestricted_guest  ,
bool  ,
S_IRUGO   
)
module_param_named ( eptad  ,
enable_ept_ad_bits  ,
bool  ,
S_IRUGO   
)
void prepare_vmcs12 ( struct kvm_vcpu vcpu,
struct vmcs12 vmcs12 
)

Definition at line 6992 of file vmx.c.

u64 vmx_read_l1_tsc ( struct kvm_vcpu vcpu)

Definition at line 1842 of file vmx.c.

Variable Documentation

const ulong vmx_return