1 // SPDX-License-Identifier: GPL-2.0 2 3 #include <linux/interrupt.h> 4 #include <linux/irq.h> 5 #include <linux/irqdesc.h> 6 #include <linux/irqnr.h> 7 8 #include "internals.h" 9 machine_kexec_mask_interrupts(void)10void machine_kexec_mask_interrupts(void) 11 { 12 struct irq_desc *desc; 13 unsigned int i; 14 15 for_each_irq_desc(i, desc) { 16 struct irq_chip *chip; 17 int check_eoi = 1; 18 19 chip = irq_desc_get_chip(desc); 20 if (!chip || !irqd_is_started(&desc->irq_data)) 21 continue; 22 23 if (IS_ENABLED(CONFIG_GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD)) { 24 /* 25 * First try to remove the active state from an interrupt which is forwarded 26 * to a VM. If the interrupt is not forwarded, try to EOI the interrupt. 27 */ 28 check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false); 29 } 30 31 if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data)) 32 chip->irq_eoi(&desc->irq_data); 33 34 irq_shutdown(desc); 35 } 36 } 37