]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm/arm64: arch_timer: Simplify kvm_timer_vcpu_terminate
authorChristoffer Dall <christoffer.dall@arm.com>
Tue, 11 Dec 2018 08:54:11 +0000 (09:54 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Wed, 19 Dec 2018 17:47:07 +0000 (17:47 +0000)
commitb2bc975de4ba8c23ab7f4f23357f29389fec1b48
tree57d8d1ed5f35e8654f22b0491e627a816b3456d0
parent873f504a8a6042a1e3bff6bccfd599e2bf5ec096
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>
virt/kvm/arm/arch_timer.c