diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2017-09-01 16:25:12 +0200 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2018-01-02 10:05:46 +0100 |
commit | df635c5b184da05145db1d63e1dcb1c853f425c2 (patch) | |
tree | 031c04df65c2481cb16ea82a6525902e021edfd1 /include | |
parent | KVM: arm/arm64: Support a vgic interrupt line level sample function (diff) | |
download | linux-df635c5b184da05145db1d63e1dcb1c853f425c2.tar.xz linux-df635c5b184da05145db1d63e1dcb1c853f425c2.zip |
KVM: arm/arm64: Support VGIC dist pend/active changes for mapped IRQs
For mapped IRQs (with the HW bit set in the LR) we have to follow some
rules of the architecture. One of these rules is that VM must not be
allowed to deactivate a virtual interrupt with the HW bit set unless the
physical interrupt is also active.
This works fine when injecting mapped interrupts, because we leave it up
to the injector to either set EOImode==1 or manually set the active
state of the physical interrupt.
However, the guest can set virtual interrupt to be pending or active by
writing to the virtual distributor, which could lead to deactivating a
virtual interrupt with the HW bit set without the physical interrupt
being active.
We could set the physical interrupt to active whenever we are about to
enter the VM with a HW interrupt either pending or active, but that
would be really slow, especially on GICv2. So we take the long way
around and do the hard work when needed, which is expected to be
extremely rare.
When the VM sets the pending state for a HW interrupt on the virtual
distributor we set the active state on the physical distributor, because
the virtual interrupt can become active and then the guest can
deactivate it.
When the VM clears the pending state we also clear it on the physical
side, because the injector might otherwise raise the interrupt. We also
clear the physical active state when the virtual interrupt is not
active, since otherwise a SPEND/CPEND sequence from the guest would
prevent signaling of future interrupts.
Changing the state of mapped interrupts from userspace is not supported,
and it's expected that userspace unmaps devices from VFIO before
attempting to set the interrupt state, because the interrupt state is
driven by hardware.
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions