path: root/arch/csky/abiv1/inc
AgeCommit message (Collapse)AuthorLines
2020-02-21csky: Set regs->usp to kernel sp, when the exception is from kernelGuo Ren-5/+14
In the past, we didn't care about kernel sp when saving pt_reg. But in some cases, we still need pt_reg->usp to represent the kernel stack before enter exception. For cmpxhg in atomic.S, we need save and restore usp for above. Signed-off-by: Guo Ren <>
2019-08-22csky: Fixup 610 vipt cache flush mechanismGuo Ren-12/+29
610 has vipt aliasing issue, so we need to finish the cache flush apis mentioned in cachetlb.rst to avoid data corruption. Here is the list of modified apis in the patch: - flush_kernel_dcache_page (new add) - flush_dcache_mmap_lock (new add) - flush_dcache_mmap_unlock (new add) - flush_kernel_vmap_range (new add) - invalidate_kernel_vmap_range (new add) - flush_anon_page (new add) - flush_cache_range (new add) - flush_cache_vmap (flush all) - flush_cache_vunmap (flush all) - flush_cache_mm (only dcache flush) - flush_icache_page (just nop) - copy_from_user_page (remove no need flush) - copy_to_user_page (remove no need flush) Change to V2: - Fixup compile error with xa_lock*(&mapping->i_pages) Signed-off-by: Guo Ren <> Cc: Arnd Bergmann <> Cc: Christoph Hellwig <>
2019-08-20csky: Fixup defer cache flush for 610Guo Ren-2/+2
We use defer cache flush mechanism to improve the performance of 610, but the implementation is wrong. We fix it up now and update the mechanism: - Zero page needn't be flushed. - If page is file mapping & non-touched in user space, defer flush. - If page is anon mapping or dirty file mapping, flush immediately. - In update_mmu_cache finish the defer flush by flush_dcache_page(). For 610 we need take care the dcache aliasing issue: - VIPT cache with 8K-bytes size per way in 4K page granularity. Signed-off-by: Guo Ren <> Cc: Arnd Bergmann <>
2019-08-20csky: Fixup arch_get_unmapped_area() implementationGuo Ren-2/+3
Current arch_get_unmapped_area() of abiv1 doesn't use standard kernel api. After referring to the implementation of arch/arm, we implement it with vm_unmapped_area() from linux/mm.h. Signed-off-by: Guo Ren <> Cc: Arnd Bergmann <>
2019-07-19csky: Fixup abiv1 memset errorGuo Ren-3/+0
Current memset implementation in abiv1 is wrong and it'll cause unalign access. Just remove it and use the generic one. This patch will cause performance degradation and we will improve it with a new design in next patchset. Signed-off-by: Guo Ren <> Cc: Arnd Bergmann <>
2019-07-19csky: Use generic asid algorithm to implement switch_mmGuo Ren-0/+6
Use linux generic asid/vmid algorithm to implement csky switch_mm function. The algorithm is from arm and it could work with SMP system. It'll help reduce tlb flush for switch_mm in task/vm switch. Signed-off-by: Guo Ren <> Cc: Arnd Bergmann <>
2019-04-22csky: Use va_pa_offset instead of phys_offsetGuo Ren-2/+2
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 <> Cc: Arnd Bergmann <>
2019-04-22csky: Support vmlinux bootup with MMU offGuo Ren-12/+17
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 <> Cc: Arnd Bergmann <>
2019-04-22csky: Add perf_arch_fetch_caller_regs supportMao Han-0/+1
In trace events as tracepoints context are not able to be retrieve with task_pt_regs. Without arch caller regs support the pt_regs context will be all zero, perf can not parsing the callchain and resolving the symbols correctly, some time will even get into deadlock while handling the page fault, eg: perf kmem —page record ls Changelog - Add test case cmd in comment - Use regs_fp(regs) which is defined in abi/regdef.h Signed-off-by: Mao Han <> Signed-off-by: Guo Ren <>
2019-04-22csky: Support dynamic start physical addressGuo Ren-2/+37
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 <> Cc: Arnd Bergmann <>
2019-04-22csky: Reconstruct signal processingGuo Ren-7/+2
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 <> Cc: Arnd Bergmann <>
2019-04-22csky: Use in_syscall & forget_syscall instead of r11_sigGuo Ren-2/+0
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 <>
2019-04-22csky: Update syscall_trace_enter/exit implementationGuo Ren-0/+4
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 <> Cc: Dmitry V. Levin <> Cc: Arnd Bergmann <>
2018-12-31csky: fixup save hi,lo,dspcr regs in switch_stack.Guo Ren-0/+17
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 <>
2018-12-31csky: fixup abiv2 mmap(... O_SYNC) failed.Guo Ren-0/+1
Glibc function mmap(... O_SYNC) will make page to _PAGE_UNCACHE + _PAGE_SO and strong-order page couldn't support unalignment access. So remove _PAGE_SO from _PAGE_UNCACHE, also sync abiv1 with the macro of _PAGE_SO. Signed-off-by: Guo Ren <> Reported-by: Liu Renwei <> Tested-by: Yuan Qiyun <>
2018-10-26csky: Misc headersGuo Ren-0/+53
This patch adds csky registers' definition, bitops, byteorder, asm-offsets codes. Signed-off-by: Guo Ren <> Reviewed-by: Arnd Bergmann <>
2018-10-26csky: Library functionsGuo Ren-0/+13
This patch adds string optimize codes and some auxiliary codes. Signed-off-by: Chen Linfei <> Signed-off-by: Mao Han <> Signed-off-by: Guo Ren <> Reviewed-by: Arnd Bergmann <>
2018-10-26csky: ELF and module probeGuo Ren-0/+26
This patch adds ELF definition and module relocate codes. Signed-off-by: Guo Ren <> Reviewed-by: Arnd Bergmann <>
2018-10-26csky: VDSO and rt_sigreturnGuo Ren-0/+17
This patch adds files related to VDSO and our VDSO only support rt_sigreturn. Signed-off-by: Guo Ren <> Reviewed-by: Arnd Bergmann <>
2018-10-25csky: MMU and page table managementGuo Ren-0/+139
This patch adds files related to memory management and here is our memory-layout: Fixmap : 0xffc02000 – 0xfffff000 (4 MB - 12KB) Pkmap : 0xff800000 – 0xffc00000 (4 MB) Vmalloc : 0xf0200000 – 0xff000000 (238 MB) Lowmem : 0x80000000 – 0xc0000000 (1GB) abiv1 CPU (CK610) is VIPT cache and it doesn't support highmem. abiv2 CPUs are all PIPT cache and they could support highmem. Lowmem is directly mapped by msa0 & msa1 reg, and we needn't setup memory page table for it. Link: Signed-off-by: Guo Ren <> Cc: Christoph Hellwig <> Reviewed-by: Arnd Bergmann <>
2018-10-25csky: Cache and TLB routinesGuo Ren-0/+49
This patch adds cache and tlb sync codes for abiv1 & abiv2. Signed-off-by: Guo Ren <> Reviewed-by: Arnd Bergmann <>
2018-10-25csky: Exception handling and mm-faultGuo Ren-0/+160
This patch adds exception handling code, cpuinfo and mm-fault code. Signed-off-by: Guo Ren <> Reviewed-by: Arnd Bergmann <>