forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/sparc/kernel/traps_64.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* arch/sparc64/kernel/traps.c
23 *
34 * Copyright (C) 1995,1997,2008,2009,2012 David S. Miller (davem@davemloft.net)
....@@ -17,6 +18,7 @@
1718 #include <linux/smp.h>
1819 #include <linux/mm.h>
1920 #include <linux/init.h>
21
+#include <linux/kallsyms.h>
2022 #include <linux/kdebug.h>
2123 #include <linux/ftrace.h>
2224 #include <linux/reboot.h>
....@@ -28,7 +30,6 @@
2830 #include <asm/ptrace.h>
2931 #include <asm/oplib.h>
3032 #include <asm/page.h>
31
-#include <asm/pgtable.h>
3233 #include <asm/unistd.h>
3334 #include <linux/uaccess.h>
3435 #include <asm/fpumacro.h>
....@@ -107,7 +108,7 @@
107108 regs->tnpc &= 0xffffffff;
108109 }
109110 force_sig_fault(SIGILL, ILL_ILLTRP,
110
- (void __user *)regs->tpc, lvl, current);
111
+ (void __user *)regs->tpc, lvl);
111112 }
112113
113114 void bad_trap_tl1(struct pt_regs *regs, long lvl)
....@@ -201,7 +202,7 @@
201202 regs->tnpc &= 0xffffffff;
202203 }
203204 force_sig_fault(SIGSEGV, SEGV_MAPERR,
204
- (void __user *)regs->tpc, 0, current);
205
+ (void __user *)regs->tpc, 0);
205206 out:
206207 exception_exit(prev_state);
207208 }
....@@ -236,7 +237,7 @@
236237 regs->tpc &= 0xffffffff;
237238 regs->tnpc &= 0xffffffff;
238239 }
239
- force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0, current);
240
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0);
240241 }
241242
242243 void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx)
....@@ -320,7 +321,7 @@
320321 if (is_no_fault_exception(regs))
321322 return;
322323
323
- force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0, current);
324
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0);
324325 out:
325326 exception_exit(prev_state);
326327 }
....@@ -384,16 +385,13 @@
384385 */
385386 switch (type) {
386387 case HV_FAULT_TYPE_INV_ASI:
387
- force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0,
388
- current);
388
+ force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0);
389389 break;
390390 case HV_FAULT_TYPE_MCD_DIS:
391
- force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0,
392
- current);
391
+ force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0);
393392 break;
394393 default:
395
- force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0,
396
- current);
394
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0);
397395 break;
398396 }
399397 }
....@@ -570,7 +568,7 @@
570568 regs->tpc &= 0xffffffff;
571569 regs->tnpc &= 0xffffffff;
572570 }
573
- force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0, current);
571
+ force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0);
574572 }
575573
576574 void spitfire_access_error(struct pt_regs *regs, unsigned long status_encoded, unsigned long afar)
....@@ -2072,7 +2070,7 @@
20722070 * code
20732071 */
20742072 force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr,
2075
- 0, current);
2073
+ 0);
20762074 }
20772075
20782076 /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
....@@ -2180,13 +2178,13 @@
21802178 addr += PAGE_SIZE;
21812179 }
21822180 }
2183
- force_sig(SIGKILL, current);
2181
+ force_sig(SIGKILL);
21842182
21852183 return true;
21862184 }
21872185 if (attrs & SUN4V_ERR_ATTRS_PIO) {
21882186 force_sig_fault(SIGBUS, BUS_ADRERR,
2189
- (void __user *)sun4v_get_vaddr(regs), 0, current);
2187
+ (void __user *)sun4v_get_vaddr(regs), 0);
21902188 return true;
21912189 }
21922190
....@@ -2343,7 +2341,7 @@
23432341 code = FPE_FLTRES;
23442342 }
23452343 force_sig_fault(SIGFPE, code,
2346
- (void __user *)regs->tpc, 0, current);
2344
+ (void __user *)regs->tpc, 0);
23472345 }
23482346 }
23492347
....@@ -2398,7 +2396,7 @@
23982396 regs->tnpc &= 0xffffffff;
23992397 }
24002398 force_sig_fault(SIGEMT, EMT_TAGOVF,
2401
- (void __user *)regs->tpc, 0, current);
2399
+ (void __user *)regs->tpc, 0);
24022400 out:
24032401 exception_exit(prev_state);
24042402 }
....@@ -2418,7 +2416,7 @@
24182416 regs->tnpc &= 0xffffffff;
24192417 }
24202418 force_sig_fault(SIGFPE, FPE_INTDIV,
2421
- (void __user *)regs->tpc, 0, current);
2419
+ (void __user *)regs->tpc, 0);
24222420 out:
24232421 exception_exit(prev_state);
24242422 }
....@@ -2453,7 +2451,7 @@
24532451 printk("\n");
24542452 }
24552453
2456
-void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2454
+void show_stack(struct task_struct *tsk, unsigned long *_ksp, const char *loglvl)
24572455 {
24582456 unsigned long fp, ksp;
24592457 struct thread_info *tp;
....@@ -2477,7 +2475,7 @@
24772475
24782476 fp = ksp + STACK_BIAS;
24792477
2480
- printk("Call Trace:\n");
2478
+ printk("%sCall Trace:\n", loglvl);
24812479 do {
24822480 struct sparc_stackf *sf;
24832481 struct pt_regs *regs;
....@@ -2498,13 +2496,14 @@
24982496 fp = (unsigned long)sf->fp + STACK_BIAS;
24992497 }
25002498
2501
- printk(" [%016lx] %pS\n", pc, (void *) pc);
2499
+ print_ip_sym(loglvl, pc);
25022500 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
25032501 if ((pc + 8UL) == (unsigned long) &return_to_handler) {
2504
- int index = tsk->curr_ret_stack;
2505
- if (tsk->ret_stack && index >= graph) {
2506
- pc = tsk->ret_stack[index - graph].ret;
2507
- printk(" [%016lx] %pS\n", pc, (void *) pc);
2502
+ struct ftrace_ret_stack *ret_stack;
2503
+ ret_stack = ftrace_graph_get_ret_stack(tsk, graph);
2504
+ if (ret_stack) {
2505
+ pc = ret_stack->ret;
2506
+ print_ip_sym(loglvl, pc);
25082507 graph++;
25092508 }
25102509 }
....@@ -2613,7 +2612,7 @@
26132612 }
26142613 }
26152614 }
2616
- force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0, current);
2615
+ force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0);
26172616 out:
26182617 exception_exit(prev_state);
26192618 }
....@@ -2633,7 +2632,7 @@
26332632 if (is_no_fault_exception(regs))
26342633 return;
26352634
2636
- force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0, current);
2635
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0);
26372636 out:
26382637 exception_exit(prev_state);
26392638 }
....@@ -2651,7 +2650,7 @@
26512650 if (is_no_fault_exception(regs))
26522651 return;
26532652
2654
- force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0, current);
2653
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0);
26552654 }
26562655
26572656 /* sun4v_mem_corrupt_detect_precise() - Handle precise exception on an ADI
....@@ -2698,7 +2697,7 @@
26982697 regs->tpc &= 0xffffffff;
26992698 regs->tnpc &= 0xffffffff;
27002699 }
2701
- force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0, current);
2700
+ force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0);
27022701 }
27032702
27042703 void do_privop(struct pt_regs *regs)
....@@ -2714,7 +2713,7 @@
27142713 regs->tnpc &= 0xffffffff;
27152714 }
27162715 force_sig_fault(SIGILL, ILL_PRVOPC,
2717
- (void __user *)regs->tpc, 0, current);
2716
+ (void __user *)regs->tpc, 0);
27182717 out:
27192718 exception_exit(prev_state);
27202719 }