Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
x86.c File Reference
#include <linux/kvm_host.h>
#include "irq.h"
#include "mmu.h"
#include "i8254.h"
#include "tss.h"
#include "kvm_cache_regs.h"
#include "x86.h"
#include "cpuid.h"
#include <linux/clocksource.h>
#include <linux/interrupt.h>
#include <linux/kvm.h>
#include <linux/fs.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
#include <linux/mman.h>
#include <linux/highmem.h>
#include <linux/iommu.h>
#include <linux/intel-iommu.h>
#include <linux/cpufreq.h>
#include <linux/user-return-notifier.h>
#include <linux/srcu.h>
#include <linux/slab.h>
#include <linux/perf_event.h>
#include <linux/uaccess.h>
#include <linux/hash.h>
#include <linux/pci.h>
#include <trace/events/kvm.h>
#include "trace.h"
#include <asm/debugreg.h>
#include <asm/msr.h>
#include <asm/desc.h>
#include <asm/mtrr.h>
#include <asm/mce.h>
#include <asm/i387.h>
#include <asm/fpu-internal.h>
#include <asm/xcr.h>
#include <asm/pvclock.h>
#include <asm/div64.h>

Go to the source code of this file.

Data Structures

struct  kvm_shared_msrs_global
 
struct  kvm_shared_msrs
 
struct  kvm_shared_msrs::kvm_shared_msr_values
 
struct  read_write_emulator_ops
 

Macros

#define CREATE_TRACE_POINTS
 
#define MAX_IO_MSRS   256
 
#define KVM_MAX_MCE_BANKS   32
 
#define KVM_MCE_CAP_SUPPORTED   (MCG_CTL_P | MCG_SER_P)
 
#define emul_to_vcpu(ctxt)   container_of(ctxt, struct kvm_vcpu, arch.emulate_ctxt)
 
#define VM_STAT(x)   offsetof(struct kvm, stat.x), KVM_STAT_VM
 
#define VCPU_STAT(x)   offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
 
#define KVM_NR_SHARED_MSRS   16
 
#define EXCPT_BENIGN   0
 
#define EXCPT_CONTRIBUTORY   1
 
#define EXCPT_PF   2
 
#define KVM_SAVE_MSRS_BEGIN   10
 
#define CMPXCHG_TYPE(t, ptr, old, new)   (cmpxchg((t *)(ptr), *(t *)(old), *(t *)(new)) == *(t *)(old))
 
#define CMPXCHG64(ptr, old, new)   (cmpxchg64((u64 *)(ptr), *(u64 *)(old), *(u64 *)(new)) == *(u64 *)(old))
 

Functions

 EXPORT_SYMBOL_GPL (kvm_x86_ops)
 
 module_param (ignore_msrs, bool, S_IRUGO|S_IWUSR)
 
 EXPORT_SYMBOL_GPL (kvm_has_tsc_control)
 
 EXPORT_SYMBOL_GPL (kvm_max_guest_tsc_khz)
 
 module_param (tsc_tolerance_ppm, uint, S_IRUGO|S_IWUSR)
 
int emulator_fix_hypercall (struct x86_emulate_ctxt *ctxt)
 
void kvm_define_shared_msr (unsigned slot, u32 msr)
 
 EXPORT_SYMBOL_GPL (kvm_define_shared_msr)
 
void kvm_set_shared_msr (unsigned slot, u64 value, u64 mask)
 
 EXPORT_SYMBOL_GPL (kvm_set_shared_msr)
 
u64 kvm_get_apic_base (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_get_apic_base)
 
void kvm_set_apic_base (struct kvm_vcpu *vcpu, u64 data)
 
 EXPORT_SYMBOL_GPL (kvm_set_apic_base)
 
void kvm_queue_exception (struct kvm_vcpu *vcpu, unsigned nr)
 
 EXPORT_SYMBOL_GPL (kvm_queue_exception)
 
void kvm_requeue_exception (struct kvm_vcpu *vcpu, unsigned nr)
 
 EXPORT_SYMBOL_GPL (kvm_requeue_exception)
 
void kvm_complete_insn_gp (struct kvm_vcpu *vcpu, int err)
 
 EXPORT_SYMBOL_GPL (kvm_complete_insn_gp)
 
void kvm_inject_page_fault (struct kvm_vcpu *vcpu, struct x86_exception *fault)
 
 EXPORT_SYMBOL_GPL (kvm_inject_page_fault)
 
void kvm_propagate_fault (struct kvm_vcpu *vcpu, struct x86_exception *fault)
 
void kvm_inject_nmi (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_inject_nmi)
 
void kvm_queue_exception_e (struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
 
 EXPORT_SYMBOL_GPL (kvm_queue_exception_e)
 
void kvm_requeue_exception_e (struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
 
 EXPORT_SYMBOL_GPL (kvm_requeue_exception_e)
 
bool kvm_require_cpl (struct kvm_vcpu *vcpu, int required_cpl)
 
 EXPORT_SYMBOL_GPL (kvm_require_cpl)
 
int kvm_read_guest_page_mmu (struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, gfn_t ngfn, void *data, int offset, int len, u32 access)
 
 EXPORT_SYMBOL_GPL (kvm_read_guest_page_mmu)
 
int kvm_read_nested_guest_page (struct kvm_vcpu *vcpu, gfn_t gfn, void *data, int offset, int len, u32 access)
 
int load_pdptrs (struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
 
 EXPORT_SYMBOL_GPL (load_pdptrs)
 
int kvm_set_cr0 (struct kvm_vcpu *vcpu, unsigned long cr0)
 
 EXPORT_SYMBOL_GPL (kvm_set_cr0)
 
void kvm_lmsw (struct kvm_vcpu *vcpu, unsigned long msw)
 
 EXPORT_SYMBOL_GPL (kvm_lmsw)
 
int __kvm_set_xcr (struct kvm_vcpu *vcpu, u32 index, u64 xcr)
 
int kvm_set_xcr (struct kvm_vcpu *vcpu, u32 index, u64 xcr)
 
 EXPORT_SYMBOL_GPL (kvm_set_xcr)
 
int kvm_set_cr4 (struct kvm_vcpu *vcpu, unsigned long cr4)
 
 EXPORT_SYMBOL_GPL (kvm_set_cr4)
 
int kvm_set_cr3 (struct kvm_vcpu *vcpu, unsigned long cr3)
 
 EXPORT_SYMBOL_GPL (kvm_set_cr3)
 
int kvm_set_cr8 (struct kvm_vcpu *vcpu, unsigned long cr8)
 
 EXPORT_SYMBOL_GPL (kvm_set_cr8)
 
unsigned long kvm_get_cr8 (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_get_cr8)
 
int kvm_set_dr (struct kvm_vcpu *vcpu, int dr, unsigned long val)
 
 EXPORT_SYMBOL_GPL (kvm_set_dr)
 
int kvm_get_dr (struct kvm_vcpu *vcpu, int dr, unsigned long *val)
 
 EXPORT_SYMBOL_GPL (kvm_get_dr)
 
bool kvm_rdpmc (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_rdpmc)
 
void kvm_enable_efer_bits (u64 mask)
 
 EXPORT_SYMBOL_GPL (kvm_enable_efer_bits)
 
int kvm_set_msr (struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
 
void kvm_write_tsc (struct kvm_vcpu *vcpu, u64 data)
 
 EXPORT_SYMBOL_GPL (kvm_write_tsc)
 
int kvm_set_msr_common (struct kvm_vcpu *vcpu, u32 msr, u64 data)
 
 EXPORT_SYMBOL_GPL (kvm_set_msr_common)
 
int kvm_get_msr (struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
 
int kvm_get_msr_common (struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
 
 EXPORT_SYMBOL_GPL (kvm_get_msr_common)
 
int kvm_dev_ioctl_check_extension (long ext)
 
long kvm_arch_dev_ioctl (struct file *filp, unsigned int ioctl, unsigned long arg)
 
void kvm_arch_vcpu_load (struct kvm_vcpu *vcpu, int cpu)
 
void kvm_arch_vcpu_put (struct kvm_vcpu *vcpu)
 
long kvm_arch_vcpu_ioctl (struct file *filp, unsigned int ioctl, unsigned long arg)
 
int kvm_arch_vcpu_fault (struct kvm_vcpu *vcpu, struct vm_fault *vmf)
 
int kvm_vm_ioctl_get_dirty_log (struct kvm *kvm, struct kvm_dirty_log *log)
 
int kvm_vm_ioctl_irq_line (struct kvm *kvm, struct kvm_irq_level *irq_event)
 
long kvm_arch_vm_ioctl (struct file *filp, unsigned int ioctl, unsigned long arg)
 
void kvm_get_segment (struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg)
 
gpa_t translate_nested_gpa (struct kvm_vcpu *vcpu, gpa_t gpa, u32 access)
 
gpa_t kvm_mmu_gva_to_gpa_read (struct kvm_vcpu *vcpu, gva_t gva, struct x86_exception *exception)
 
gpa_t kvm_mmu_gva_to_gpa_fetch (struct kvm_vcpu *vcpu, gva_t gva, struct x86_exception *exception)
 
gpa_t kvm_mmu_gva_to_gpa_write (struct kvm_vcpu *vcpu, gva_t gva, struct x86_exception *exception)
 
gpa_t kvm_mmu_gva_to_gpa_system (struct kvm_vcpu *vcpu, gva_t gva, struct x86_exception *exception)
 
int kvm_read_guest_virt (struct x86_emulate_ctxt *ctxt, gva_t addr, void *val, unsigned int bytes, struct x86_exception *exception)
 
 EXPORT_SYMBOL_GPL (kvm_read_guest_virt)
 
int kvm_write_guest_virt_system (struct x86_emulate_ctxt *ctxt, gva_t addr, void *val, unsigned int bytes, struct x86_exception *exception)
 
 EXPORT_SYMBOL_GPL (kvm_write_guest_virt_system)
 
int emulator_write_phys (struct kvm_vcpu *vcpu, gpa_t gpa, const void *val, int bytes)
 
int emulator_read_write (struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, struct x86_exception *exception, const struct read_write_emulator_ops *ops)
 
int emulator_write_emulated (struct x86_emulate_ctxt *ctxt, unsigned long addr, const void *val, unsigned int bytes, struct x86_exception *exception)
 
int kvm_emulate_wbinvd (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_emulate_wbinvd)
 
int emulator_get_dr (struct x86_emulate_ctxt *ctxt, int dr, unsigned long *dest)
 
int emulator_set_dr (struct x86_emulate_ctxt *ctxt, int dr, unsigned long value)
 
int kvm_inject_realmode_interrupt (struct kvm_vcpu *vcpu, int irq, int inc_eip)
 
 EXPORT_SYMBOL_GPL (kvm_inject_realmode_interrupt)
 
int x86_emulate_instruction (struct kvm_vcpu *vcpu, unsigned long cr2, int emulation_type, void *insn, int insn_len)
 
 EXPORT_SYMBOL_GPL (x86_emulate_instruction)
 
int kvm_fast_pio_out (struct kvm_vcpu *vcpu, int size, unsigned short port)
 
 EXPORT_SYMBOL_GPL (kvm_fast_pio_out)
 
int kvm_is_in_guest (void)
 
void kvm_before_handle_nmi (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_before_handle_nmi)
 
void kvm_after_handle_nmi (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_after_handle_nmi)
 
int kvm_arch_init (void *opaque)
 
void kvm_arch_exit (void)
 
int kvm_emulate_halt (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_emulate_halt)
 
int kvm_hv_hypercall (struct kvm_vcpu *vcpu)
 
int kvm_emulate_hypercall (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_emulate_hypercall)
 
int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 
int kvm_arch_vcpu_ioctl_get_regs (struct kvm_vcpu *vcpu, struct kvm_regs *regs)
 
int kvm_arch_vcpu_ioctl_set_regs (struct kvm_vcpu *vcpu, struct kvm_regs *regs)
 
void kvm_get_cs_db_l_bits (struct kvm_vcpu *vcpu, int *db, int *l)
 
 EXPORT_SYMBOL_GPL (kvm_get_cs_db_l_bits)
 
int kvm_arch_vcpu_ioctl_get_sregs (struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 
int kvm_arch_vcpu_ioctl_get_mpstate (struct kvm_vcpu *vcpu, struct kvm_mp_state *mp_state)
 
int kvm_arch_vcpu_ioctl_set_mpstate (struct kvm_vcpu *vcpu, struct kvm_mp_state *mp_state)
 
int kvm_task_switch (struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code)
 
 EXPORT_SYMBOL_GPL (kvm_task_switch)
 
int kvm_arch_vcpu_ioctl_set_sregs (struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 
int kvm_arch_vcpu_ioctl_set_guest_debug (struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg)
 
int kvm_arch_vcpu_ioctl_translate (struct kvm_vcpu *vcpu, struct kvm_translation *tr)
 
int kvm_arch_vcpu_ioctl_get_fpu (struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 
int kvm_arch_vcpu_ioctl_set_fpu (struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 
int fx_init (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (fx_init)
 
void kvm_load_guest_fpu (struct kvm_vcpu *vcpu)
 
void kvm_put_guest_fpu (struct kvm_vcpu *vcpu)
 
void kvm_arch_vcpu_free (struct kvm_vcpu *vcpu)
 
struct kvm_vcpukvm_arch_vcpu_create (struct kvm *kvm, unsigned int id)
 
int kvm_arch_vcpu_setup (struct kvm_vcpu *vcpu)
 
void kvm_arch_vcpu_destroy (struct kvm_vcpu *vcpu)
 
int kvm_arch_vcpu_reset (struct kvm_vcpu *vcpu)
 
int kvm_arch_hardware_enable (void *garbage)
 
void kvm_arch_hardware_disable (void *garbage)
 
int kvm_arch_hardware_setup (void)
 
void kvm_arch_hardware_unsetup (void)
 
void kvm_arch_check_processor_compat (void *rtn)
 
bool kvm_vcpu_compatible (struct kvm_vcpu *vcpu)
 
int kvm_arch_vcpu_init (struct kvm_vcpu *vcpu)
 
void kvm_arch_vcpu_uninit (struct kvm_vcpu *vcpu)
 
int kvm_arch_init_vm (struct kvm *kvm, unsigned long type)
 
void kvm_arch_sync_events (struct kvm *kvm)
 
void kvm_arch_destroy_vm (struct kvm *kvm)
 
void kvm_arch_free_memslot (struct kvm_memory_slot *free, struct kvm_memory_slot *dont)
 
int kvm_arch_create_memslot (struct kvm_memory_slot *slot, unsigned long npages)
 
int kvm_arch_prepare_memory_region (struct kvm *kvm, struct kvm_memory_slot *memslot, struct kvm_memory_slot old, struct kvm_userspace_memory_region *mem, int user_alloc)
 
void kvm_arch_commit_memory_region (struct kvm *kvm, struct kvm_userspace_memory_region *mem, struct kvm_memory_slot old, int user_alloc)
 
void kvm_arch_flush_shadow_all (struct kvm *kvm)
 
void kvm_arch_flush_shadow_memslot (struct kvm *kvm, struct kvm_memory_slot *slot)
 
int kvm_arch_vcpu_runnable (struct kvm_vcpu *vcpu)
 
int kvm_arch_vcpu_should_kick (struct kvm_vcpu *vcpu)
 
int kvm_arch_interrupt_allowed (struct kvm_vcpu *vcpu)
 
bool kvm_is_linear_rip (struct kvm_vcpu *vcpu, unsigned long linear_rip)
 
 EXPORT_SYMBOL_GPL (kvm_is_linear_rip)
 
unsigned long kvm_get_rflags (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_get_rflags)
 
void kvm_set_rflags (struct kvm_vcpu *vcpu, unsigned long rflags)
 
 EXPORT_SYMBOL_GPL (kvm_set_rflags)
 
void kvm_arch_async_page_ready (struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
 
bool kvm_find_async_pf_gfn (struct kvm_vcpu *vcpu, gfn_t gfn)
 
void kvm_arch_async_page_not_present (struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
 
void kvm_arch_async_page_present (struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
 
bool kvm_arch_can_inject_async_page_present (struct kvm_vcpu *vcpu)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_exit)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_inj_virq)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_page_fault)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_msr)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_cr)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_nested_vmrun)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_nested_vmexit)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_nested_vmexit_inject)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_nested_intr_vmexit)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_invlpga)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_skinit)
 
 EXPORT_TRACEPOINT_SYMBOL_GPL (kvm_nested_intercepts)
 

Variables

struct kvm_x86_opskvm_x86_ops
 
bool kvm_has_tsc_control
 
u32 kvm_max_guest_tsc_khz
 
struct kvm_stats_debugfs_item debugfs_entries []
 
u64 __read_mostly host_xcr0
 
unsigned long max_tsc_khz
 
struct static_key kvm_no_apic_vcpu __read_mostly
 

Macro Definition Documentation

#define CMPXCHG64 (   ptr,
  old,
  new 
)    (cmpxchg64((u64 *)(ptr), *(u64 *)(old), *(u64 *)(new)) == *(u64 *)(old))

Definition at line 3920 of file x86.c.

#define CMPXCHG_TYPE (   t,
  ptr,
  old,
  new 
)    (cmpxchg((t *)(ptr), *(t *)(old), *(t *)(new)) == *(t *)(old))

Definition at line 3914 of file x86.c.

#define CREATE_TRACE_POINTS

Definition at line 51 of file x86.c.

#define emul_to_vcpu (   ctxt)    container_of(ctxt, struct kvm_vcpu, arch.emulate_ctxt)

Definition at line 69 of file x86.c.

#define EXCPT_BENIGN   0

Definition at line 260 of file x86.c.

#define EXCPT_CONTRIBUTORY   1

Definition at line 261 of file x86.c.

#define EXCPT_PF   2

Definition at line 262 of file x86.c.

#define KVM_MAX_MCE_BANKS   32

Definition at line 66 of file x86.c.

#define KVM_MCE_CAP_SUPPORTED   (MCG_CTL_P | MCG_SER_P)

Definition at line 67 of file x86.c.

#define KVM_NR_SHARED_MSRS   16

Definition at line 104 of file x86.c.

#define KVM_SAVE_MSRS_BEGIN   10

Definition at line 812 of file x86.c.

#define MAX_IO_MSRS   256

Definition at line 65 of file x86.c.

#define VCPU_STAT (   x)    offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU

Definition at line 84 of file x86.c.

#define VM_STAT (   x)    offsetof(struct kvm, stat.x), KVM_STAT_VM

Definition at line 83 of file x86.c.

Function Documentation

int __kvm_set_xcr ( struct kvm_vcpu vcpu,
u32  index,
u64  xcr 
)

Definition at line 547 of file x86.c.

int emulator_fix_hypercall ( struct x86_emulate_ctxt ctxt)

Definition at line 5062 of file x86.c.

int emulator_get_dr ( struct x86_emulate_ctxt ctxt,
int  dr,
unsigned long dest 
)

Definition at line 4094 of file x86.c.

int emulator_read_write ( struct x86_emulate_ctxt ctxt,
unsigned long  addr,
void val,
unsigned int  bytes,
struct x86_exception exception,
const struct read_write_emulator_ops ops 
)

Definition at line 3843 of file x86.c.

int emulator_set_dr ( struct x86_emulate_ctxt ctxt,
int  dr,
unsigned long  value 
)

Definition at line 4099 of file x86.c.

int emulator_write_emulated ( struct x86_emulate_ctxt ctxt,
unsigned long  addr,
const void val,
unsigned int  bytes,
struct x86_exception exception 
)

Definition at line 3904 of file x86.c.

int emulator_write_phys ( struct kvm_vcpu vcpu,
gpa_t  gpa,
const void val,
int  bytes 
)

Definition at line 3716 of file x86.c.

EXPORT_SYMBOL_GPL ( kvm_x86_ops  )
EXPORT_SYMBOL_GPL ( kvm_has_tsc_control  )
EXPORT_SYMBOL_GPL ( kvm_max_guest_tsc_khz  )
EXPORT_SYMBOL_GPL ( kvm_define_shared_msr  )
EXPORT_SYMBOL_GPL ( kvm_set_shared_msr  )
EXPORT_SYMBOL_GPL ( kvm_get_apic_base  )
EXPORT_SYMBOL_GPL ( kvm_set_apic_base  )
EXPORT_SYMBOL_GPL ( kvm_queue_exception  )
EXPORT_SYMBOL_GPL ( kvm_requeue_exception  )
EXPORT_SYMBOL_GPL ( kvm_complete_insn_gp  )
EXPORT_SYMBOL_GPL ( kvm_inject_page_fault  )
EXPORT_SYMBOL_GPL ( kvm_inject_nmi  )
EXPORT_SYMBOL_GPL ( kvm_queue_exception_e  )
EXPORT_SYMBOL_GPL ( kvm_requeue_exception_e  )
EXPORT_SYMBOL_GPL ( kvm_require_cpl  )
EXPORT_SYMBOL_GPL ( kvm_read_guest_page_mmu  )
EXPORT_SYMBOL_GPL ( load_pdptrs  )
EXPORT_SYMBOL_GPL ( kvm_set_cr0  )
EXPORT_SYMBOL_GPL ( kvm_lmsw  )
EXPORT_SYMBOL_GPL ( kvm_set_xcr  )
EXPORT_SYMBOL_GPL ( kvm_set_cr4  )
EXPORT_SYMBOL_GPL ( kvm_set_cr3  )
EXPORT_SYMBOL_GPL ( kvm_set_cr8  )
EXPORT_SYMBOL_GPL ( kvm_get_cr8  )
EXPORT_SYMBOL_GPL ( kvm_set_dr  )
EXPORT_SYMBOL_GPL ( kvm_get_dr  )
EXPORT_SYMBOL_GPL ( kvm_rdpmc  )
EXPORT_SYMBOL_GPL ( kvm_enable_efer_bits  )
EXPORT_SYMBOL_GPL ( kvm_write_tsc  )
EXPORT_SYMBOL_GPL ( kvm_set_msr_common  )
EXPORT_SYMBOL_GPL ( kvm_get_msr_common  )
EXPORT_SYMBOL_GPL ( kvm_read_guest_virt  )
EXPORT_SYMBOL_GPL ( kvm_write_guest_virt_system  )
EXPORT_SYMBOL_GPL ( kvm_emulate_wbinvd  )
EXPORT_SYMBOL_GPL ( kvm_inject_realmode_interrupt  )
EXPORT_SYMBOL_GPL ( x86_emulate_instruction  )
EXPORT_SYMBOL_GPL ( kvm_fast_pio_out  )
EXPORT_SYMBOL_GPL ( kvm_before_handle_nmi  )
EXPORT_SYMBOL_GPL ( kvm_after_handle_nmi  )
EXPORT_SYMBOL_GPL ( kvm_emulate_halt  )
EXPORT_SYMBOL_GPL ( kvm_emulate_hypercall  )
EXPORT_SYMBOL_GPL ( kvm_get_cs_db_l_bits  )
EXPORT_SYMBOL_GPL ( kvm_task_switch  )
EXPORT_SYMBOL_GPL ( fx_init  )
EXPORT_SYMBOL_GPL ( kvm_is_linear_rip  )
EXPORT_SYMBOL_GPL ( kvm_get_rflags  )
EXPORT_SYMBOL_GPL ( kvm_set_rflags  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_exit  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_inj_virq  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_page_fault  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_msr  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_cr  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_nested_vmrun  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_nested_vmexit  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_nested_vmexit_inject  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_nested_intr_vmexit  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_invlpga  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_skinit  )
EXPORT_TRACEPOINT_SYMBOL_GPL ( kvm_nested_intercepts  )
int fx_init ( struct kvm_vcpu vcpu)

Definition at line 5965 of file x86.c.

void kvm_after_handle_nmi ( struct kvm_vcpu vcpu)

Definition at line 4854 of file x86.c.

void kvm_arch_async_page_not_present ( struct kvm_vcpu vcpu,
struct kvm_async_pf *  work 
)

Definition at line 6666 of file x86.c.

void kvm_arch_async_page_present ( struct kvm_vcpu vcpu,
struct kvm_async_pf *  work 
)

Definition at line 6688 of file x86.c.

void kvm_arch_async_page_ready ( struct kvm_vcpu vcpu,
struct kvm_async_pf *  work 
)

Definition at line 6579 of file x86.c.

bool kvm_arch_can_inject_async_page_present ( struct kvm_vcpu vcpu)

Definition at line 6712 of file x86.c.

void kvm_arch_check_processor_compat ( void rtn)

Definition at line 6203 of file x86.c.

void kvm_arch_commit_memory_region ( struct kvm kvm,
struct kvm_userspace_memory_region mem,
struct kvm_memory_slot  old,
int  user_alloc 
)

Definition at line 6479 of file x86.c.

int kvm_arch_create_memslot ( struct kvm_memory_slot slot,
unsigned long  npages 
)

Definition at line 6384 of file x86.c.

void kvm_arch_destroy_vm ( struct kvm kvm)

Definition at line 6350 of file x86.c.

long kvm_arch_dev_ioctl ( struct file filp,
unsigned int  ioctl,
unsigned long  arg 
)

Definition at line 2235 of file x86.c.

void kvm_arch_exit ( void  )

Definition at line 4931 of file x86.c.

void kvm_arch_flush_shadow_all ( struct kvm kvm)

Definition at line 6516 of file x86.c.

void kvm_arch_flush_shadow_memslot ( struct kvm kvm,
struct kvm_memory_slot slot 
)

Definition at line 6522 of file x86.c.

void kvm_arch_free_memslot ( struct kvm_memory_slot free,
struct kvm_memory_slot dont 
)

Definition at line 6363 of file x86.c.

void kvm_arch_hardware_disable ( void garbage)

Definition at line 6187 of file x86.c.

int kvm_arch_hardware_enable ( void garbage)

Definition at line 6098 of file x86.c.

int kvm_arch_hardware_setup ( void  )

Definition at line 6193 of file x86.c.

void kvm_arch_hardware_unsetup ( void  )

Definition at line 6198 of file x86.c.

int kvm_arch_init ( void opaque)

Definition at line 4884 of file x86.c.

int kvm_arch_init_vm ( struct kvm kvm,
unsigned long  type 
)

Definition at line 6292 of file x86.c.

int kvm_arch_interrupt_allowed ( struct kvm_vcpu vcpu)

Definition at line 6544 of file x86.c.

int kvm_arch_prepare_memory_region ( struct kvm kvm,
struct kvm_memory_slot memslot,
struct kvm_memory_slot  old,
struct kvm_userspace_memory_region mem,
int  user_alloc 
)

Definition at line 6442 of file x86.c.

void kvm_arch_sync_events ( struct kvm kvm)

Definition at line 6344 of file x86.c.

struct kvm_vcpu* kvm_arch_vcpu_create ( struct kvm kvm,
unsigned int  id 
)
read

Definition at line 6032 of file x86.c.

void kvm_arch_vcpu_destroy ( struct kvm_vcpu vcpu)

Definition at line 6058 of file x86.c.

int kvm_arch_vcpu_fault ( struct kvm_vcpu vcpu,
struct vm_fault *  vmf 
)

Definition at line 2944 of file x86.c.

void kvm_arch_vcpu_free ( struct kvm_vcpu vcpu)

Definition at line 6023 of file x86.c.

int kvm_arch_vcpu_init ( struct kvm_vcpu vcpu)

Definition at line 6215 of file x86.c.

long kvm_arch_vcpu_ioctl ( struct file filp,
unsigned int  ioctl,
unsigned long  arg 
)

Definition at line 2656 of file x86.c.

int kvm_arch_vcpu_ioctl_get_fpu ( struct kvm_vcpu vcpu,
struct kvm_fpu fpu 
)

Definition at line 5931 of file x86.c.

int kvm_arch_vcpu_ioctl_get_mpstate ( struct kvm_vcpu vcpu,
struct kvm_mp_state mp_state 
)

Definition at line 5741 of file x86.c.

int kvm_arch_vcpu_ioctl_get_regs ( struct kvm_vcpu vcpu,
struct kvm_regs regs 
)

Definition at line 5620 of file x86.c.

int kvm_arch_vcpu_ioctl_get_sregs ( struct kvm_vcpu vcpu,
struct kvm_sregs sregs 
)

Definition at line 5702 of file x86.c.

int kvm_arch_vcpu_ioctl_run ( struct kvm_vcpu vcpu,
struct kvm_run kvm_run 
)

Definition at line 5575 of file x86.c.

int kvm_arch_vcpu_ioctl_set_fpu ( struct kvm_vcpu vcpu,
struct kvm_fpu fpu 
)

Definition at line 5948 of file x86.c.

int kvm_arch_vcpu_ioctl_set_guest_debug ( struct kvm_vcpu vcpu,
struct kvm_guest_debug dbg 
)

Definition at line 5855 of file x86.c.

int kvm_arch_vcpu_ioctl_set_mpstate ( struct kvm_vcpu vcpu,
struct kvm_mp_state mp_state 
)

Definition at line 5748 of file x86.c.

int kvm_arch_vcpu_ioctl_set_regs ( struct kvm_vcpu vcpu,
struct kvm_regs regs 
)

Definition at line 5658 of file x86.c.

int kvm_arch_vcpu_ioctl_set_sregs ( struct kvm_vcpu vcpu,
struct kvm_sregs sregs 
)

Definition at line 5777 of file x86.c.

int kvm_arch_vcpu_ioctl_translate ( struct kvm_vcpu vcpu,
struct kvm_translation tr 
)

Definition at line 5913 of file x86.c.

void kvm_arch_vcpu_load ( struct kvm_vcpu vcpu,
int  cpu 
)

Definition at line 2314 of file x86.c.

void kvm_arch_vcpu_put ( struct kvm_vcpu vcpu)

Definition at line 2355 of file x86.c.

int kvm_arch_vcpu_reset ( struct kvm_vcpu vcpu)

Definition at line 6072 of file x86.c.

int kvm_arch_vcpu_runnable ( struct kvm_vcpu vcpu)

Definition at line 6528 of file x86.c.

int kvm_arch_vcpu_setup ( struct kvm_vcpu vcpu)

Definition at line 6042 of file x86.c.

int kvm_arch_vcpu_should_kick ( struct kvm_vcpu vcpu)

Definition at line 6539 of file x86.c.

void kvm_arch_vcpu_uninit ( struct kvm_vcpu vcpu)

Definition at line 6277 of file x86.c.

long kvm_arch_vm_ioctl ( struct file filp,
unsigned int  ioctl,
unsigned long  arg 
)

Definition at line 3195 of file x86.c.

void kvm_before_handle_nmi ( struct kvm_vcpu vcpu)

Definition at line 4848 of file x86.c.

void kvm_complete_insn_gp ( struct kvm_vcpu vcpu,
int  err 
)

Definition at line 335 of file x86.c.

void kvm_define_shared_msr ( unsigned  slot,
u32  msr 
)

Definition at line 205 of file x86.c.

int kvm_dev_ioctl_check_extension ( long  ext)

Definition at line 2152 of file x86.c.

int kvm_emulate_halt ( struct kvm_vcpu vcpu)

Definition at line 4943 of file x86.c.

int kvm_emulate_hypercall ( struct kvm_vcpu vcpu)

Definition at line 5018 of file x86.c.

int kvm_emulate_wbinvd ( struct kvm_vcpu vcpu)

Definition at line 4070 of file x86.c.

void kvm_enable_efer_bits ( u64  mask)

Definition at line 877 of file x86.c.

int kvm_fast_pio_out ( struct kvm_vcpu vcpu,
int  size,
unsigned short  port 
)

Definition at line 4651 of file x86.c.

bool kvm_find_async_pf_gfn ( struct kvm_vcpu vcpu,
gfn_t  gfn 
)

Definition at line 6631 of file x86.c.

u64 kvm_get_apic_base ( struct kvm_vcpu vcpu)

Definition at line 247 of file x86.c.

unsigned long kvm_get_cr8 ( struct kvm_vcpu vcpu)

Definition at line 686 of file x86.c.

void kvm_get_cs_db_l_bits ( struct kvm_vcpu vcpu,
int db,
int l 
)

Definition at line 5692 of file x86.c.

int kvm_get_dr ( struct kvm_vcpu vcpu,
int  dr,
unsigned long val 
)

Definition at line 778 of file x86.c.

int kvm_get_msr ( struct kvm_vcpu vcpu,
u32  msr_index,
u64 pdata 
)

Definition at line 1796 of file x86.c.

int kvm_get_msr_common ( struct kvm_vcpu vcpu,
u32  msr,
u64 pdata 
)

Definition at line 1923 of file x86.c.

unsigned long kvm_get_rflags ( struct kvm_vcpu vcpu)

Definition at line 6558 of file x86.c.

void kvm_get_segment ( struct kvm_vcpu vcpu,
struct kvm_segment var,
int  seg 
)

Definition at line 3537 of file x86.c.

int kvm_hv_hypercall ( struct kvm_vcpu vcpu)

Definition at line 4956 of file x86.c.

void kvm_inject_nmi ( struct kvm_vcpu vcpu)

Definition at line 360 of file x86.c.

void kvm_inject_page_fault ( struct kvm_vcpu vcpu,
struct x86_exception fault 
)

Definition at line 344 of file x86.c.

int kvm_inject_realmode_interrupt ( struct kvm_vcpu vcpu,
int  irq,
int  inc_eip 
)

Definition at line 4425 of file x86.c.

int kvm_is_in_guest ( void  )

Definition at line 4817 of file x86.c.

bool kvm_is_linear_rip ( struct kvm_vcpu vcpu,
unsigned long  linear_rip 
)

Definition at line 6549 of file x86.c.

void kvm_lmsw ( struct kvm_vcpu vcpu,
unsigned long  msw 
)

Definition at line 541 of file x86.c.

void kvm_load_guest_fpu ( struct kvm_vcpu vcpu)

Definition at line 5991 of file x86.c.

gpa_t kvm_mmu_gva_to_gpa_fetch ( struct kvm_vcpu vcpu,
gva_t  gva,
struct x86_exception exception 
)

Definition at line 3564 of file x86.c.

gpa_t kvm_mmu_gva_to_gpa_read ( struct kvm_vcpu vcpu,
gva_t  gva,
struct x86_exception exception 
)

Definition at line 3557 of file x86.c.

gpa_t kvm_mmu_gva_to_gpa_system ( struct kvm_vcpu vcpu,
gva_t  gva,
struct x86_exception exception 
)

Definition at line 3581 of file x86.c.

gpa_t kvm_mmu_gva_to_gpa_write ( struct kvm_vcpu vcpu,
gva_t  gva,
struct x86_exception exception 
)

Definition at line 3572 of file x86.c.

void kvm_propagate_fault ( struct kvm_vcpu vcpu,
struct x86_exception fault 
)

Definition at line 352 of file x86.c.

void kvm_put_guest_fpu ( struct kvm_vcpu vcpu)

Definition at line 6008 of file x86.c.

void kvm_queue_exception ( struct kvm_vcpu vcpu,
unsigned  nr 
)

Definition at line 323 of file x86.c.

void kvm_queue_exception_e ( struct kvm_vcpu vcpu,
unsigned  nr,
u32  error_code 
)

Definition at line 367 of file x86.c.

bool kvm_rdpmc ( struct kvm_vcpu vcpu)

Definition at line 788 of file x86.c.

int kvm_read_guest_page_mmu ( struct kvm_vcpu vcpu,
struct kvm_mmu mmu,
gfn_t  ngfn,
void data,
int  offset,
int  len,
u32  access 
)

Definition at line 397 of file x86.c.

int kvm_read_guest_virt ( struct x86_emulate_ctxt ctxt,
gva_t  addr,
void val,
unsigned int  bytes,
struct x86_exception exception 
)

Definition at line 3630 of file x86.c.

int kvm_read_nested_guest_page ( struct kvm_vcpu vcpu,
gfn_t  gfn,
void data,
int  offset,
int  len,
u32  access 
)

Definition at line 415 of file x86.c.

void kvm_requeue_exception ( struct kvm_vcpu vcpu,
unsigned  nr 
)

Definition at line 329 of file x86.c.

void kvm_requeue_exception_e ( struct kvm_vcpu vcpu,
unsigned  nr,
u32  error_code 
)

Definition at line 373 of file x86.c.

bool kvm_require_cpl ( struct kvm_vcpu vcpu,
int  required_cpl 
)

Definition at line 383 of file x86.c.

void kvm_set_apic_base ( struct kvm_vcpu vcpu,
u64  data 
)

Definition at line 253 of file x86.c.

int kvm_set_cr0 ( struct kvm_vcpu vcpu,
unsigned long  cr0 
)

Definition at line 487 of file x86.c.

int kvm_set_cr3 ( struct kvm_vcpu vcpu,
unsigned long  cr3 
)

Definition at line 627 of file x86.c.

int kvm_set_cr4 ( struct kvm_vcpu vcpu,
unsigned long  cr4 
)

Definition at line 578 of file x86.c.

int kvm_set_cr8 ( struct kvm_vcpu vcpu,
unsigned long  cr8 
)

Definition at line 674 of file x86.c.

int kvm_set_dr ( struct kvm_vcpu vcpu,
int  dr,
unsigned long  val 
)

Definition at line 739 of file x86.c.

int kvm_set_msr ( struct kvm_vcpu vcpu,
u32  msr_index,
u64  data 
)

Definition at line 889 of file x86.c.

int kvm_set_msr_common ( struct kvm_vcpu vcpu,
u32  msr,
u64  data 
)

Definition at line 1575 of file x86.c.

void kvm_set_rflags ( struct kvm_vcpu vcpu,
unsigned long  rflags 
)

Definition at line 6569 of file x86.c.

void kvm_set_shared_msr ( unsigned  slot,
u64  value,
u64  mask 
)

Definition at line 223 of file x86.c.

int kvm_set_xcr ( struct kvm_vcpu vcpu,
u32  index,
u64  xcr 
)

Definition at line 568 of file x86.c.

int kvm_task_switch ( struct kvm_vcpu vcpu,
u16  tss_selector,
int  idt_index,
int  reason,
bool  has_error_code,
u32  error_code 
)

Definition at line 5756 of file x86.c.

bool kvm_vcpu_compatible ( struct kvm_vcpu vcpu)

Definition at line 6208 of file x86.c.

int kvm_vm_ioctl_get_dirty_log ( struct kvm kvm,
struct kvm_dirty_log log 
)

kvm_vm_ioctl_get_dirty_log - get and clear the log of dirty pages in a slot : kvm instance : slot id and address to which we copy the log

We need to keep it in mind that VCPU threads can write to the bitmap concurrently. So, to avoid losing data, we keep the following order for each bit:

  1. Take a snapshot of the bit and clear it if needed.
  2. Write protect the corresponding page.
  3. Flush TLB's if needed.
  4. Copy the snapshot to the userspace.

Between 2 and 3, the guest may write to the page using the remaining TLB entry. This is not a problem because the page will be reported dirty at step 4 using the snapshot taken before and step 3 ensures that successive writes will be logged for the next call.

Definition at line 3126 of file x86.c.

int kvm_vm_ioctl_irq_line ( struct kvm kvm,
struct kvm_irq_level irq_event 
)

Definition at line 3185 of file x86.c.

int kvm_write_guest_virt_system ( struct x86_emulate_ctxt ctxt,
gva_t  addr,
void val,
unsigned int  bytes,
struct x86_exception exception 
)

Definition at line 3650 of file x86.c.

void kvm_write_tsc ( struct kvm_vcpu vcpu,
u64  data 
)

Definition at line 1049 of file x86.c.

int load_pdptrs ( struct kvm_vcpu vcpu,
struct kvm_mmu mmu,
unsigned long  cr3 
)

Definition at line 425 of file x86.c.

module_param ( ignore_msrs  ,
bool  ,
S_IRUGO S_IWUSR 
)
module_param ( tsc_tolerance_ppm  ,
uint  ,
S_IRUGO S_IWUSR 
)
gpa_t translate_nested_gpa ( struct kvm_vcpu vcpu,
gpa_t  gpa,
u32  access 
)

Definition at line 3543 of file x86.c.

int x86_emulate_instruction ( struct kvm_vcpu vcpu,
unsigned long  cr2,
int  emulation_type,
void insn,
int  insn_len 
)

Definition at line 4553 of file x86.c.

Variable Documentation

Definition at line 6213 of file x86.c.

struct kvm_stats_debugfs_item debugfs_entries[]

Definition at line 123 of file x86.c.

u64 __read_mostly host_xcr0

Definition at line 159 of file x86.c.

bool kvm_has_tsc_control

Definition at line 95 of file x86.c.

u32 kvm_max_guest_tsc_khz

Definition at line 97 of file x86.c.

Definition at line 89 of file x86.c.

unsigned long max_tsc_khz

Definition at line 999 of file x86.c.