Commit graph

11 commits

Author SHA1 Message Date
Kelly Devilliv
a0793fdad9 csky: fix typo of fpu config macro
Fix typo which will cause fpe and privilege exception error.

Signed-off-by: Kelly Devilliv <kelly.devilliv@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
2021-12-08 14:15:54 +08:00
Guo Ren
b0ae5e26b8 csky: Remove prologue of page fault handler in entry.S
There is a prologue on page fault handler which marking pages dirty
and/or accessed in page attributes, but all of these have been
handled in handle_pte_fault.

 - Add flush_tlb_one in vmalloc page fault instead of prologue.
 - Using cmxchg_fixup C codes in do_page_fault instead of ASM one.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
2021-01-12 09:52:40 +08:00
Guo Ren
5bc46ce26c csky: Optimize the trap processing flow
- Seperate different trap functions
 - Add trap_no()
 - Remove panic code print
 - Redesign die_if_kerenl to die with riscv's
 - Print exact trap info for app segment fault

[   17.389321] gzip[126]: unhandled signal 11 code 0x3 at 0x0007835a in busybox[8000+d4000]
[   17.393882]
[   17.393882] CURRENT PROCESS:
[   17.393882]
[   17.394309] COMM=gzip PID=126
[   17.394513] TEXT=00008000-000db2e4 DATA=000dcf14-000dd1ad BSS=000dd1ad-000ff000
[   17.395499] USER-STACK=7f888e50  KERNEL-STACK=bf130300
[   17.395499]
[   17.396801] PC: 0x0007835a (0x7835a)
[   17.397048] LR: 0x000058b4 (0x58b4)
[   17.397285] SP: 0xbe519f68
[   17.397555] orig_a0: 0x00002852
[   17.397886] PSR: 0x00020341
[   17.398356]  a0: 0x00002852   a1: 0x000f2f5a   a2: 0x0000d7ae   a3: 0x0000005d
[   17.399289]  r4: 0x000de150   r5: 0x00000002   r6: 0x00000102   r7: 0x00007efa
[   17.399800]  r8: 0x7f888bc4   r9: 0x00000001  r10: 0x000002eb  r11: 0x0000aac1
[   17.400166] r12: 0x00002ef2  r13: 0x00000007  r15: 0x000058b4
[   17.400531] r16: 0x0000004c  r17: 0x00000031  r18: 0x000f5816  r19: 0x000e8068
[   17.401006] r20: 0x000f5818  r21: 0x000e8068  r22: 0x000f5918  r23: 0x90000000
[   17.401721] r24: 0x00000031  r25: 0x000000c8  r26: 0x00000000  r27: 0x00000000
[   17.402199] r28: 0x2ac2a000  r29: 0x00000000  r30: 0x00000000  tls: 0x2aadbaa8
[   17.402686]  hi: 0x00120340   lo: 0x7f888bec
/etc/init.ci/ntfs3g_run: line 61:   126 Segmentation fault      gzip -c -9 /mnt/test.bin > /mnt/test_bin.gz

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
2020-07-31 01:52:22 +00:00
Guo Ren
8f6bb793b2 csky: Add uprobes support
This patch adds support for uprobes on csky architecture.

Just like kprobe, it support single-step and simulate instructions.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
2020-04-03 11:37:51 +08:00
Guo Ren
33e53ae1ce csky: Add kprobes supported
This patch enable kprobes, kretprobes, ftrace interface. It utilized
software breakpoint and single step debug exceptions, instructions
simulation on csky.

We use USR_BKPT replace origin instruction, and the kprobe handler
prepares an excutable memory slot for out-of-line execution with a
copy of the original instruction being probed. Most of instructions
could be executed by single-step, but some instructions need origin
pc value to execute and we need software simulate these instructions.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
2020-04-03 11:14:17 +08:00
Guo Ren
9c0e343d76 csky: Fixup get wrong psr value from phyical reg
We should get psr value from regs->psr in stack, not directly get
it from phyiscal register then save the vector number in
tsk->trap_no.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
2020-04-01 00:06:40 +08:00
Linus Torvalds
a84d2d2906 arch/csky patches for 5.3-rc1
This round of csky subsystem gives two features (ASID algorithm update,
 Perf pmu record support) and some fixups.
 
 Feature:
  - csky: Revert mmu ASID mechanism
  - csky: Add new asid lib code from arm
  - csky: Use generic asid algorithm to implement switch_mm
  - csky: Improve tlb operation with help of asid
 
  - csky: Init pmu as a device
  - csky: Add count-width property for csky pmu
  - csky: Add pmu interrupt support
  - csky: Fix perf record in kernel/user space
  - dt-bindings: csky: Add csky PMU bindings
 
 Fixup:
  - csky: Fixup no panic in kernel for some traps
  - csky: Fixup some error count in 810 & 860.
  - csky: Fixup abiv1 memset error
 
 CI-Tested: https://gitlab.com/c-sky/buildroot/pipelines/68656845
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE2KAv+isbWR/viAKHAXH1GYaIxXsFAl0xaiwSHHJlbl9ndW9A
 Yy1za3kuY29tAAoJEAFx9RmGiMV7+PgP/3mbYMf42AicPZHF/m4QkK9+wProS3TF
 ctu8Qzncue8SDMELKXWegnU6svB7wntL69wFbr53zQr4Kxyo0PS6QM1HrbIUHMZ/
 rnwGKAMHTP1yjwN89TZ7F0IIb2WPlbEyrJnYSJ4FvtUM/YWI310POibtFOpGztUw
 Wx/ioTharhtOipkkVMITYZRFnIQMm4j4I2YDROsSHbEGPy0QdrQ7nZvYiRAa7X50
 tDjXPNeV8+r5wlhMybCjykcdypPtFXv/na+9uwboO2RRapkUQx6J8Q9NG2SqTs4e
 EWrOAOnpniA3lahBuivhHfQrd9nxHAKfy0C/7Rhs9PTiU5dwETPILh2bF2TqnBZt
 XHohUyIxec6KmuY1o3/IOAhaAg8WCouVG3EtVv19qHxReWrlzc7RnQZ/j276BhcS
 BCB3b7WgrNES5i73gRPEQGFOxbML53uzoWShUZkAhQC5hepNqQNcvBmz/ecshbMM
 qL4p1uz3ol9yCylVcw1U5hzGjzChRGLj95MDeYuCMgDXybCzL8XevBuoOYB30r56
 tJJ2cSF3qkkB4a95OOAnxO+NgT88VXaXxA7/lzjFJjce5jH1ZN1e+GlYLDDyfVfT
 073j3GlhHUbzR5InQEJhHQW/1zKUOTV9H28dW3yJdlbrwAEroYPIJE+k+GSpS3Dq
 oNp4p5jePTZu
 =PbF1
 -----END PGP SIGNATURE-----

Merge tag 'csky-for-linus-5.3-rc1' of git://github.com/c-sky/csky-linux

Pull arch/csky pupdates from Guo Ren:
 "This round of csky subsystem gives two features (ASID algorithm
  update, Perf pmu record support) and some fixups.

  ASID updates:
   - Revert mmu ASID mechanism
   - Add new asid lib code from arm
   - Use generic asid algorithm to implement switch_mm
   - Improve tlb operation with help of asid

  Perf pmu record support:
   - Init pmu as a device
   - Add count-width property for csky pmu
   - Add pmu interrupt support
   - Fix perf record in kernel/user space
   - dt-bindings: Add csky PMU bindings

  Fixes:
   - Fixup no panic in kernel for some traps
   - Fixup some error count in 810 & 860.
   - Fixup abiv1 memset error"

* tag 'csky-for-linus-5.3-rc1' of git://github.com/c-sky/csky-linux:
  csky: Fixup abiv1 memset error
  csky: Improve tlb operation with help of asid
  csky: Use generic asid algorithm to implement switch_mm
  csky: Add new asid lib code from arm
  csky: Revert mmu ASID mechanism
  dt-bindings: csky: Add csky PMU bindings
  dt-bindings: interrupt-controller: Update csky mpintc
  csky: Fixup some error count in 810 & 860.
  csky: Fix perf record in kernel/user space
  csky: Add pmu interrupt support
  csky: Add count-width property for csky pmu
  csky: Init pmu as a device
  csky: Fixup no panic in kernel for some traps
  csky: Select intc & timer drivers
2019-07-19 12:15:33 -07:00
Guo Ren
3158d28953 csky: Fixup no panic in kernel for some traps
These traps couldn't be hanppen in kernel and we must panic there not
send a signal to userspace.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Cc: Arnd Bergmann <arnd@arndb.de>
2019-07-19 14:21:36 +08:00
Eric W. Biederman
2e1661d267 signal: Remove the task parameter from force_sig_fault
As synchronous exceptions really only make sense against the current
task (otherwise how are you synchronous) remove the task parameter
from from force_sig_fault to make it explicit that is what is going
on.

The two known exceptions that deliver a synchronous exception to a
stopped ptraced task have already been changed to
force_sig_fault_to_task.

The callers have been changed with the following emacs regular expression
(with obvious variations on the architectures that take more arguments)
to avoid typos:

force_sig_fault[(]\([^,]+\)[,]\([^,]+\)[,]\([^,]+\)[,]\W+current[)]
->
force_sig_fault(\1,\2,\3)

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2019-05-29 09:31:43 -05:00
Guo Ren
17a68777bc csky: remove unused members in processor.h
Cleanup struct cpuinfo_csky and struct thread_struct, remove all esp0
related code. We could get pt_regs from sp and backtrace could use fp
in switch_stack.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-12-31 23:16:00 +08:00
Guo Ren
081860b970 csky: Exception handling and mm-fault
This patch adds exception handling code, cpuinfo and mm-fault code.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
2018-10-25 23:36:19 +08:00