Skip to content

Commit 40f4cba

Browse files
Christoffer Dallchazy
authored andcommitted
KVM: arm/arm64: Set VCPU affinity for virt timer irq
As we are about to take physical interrupts for the virtual timer on the host but want to leave those active while running the VM (and let the VM deactivate them), we need to set the vtimer PPI affinity accordingly. Signed-off-by: Christoffer Dall <cdall@linaro.org> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 688c50a commit 40f4cba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

virt/kvm/arm/arch_timer.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,20 @@ int kvm_timer_hyp_init(void)
649649
return err;
650650
}
651651

652+
err = irq_set_vcpu_affinity(host_vtimer_irq, kvm_get_running_vcpus());
653+
if (err) {
654+
kvm_err("kvm_arch_timer: error setting vcpu affinity\n");
655+
goto out_free_irq;
656+
}
657+
652658
kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
653659

654660
cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING,
655661
"kvm/arm/timer:starting", kvm_timer_starting_cpu,
656662
kvm_timer_dying_cpu);
663+
return 0;
664+
out_free_irq:
665+
free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus());
657666
return err;
658667
}
659668

0 commit comments

Comments
 (0)