Skip to content

Commit 6f779e1

Browse files
legoatermpe
authored andcommitted
powerpc/xive: Discard disabled interrupts in get_irqchip_state()
When an interrupt is passed through, the KVM XIVE device calls the set_vcpu_affinity() handler which raises the P bit to mask the interrupt and to catch any in-flight interrupts while routing the interrupt to the guest. On the guest side, drivers (like some Intels) can request at probe time some MSIs and call synchronize_irq() to check that there are no in flight interrupts. This will call the XIVE get_irqchip_state() handler which will always return true as the interrupt P bit has been set on the host side and lock the CPU in an infinite loop. Fix that by discarding disabled interrupts in get_irqchip_state(). Fixes: da15c03 ("powerpc/xive: Implement get_irqchip_state method for XIVE to fix shutdown race") Cc: stable@vger.kernel.org #v5.4+ Signed-off-by: Cédric Le Goater <clg@kaod.org> Tested-by: seeteena <s1seetee@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20211011070203.99726-1-clg@kaod.org
1 parent eb8257a commit 6f779e1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/powerpc/sysdev/xive/common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,8 @@ static int xive_get_irqchip_state(struct irq_data *data,
945945
* interrupt to be inactive in that case.
946946
*/
947947
*state = (pq != XIVE_ESB_INVALID) && !xd->stale_p &&
948-
(xd->saved_p || !!(pq & XIVE_ESB_VAL_P));
948+
(xd->saved_p || (!!(pq & XIVE_ESB_VAL_P) &&
949+
!irqd_irq_disabled(data)));
949950
return 0;
950951
default:
951952
return -EINVAL;

0 commit comments

Comments
 (0)