Lines Matching refs:lapic_timer
386 return apic->lapic_timer.timer_mode == APIC_LVT_TIMER_ONESHOT; in apic_lvtt_oneshot()
391 return apic->lapic_timer.timer_mode == APIC_LVT_TIMER_PERIODIC; in apic_lvtt_period()
396 return apic->lapic_timer.timer_mode == APIC_LVT_TIMER_TSCDEADLINE; in apic_lvtt_tscdeadline()
1372 apic->lapic_timer.period == 0) in apic_get_tmcct()
1376 remaining = ktime_sub(apic->lapic_timer.target_expiration, now); in apic_get_tmcct()
1380 ns = mod_64(ktime_to_ns(remaining), apic->lapic_timer.period); in apic_get_tmcct()
1557 if (apic_lvtt_period(apic) && apic->lapic_timer.period) { in limit_periodic_timer_frequency()
1560 if (apic->lapic_timer.period < min_period) { in limit_periodic_timer_frequency()
1565 apic->lapic_timer.period, min_period); in limit_periodic_timer_frequency()
1566 apic->lapic_timer.period = min_period; in limit_periodic_timer_frequency()
1575 hrtimer_cancel(&apic->lapic_timer.timer); in cancel_apic_timer()
1577 if (apic->lapic_timer.hv_timer_in_use) in cancel_apic_timer()
1580 atomic_set(&apic->lapic_timer.pending, 0); in cancel_apic_timer()
1586 apic->lapic_timer.timer_mode_mask; in apic_update_lvtt()
1588 if (apic->lapic_timer.timer_mode != timer_mode) { in apic_update_lvtt()
1593 apic->lapic_timer.period = 0; in apic_update_lvtt()
1594 apic->lapic_timer.tscdeadline = 0; in apic_update_lvtt()
1596 apic->lapic_timer.timer_mode = timer_mode; in apic_update_lvtt()
1626 u64 timer_advance_ns = vcpu->arch.apic->lapic_timer.timer_advance_ns; in __wait_lapic_expire()
1648 u32 timer_advance_ns = apic->lapic_timer.timer_advance_ns; in adjust_lapic_timer_advance()
1670 apic->lapic_timer.timer_advance_ns = timer_advance_ns; in adjust_lapic_timer_advance()
1678 tsc_deadline = apic->lapic_timer.expired_tscdeadline; in __kvm_wait_lapic_expire()
1679 apic->lapic_timer.expired_tscdeadline = 0; in __kvm_wait_lapic_expire()
1701 vcpu->arch.apic->lapic_timer.expired_tscdeadline && in kvm_wait_lapic_expire()
1702 vcpu->arch.apic->lapic_timer.timer_advance_ns && in kvm_wait_lapic_expire()
1710 struct kvm_timer *ktimer = &apic->lapic_timer; in kvm_apic_inject_pending_timer_irqs()
1724 struct kvm_timer *ktimer = &apic->lapic_timer; in apic_timer_expired()
1726 if (atomic_read(&apic->lapic_timer.pending)) in apic_timer_expired()
1746 if (vcpu->arch.apic->lapic_timer.expired_tscdeadline && in apic_timer_expired()
1747 vcpu->arch.apic->lapic_timer.timer_advance_ns) in apic_timer_expired()
1753 atomic_inc(&apic->lapic_timer.pending); in apic_timer_expired()
1761 struct kvm_timer *ktimer = &apic->lapic_timer; in start_sw_tscdeadline()
1782 likely(ns > apic->lapic_timer.timer_advance_ns)) { in start_sw_tscdeadline()
1802 apic->lapic_timer.period = in update_target_expiration()
1807 remaining = ktime_sub(apic->lapic_timer.target_expiration, now); in update_target_expiration()
1815 apic->lapic_timer.tscdeadline += in update_target_expiration()
1818 apic->lapic_timer.target_expiration = ktime_add_ns(now, ns_remaining_new); in update_target_expiration()
1828 apic->lapic_timer.period = in set_target_expiration()
1831 if (!apic->lapic_timer.period) { in set_target_expiration()
1832 apic->lapic_timer.tscdeadline = 0; in set_target_expiration()
1837 deadline = apic->lapic_timer.period; in set_target_expiration()
1844 deadline = apic->lapic_timer.period; in set_target_expiration()
1845 else if (unlikely(deadline > apic->lapic_timer.period)) { in set_target_expiration()
1853 deadline, apic->lapic_timer.period); in set_target_expiration()
1855 deadline = apic->lapic_timer.period; in set_target_expiration()
1860 apic->lapic_timer.tscdeadline = kvm_read_l1_tsc(apic->vcpu, tscl) + in set_target_expiration()
1862 apic->lapic_timer.target_expiration = ktime_add_ns(now, deadline); in set_target_expiration()
1880 apic->lapic_timer.target_expiration = in advance_periodic_target_expiration()
1881 ktime_add_ns(apic->lapic_timer.target_expiration, in advance_periodic_target_expiration()
1882 apic->lapic_timer.period); in advance_periodic_target_expiration()
1883 delta = ktime_sub(apic->lapic_timer.target_expiration, now); in advance_periodic_target_expiration()
1884 apic->lapic_timer.tscdeadline = kvm_read_l1_tsc(apic->vcpu, tscl) + in advance_periodic_target_expiration()
1890 if (!apic->lapic_timer.period) in start_sw_period()
1894 apic->lapic_timer.target_expiration)) { in start_sw_period()
1903 hrtimer_start(&apic->lapic_timer.timer, in start_sw_period()
1904 apic->lapic_timer.target_expiration, in start_sw_period()
1913 return vcpu->arch.apic->lapic_timer.hv_timer_in_use; in kvm_lapic_hv_timer_in_use()
1920 WARN_ON(!apic->lapic_timer.hv_timer_in_use); in cancel_hv_timer()
1922 apic->lapic_timer.hv_timer_in_use = false; in cancel_hv_timer()
1927 struct kvm_timer *ktimer = &apic->lapic_timer; in start_hv_timer()
1969 struct kvm_timer *ktimer = &apic->lapic_timer; in start_sw_timer()
1972 if (apic->lapic_timer.hv_timer_in_use) in start_sw_timer()
1988 if (!apic_lvtt_period(apic) && atomic_read(&apic->lapic_timer.pending)) in restart_apic_timer()
2003 if (!apic->lapic_timer.hv_timer_in_use) in kvm_lapic_expired_hv_timer()
2009 if (apic_lvtt_period(apic) && apic->lapic_timer.period) { in kvm_lapic_expired_hv_timer()
2029 if (apic->lapic_timer.hv_timer_in_use) in kvm_lapic_switch_to_sw_timer()
2038 WARN_ON(!apic->lapic_timer.hv_timer_in_use); in kvm_lapic_restart_hv_timer()
2044 atomic_set(&apic->lapic_timer.pending, 0); in __start_apic_timer()
2146 atomic_set(&apic->lapic_timer.pending, 0); in kvm_lapic_reg_write()
2189 val &= (apic_lvt_mask[0] | apic->lapic_timer.timer_mode_mask); in kvm_lapic_reg_write()
2209 apic->lapic_timer.period) { in kvm_lapic_reg_write()
2210 hrtimer_cancel(&apic->lapic_timer.timer); in kvm_lapic_reg_write()
2316 hrtimer_cancel(&apic->lapic_timer.timer); in kvm_free_lapic()
2342 return apic->lapic_timer.tscdeadline; in kvm_get_lapic_tscdeadline_msr()
2352 hrtimer_cancel(&apic->lapic_timer.timer); in kvm_set_lapic_tscdeadline_msr()
2353 apic->lapic_timer.tscdeadline = data; in kvm_set_lapic_tscdeadline_msr()
2452 hrtimer_cancel(&apic->lapic_timer.timer); in kvm_lapic_reset()
2490 atomic_set(&apic->lapic_timer.pending, 0); in kvm_lapic_reset()
2522 return atomic_read(&apic->lapic_timer.pending); in apic_has_pending_timer()
2558 struct kvm_lapic *apic = container_of(ktimer, struct kvm_lapic, lapic_timer); in apic_timer_fn()
2592 hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, in kvm_create_lapic()
2594 apic->lapic_timer.timer.function = apic_timer_fn; in kvm_create_lapic()
2596 apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT; in kvm_create_lapic()
2599 apic->lapic_timer.timer_advance_ns = timer_advance_ns; in kvm_create_lapic()
2648 if (atomic_read(&apic->lapic_timer.pending) > 0) { in kvm_inject_apic_timer_irqs()
2650 atomic_set(&apic->lapic_timer.pending, 0); in kvm_inject_apic_timer_irqs()
2769 apic->lapic_timer.expired_tscdeadline = 0; in kvm_apic_set_state()
2799 timer = &vcpu->arch.apic->lapic_timer.timer; in __kvm_migrate_apic_timer()