diff options
Diffstat (limited to 'arch/s390/kvm/interrupt.c')
-rw-r--r-- | arch/s390/kvm/interrupt.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 4ed4c3a11485..a48830fa9c59 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -12,6 +12,8 @@ | |||
12 | 12 | ||
13 | #include <asm/lowcore.h> | 13 | #include <asm/lowcore.h> |
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <linux/hrtimer.h> | ||
16 | #include <linux/interrupt.h> | ||
15 | #include <linux/kvm_host.h> | 17 | #include <linux/kvm_host.h> |
16 | #include <linux/signal.h> | 18 | #include <linux/signal.h> |
17 | #include "kvm-s390.h" | 19 | #include "kvm-s390.h" |
@@ -361,12 +363,10 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu) | |||
361 | return 0; | 363 | return 0; |
362 | } | 364 | } |
363 | 365 | ||
364 | sltime = (vcpu->arch.sie_block->ckc - now) / (0xf4240000ul / HZ) + 1; | 366 | sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9; |
365 | 367 | ||
366 | vcpu->arch.ckc_timer.expires = jiffies + sltime; | 368 | hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL); |
367 | 369 | VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime); | |
368 | add_timer(&vcpu->arch.ckc_timer); | ||
369 | VCPU_EVENT(vcpu, 5, "enabled wait timer:%llx jiffies", sltime); | ||
370 | no_timer: | 370 | no_timer: |
371 | spin_lock_bh(&vcpu->arch.local_int.float_int->lock); | 371 | spin_lock_bh(&vcpu->arch.local_int.float_int->lock); |
372 | spin_lock_bh(&vcpu->arch.local_int.lock); | 372 | spin_lock_bh(&vcpu->arch.local_int.lock); |
@@ -389,21 +389,34 @@ no_timer: | |||
389 | remove_wait_queue(&vcpu->wq, &wait); | 389 | remove_wait_queue(&vcpu->wq, &wait); |
390 | spin_unlock_bh(&vcpu->arch.local_int.lock); | 390 | spin_unlock_bh(&vcpu->arch.local_int.lock); |
391 | spin_unlock_bh(&vcpu->arch.local_int.float_int->lock); | 391 | spin_unlock_bh(&vcpu->arch.local_int.float_int->lock); |
392 | del_timer(&vcpu->arch.ckc_timer); | 392 | hrtimer_try_to_cancel(&vcpu->arch.ckc_timer); |
393 | return 0; | 393 | return 0; |
394 | } | 394 | } |
395 | 395 | ||
396 | void kvm_s390_idle_wakeup(unsigned long data) | 396 | void kvm_s390_tasklet(unsigned long parm) |
397 | { | 397 | { |
398 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; | 398 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *) parm; |
399 | 399 | ||
400 | spin_lock_bh(&vcpu->arch.local_int.lock); | 400 | spin_lock(&vcpu->arch.local_int.lock); |
401 | vcpu->arch.local_int.timer_due = 1; | 401 | vcpu->arch.local_int.timer_due = 1; |
402 | if (waitqueue_active(&vcpu->arch.local_int.wq)) | 402 | if (waitqueue_active(&vcpu->arch.local_int.wq)) |
403 | wake_up_interruptible(&vcpu->arch.local_int.wq); | 403 | wake_up_interruptible(&vcpu->arch.local_int.wq); |
404 | spin_unlock_bh(&vcpu->arch.local_int.lock); | 404 | spin_unlock(&vcpu->arch.local_int.lock); |
405 | } | 405 | } |
406 | 406 | ||
407 | /* | ||
408 | * low level hrtimer wake routine. Because this runs in hardirq context | ||
409 | * we schedule a tasklet to do the real work. | ||
410 | */ | ||
411 | enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer) | ||
412 | { | ||
413 | struct kvm_vcpu *vcpu; | ||
414 | |||
415 | vcpu = container_of(timer, struct kvm_vcpu, arch.ckc_timer); | ||
416 | tasklet_schedule(&vcpu->arch.tasklet); | ||
417 | |||
418 | return HRTIMER_NORESTART; | ||
419 | } | ||
407 | 420 | ||
408 | void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu) | 421 | void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu) |
409 | { | 422 | { |