aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/arm/arch_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/arm/arch_timer.c')
-rw-r--r--virt/kvm/arm/arch_timer.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index e2d5b6f988fb..4fde8c7dfcfe 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -405,26 +405,17 @@ u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
405 return (u64)-1; 405 return (u64)-1;
406} 406}
407 407
408static int kvm_timer_cpu_notify(struct notifier_block *self, 408static int kvm_timer_starting_cpu(unsigned int cpu)
409 unsigned long action, void *cpu)
410{ 409{
411 switch (action) { 410 kvm_timer_init_interrupt(NULL);
412 case CPU_STARTING: 411 return 0;
413 case CPU_STARTING_FROZEN:
414 kvm_timer_init_interrupt(NULL);
415 break;
416 case CPU_DYING:
417 case CPU_DYING_FROZEN:
418 disable_percpu_irq(host_vtimer_irq);
419 break;
420 }
421
422 return NOTIFY_OK;
423} 412}
424 413
425static struct notifier_block kvm_timer_cpu_nb = { 414static int kvm_timer_dying_cpu(unsigned int cpu)
426 .notifier_call = kvm_timer_cpu_notify, 415{
427}; 416 disable_percpu_irq(host_vtimer_irq);
417 return 0;
418}
428 419
429int kvm_timer_hyp_init(void) 420int kvm_timer_hyp_init(void)
430{ 421{
@@ -449,12 +440,6 @@ int kvm_timer_hyp_init(void)
449 goto out; 440 goto out;
450 } 441 }
451 442
452 err = __register_cpu_notifier(&kvm_timer_cpu_nb);
453 if (err) {
454 kvm_err("Cannot register timer CPU notifier\n");
455 goto out_free;
456 }
457
458 wqueue = create_singlethread_workqueue("kvm_arch_timer"); 443 wqueue = create_singlethread_workqueue("kvm_arch_timer");
459 if (!wqueue) { 444 if (!wqueue) {
460 err = -ENOMEM; 445 err = -ENOMEM;
@@ -462,8 +447,10 @@ int kvm_timer_hyp_init(void)
462 } 447 }
463 448
464 kvm_info("virtual timer IRQ%d\n", host_vtimer_irq); 449 kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
465 on_each_cpu(kvm_timer_init_interrupt, NULL, 1);
466 450
451 cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING,
452 "AP_KVM_ARM_TIMER_STARTING", kvm_timer_starting_cpu,
453 kvm_timer_dying_cpu);
467 goto out; 454 goto out;
468out_free: 455out_free:
469 free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus()); 456 free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus());