mirror of
https://gitee.com/open-loongarch/linux-6.12.git
synced 2026-10-29 06:27:12 +08:00
kexec: Consolidate machine_kexec_mask_interrupts() implementation
Consolidate the machine_kexec_mask_interrupts implementation into a common function located in a new file: kernel/irq/kexec.c. This removes duplicate implementations from architecture-specific files in arch/arm, arch/arm64, arch/powerpc, and arch/riscv, reducing code duplication and improving maintainability. The new implementation retains architecture-specific behavior for CONFIG_GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD, which was previously implemented for ARM64. When enabled (currently for ARM64), it clears the active state of interrupts forwarded to virtual machines (VMs) before handling other interrupt masking operations. Signed-off-by: Eliav Farber <farbere@amazon.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20241204142003.32859-2-farbere@amazon.com Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
committed by
maoxiaochuan
parent
d356138b31
commit
ba49f29324
@@ -141,6 +141,12 @@ config GENERIC_IRQ_DEBUGFS
|
||||
|
||||
If you don't know what to do here, say N.
|
||||
|
||||
# Clear forwarded VM interrupts during kexec.
|
||||
# This option ensures the kernel clears active states for interrupts
|
||||
# forwarded to virtual machines (VMs) during a machine kexec.
|
||||
config GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
config GENERIC_IRQ_MULTI_HANDLER
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o
|
||||
obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o kexec.o
|
||||
obj-$(CONFIG_IRQ_TIMINGS) += timings.o
|
||||
ifeq ($(CONFIG_TEST_IRQ_TIMINGS),y)
|
||||
CFLAGS_timings.o += -DDEBUG
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/irqdesc.h>
|
||||
#include <linux/irqnr.h>
|
||||
|
||||
#include "internals.h"
|
||||
|
||||
void machine_kexec_mask_interrupts(void)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
unsigned int i;
|
||||
|
||||
for_each_irq_desc(i, desc) {
|
||||
struct irq_chip *chip;
|
||||
int check_eoi = 1;
|
||||
|
||||
chip = irq_desc_get_chip(desc);
|
||||
if (!chip)
|
||||
continue;
|
||||
|
||||
if (IS_ENABLED(CONFIG_GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD)) {
|
||||
/*
|
||||
* First try to remove the active state from an interrupt which is forwarded
|
||||
* to a VM. If the interrupt is not forwarded, try to EOI the interrupt.
|
||||
*/
|
||||
check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
|
||||
}
|
||||
|
||||
if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
|
||||
chip->irq_eoi(&desc->irq_data);
|
||||
|
||||
if (chip->irq_mask)
|
||||
chip->irq_mask(&desc->irq_data);
|
||||
|
||||
if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
|
||||
chip->irq_disable(&desc->irq_data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user