x86/irq: Rework handle_irq() for 64-bit
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 May 2020 20:05:35 +0000 (22:05 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 11 Jun 2020 13:15:12 +0000 (15:15 +0200)
To consolidate the interrupt entry/exit code vs. the other exceptions
make handle_irq() an inline and handle both 64-bit and 32-bit mode.

Preparatory change to move irq stack switching for 64-bit to C which allows
to consolidate the entry exit handling by reusing the idtentry machinery
both in ASM and C.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/20200521202118.889972748@linutronix.de
arch/x86/include/asm/irq.h
arch/x86/kernel/irq.c
arch/x86/kernel/irq_32.c

index 74690a373c58797666fe09628159fa48c2d2003f..67aa1e2a5b4aeb1fdcc50daae55fe2a9eba3bda0 100644 (file)
@@ -34,7 +34,7 @@ extern __visible void smp_kvm_posted_intr_nested_ipi(struct pt_regs *regs);
 extern void (*x86_platform_ipi_callback)(void);
 extern void native_init_IRQ(void);
 
-extern void handle_irq(struct irq_desc *desc, struct pt_regs *regs);
+extern void __handle_irq(struct irq_desc *desc, struct pt_regs *regs);
 
 extern __visible void do_IRQ(struct pt_regs *regs, unsigned long vector);
 
index c7669363251a2bae994ec10967d5d8a691144815..5495ea4debba3a803117e7182e309165941a19b3 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/export.h>
 #include <linux/irq.h>
 
+#include <asm/irq_stack.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <asm/irq.h>
@@ -221,6 +222,14 @@ u64 arch_irq_stat(void)
        return sum;
 }
 
+static __always_inline void handle_irq(struct irq_desc *desc,
+                                      struct pt_regs *regs)
+{
+       if (IS_ENABLED(CONFIG_X86_64))
+               run_on_irqstack_cond(desc->handle_irq, desc, regs);
+       else
+               __handle_irq(desc, regs);
+}
 
 /*
  * do_IRQ handles all normal device IRQ's (the special
@@ -246,7 +255,7 @@ __visible void __irq_entry do_IRQ(struct pt_regs *regs, unsigned long vector)
        desc = __this_cpu_read(vector_irq[vector]);
        if (likely(!IS_ERR_OR_NULL(desc))) {
                if (IS_ENABLED(CONFIG_X86_32))
-                       handle_irq(desc, regs);
+                       __handle_irq(desc, regs);
                else
                        generic_handle_irq_desc(desc);
        } else {
index a759ca97cd01cb5f9d3603987ce8676c2edb18e7..0b79efc87be527a08b91ffb8e6849ec9743d7a95 100644 (file)
@@ -148,7 +148,7 @@ void do_softirq_own_stack(void)
        call_on_stack(__do_softirq, isp);
 }
 
-void handle_irq(struct irq_desc *desc, struct pt_regs *regs)
+void __handle_irq(struct irq_desc *desc, struct pt_regs *regs)
 {
        int overflow = check_stack_overflow();