Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
lapic.c File Reference
#include <linux/kvm_host.h>
#include <linux/kvm.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/smp.h>
#include <linux/hrtimer.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/math64.h>
#include <linux/slab.h>
#include <asm/processor.h>
#include <asm/msr.h>
#include <asm/page.h>
#include <asm/current.h>
#include <asm/apicdef.h>
#include <linux/atomic.h>
#include <linux/jump_label.h>
#include "kvm_cache_regs.h"
#include "irq.h"
#include "trace.h"
#include "x86.h"
#include "cpuid.h"

Go to the source code of this file.

Macros

#define mod_64(x, y)   ((x) - (y) * div64_u64(x, y))
 
#define PRId64   "d"
 
#define PRIx64   "llx"
 
#define PRIu64   "u"
 
#define PRIo64   "o"
 
#define APIC_BUS_CYCLE_NS   1
 
#define apic_debug(fmt, arg...)
 
#define APIC_LVT_NUM   6
 
#define APIC_VERSION   (0x14UL | ((APIC_LVT_NUM - 1) << 16))
 
#define LAPIC_MMIO_LENGTH   (1 << 12)
 
#define APIC_SHORT_MASK   0xc0000
 
#define APIC_DEST_NOSHORT   0x0
 
#define APIC_DEST_MASK   0x800
 
#define MAX_APIC_VECTOR   256
 
#define APIC_VECTORS_PER_REG   32
 
#define VEC_POS(v)   ((v) & (32 - 1))
 
#define REG_POS(v)   (((v) >> 5) << 4)
 
#define LVT_MASK   (APIC_LVT_MASKED | APIC_SEND_PENDING | APIC_VECTOR_MASK)
 
#define LINT_MASK
 

Functions

 module_param (min_timer_period_us, uint, S_IRUGO|S_IWUSR)
 
void kvm_apic_set_version (struct kvm_vcpu *vcpu)
 
int kvm_lapic_find_highest_irr (struct kvm_vcpu *vcpu)
 
int kvm_apic_set_irq (struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq)
 
int kvm_apic_match_physical_addr (struct kvm_lapic *apic, u16 dest)
 
int kvm_apic_match_logical_addr (struct kvm_lapic *apic, u8 mda)
 
int kvm_apic_match_dest (struct kvm_vcpu *vcpu, struct kvm_lapic *source, int short_hand, int dest, int dest_mode)
 
bool kvm_irq_delivery_to_apic_fast (struct kvm *kvm, struct kvm_lapic *src, struct kvm_lapic_irq *irq, int *r)
 
int kvm_apic_compare_prio (struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2)
 
void kvm_lapic_set_eoi (struct kvm_vcpu *vcpu)
 
 EXPORT_SYMBOL_GPL (kvm_lapic_set_eoi)
 
void kvm_free_lapic (struct kvm_vcpu *vcpu)
 
u64 kvm_get_lapic_tscdeadline_msr (struct kvm_vcpu *vcpu)
 
void kvm_set_lapic_tscdeadline_msr (struct kvm_vcpu *vcpu, u64 data)
 
void kvm_lapic_set_tpr (struct kvm_vcpu *vcpu, unsigned long cr8)
 
u64 kvm_lapic_get_cr8 (struct kvm_vcpu *vcpu)
 
void kvm_lapic_set_base (struct kvm_vcpu *vcpu, u64 value)
 
void kvm_lapic_reset (struct kvm_vcpu *vcpu)
 
int apic_has_pending_timer (struct kvm_vcpu *vcpu)
 
int kvm_apic_local_deliver (struct kvm_lapic *apic, int lvt_type)
 
void kvm_apic_nmi_wd_deliver (struct kvm_vcpu *vcpu)
 
int kvm_create_lapic (struct kvm_vcpu *vcpu)
 
int kvm_apic_has_interrupt (struct kvm_vcpu *vcpu)
 
int kvm_apic_accept_pic_intr (struct kvm_vcpu *vcpu)
 
void kvm_inject_apic_timer_irqs (struct kvm_vcpu *vcpu)
 
int kvm_get_apic_interrupt (struct kvm_vcpu *vcpu)
 
void kvm_apic_post_state_restore (struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
 
void __kvm_migrate_apic_timer (struct kvm_vcpu *vcpu)
 
void kvm_lapic_sync_from_vapic (struct kvm_vcpu *vcpu)
 
void kvm_lapic_sync_to_vapic (struct kvm_vcpu *vcpu)
 
void kvm_lapic_set_vapic_addr (struct kvm_vcpu *vcpu, gpa_t vapic_addr)
 
int kvm_x2apic_msr_write (struct kvm_vcpu *vcpu, u32 msr, u64 data)
 
int kvm_x2apic_msr_read (struct kvm_vcpu *vcpu, u32 msr, u64 *data)
 
int kvm_hv_vapic_msr_write (struct kvm_vcpu *vcpu, u32 reg, u64 data)
 
int kvm_hv_vapic_msr_read (struct kvm_vcpu *vcpu, u32 reg, u64 *data)
 
int kvm_lapic_enable_pv_eoi (struct kvm_vcpu *vcpu, u64 data)
 
void kvm_lapic_init (void)
 

Variables

struct static_key_deferred
apic_hw_disabled 
__read_mostly
 

Macro Definition Documentation

#define APIC_BUS_CYCLE_NS   1

Definition at line 55 of file lapic.c.

#define apic_debug (   fmt,
  arg... 
)

Definition at line 58 of file lapic.c.

#define APIC_DEST_MASK   0x800

Definition at line 67 of file lapic.c.

#define APIC_DEST_NOSHORT   0x0

Definition at line 66 of file lapic.c.

#define APIC_LVT_NUM   6

Definition at line 60 of file lapic.c.

#define APIC_SHORT_MASK   0xc0000

Definition at line 65 of file lapic.c.

#define APIC_VECTORS_PER_REG   32

Definition at line 69 of file lapic.c.

#define APIC_VERSION   (0x14UL | ((APIC_LVT_NUM - 1) << 16))

Definition at line 62 of file lapic.c.

#define LAPIC_MMIO_LENGTH   (1 << 12)

Definition at line 63 of file lapic.c.

#define LINT_MASK
Value:

Definition at line 139 of file lapic.c.

#define LVT_MASK   (APIC_LVT_MASKED | APIC_SEND_PENDING | APIC_VECTOR_MASK)

Definition at line 136 of file lapic.c.

#define MAX_APIC_VECTOR   256

Definition at line 68 of file lapic.c.

#define mod_64 (   x,
  y 
)    ((x) - (y) * div64_u64(x, y))

Definition at line 45 of file lapic.c.

#define PRId64   "d"

Definition at line 50 of file lapic.c.

#define PRIo64   "o"

Definition at line 53 of file lapic.c.

#define PRIu64   "u"

Definition at line 52 of file lapic.c.

#define PRIx64   "llx"

Definition at line 51 of file lapic.c.

#define REG_POS (   v)    (((v) >> 5) << 4)

Definition at line 72 of file lapic.c.

#define VEC_POS (   v)    ((v) & (32 - 1))

Definition at line 71 of file lapic.c.

Function Documentation

void __kvm_migrate_apic_timer ( struct kvm_vcpu vcpu)

Definition at line 1583 of file lapic.c.

int apic_has_pending_timer ( struct kvm_vcpu vcpu)

Definition at line 1393 of file lapic.c.

EXPORT_SYMBOL_GPL ( kvm_lapic_set_eoi  )
int kvm_apic_accept_pic_intr ( struct kvm_vcpu vcpu)

Definition at line 1520 of file lapic.c.

int kvm_apic_compare_prio ( struct kvm_vcpu vcpu1,
struct kvm_vcpu vcpu2 
)

Definition at line 738 of file lapic.c.

int kvm_apic_has_interrupt ( struct kvm_vcpu vcpu)

Definition at line 1504 of file lapic.c.

int kvm_apic_local_deliver ( struct kvm_lapic apic,
int  lvt_type 
)

Definition at line 1404 of file lapic.c.

int kvm_apic_match_dest ( struct kvm_vcpu vcpu,
struct kvm_lapic source,
int  short_hand,
int  dest,
int  dest_mode 
)

Definition at line 542 of file lapic.c.

int kvm_apic_match_logical_addr ( struct kvm_lapic apic,
u8  mda 
)

Definition at line 511 of file lapic.c.

int kvm_apic_match_physical_addr ( struct kvm_lapic apic,
u16  dest 
)

Definition at line 506 of file lapic.c.

void kvm_apic_nmi_wd_deliver ( struct kvm_vcpu vcpu)

Definition at line 1418 of file lapic.c.

void kvm_apic_post_state_restore ( struct kvm_vcpu vcpu,
struct kvm_lapic_state s 
)

Definition at line 1560 of file lapic.c.

int kvm_apic_set_irq ( struct kvm_vcpu vcpu,
struct kvm_lapic_irq irq 
)

Definition at line 405 of file lapic.c.

void kvm_apic_set_version ( struct kvm_vcpu vcpu)

Definition at line 281 of file lapic.c.

int kvm_create_lapic ( struct kvm_vcpu vcpu)

Definition at line 1460 of file lapic.c.

void kvm_free_lapic ( struct kvm_vcpu vcpu)

Definition at line 1215 of file lapic.c.

int kvm_get_apic_interrupt ( struct kvm_vcpu vcpu)

Definition at line 1546 of file lapic.c.

u64 kvm_get_lapic_tscdeadline_msr ( struct kvm_vcpu vcpu)

Definition at line 1242 of file lapic.c.

int kvm_hv_vapic_msr_read ( struct kvm_vcpu vcpu,
u32  reg,
u64 data 
)

Definition at line 1756 of file lapic.c.

int kvm_hv_vapic_msr_write ( struct kvm_vcpu vcpu,
u32  reg,
u64  data 
)

Definition at line 1743 of file lapic.c.

void kvm_inject_apic_timer_irqs ( struct kvm_vcpu vcpu)

Definition at line 1533 of file lapic.c.

bool kvm_irq_delivery_to_apic_fast ( struct kvm kvm,
struct kvm_lapic src,
struct kvm_lapic_irq irq,
int r 
)

Definition at line 580 of file lapic.c.

int kvm_lapic_enable_pv_eoi ( struct kvm_vcpu vcpu,
u64  data 
)

Definition at line 1774 of file lapic.c.

int kvm_lapic_find_highest_irr ( struct kvm_vcpu vcpu)

Definition at line 386 of file lapic.c.

u64 kvm_lapic_get_cr8 ( struct kvm_vcpu vcpu)

Definition at line 1277 of file lapic.c.

void kvm_lapic_init ( void  )

Definition at line 1787 of file lapic.c.

void kvm_lapic_reset ( struct kvm_vcpu vcpu)

Definition at line 1326 of file lapic.c.

void kvm_lapic_set_base ( struct kvm_vcpu vcpu,
u64  value 
)

Definition at line 1289 of file lapic.c.

void kvm_lapic_set_eoi ( struct kvm_vcpu vcpu)

Definition at line 1208 of file lapic.c.

void kvm_lapic_set_tpr ( struct kvm_vcpu vcpu,
unsigned long  cr8 
)

Definition at line 1266 of file lapic.c.

void kvm_lapic_set_vapic_addr ( struct kvm_vcpu vcpu,
gpa_t  vapic_addr 
)

Definition at line 1702 of file lapic.c.

void kvm_lapic_sync_from_vapic ( struct kvm_vcpu vcpu)

Definition at line 1632 of file lapic.c.

void kvm_lapic_sync_to_vapic ( struct kvm_vcpu vcpu)

Definition at line 1676 of file lapic.c.

void kvm_set_lapic_tscdeadline_msr ( struct kvm_vcpu vcpu,
u64  data 
)

Definition at line 1253 of file lapic.c.

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

Definition at line 1725 of file lapic.c.

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

Definition at line 1711 of file lapic.c.

module_param ( min_timer_period_us  ,
uint  ,
S_IRUGO S_IWUSR 
)

Variable Documentation

Definition at line 117 of file lapic.c.