Skip to content

Commit 3a96570

Browse files
npigginmpe
authored andcommitted
powerpc: convert interrupt handlers to use wrappers
Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fd3f1e0 commit 3a96570

File tree

24 files changed

+169
-101
lines changed

24 files changed

+169
-101
lines changed

arch/powerpc/include/asm/asm-prototypes.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,35 +56,6 @@ int exit_vmx_usercopy(void);
5656
int enter_vmx_ops(void);
5757
void *exit_vmx_ops(void *dest);
5858

59-
/* Traps */
60-
long machine_check_early(struct pt_regs *regs);
61-
long hmi_exception_realmode(struct pt_regs *regs);
62-
void SMIException(struct pt_regs *regs);
63-
void handle_hmi_exception(struct pt_regs *regs);
64-
void instruction_breakpoint_exception(struct pt_regs *regs);
65-
void RunModeException(struct pt_regs *regs);
66-
void single_step_exception(struct pt_regs *regs);
67-
void program_check_exception(struct pt_regs *regs);
68-
void alignment_exception(struct pt_regs *regs);
69-
void StackOverflow(struct pt_regs *regs);
70-
void stack_overflow_exception(struct pt_regs *regs);
71-
void kernel_fp_unavailable_exception(struct pt_regs *regs);
72-
void altivec_unavailable_exception(struct pt_regs *regs);
73-
void vsx_unavailable_exception(struct pt_regs *regs);
74-
void fp_unavailable_tm(struct pt_regs *regs);
75-
void altivec_unavailable_tm(struct pt_regs *regs);
76-
void vsx_unavailable_tm(struct pt_regs *regs);
77-
void facility_unavailable_exception(struct pt_regs *regs);
78-
void TAUException(struct pt_regs *regs);
79-
void altivec_assist_exception(struct pt_regs *regs);
80-
void unrecoverable_exception(struct pt_regs *regs);
81-
void kernel_bad_stack(struct pt_regs *regs);
82-
void system_reset_exception(struct pt_regs *regs);
83-
void machine_check_exception(struct pt_regs *regs);
84-
void emulation_assist_interrupt(struct pt_regs *regs);
85-
long do_slb_fault(struct pt_regs *regs);
86-
void do_bad_slb_fault(struct pt_regs *regs);
87-
8859
/* signals, syscalls and interrupts */
8960
long sys_swapcontext(struct ucontext __user *old_ctx,
9061
struct ucontext __user *new_ctx,

arch/powerpc/include/asm/book3s/64/mmu-hash.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ static inline unsigned long hpt_hash(unsigned long vpn,
456456

457457
long hpte_insert_repeating(unsigned long hash, unsigned long vpn, unsigned long pa,
458458
unsigned long rlags, unsigned long vflags, int psize, int ssize);
459-
long do_hash_fault(struct pt_regs *regs);
460459
extern int __hash_page_4K(unsigned long ea, unsigned long access,
461460
unsigned long vsid, pte_t *ptep, unsigned long trap,
462461
unsigned long flags, int ssize, int subpage_prot);

arch/powerpc/include/asm/debug.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ bool ppc_breakpoint_available(void);
5050
#ifdef CONFIG_PPC_ADV_DEBUG_REGS
5151
extern void do_send_trap(struct pt_regs *regs, unsigned long address,
5252
unsigned long error_code, int brkpt);
53-
#else
54-
55-
void do_break(struct pt_regs *regs);
5653
#endif
5754

5855
#endif /* _ASM_POWERPC_DEBUG_H */

arch/powerpc/include/asm/hw_irq.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@
5050

5151
#ifndef __ASSEMBLY__
5252

53-
extern void replay_system_reset(void);
54-
extern void replay_soft_interrupts(void);
55-
56-
extern void timer_interrupt(struct pt_regs *);
57-
extern void performance_monitor_exception(struct pt_regs *regs);
58-
extern void WatchdogException(struct pt_regs *regs);
59-
extern void unknown_exception(struct pt_regs *regs);
60-
void unknown_async_exception(struct pt_regs *regs);
61-
6253
#ifdef CONFIG_PPC64
6354
#include <asm/paca.h>
6455

arch/powerpc/include/asm/interrupt.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,70 @@ __visible noinstr long func(struct pt_regs *regs) \
232232
\
233233
static __always_inline long ____##func(struct pt_regs *regs)
234234

235+
236+
/* Interrupt handlers */
237+
/* kernel/traps.c */
238+
DECLARE_INTERRUPT_HANDLER_NMI(system_reset_exception);
239+
#ifdef CONFIG_PPC_BOOK3S_64
240+
DECLARE_INTERRUPT_HANDLER_ASYNC(machine_check_exception);
241+
#else
242+
DECLARE_INTERRUPT_HANDLER_NMI(machine_check_exception);
243+
#endif
244+
DECLARE_INTERRUPT_HANDLER(SMIException);
245+
DECLARE_INTERRUPT_HANDLER(handle_hmi_exception);
246+
DECLARE_INTERRUPT_HANDLER(unknown_exception);
247+
DECLARE_INTERRUPT_HANDLER_ASYNC(unknown_async_exception);
248+
DECLARE_INTERRUPT_HANDLER(instruction_breakpoint_exception);
249+
DECLARE_INTERRUPT_HANDLER(RunModeException);
250+
DECLARE_INTERRUPT_HANDLER(single_step_exception);
251+
DECLARE_INTERRUPT_HANDLER(program_check_exception);
252+
DECLARE_INTERRUPT_HANDLER(emulation_assist_interrupt);
253+
DECLARE_INTERRUPT_HANDLER(alignment_exception);
254+
DECLARE_INTERRUPT_HANDLER(StackOverflow);
255+
DECLARE_INTERRUPT_HANDLER(stack_overflow_exception);
256+
DECLARE_INTERRUPT_HANDLER(kernel_fp_unavailable_exception);
257+
DECLARE_INTERRUPT_HANDLER(altivec_unavailable_exception);
258+
DECLARE_INTERRUPT_HANDLER(vsx_unavailable_exception);
259+
DECLARE_INTERRUPT_HANDLER(facility_unavailable_exception);
260+
DECLARE_INTERRUPT_HANDLER(fp_unavailable_tm);
261+
DECLARE_INTERRUPT_HANDLER(altivec_unavailable_tm);
262+
DECLARE_INTERRUPT_HANDLER(vsx_unavailable_tm);
263+
DECLARE_INTERRUPT_HANDLER_NMI(performance_monitor_exception_nmi);
264+
DECLARE_INTERRUPT_HANDLER_ASYNC(performance_monitor_exception_async);
265+
DECLARE_INTERRUPT_HANDLER_RAW(performance_monitor_exception);
266+
DECLARE_INTERRUPT_HANDLER(DebugException);
267+
DECLARE_INTERRUPT_HANDLER(altivec_assist_exception);
268+
DECLARE_INTERRUPT_HANDLER(CacheLockingException);
269+
DECLARE_INTERRUPT_HANDLER(SPEFloatingPointException);
270+
DECLARE_INTERRUPT_HANDLER(SPEFloatingPointRoundException);
271+
DECLARE_INTERRUPT_HANDLER(unrecoverable_exception);
272+
DECLARE_INTERRUPT_HANDLER(WatchdogException);
273+
DECLARE_INTERRUPT_HANDLER(kernel_bad_stack);
274+
275+
/* slb.c */
276+
DECLARE_INTERRUPT_HANDLER_RAW(do_slb_fault);
277+
DECLARE_INTERRUPT_HANDLER(do_bad_slb_fault);
278+
279+
/* hash_utils.c */
280+
DECLARE_INTERRUPT_HANDLER_RAW(do_hash_fault);
281+
282+
/* fault.c */
283+
DECLARE_INTERRUPT_HANDLER_RET(do_page_fault);
284+
DECLARE_INTERRUPT_HANDLER(do_bad_page_fault_segv);
285+
286+
/* process.c */
287+
DECLARE_INTERRUPT_HANDLER(do_break);
288+
289+
/* time.c */
290+
DECLARE_INTERRUPT_HANDLER_ASYNC(timer_interrupt);
291+
292+
/* mce.c */
293+
DECLARE_INTERRUPT_HANDLER_NMI(machine_check_early);
294+
DECLARE_INTERRUPT_HANDLER_NMI(hmi_exception_realmode);
295+
296+
DECLARE_INTERRUPT_HANDLER_ASYNC(TAUException);
297+
298+
void replay_system_reset(void);
299+
void replay_soft_interrupts(void);
300+
235301
#endif /* _ASM_POWERPC_INTERRUPT_H */

arch/powerpc/include/asm/nmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#ifdef CONFIG_PPC_WATCHDOG
66
extern void arch_touch_nmi_watchdog(void);
7-
void soft_nmi_interrupt(struct pt_regs *regs);
7+
long soft_nmi_interrupt(struct pt_regs *regs);
88
#else
99
static inline void arch_touch_nmi_watchdog(void) {}
1010
#endif

arch/powerpc/kernel/dbell.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
#include <linux/hardirq.h>
1313

1414
#include <asm/dbell.h>
15+
#include <asm/interrupt.h>
1516
#include <asm/irq_regs.h>
1617
#include <asm/kvm_ppc.h>
1718
#include <asm/trace.h>
1819

1920
#ifdef CONFIG_SMP
2021

21-
void doorbell_exception(struct pt_regs *regs)
22+
DEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception)
2223
{
2324
struct pt_regs *old_regs = set_irq_regs(regs);
2425

@@ -39,9 +40,8 @@ void doorbell_exception(struct pt_regs *regs)
3940
set_irq_regs(old_regs);
4041
}
4142
#else /* CONFIG_SMP */
42-
void doorbell_exception(struct pt_regs *regs)
43+
DEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception)
4344
{
4445
printk(KERN_WARNING "Received doorbell on non-smp system\n");
4546
}
4647
#endif /* CONFIG_SMP */
47-

arch/powerpc/kernel/irq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <linux/pgtable.h>
5555

5656
#include <linux/uaccess.h>
57+
#include <asm/interrupt.h>
5758
#include <asm/io.h>
5859
#include <asm/irq.h>
5960
#include <asm/cache.h>
@@ -665,7 +666,7 @@ void __do_irq(struct pt_regs *regs)
665666
irq_exit();
666667
}
667668

668-
void do_IRQ(struct pt_regs *regs)
669+
DEFINE_INTERRUPT_HANDLER_ASYNC(do_IRQ)
669670
{
670671
struct pt_regs *old_regs = set_irq_regs(regs);
671672
void *cursp, *irqsp, *sirqsp;

arch/powerpc/kernel/mce.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/ftrace.h>
2020
#include <linux/memblock.h>
2121

22+
#include <asm/interrupt.h>
2223
#include <asm/machdep.h>
2324
#include <asm/mce.h>
2425
#include <asm/nmi.h>
@@ -583,7 +584,7 @@ EXPORT_SYMBOL_GPL(machine_check_print_event_info);
583584
*
584585
* regs->nip and regs->msr contains srr0 and ssr1.
585586
*/
586-
long notrace machine_check_early(struct pt_regs *regs)
587+
DEFINE_INTERRUPT_HANDLER_NMI(machine_check_early)
587588
{
588589
long handled = 0;
589590
u8 ftrace_enabled = this_cpu_get_ftrace_enabled();
@@ -717,7 +718,7 @@ long hmi_handle_debugtrig(struct pt_regs *regs)
717718
/*
718719
* Return values:
719720
*/
720-
long hmi_exception_realmode(struct pt_regs *regs)
721+
DEFINE_INTERRUPT_HANDLER_NMI(hmi_exception_realmode)
721722
{
722723
int ret;
723724

arch/powerpc/kernel/process.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/pkeys.h>
4242
#include <linux/seq_buf.h>
4343

44+
#include <asm/interrupt.h>
4445
#include <asm/io.h>
4546
#include <asm/processor.h>
4647
#include <asm/mmu.h>
@@ -659,7 +660,7 @@ static void do_break_handler(struct pt_regs *regs)
659660
}
660661
}
661662

662-
void do_break(struct pt_regs *regs)
663+
DEFINE_INTERRUPT_HANDLER(do_break)
663664
{
664665
current->thread.trap_nr = TRAP_HWBKPT;
665666
if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, regs->dsisr,

arch/powerpc/kernel/syscall_64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <asm/kup.h>
66
#include <asm/cputime.h>
77
#include <asm/hw_irq.h>
8+
#include <asm/interrupt.h>
89
#include <asm/kprobes.h>
910
#include <asm/paca.h>
1011
#include <asm/ptrace.h>

arch/powerpc/kernel/tau_6xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/delay.h>
2323
#include <linux/workqueue.h>
2424

25+
#include <asm/interrupt.h>
2526
#include <asm/io.h>
2627
#include <asm/reg.h>
2728
#include <asm/nvram.h>
@@ -100,7 +101,7 @@ static void TAUupdate(int cpu)
100101
* with interrupts disabled
101102
*/
102103

103-
void TAUException(struct pt_regs * regs)
104+
DEFINE_INTERRUPT_HANDLER_ASYNC(TAUException)
104105
{
105106
int cpu = smp_processor_id();
106107

arch/powerpc/kernel/time.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include <linux/processor.h>
5858
#include <asm/trace.h>
5959

60+
#include <asm/interrupt.h>
6061
#include <asm/io.h>
6162
#include <asm/nvram.h>
6263
#include <asm/cache.h>
@@ -571,7 +572,7 @@ void arch_irq_work_raise(void)
571572
* timer_interrupt - gets called when the decrementer overflows,
572573
* with interrupts disabled.
573574
*/
574-
void timer_interrupt(struct pt_regs *regs)
575+
DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt)
575576
{
576577
struct clock_event_device *evt = this_cpu_ptr(&decrementers);
577578
u64 *next_tb = this_cpu_ptr(&decrementers_next_tb);

0 commit comments

Comments
 (0)