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