diff options
Diffstat (limited to 'arch/x86/kvm/timer.c')
-rw-r--r-- | arch/x86/kvm/timer.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c index ae432ea1cd83..6b85cc647f34 100644 --- a/arch/x86/kvm/timer.c +++ b/arch/x86/kvm/timer.c | |||
@@ -18,9 +18,10 @@ | |||
18 | #include <linux/atomic.h> | 18 | #include <linux/atomic.h> |
19 | #include "kvm_timer.h" | 19 | #include "kvm_timer.h" |
20 | 20 | ||
21 | static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer) | 21 | enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) |
22 | { | 22 | { |
23 | int restart_timer = 0; | 23 | struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); |
24 | struct kvm_vcpu *vcpu = ktimer->vcpu; | ||
24 | wait_queue_head_t *q = &vcpu->wq; | 25 | wait_queue_head_t *q = &vcpu->wq; |
25 | 26 | ||
26 | /* | 27 | /* |
@@ -40,26 +41,7 @@ static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer) | |||
40 | 41 | ||
41 | if (ktimer->t_ops->is_periodic(ktimer)) { | 42 | if (ktimer->t_ops->is_periodic(ktimer)) { |
42 | hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); | 43 | hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); |
43 | restart_timer = 1; | ||
44 | } | ||
45 | |||
46 | return restart_timer; | ||
47 | } | ||
48 | |||
49 | enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) | ||
50 | { | ||
51 | int restart_timer; | ||
52 | struct kvm_vcpu *vcpu; | ||
53 | struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); | ||
54 | |||
55 | vcpu = ktimer->vcpu; | ||
56 | if (!vcpu) | ||
57 | return HRTIMER_NORESTART; | ||
58 | |||
59 | restart_timer = __kvm_timer_fn(vcpu, ktimer); | ||
60 | if (restart_timer) | ||
61 | return HRTIMER_RESTART; | 44 | return HRTIMER_RESTART; |
62 | else | 45 | } else |
63 | return HRTIMER_NORESTART; | 46 | return HRTIMER_NORESTART; |
64 | } | 47 | } |
65 | |||