]> git.ipfire.org Git - people/arne_f/kernel.git/commit
KVM: PPC: Book3S HV: Don't sleep if XIVE interrupt pending on POWER9
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 20 Jun 2017 05:46:12 +0000 (15:46 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 20 Jun 2017 05:46:12 +0000 (15:46 +1000)
commitee3308a254ec339b8d7c29e20274391685e58de1
tree7c2e984406d99ade0b292c6a527ee8c80f0c7eb4
parent579006944e0d675361e987c646b83d2d1725966c
KVM: PPC: Book3S HV: Don't sleep if XIVE interrupt pending on POWER9

On a POWER9 system, it is possible for an interrupt to become pending
for a VCPU when that VCPU is about to cede (execute a H_CEDE hypercall)
and has already disabled interrupts, or in the H_CEDE processing up
to the point where the XIVE context is pulled from the hardware.  In
such a case, the H_CEDE should not sleep, but should return immediately
to the guest.  However, the conditions tested in kvmppc_vcpu_woken()
don't include the condition that a XIVE interrupt is pending, so the
VCPU could sleep until the next decrementer interrupt.

To fix this, we add a new xive_interrupt_pending() helper which looks
in the XIVE context that was pulled from the hardware to see if the
priority of any pending interrupt is higher (numerically lower than)
the CPU priority.  If so then kvmppc_vcpu_woken() will return true.
If the XIVE context has never been used, then both the pipr and the
cppr fields will be zero and the test will indicate that no interrupt
is pending.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_hv.c