Commit b3c9950a authored by Richard Cochran's avatar Richard Cochran Committed by Ingo Molnar

arm/kvm/arch_timer: Convert to hotplug state machine

Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: default avatarRichard Cochran <rcochran@linutronix.de>
Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kvm@vger.kernel.org
Cc: kvmarm@lists.cs.columbia.edu
Cc: linux-arm-kernel@lists.infradead.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153336.634155707@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 42ec50b5
...@@ -43,6 +43,7 @@ enum cpuhp_state { ...@@ -43,6 +43,7 @@ enum cpuhp_state {
CPUHP_AP_MIPS_GIC_TIMER_STARTING, CPUHP_AP_MIPS_GIC_TIMER_STARTING,
CPUHP_AP_KVM_STARTING, CPUHP_AP_KVM_STARTING,
CPUHP_AP_KVM_ARM_VGIC_STARTING, CPUHP_AP_KVM_ARM_VGIC_STARTING,
CPUHP_AP_KVM_ARM_TIMER_STARTING,
CPUHP_AP_LEDTRIG_STARTING, CPUHP_AP_LEDTRIG_STARTING,
CPUHP_AP_NOTIFY_STARTING, CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE, CPUHP_AP_ONLINE,
......
...@@ -405,26 +405,17 @@ u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid) ...@@ -405,26 +405,17 @@ u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
return (u64)-1; return (u64)-1;
} }
static int kvm_timer_cpu_notify(struct notifier_block *self, static int kvm_timer_starting_cpu(unsigned int cpu)
unsigned long action, void *cpu)
{ {
switch (action) {
case CPU_STARTING:
case CPU_STARTING_FROZEN:
kvm_timer_init_interrupt(NULL); kvm_timer_init_interrupt(NULL);
break; return 0;
case CPU_DYING:
case CPU_DYING_FROZEN:
disable_percpu_irq(host_vtimer_irq);
break;
}
return NOTIFY_OK;
} }
static struct notifier_block kvm_timer_cpu_nb = { static int kvm_timer_dying_cpu(unsigned int cpu)
.notifier_call = kvm_timer_cpu_notify, {
}; disable_percpu_irq(host_vtimer_irq);
return 0;
}
int kvm_timer_hyp_init(void) int kvm_timer_hyp_init(void)
{ {
...@@ -449,12 +440,6 @@ int kvm_timer_hyp_init(void) ...@@ -449,12 +440,6 @@ int kvm_timer_hyp_init(void)
goto out; goto out;
} }
err = __register_cpu_notifier(&kvm_timer_cpu_nb);
if (err) {
kvm_err("Cannot register timer CPU notifier\n");
goto out_free;
}
wqueue = create_singlethread_workqueue("kvm_arch_timer"); wqueue = create_singlethread_workqueue("kvm_arch_timer");
if (!wqueue) { if (!wqueue) {
err = -ENOMEM; err = -ENOMEM;
...@@ -462,8 +447,10 @@ int kvm_timer_hyp_init(void) ...@@ -462,8 +447,10 @@ int kvm_timer_hyp_init(void)
} }
kvm_info("virtual timer IRQ%d\n", host_vtimer_irq); kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
on_each_cpu(kvm_timer_init_interrupt, NULL, 1);
cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING,
"AP_KVM_ARM_TIMER_STARTING", kvm_timer_starting_cpu,
kvm_timer_dying_cpu);
goto out; goto out;
out_free: out_free:
free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus()); free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment