aboutsummaryrefslogtreecommitdiff
path: root/arch/csky/kernel
AgeCommit message (Collapse)AuthorFilesLines
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner1-0/+1
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-22csky/syscall_trace: Fixup return processing flowGuo Ren1-1/+2
The function tracehook_report_syscall_entry's return value is __must_check attribute. We should add return processing flow in ptrace.c and set the syscall number to -1 when failed just like riscv's. Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]>
2019-04-22csky: Add support for perf registers samplingMao Han2-0/+41
This patch implements the perf registers sampling and validation API for csky arch. The valid registers and their register ID are defined in perf_regs.h. Perf tool can backtrace in userspace with unwind library and the registers/user stack dump support. Signed-off-by: Mao Han <[email protected]> Signed-off-by: Guo Ren <[email protected]>
2019-04-22csky: Use va_pa_offset instead of phys_offsetGuo Ren2-5/+5
The name of phys_offset is so common for global export and it may conflict with some local name. So change phys_offset to va_pa_offset which also used by riscv. Also use __pa() and __va() instead of using phys_offset directly. Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]>
2019-04-22csky: Support vmlinux bootup with MMU offGuo Ren2-56/+11
Modify SETUP_MMU macro to fit on both MMU-on or MMU-off enviornment and vmlinux could bootup from MMU off enviornment for some cases. Unify the style of _start and _start_smp_secondary in head.S to make head.S looks more concise and easy to understand. Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]>
2019-04-22csky: Support dynamic start physical addressGuo Ren2-2/+9
Before this patch csky-linux need CONFIG_RAM_BASE to determine start physical address. Now we use phys_offset variable to replace the macro of PHYS_OFFSET and we setup phys_offset with real physical address which is determined during startup in head.S. With this patch we needn't re-compile kernel for different start physical address. ie: 0x0 / 0xc0000000 start physical address could use the same vmlinux, be care different start address must be 512MB aligned. Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]>
2019-04-22csky: Reconstruct signal processingGuo Ren3-260/+146
Linux kernel has provided some apis for arch signal's implementation. For example: restore_saved_sigmask() set_current_blocked() restore_altstack() But in last version of csky signal.c didn't use them and some codes are confusing, so reconstruct signal.c with reference to riscv's code. Now csky signal.c implementation are very close to riscv and we can get the following benefits: - Clear code structure - The signal code of riscv and csky can be reviewed together - Promoting the unification of arch's signal implementation Also modified the related code in entry.S Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]>
2019-04-22csky: Use in_syscall & forget_syscall instead of r11_sigGuo Ren2-16/+10
We could use regs->sr 16-24 bits to detect syscall: VEC_TRAP0 and r11_sig is no necessary for current implementation. In this patch, we implement the in_syscall and forget_syscall which are inspired from arm & nds32, but csky pt_regs has no syscall_num element and we just set zero to regs->sr's vector-bits-field instead. For ret_from_fork, current task was forked from parent which is in syscall progress and its regs->sr has been already setted with VEC_TRAP0. See: arch/csky/kernel/process.c: copy_thread() Signed-off-by: Guo Ren <[email protected]>
2019-04-22csky: Update syscall_trace_enter/exit implementationGuo Ren2-40/+35
Previous syscall_trace implementation couldn't support AUDITSYSCALL and SYSCALL_TRACEPOINTS. Now we redesign it to support audit_syscall and syscall_tracepoints just like other archs'. Signed-off-by: Guo Ren <[email protected]> Cc: Dmitry V. Levin <[email protected]> Cc: Arnd Bergmann <[email protected]>
2019-04-22csky: Add perf callchain supportMao Han2-0/+120
This patch add support for perf callchain sampling on csky platform. As fp is used to unwind the stack, the program being sampled and the C library need to be compiled with -mbacktrace for user callchains, kernel callchains require CONFIG_STACKTRACE = y. Changelog: - Coding convention with Christoph's advice for riscv's. Signed-off-by: Mao Han <[email protected]> Signed-off-by: Guo Ren <[email protected]> Cc: Christoph Hellwig <[email protected]>
2019-04-22csky/ftrace: Add dynamic function tracer (include graph tracer)Guo Ren1-2/+146
Support dynamic ftrace including dynamic graph tracer. Gcc-csky with -pg will produce call site in every function prologue and we can use these call site to hook trace function. gcc with -pg origin call site: push lr jbsr _mcount nop32 nop32 If the (callee - caller)'s offset is in range of bsr instruction, we'll modify code with: push lr bsr _mcount nop32 nop32 Else if the (callee - caller)'s offset is out of bsr instrunction, we'll modify code with: push lr movih r26, ... ori r26, ... jsr r26 (r26 is reserved for jsr link reg in csky abiv2 spec.) Signed-off-by: Guo Ren <[email protected]>
2019-02-13csky: Fixup dead loop in show_stackGuo Ren1-0/+4
When STACKTRACE is enabled, we must pass fp as stack for unwind, otherwise random value in stack will casue a dead loop. Signed-off-by: Guo Ren <[email protected]> Reported-by: Lu Baoquan <[email protected]>
2019-02-13csky: coding convention: Use task_stack_pageGuo Ren1-1/+2
Use task_stack_page instead of p->stack to get stack. Follow the coding convention style. Also for init_stack, the same with other archs. Signed-off-by: Guo Ren <[email protected]>
2019-02-13csky: Fixup wrong pt_regs sizeGuo Ren1-1/+2
The bug is from commit 2054f4af1957 ("csky: bugfix gdb coredump error.") We change the ELF_NGREG to ELF_NGREG - 2 to fit gdb&gcc define, but forgot modify ptrace regset. Now coredump use ELF_NRGEG to parse GPRs and ptrace use pt_regs_regset, so there are two different reg_sets for userspace. Signed-off-by: Guo Ren <[email protected]>
2019-01-10csky: fixup compile error with CPU 810.Guo Ren1-1/+1
This bug is from commit f553aa1c13cb ("csky: fixup relocation error with 807 & 860"). I forgot to compile with 810 for that patch. Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2019-01-08csky: fixup relocation error with 807 & 860Guo Ren1-16/+22
810 doesn't support jsri instruction and csky-as will leave jsri + nop for relocation. Module-probe need replace them with lrw + jsr. Signed-off-by: Guo Ren <[email protected]> Cc: Hui Kai <[email protected]>
2019-01-05Merge tag 'csky-for-linus-4.21' of git://github.com/c-sky/csky-linuxLinus Torvalds12-144/+1265
Pull arch/csky updates from Guo Ren: "Here are three main features (cpu_hotplug, basic ftrace, basic perf) and some bugfixes: Features: - Add CPU-hotplug support for SMP - Add ftrace with function trace and function graph trace - Add Perf support - Add EM_CSKY_OLD 39 - optimize kernel panic print. - remove syscall_exit_work Bugfixes: - fix abiv2 mmap(... O_SYNC) failure - fix gdb coredump error - remove vdsp implement for kernel - fix qemu failure to bootup sometimes - fix ftrace call-graph panic - fix device tree node reference leak - remove meaningless header-y - fix save hi,lo,dspcr regs in switch_stack - remove unused members in processor.h" * tag 'csky-for-linus-4.21' of git://github.com/c-sky/csky-linux: csky: Add perf support for C-SKY csky: Add EM_CSKY_OLD 39 clocksource/drivers/c-sky: fixup ftrace call-graph panic csky: ftrace call graph supported. csky: basic ftrace supported csky: remove unused members in processor.h csky: optimize kernel panic print. csky: stacktrace supported. csky: CPU-hotplug supported for SMP clocksource/drivers/c-sky: fixup qemu fail to bootup sometimes. csky: fixup save hi,lo,dspcr regs in switch_stack. csky: remove syscall_exit_work csky: fixup remove vdsp implement for kernel. csky: bugfix gdb coredump error. csky: fixup abiv2 mmap(... O_SYNC) failed. csky: define syscall_get_arch() elf-em.h: add EM_CSKY csky: remove meaningless header-y csky: Don't leak device tree node reference
2019-01-03Remove 'type' argument from access_ok() functionLinus Torvalds1-1/+1
Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument of the user address range verification function since we got rid of the old racy i386-only code to walk page tables by hand. It existed because the original 80386 would not honor the write protect bit when in kernel mode, so you had to do COW by hand before doing any user access. But we haven't supported that in a long time, and these days the 'type' argument is a purely historical artifact. A discussion about extending 'user_access_begin()' to do the range checking resulted this patch, because there is no way we're going to move the old VERIFY_xyz interface to that model. And it's best done at the end of the merge window when I've done most of my merges, so let's just get this done once and for all. This patch was mostly done with a sed-script, with manual fix-ups for the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form. There were a couple of notable cases: - csky still had the old "verify_area()" name as an alias. - the iter_iov code had magical hardcoded knowledge of the actual values of VERIFY_{READ,WRITE} (not that they mattered, since nothing really used it) - microblaze used the type argument for a debug printout but other than those oddities this should be a total no-op patch. I tried to fix up all architectures, did fairly extensive grepping for access_ok() uses, and the changes are trivial, but I may have missed something. Any missed conversion should be trivially fixable, though. Signed-off-by: Linus Torvalds <[email protected]>
2019-01-02csky: Add perf support for C-SKYGuo Ren2-0/+1032
This adds basic perf support for all C-SKY CPUs. Hardware events are only supported by 807/810/860. Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: ftrace call graph supported.Guo Ren1-11/+37
With csky-gcc -pg -mbacktrace, ftrace call graph supported. Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: basic ftrace supportedGuo Ren2-0/+29
When gcc with -pg, it'll add _mcount stub in every function. We need implement the _mcount in kernel and ftrace depends on stackstrace. To do: call-graph, dynamic ftrace Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: remove unused members in processor.hGuo Ren5-25/+0
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 <[email protected]>
2018-12-31csky: optimize kernel panic print.Guo Ren2-54/+39
Use STACKTRACE to optimize panic print more pretty and align registers printing. Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: stacktrace supported.Guo Ren3-12/+75
The gcc option "-mbacktrace" will push fp(r8),lr into stack and we could unwind the stack with: fp = *fp lr = (unsigned int *)fp[1] Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: CPU-hotplug supported for SMPGuo Ren1-15/+56
This is a simple implement of CPU-hotplug for power saving. CPU use wait instruction to enter power saving mode and waiting for IPI wakeup signal. Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: fixup save hi,lo,dspcr regs in switch_stack.Guo Ren3-25/+3
HI, LO, DSPCR registers are 807/810 related regs and no need for 610/860. All of the regs must be saved in pt_regs and switch_stack. This patch fixup saving dspcr reg in switch_stack and pt_regs. Signed-off-by: Guo Ren <[email protected]>
2018-12-31csky: remove syscall_exit_workGuo Ren1-12/+4
Remove syscall_exit_work and union all to ret_from_exception. Signed-off-by: Guo Ren <[email protected]>
2018-12-30csky: Don't leak device tree node referenceYangtao Li1-1/+1
of_find_node_by_type() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. setup_smp() doesn't do that, so fix it by converting to for_each_of_cpu_node(). Signed-off-by: Yangtao Li <[email protected]> Signed-off-by: Guo Ren <[email protected]>
2018-10-31mm: remove CONFIG_HAVE_MEMBLOCKMike Rapoport1-1/+0
All architecures use memblock for early memory management. There is no need for the CONFIG_HAVE_MEMBLOCK configuration option. [[email protected]: of/fdt: fixup #ifdefs] Link: http://lkml.kernel.org/r/20180919103457.GA20545@rapoport-lnx [[email protected]: csky: fixups after bootmem removal] Link: http://lkml.kernel.org/r/20180926112744.GC4628@rapoport-lnx [[email protected]: remove stale #else and the code it protects] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Acked-by: Michal Hocko <[email protected]> Tested-by: Jonathan Cameron <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Chris Zankel <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Ley Foon Tan <[email protected]> Cc: Mark Salter <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Burton <[email protected]> Cc: Richard Kuo <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Rich Felker <[email protected]> Cc: Russell King <[email protected]> Cc: Serge Semin <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Yoshinori Sato <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2018-10-26csky: Misc headersGuo Ren1-0/+88
This patch adds csky registers' definition, bitops, byteorder, asm-offsets codes. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: SMP supportGuo Ren1-0/+237
This patch adds boot, ipi, hotplug codes for SMP. Signed-off-by: Guo Ren <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: Debug and Ptrace GDBGuo Ren2-0/+380
This patch adds arch ptrace implementation, stack dump and bug.h. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: Library functionsGuo Ren1-0/+30
This patch adds string optimize codes and some auxiliary codes. Signed-off-by: Chen Linfei <[email protected]> Signed-off-by: Mao Han <[email protected]> Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: ELF and module probeGuo Ren1-0/+92
This patch adds ELF definition and module relocate codes. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: Atomic operationsGuo Ren1-0/+87
This patch adds atomic, cmpxchg, spinlock files. Signed-off-by: Guo Ren <[email protected]> Cc: Andrea Parri <[email protected]> Cc: Arnd Bergmann <[email protected]> Reviewed-by: Peter Zijlstra <[email protected]>
2018-10-26csky: IRQ handlingGuo Ren1-0/+22
This patch adds IRQ handling files. Signed-off-by: Guo Ren <[email protected]> Cc: Thomas Gleixner <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: VDSO and rt_sigreturnGuo Ren1-0/+86
This patch adds files related to VDSO and our VDSO only support rt_sigreturn. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-26csky: Process management and SignalGuo Ren3-0/+494
This patch adds files related to task_switch, sigcontext, signal, fpu context switch. Signed-off-by: Guo Ren <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Eric W. Biederman <[email protected]>
2018-10-25csky: System CallGuo Ren2-0/+57
This patch adds files related to syscall. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-25csky: Exception handling and mm-faultGuo Ren3-0/+644
This patch adds exception handling code, cpuinfo and mm-fault code. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-25csky: Kernel bootingGuo Ren3-0/+305
This patch add boot code. Thx boot params is all in dtb and it's the only way to let kernel get bootloader param information. Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]>
2018-10-25csky: Build infrastructureGuo Ren1-0/+8
This patch adds Makefile, Kconfig for build infrastructure. Signed-off-by: Guo Ren <[email protected]> Acked-by: Arnd Bergmann <[email protected]>