Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit dc1c416

Browse files
legoatermpe
authored andcommitted
KVM: PPC: Book3S: fix XIVE migration of pending interrupts
When restoring a pending interrupt, we are setting the Q bit to force a retrigger in xive_finish_unmask(). But we also need to force an EOI in this case to reach the same initial state : P=1, Q=0. This can be done by not setting 'old_p' for pending interrupts which will inform xive_finish_unmask() that an EOI needs to be sent. Fixes: 5af5099 ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller") Cc: stable@vger.kernel.org # v4.12+ Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Tested-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 182dc9c commit dc1c416

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/kvm/book3s_xive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,15 +1558,15 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
15581558

15591559
/*
15601560
* Restore P and Q. If the interrupt was pending, we
1561-
* force both P and Q, which will trigger a resend.
1561+
* force Q and !P, which will trigger a resend.
15621562
*
15631563
* That means that a guest that had both an interrupt
15641564
* pending (queued) and Q set will restore with only
15651565
* one instance of that interrupt instead of 2, but that
15661566
* is perfectly fine as coalescing interrupts that haven't
15671567
* been presented yet is always allowed.
15681568
*/
1569-
if (val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING)
1569+
if (val & KVM_XICS_PRESENTED && !(val & KVM_XICS_PENDING))
15701570
state->old_p = true;
15711571
if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING)
15721572
state->old_q = true;

0 commit comments

Comments
 (0)