| #include <linux/kvm_host.h> |
| #include <linux/hrtimer.h> |
| static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer) |
| wait_queue_head_t *q = &vcpu->wq; |
| * There is a race window between reading and incrementing, but we do |
| * not care about potentially loosing timer events in the !reinject |
| if (ktimer->reinject || !atomic_read(&ktimer->pending)) { |
| atomic_inc(&ktimer->pending); |
| /* FIXME: this code should not know anything about vcpus */ |
| set_bit(KVM_REQ_PENDING_TIMER, &vcpu->requests); |
| wake_up_interruptible(q); |
| if (ktimer->t_ops->is_periodic(ktimer)) { |
| hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); |
| enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) |
| struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); |
| return HRTIMER_NORESTART; |
| restart_timer = __kvm_timer_fn(vcpu, ktimer); |
| return HRTIMER_NORESTART; |