Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | arch/x86/kvm/hyperv.c | static void kvm_send_ipi_to_many(struct kvm *kvm, u32 vector,
unsigned long *vcpu_bitmap) {
struct kvm_lapic_irq irq = {.delivery_mode = APIC_DM_FIXED, .vector = vector};
struct kvm_vcpu *vcpu;
unsigned long i;
kvm_for_each_vcpu(i, vcpu, kvm) {
if (vcpu_bitmap && !test_bit(... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/hyperv.c |
static int kvm_hv_hypercall_complete(struct kvm_vcpu *vcpu, u64 result) {
trace_kvm_hv_hypercall_done(result);
kvm_hv_hypercall_set_result(vcpu, result);
++vcpu->stat.hypercalls;
return kvm_skip_emulated_instruction(vcpu);
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/hyperv.h |
static inline u32 kvm_hv_get_vpindex(struct kvm_vcpu *vcpu) {
struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu);
return hv_vcpu ? hv_vcpu->vp_index : vcpu->vcpu_idx;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/hyperv.h |
static inline bool kvm_hv_hypercall_enabled(struct kvm_vcpu *vcpu) {
return vcpu->arch.hyperv_enabled && to_kvm_hv(vcpu->kvm)->hv_guest_os_id;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/hyperv.h |
static inline struct kvm_vcpu_hv_stimer *to_hv_stimer(struct kvm_vcpu *vcpu,
int timer_index) {
return &to_hv_vcpu(vcpu)->stimer[timer_index];
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/hyperv.h |
static inline struct kvm_vcpu *
hv_stimer_to_vcpu(struct kvm_vcpu_hv_stimer *stimer) {
struct kvm_vcpu_hv *hv_vcpu;
hv_vcpu = container_of(stimer - stimer->index, struct kvm_vcpu_hv, stimer[0]);
return hv_vcpu->vcpu;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/hyperv.h |
static inline bool kvm_hv_has_stimer_pending(struct kvm_vcpu *vcpu) {
struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu);
if (!hv_vcpu)
return false;
return !bitmap_empty(hv_vcpu->stimer_pending_bitmap, HV_SYNIC_STIMER_COUNT);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8254.c | static int pit_get_count(struct kvm_pit *pit, int channel) {
struct kvm_kpit_channel_state *c = &pit->pit_state.channels[channel];
s64 d, t;
int counter;
t = kpit_elapsed(pit, c, channel);
d = mul_u64_u32_div(t, KVM_PIT_FREQ, NSEC_PER_SEC);
switch (c->mode) {
case 0:
case 1:
case 4:
case 5:
co... | [
1,
1
] |
Linux Kernel | arch/x86/kvm/i8254.c |
static inline struct kvm_pit *pit_state_to_pit(struct kvm_kpit_state *ps) {
return container_of(ps, struct kvm_pit, pit_state);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8254.c |
static void destroy_pit_timer(struct kvm_pit *pit) {
hrtimer_cancel(&pit->pit_state.timer);
kthread_flush_work(&pit->expired);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8254.c | static void pit_do_work(struct kthread_work *work) {
struct kvm_pit *pit = container_of(work, struct kvm_pit, expired);
struct kvm *kvm = pit->kvm;
struct kvm_vcpu *vcpu;
unsigned long i;
struct kvm_kpit_state *ps = &pit->pit_state;
if (atomic_read(&ps->reinject) && !atomic_xchg(&ps->irq_ack, 0))
retur... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8254.c | void kvm_pit_load_count(struct kvm_pit *pit, int channel, u32 val,
int hpet_legacy_start) {
u8 saved_mode;
WARN_ON_ONCE(!mutex_is_locked(&pit->pit_state.lock));
if (hpet_legacy_start) {
WARN_ON(channel != 0);
saved_mode = pit->pit_state.channels[0].mode;
pit->pit_state.chann... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/i8254.c | static int speaker_ioport_read(struct kvm_vcpu *vcpu,
struct kvm_io_device *this, gpa_t addr, int len,
void *data) {
struct kvm_pit *pit = speaker_to_pit(this);
struct kvm_kpit_state *pit_state = &pit->pit_state;
unsigned int refresh_clock;
int ret;
... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/i8254.c |
static void kvm_pit_reset(struct kvm_pit *pit) {
int i;
struct kvm_kpit_channel_state *c;
pit->pit_state.flags = 0;
for (i = 0; i < 3; i++) {
c = &pit->pit_state.channels[i];
c->mode = 0xff;
c->gate = (i != 2);
pit_load_count(pit, i, 0);
}
kvm_pit_reset_reinject(pit);
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/i8259.c | static inline int get_priority(struct kvm_kpic_state *s, int mask) {
int priority;
if (mask == 0)
return 8;
priority = 0;
while ((mask & (1 << ((priority + s->priority_add) & 7))) == 0)
priority++;
return priority;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8259.c |
void kvm_pic_update_irq(struct kvm_pic *s) {
pic_lock(s);
pic_update_irq(s);
pic_unlock(s);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8259.c |
static int picdev_master_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
gpa_t addr, int len, const void *val) {
return picdev_write(container_of(dev, struct kvm_pic, dev_master), addr, len,
val);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8259.c |
static int picdev_elcr_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
gpa_t addr, int len, const void *val) {
return picdev_write(container_of(dev, struct kvm_pic, dev_elcr), addr, len,
val);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8259.c |
static int picdev_elcr_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
gpa_t addr, int len, void *val) {
return picdev_read(container_of(dev, struct kvm_pic, dev_elcr), addr, len,
val);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/i8259.c | int kvm_pic_init(struct kvm *kvm) {
struct kvm_pic *s;
int ret;
s = kzalloc(sizeof(struct kvm_pic), GFP_KERNEL_ACCOUNT);
if (!s)
return -ENOMEM;
spin_lock_init(&s->lock);
s->kvm = kvm;
s->pics[0].elcr_mask = 0xf8;
s->pics[1].elcr_mask = 0xde;
s->pics[0].pics_state = s;
s->pics[1].pics_state = s... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c |
static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic) {
unsigned long result = 0;
switch (ioapic->ioregsel) {
case IOAPIC_REG_VERSION:
result =
((((IOAPIC_NUM_PINS - 1) & 0xff) << 16) | (IOAPIC_VERSION_ID & 0xff));
break;
case IOAPIC_REG_APIC_ID:
case IOAPIC_REG_ARB_ID:
r... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c |
static void rtc_status_pending_eoi_check_valid(struct kvm_ioapic *ioapic) {
if (WARN_ON(ioapic->rtc_status.pending_eoi < 0))
kvm_rtc_eoi_tracking_restore_all(ioapic);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c |
static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) {
bool new_val, old_val;
struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic;
struct dest_map *dest_map = &ioapic->rtc_status.dest_map;
union kvm_ioapic_redirect_entry *e;
e = &ioapic->redirtbl[RTC_GSI];
if (!kvm_apic_match_dest(vcpu, N... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c | static int ioapic_set_irq(struct kvm_ioapic *ioapic, unsigned int irq,
int irq_level, bool line_status) {
union kvm_ioapic_redirect_entry entry;
u32 mask = 1 << irq;
u32 old_irr;
int edge, ret;
entry = ioapic->redirtbl[irq];
edge = (entry.fields.trig_mode == IOAPIC_EDGE_TRIG);
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c | void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu,
ulong *ioapic_handled_vectors) {
struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic;
struct dest_map *dest_map = &ioapic->rtc_status.dest_map;
union kvm_ioapic_redirect_entry *e;
int index;
spin_lock(&ioapic->lock);
if (test_bit... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c |
static inline struct kvm_ioapic *to_ioapic(struct kvm_io_device *dev) {
return container_of(dev, struct kvm_ioapic, dev);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.c |
int kvm_ioapic_init(struct kvm *kvm) {
struct kvm_ioapic *ioapic;
int ret;
ioapic = kzalloc(sizeof(struct kvm_ioapic), GFP_KERNEL_ACCOUNT);
if (!ioapic)
return -ENOMEM;
spin_lock_init(&ioapic->lock);
INIT_DELAYED_WORK(&ioapic->eoi_inject, kvm_ioapic_eoi_inject_work);
kvm->arch.vioapic = ioapic;
kv... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/ioapic.h |
static inline int ioapic_in_kernel(struct kvm *kvm) {
return irqchip_kernel(kvm);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/irq.c | int kvm_cpu_has_extint(struct kvm_vcpu *v) {
/*
* FIXME: interrupt.injected represents an interrupt whose
* side-effects have already been applied (e.g. bit from IRR
* already moved to ISR). Therefore, it is incorrect to rely
* on interrupt.injected to know if there is a pending
* interrupt in the user... | [
0,
1
] |
Linux Kernel | arch/x86/kvm/irq.c | int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) {
if (kvm_cpu_has_extint(v))
return 1;
if (!is_guest_mode(v) && kvm_vcpu_apicv_active(v))
return 0;
return kvm_apic_has_interrupt(v) != -1;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/irq.c | int kvm_cpu_has_interrupt(struct kvm_vcpu *v) {
if (kvm_cpu_has_extint(v))
return 1;
return kvm_apic_has_interrupt(v) != -1;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/irq.c |
void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu) {
if (lapic_in_kernel(vcpu))
kvm_inject_apic_timer_irqs(vcpu);
if (kvm_xen_timer_enabled(vcpu))
kvm_xen_inject_timer_irqs(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/irq.h | static inline int irqchip_kernel(struct kvm *kvm) {
int mode = kvm->arch.irqchip_mode;
smp_rmb();
return mode == KVM_IRQCHIP_KERNEL;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/irq_comm.c |
static inline bool
kvm_msi_route_invalid(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e) {
return kvm->arch.x2apic_format && (e->msi.address_hi & 0xff);
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/irq_comm.c |
int kvm_request_irq_source_id(struct kvm *kvm) {
unsigned long *bitmap = &kvm->arch.irq_sources_bitmap;
int irq_source_id;
mutex_lock(&kvm->irq_lock);
irq_source_id = find_first_zero_bit(bitmap, BITS_PER_LONG);
if (irq_source_id >= BITS_PER_LONG) {
printk(KERN_WARNING "kvm: exhaust allocatable IRQ sour... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/irq_comm.c |
void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
struct kvm_irq_mask_notifier *kimn) {
mutex_lock(&kvm->irq_lock);
kimn->irq = irq;
hlist_add_head_rcu(&kimn->link, &kvm->arch.mask_notifier_list);
mutex_unlock(&kvm->irq_lock);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/irq_comm.c |
void kvm_arch_post_irq_routing_update(struct kvm *kvm) {
if (!irqchip_split(kvm))
return;
kvm_make_scan_ioapic_request(kvm);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline void kvm_register_mark_available(struct kvm_vcpu *vcpu,
enum kvm_reg reg) {
__set_bit(reg, (unsigned long *)&vcpu->arch.regs_avail);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h | static inline unsigned long kvm_register_read_raw(struct kvm_vcpu *vcpu,
int reg) {
if (WARN_ON_ONCE((unsigned int)reg >= NR_VCPU_REGS))
return 0;
if (!kvm_register_is_available(vcpu, reg))
static_call(kvm_x86_cache_reg)(vcpu, reg);
return vcpu->arch.reg... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline void kvm_register_write_raw(struct kvm_vcpu *vcpu, int reg,
unsigned long val) {
if (WARN_ON_ONCE((unsigned int)reg >= NR_VCPU_REGS))
return;
vcpu->arch.regs[reg] = val;
kvm_register_mark_dirty(vcpu, reg);
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline unsigned long kvm_rip_read(struct kvm_vcpu *vcpu) {
return kvm_register_read_raw(vcpu, VCPU_REGS_RIP);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline unsigned long kvm_rsp_read(struct kvm_vcpu *vcpu) {
return kvm_register_read_raw(vcpu, VCPU_REGS_RSP);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline void kvm_rsp_write(struct kvm_vcpu *vcpu, unsigned long val) {
kvm_register_write_raw(vcpu, VCPU_REGS_RSP, val);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline void kvm_pdptr_write(struct kvm_vcpu *vcpu, int index,
u64 value) {
vcpu->arch.walk_mmu->pdptrs[index] = value;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline ulong kvm_read_cr4(struct kvm_vcpu *vcpu) {
return kvm_read_cr4_bits(vcpu, ~0UL);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline u64 kvm_read_edx_eax(struct kvm_vcpu *vcpu) {
return (kvm_rax_read(vcpu) & -1u) | ((u64)(kvm_rdx_read(vcpu) & -1u) << 32);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_cache_regs.h |
static inline bool is_smm(struct kvm_vcpu *vcpu) {
return vcpu->arch.hflags & HF_SMM_MASK;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_onhyperv.c |
static inline int hv_remote_flush_root_tdp(hpa_t root_tdp,
struct kvm_tlb_range *range) {
if (range)
return hyperv_flush_guest_mapping_range(
root_tdp, kvm_fill_hv_flush_list_func, (void *)range);
else
return hyperv_flush_guest_mapping(root_tdp);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/kvm_onhyperv.c |
int hv_remote_flush_tlb(struct kvm *kvm) {
return hv_remote_flush_tlb_with_range(kvm, NULL);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static inline void kvm_lapic_set_reg(struct kvm_lapic *apic, int reg_off,
u32 val) {
__kvm_lapic_set_reg(apic->regs, reg_off, val);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static __always_inline void __kvm_lapic_set_reg64(char *regs, int reg,
u64 val) {
BUILD_BUG_ON(reg != APIC_ICR);
*((u64 *)(regs + reg)) = val;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static inline int apic_test_vector(int vec, void *bitmap) {
return test_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) {
bool enabled = val & APIC_SPIV_APIC_ENABLED;
kvm_lapic_set_reg(apic, APIC_SPIV, val);
if (enabled != apic->sw_enabled) {
apic->sw_enabled = enabled;
if (enabled)
static_branch_slow_dec_deferred(&apic_sw_disabled);
else
s... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static inline bool kvm_lapic_lvt_supported(struct kvm_lapic *apic,
int lvt_index) {
return apic->nr_lvt_entries > lvt_index;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static inline void apic_clear_irr(int vec, struct kvm_lapic *apic) {
if (unlikely(apic->apicv_active)) {
kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR);
static_call_cond(kvm_x86_hwapic_irr_update)(apic->vcpu,
apic_find_highest_irr(apic));
} else {
api... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
void kvm_apic_clear_irr(struct kvm_vcpu *vcpu, int vec) {
apic_clear_irr(vec, vcpu->arch.apic);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static inline int apic_find_highest_isr(struct kvm_lapic *apic) {
int result;
if (!apic->isr_count)
return -1;
if (likely(apic->highest_isr_cache != -1))
return apic->highest_isr_cache;
result = find_highest_vector(apic->regs + APIC_ISR);
ASSERT(result == -1 || result >= 16);
return result;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu) {
return apic_find_highest_irr(vcpu->arch.apic);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static int __pv_send_ipi(unsigned long *ipi_bitmap, struct kvm_apic_map *map,
struct kvm_lapic_irq *irq, u32 min) {
int i, count = 0;
struct kvm_vcpu *vcpu;
if (min > map->max_apic_id)
return 0;
for_each_set_bit(i, ipi_bitmap,
min((u32)BITS_PER_LONG, (map->max_... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static int apic_has_interrupt_for_ppr(struct kvm_lapic *apic, u32 ppr) {
int highest_irr;
if (kvm_x86_ops.sync_pir_to_irr)
highest_irr = static_call(kvm_x86_sync_pir_to_irr)(apic->vcpu);
else
highest_irr = apic_find_highest_irr(apic);
if (highest_irr == -1 || (highest_irr & 0xF0) <= ppr)
return -1;... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static bool __apic_update_ppr(struct kvm_lapic *apic, u32 *new_ppr) {
u32 tpr, isrv, ppr, old_ppr;
int isr;
old_ppr = kvm_lapic_get_reg(apic, APIC_PROCPRI);
tpr = kvm_lapic_get_reg(apic, APIC_TASKPRI);
isr = apic_find_highest_isr(apic);
isrv = (isr != -1) ? isr : 0;
if ((tpr & 0xf0) >= (isrv & 0xf0))
... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
bool kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
int shorthand, unsigned int dest, int dest_mode) {
struct kvm_lapic *target = vcpu->arch.apic;
u32 mda = kvm_apic_mda(vcpu, dest, source, target);
ASSERT(target);
switch (shorthand) {
case APIC_DEST_NOSHORT:
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | bool kvm_intr_is_single_vcpu_fast(struct kvm *kvm, struct kvm_lapic_irq *irq,
struct kvm_vcpu **dest_vcpu) {
struct kvm_apic_map *map;
unsigned long bitmap;
struct kvm_lapic **dst = NULL;
bool ret = false;
if (irq->shorthand)
return false;
rcu_read_lock();
map = rcu... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2) {
return vcpu1->arch.apic_arb_prio - vcpu2->arch.apic_arb_prio;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | void kvm_apic_set_eoi_accelerated(struct kvm_vcpu *vcpu, int vector) {
struct kvm_lapic *apic = vcpu->arch.apic;
trace_kvm_eoi(apic, vector);
kvm_ioapic_send_eoi(apic, vector);
kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static u32 apic_get_tmcct(struct kvm_lapic *apic) {
ktime_t remaining, now;
s64 ns;
u32 tmcct;
ASSERT(apic != NULL);
if (kvm_lapic_get_reg(apic, APIC_TMICT) == 0 || apic->lapic_timer.period == 0)
return 0;
now = ktime_get();
remaining = ktime_sub(apic->lapic_timer.target_expiration, now);
if (kti... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static void limit_periodic_timer_frequency(struct kvm_lapic *apic) {
if (apic_lvtt_period(apic) && apic->lapic_timer.period) {
s64 min_period = min_timer_period_us * 1000LL;
if (apic->lapic_timer.period < min_period) {
pr_info_ratelimited("kvm: vcpu %i: requested %lld ns "
"l... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static void cancel_apic_timer(struct kvm_lapic *apic) {
hrtimer_cancel(&apic->lapic_timer.timer);
preempt_disable();
if (apic->lapic_timer.hv_timer_in_use)
cancel_hv_timer(apic);
preempt_enable();
atomic_set(&apic->lapic_timer.pending, 0);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static inline void __wait_lapic_expire(struct kvm_vcpu *vcpu,
u64 guest_cycles) {
u64 timer_advance_ns = vcpu->arch.apic->lapic_timer.timer_advance_ns;
if (vcpu->arch.tsc_scaling_ratio == kvm_caps.default_tsc_scaling_ratio) {
__delay(min(guest_cycles, nsec_to_cycles(vcpu,... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static void __kvm_wait_lapic_expire(struct kvm_vcpu *vcpu) {
struct kvm_lapic *apic = vcpu->arch.apic;
u64 guest_tsc, tsc_deadline;
tsc_deadline = apic->lapic_timer.expired_tscdeadline;
apic->lapic_timer.expired_tscdeadline = 0;
guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc());
trace_kvm_wait_lapic_expire(vcpu->... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static void start_sw_tscdeadline(struct kvm_lapic *apic) {
struct kvm_timer *ktimer = &apic->lapic_timer;
u64 guest_tsc, tscdeadline = ktimer->tscdeadline;
u64 ns = 0;
ktime_t expire;
struct kvm_vcpu *vcpu = apic->vcpu;
unsigned long this_tsc_khz = vcpu->arch.virtual_tsc_khz;
unsigned long flags;
ktime... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg) {
ktime_t now;
u64 tscl = rdtsc();
s64 deadline;
now = ktime_get();
apic->lapic_timer.period =
tmict_to_ns(apic, kvm_lapic_get_reg(apic, APIC_TMICT));
if (!apic->lapic_timer.period) {
apic->lapic_timer.tscdeadline = 0;
... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static void cancel_hv_timer(struct kvm_lapic *apic) {
WARN_ON(preemptible());
WARN_ON(!apic->lapic_timer.hv_timer_in_use);
static_call(kvm_x86_cancel_hv_timer)(apic->vcpu);
apic->lapic_timer.hv_timer_in_use = false;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static void __start_apic_timer(struct kvm_lapic *apic, u32 count_reg) {
atomic_set(&apic->lapic_timer.pending, 0);
if ((apic_lvtt_period(apic) || apic_lvtt_oneshot(apic)) &&
!set_target_expiration(apic, count_reg))
return;
restart_apic_timer(apic);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
void kvm_lapic_set_eoi(struct kvm_vcpu *vcpu) {
kvm_lapic_reg_write(vcpu->arch.apic, APIC_EOI, 0);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | void kvm_apic_write_nodecode(struct kvm_vcpu *vcpu, u32 offset) {
struct kvm_lapic *apic = vcpu->arch.apic;
u64 val;
if (apic_x2apic_mode(apic)) {
if (KVM_BUG_ON(kvm_lapic_msr_read(apic, offset, &val), vcpu->kvm))
return;
} else {
val = kvm_lapic_get_reg(apic, offset);
}
if (apic_x2apic_mode... | [
0,
1
] |
Linux Kernel | arch/x86/kvm/lapic.c |
void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8) {
apic_set_tpr(vcpu->arch.apic, (cr8 & 0x0f) << 4);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
static enum hrtimer_restart apic_timer_fn(struct hrtimer *data) {
struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer);
struct kvm_lapic *apic = container_of(ktimer, struct kvm_lapic, lapic_timer);
apic_timer_expired(apic, true);
if (lapic_is_periodic(apic)) {
advance_periodic_target_ex... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns) {
struct kvm_lapic *apic;
ASSERT(vcpu != NULL);
apic = kzalloc(sizeof(*apic), GFP_KERNEL_ACCOUNT);
if (!apic)
goto nomem;
vcpu->arch.apic = apic;
apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
if (!apic->regs) {
print... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | int kvm_apic_get_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) {
memcpy(s->regs, vcpu->arch.apic->regs, sizeof(*s));
__kvm_lapic_set_reg(s->regs, APIC_TMCCT,
__apic_read(vcpu->arch.apic, APIC_TMCCT));
return kvm_apic_state_fixup(vcpu, s, false);
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static void apic_sync_pv_eoi_from_guest(struct kvm_vcpu *vcpu,
struct kvm_lapic *apic) {
int vector;
BUG_ON(!pv_eoi_enabled(vcpu));
if (pv_eoi_test_and_clr_pending(vcpu))
return;
vector = apic_set_eoi(apic);
trace_kvm_pv_eoi(apic, vector);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c | static void apic_sync_pv_eoi_to_guest(struct kvm_vcpu *vcpu,
struct kvm_lapic *apic) {
if (!pv_eoi_enabled(vcpu) ||
apic->irr_pending ||
/* Cache not set: could be safe but we don't bother. */
apic->highest_isr_cache == -1 ||
/* Need EOI to update ioapic.... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
int kvm_x2apic_icr_write(struct kvm_lapic *apic, u64 data) {
data &= ~APIC_ICR_BUSY;
kvm_apic_send_ipi(apic, (u32)data, (u32)(data >> 32));
kvm_lapic_set_reg64(apic, APIC_ICR, data);
trace_kvm_apic_write(APIC_ICR, data);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.c |
int kvm_hv_vapic_msr_write(struct kvm_vcpu *vcpu, u32 reg, u64 data) {
if (!lapic_in_kernel(vcpu))
return 1;
return kvm_lapic_msr_write(vcpu->arch.apic, reg, data);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.h | static inline void kvm_lapic_set_irr(int vec, struct kvm_lapic *apic) {
kvm_lapic_set_vector(vec, apic->regs + APIC_IRR);
apic->irr_pending = true;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.h |
static inline bool lapic_in_kernel(struct kvm_vcpu *vcpu) {
if (static_branch_unlikely(&kvm_has_noapic_vcpu))
return vcpu->arch.apic;
return true;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.h |
static inline int kvm_apic_hw_enabled(struct kvm_lapic *apic) {
if (static_branch_unlikely(&apic_hw_disabled.key))
return apic->vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE;
return MSR_IA32_APICBASE_ENABLE;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/lapic.h |
static inline bool kvm_lowest_prio_delivery(struct kvm_lapic_irq *irq) {
return (irq->delivery_mode == APIC_DM_LOWEST || irq->msi_redir_hint);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/lapic.h |
static inline enum lapic_mode kvm_apic_mode(u64 apic_base) {
return apic_base & (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static inline bool kvm_available_flush_tlb_with_range(void) {
return kvm_x86_ops.tlb_remote_flush_with_range;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static gfn_t get_mmio_spte_gfn(u64 spte) {
u64 gpa = spte & shadow_nonpresent_or_rsvd_lower_gfn_mask;
gpa |= (spte >> SHADOW_NONPRESENT_OR_RSVD_MASK_LEN) &
shadow_nonpresent_or_rsvd_mask;
return gpa >> PAGE_SHIFT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static unsigned get_mmio_spte_access(u64 spte) {
return spte & shadow_mmio_access_mask;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static bool check_mmio_spte(struct kvm_vcpu *vcpu, u64 spte) {
u64 kvm_gen, spte_gen, gen;
gen = kvm_vcpu_memslots(vcpu)->generation;
if (unlikely(gen & KVM_MEMSLOT_GEN_UPDATE_IN_PROGRESS))
return false;
kvm_gen = gen & MMIO_SPTE_GEN_MASK;
spte_gen = get_mmio_spte_generation(spte);
trace_check_mmio_... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static void __update_clear_spte_fast(u64 *sptep, u64 spte) {
WRITE_ONCE(*sptep, spte);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static u64 __get_spte_lockless(u64 *sptep) { return READ_ONCE(*sptep); }
#else | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c | static u64 __get_spte_lockless(u64 *sptep) {
struct kvm_mmu_page *sp = sptep_to_sp(sptep);
union split_spte spte, *orig = (union split_spte *)sptep;
int count;
retry:
count = sp->clear_spte_count;
smp_rmb();
spte.spte_low = orig->spte_low;
smp_rmb();
spte.spte_high = orig->spte_high;
smp_rmb();
... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static void mmu_free_memory_caches(struct kvm_vcpu *vcpu) {
kvm_mmu_free_memory_cache(&vcpu->arch.mmu_pte_list_desc_cache);
kvm_mmu_free_memory_cache(&vcpu->arch.mmu_shadow_page_cache);
kvm_mmu_free_memory_cache(&vcpu->arch.mmu_shadowed_info_cache);
kvm_mmu_free_memory_cache(&vcpu->arch.mmu_page_header_cache);... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static gfn_t kvm_mmu_page_get_gfn(struct kvm_mmu_page *sp, int index) {
if (sp->role.passthrough)
return sp->gfn;
if (!sp->role.direct)
return sp->shadowed_translation[index] >> PAGE_SHIFT;
return sp->gfn + (index << ((sp->role.level - 1) * SPTE_LEVEL_BITS));
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c | static u32 kvm_mmu_page_get_access(struct kvm_mmu_page *sp, int index) {
if (sp_has_gptes(sp))
return sp->shadowed_translation[index] & ACC_ALL;
return sp->role.access;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/mmu/mmu.c |
static void kvm_mmu_page_set_translation(struct kvm_mmu_page *sp, int index,
gfn_t gfn, unsigned int access) {
if (sp_has_gptes(sp)) {
sp->shadowed_translation[index] = (gfn << PAGE_SHIFT) | access;
return;
}
WARN_ONCE(access != kvm_mmu_page_get_access(sp, index)... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.