xref: /openbmc/linux/arch/hexagon/kernel/vm_events.c (revision b830f94f)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Mostly IRQ support for Hexagon
4  *
5  * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
6  */
7 
8 #include <linux/kernel.h>
9 #include <linux/sched/debug.h>
10 #include <asm/registers.h>
11 #include <linux/irq.h>
12 #include <linux/hardirq.h>
13 
14 /*
15  * show_regs - print pt_regs structure
16  * @regs: pointer to pt_regs
17  *
18  * To-do:  add all the accessor definitions to registers.h
19  *
20  * Will make this routine a lot easier to write.
21  */
22 void show_regs(struct pt_regs *regs)
23 {
24 	show_regs_print_info(KERN_EMERG);
25 
26 	printk(KERN_EMERG "restart_r0: \t0x%08lx   syscall_nr: %ld\n",
27 	       regs->restart_r0, regs->syscall_nr);
28 	printk(KERN_EMERG "preds: \t\t0x%08lx\n", regs->preds);
29 	printk(KERN_EMERG "lc0: \t0x%08lx   sa0: 0x%08lx   m0:  0x%08lx\n",
30 	       regs->lc0, regs->sa0, regs->m0);
31 	printk(KERN_EMERG "lc1: \t0x%08lx   sa1: 0x%08lx   m1:  0x%08lx\n",
32 	       regs->lc1, regs->sa1, regs->m1);
33 	printk(KERN_EMERG "gp: \t0x%08lx   ugp: 0x%08lx   usr: 0x%08lx\n",
34 	       regs->gp, regs->ugp, regs->usr);
35 	printk(KERN_EMERG "cs0: \t0x%08lx   cs1: 0x%08lx\n",
36 	       regs->cs0, regs->cs1);
37 	printk(KERN_EMERG "r0: \t0x%08lx %08lx %08lx %08lx\n", regs->r00,
38 		regs->r01,
39 		regs->r02,
40 		regs->r03);
41 	printk(KERN_EMERG "r4:  \t0x%08lx %08lx %08lx %08lx\n", regs->r04,
42 		regs->r05,
43 		regs->r06,
44 		regs->r07);
45 	printk(KERN_EMERG "r8:  \t0x%08lx %08lx %08lx %08lx\n", regs->r08,
46 		regs->r09,
47 		regs->r10,
48 		regs->r11);
49 	printk(KERN_EMERG "r12: \t0x%08lx %08lx %08lx %08lx\n", regs->r12,
50 		regs->r13,
51 		regs->r14,
52 		regs->r15);
53 	printk(KERN_EMERG "r16: \t0x%08lx %08lx %08lx %08lx\n", regs->r16,
54 		regs->r17,
55 		regs->r18,
56 		regs->r19);
57 	printk(KERN_EMERG "r20: \t0x%08lx %08lx %08lx %08lx\n", regs->r20,
58 		regs->r21,
59 		regs->r22,
60 		regs->r23);
61 	printk(KERN_EMERG "r24: \t0x%08lx %08lx %08lx %08lx\n", regs->r24,
62 		regs->r25,
63 		regs->r26,
64 		regs->r27);
65 	printk(KERN_EMERG "r28: \t0x%08lx %08lx %08lx %08lx\n", regs->r28,
66 		regs->r29,
67 		regs->r30,
68 		regs->r31);
69 
70 	printk(KERN_EMERG "elr: \t0x%08lx   cause: 0x%08lx   user_mode: %d\n",
71 		pt_elr(regs), pt_cause(regs), user_mode(regs));
72 	printk(KERN_EMERG "psp: \t0x%08lx   badva: 0x%08lx   int_enabled: %d\n",
73 		pt_psp(regs), pt_badva(regs), ints_enabled(regs));
74 }
75 
76 void dummy_handler(struct pt_regs *regs)
77 {
78 	unsigned int elr = pt_elr(regs);
79 	printk(KERN_ERR "Unimplemented handler; ELR=0x%08x\n", elr);
80 }
81 
82 
83 void arch_do_IRQ(struct pt_regs *regs)
84 {
85 	int irq = pt_cause(regs);
86 	struct pt_regs *old_regs = set_irq_regs(regs);
87 
88 	irq_enter();
89 	generic_handle_irq(irq);
90 	irq_exit();
91 	set_irq_regs(old_regs);
92 }
93