Skip to content

Commit 6e14ef1

Browse files
christofferdall-armMarc Zyngier
authored andcommitted
KVM: arm/arm64: arch_timer: Simplify kvm_timer_vcpu_terminate
kvm_timer_vcpu_terminate can only be called in two scenarios: 1. As part of cleanup during a failed VCPU create 2. As part of freeing the whole VM (struct kvm refcount == 0) In the first case, we cannot have programmed any timers or mapped any IRQs, and therefore we do not have to cancel anything or unmap anything. In the second case, the VCPU will have gone through kvm_timer_vcpu_put, which will have canceled the emulated physical timer's hrtimer, and we do not need to that here as well. We also do not care if the irq is recorded as mapped or not in the VGIC data structure, because the whole VM is going away. That leaves us only with having to ensure that we cancel the bg_timer if we were blocking the last time we called kvm_timer_vcpu_put(). Signed-off-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 8a411b0 commit 6e14ef1

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

virt/kvm/arm/arch_timer.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,11 +772,8 @@ int kvm_timer_hyp_init(bool has_gic)
772772
void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu)
773773
{
774774
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
775-
struct arch_timer_context *vtimer = vcpu_vtimer(vcpu);
776775

777776
soft_timer_cancel(&timer->bg_timer);
778-
soft_timer_cancel(&timer->phys_timer);
779-
kvm_vgic_unmap_phys_irq(vcpu, vtimer->irq.irq);
780777
}
781778

782779
static bool timer_irqs_are_valid(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)