Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion arch/arm64/kernel/entry-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <asm/kprobes.h>
#include <asm/mmu.h>
#include <asm/processor.h>
#include <asm/runtime-const.h>
#include <asm/sdei.h>
#include <asm/stacktrace.h>
#include <asm/sysreg.h>
Expand Down Expand Up @@ -139,7 +140,8 @@ static void do_interrupt_handler(struct pt_regs *regs,
set_irq_regs(old_regs);
}

extern void (*handle_arch_irq)(struct pt_regs *);
extern void (*_handle_arch_irq)(struct pt_regs *);
#define handle_arch_irq runtime_const_ptr(_handle_arch_irq)
extern void (*handle_arch_fiq)(struct pt_regs *);

static void noinstr __panic_unhandled(struct pt_regs *regs, const char *vector,
Expand Down
9 changes: 6 additions & 3 deletions arch/arm64/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <asm/daifflags.h>
#include <asm/exception.h>
#include <asm/numa.h>
#include <asm/runtime-const.h>
#include <asm/softirq_stack.h>
#include <asm/stacktrace.h>
#include <asm/vmap_stack.h>
Expand Down Expand Up @@ -84,15 +85,17 @@ static void default_handle_fiq(struct pt_regs *regs)
panic("FIQ taken without a root FIQ handler\n");
}

void (*handle_arch_irq)(struct pt_regs *) __ro_after_init = default_handle_irq;
void (*_handle_arch_irq)(struct pt_regs *) __ro_after_init = default_handle_irq;
#define handle_arch_irq runtime_const_ptr(_handle_arch_irq)
void (*handle_arch_fiq)(struct pt_regs *) __ro_after_init = default_handle_fiq;

int __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
{
if (handle_arch_irq != default_handle_irq)
if (_handle_arch_irq != default_handle_irq)
return -EBUSY;

handle_arch_irq = handle_irq;
_handle_arch_irq = handle_irq;
runtime_const_init(ptr, _handle_arch_irq);
pr_info("Root IRQ handler: %ps\n", handle_irq);
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,8 @@
RUNTIME_CONST(shift, d_hash_shift) \
RUNTIME_CONST(ptr, dentry_hashtable) \
RUNTIME_CONST(ptr, __dentry_cache) \
RUNTIME_CONST(ptr, __names_cache)
RUNTIME_CONST(ptr, __names_cache) \
RUNTIME_CONST(ptr, _handle_arch_irq)

/* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */
#define KUNIT_TABLE() \
Expand Down
4 changes: 3 additions & 1 deletion include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ void ipi_mux_process(void);
int ipi_mux_create(unsigned int nr_ipi, void (*mux_send)(unsigned int cpu));

#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
#include <asm/runtime-const.h>
/*
* Registers a generic IRQ handling function as the top-level IRQ handler in
* the system, which is generally the first C code called from an assembly
Expand All @@ -1288,7 +1289,8 @@ int __init set_handle_irq(void (*handle_irq)(struct pt_regs *));
* Allows interrupt handlers to find the irqchip that's been registered as the
* top-level IRQ handler.
*/
extern void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
extern void (*_handle_arch_irq)(struct pt_regs *) __ro_after_init;
#define handle_arch_irq runtime_const_ptr(_handle_arch_irq)
asmlinkage void generic_handle_arch_irq(struct pt_regs *regs);
#else
#ifndef set_handle_irq
Expand Down
8 changes: 5 additions & 3 deletions kernel/irq/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
#include <linux/kernel_stat.h>

#include <asm/irq_regs.h>
#include <asm/runtime-const.h>

#include <trace/events/irq.h>

#include "internals.h"

#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
void (*_handle_arch_irq)(struct pt_regs *) __ro_after_init;
#endif

/**
Expand Down Expand Up @@ -270,10 +271,11 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
int __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
{
if (handle_arch_irq)
if (_handle_arch_irq)
return -EBUSY;

handle_arch_irq = handle_irq;
_handle_arch_irq = handle_irq;
runtime_const_init(ptr, _handle_arch_irq);
return 0;
}

Expand Down