]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
arm/arm64: KVM: Fix disabled distributor operation
authorChristoffer Dall <christoffer.dall@linaro.org>
Sat, 17 Oct 2015 17:05:27 +0000 (19:05 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Tue, 20 Oct 2015 16:09:13 +0000 (18:09 +0200)
commit0d997491f814c87310a6ad7be30a9049c7150489
treee368ad59cc46060514c092f8121bd62f7311e0c4
parent544c572e03174438b6656ed24a4516b9a9d5f14a
arm/arm64: KVM: Fix disabled distributor operation

We currently do a single update of the vgic state when the distributor
enable/disable control register is accessed and then bypass updating the
state for as long as the distributor remains disabled.

This is incorrect, because updating the state does not consider the
distributor enable bit, and this you can end up in a situation where an
interrupt is marked as pending on the CPU interface, but not pending on
the distributor, which is an impossible state to be in, and triggers a
warning.  Consider for example the following sequence of events:

1. An interrupt is marked as pending on the distributor
   - the interrupt is also forwarded to the CPU interface
2. The guest turns off the distributor (it's about to do a reboot)
   - we stop updating the CPU interface state from now on
3. The guest disables the pending interrupt
   - we remove the pending state from the distributor, but don't touch
     the CPU interface, see point 2.

Since the distributor disable bit really means that no interrupts should
be forwarded to the CPU interface, we modify the code to keep updating
the internal VGIC state, but always set the CPU interface pending bits
to zero when the distributor is disabled.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/arm/vgic.c