Merge tag 'csky-for-linus-5.2-rc1' of git://github.com/c-sky/csky-linux
Pull arch/csky updates from Guo Ren: - Fixup vdsp&fpu issues in kernel - Add dynamic function tracer - Use in_syscall & forget_syscall instead of r11_sig - Reconstruct signal processing - Support dynamic start physical address - Fixup wrong update_mmu_cache implementation - Support vmlinux bootup with MMU off - Use va_pa_offset instead of phys_offset - Fixup syscall_trace return processing flow - Add perf callchain support - Add perf_arch_fetch_caller_regs support - Add page fault perf event support - Add support for perf registers sampling * tag 'csky-for-linus-5.2-rc1' of git://github.com/c-sky/csky-linux: csky/syscall_trace: Fixup return processing flow csky: Fixup compile warning csky: Add support for perf registers sampling csky: add page fault perf event support csky: Use va_pa_offset instead of phys_offset csky: Support vmlinux bootup with MMU off csky: Add perf_arch_fetch_caller_regs support csky: Fixup wrong update_mmu_cache implementation csky: Support dynamic start physical address csky: Reconstruct signal processing csky: Use in_syscall & forget_syscall instead of r11_sig csky: Add non-uapi asm/ptrace.h namespace csky: mm/fault.c: Remove duplicate header csky: remove redundant generic-y csky: Update syscall_trace_enter/exit implementation csky: Add perf callchain support csky/ftrace: Add dynamic function tracer (include graph tracer) csky: Fixup vdsp&fpu issues in kernel
This commit is contained in:
@@ -12,7 +12,6 @@ generic-y += dma-mapping.h
|
||||
generic-y += emergency-restart.h
|
||||
generic-y += exec.h
|
||||
generic-y += fb.h
|
||||
generic-y += ftrace.h
|
||||
generic-y += futex.h
|
||||
generic-y += gpio.h
|
||||
generic-y += hardirq.h
|
||||
|
@@ -4,10 +4,26 @@
|
||||
#ifndef __ASM_CSKY_FTRACE_H
|
||||
#define __ASM_CSKY_FTRACE_H
|
||||
|
||||
#define MCOUNT_INSN_SIZE 4
|
||||
#define MCOUNT_INSN_SIZE 14
|
||||
|
||||
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
||||
|
||||
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
||||
|
||||
#define MCOUNT_ADDR ((unsigned long)_mcount)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
extern void _mcount(unsigned long);
|
||||
|
||||
extern void ftrace_graph_call(void);
|
||||
|
||||
static inline unsigned long ftrace_call_adjust(unsigned long addr)
|
||||
{
|
||||
return addr;
|
||||
}
|
||||
|
||||
struct dyn_arch_ftrace {
|
||||
};
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* __ASM_CSKY_FTRACE_H */
|
||||
|
@@ -14,23 +14,10 @@
|
||||
#include <linux/sched.h>
|
||||
#include <abi/ckmmu.h>
|
||||
|
||||
static inline void tlbmiss_handler_setup_pgd(unsigned long pgd, bool kernel)
|
||||
{
|
||||
pgd -= PAGE_OFFSET;
|
||||
pgd += PHYS_OFFSET;
|
||||
pgd |= 1;
|
||||
setup_pgd(pgd, kernel);
|
||||
}
|
||||
|
||||
#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
|
||||
tlbmiss_handler_setup_pgd((unsigned long)pgd, 0)
|
||||
setup_pgd(__pa(pgd), false)
|
||||
#define TLBMISS_HANDLER_SETUP_PGD_KERNEL(pgd) \
|
||||
tlbmiss_handler_setup_pgd((unsigned long)pgd, 1)
|
||||
|
||||
static inline unsigned long tlb_get_pgd(void)
|
||||
{
|
||||
return ((get_pgd() - PHYS_OFFSET) & ~1) + PAGE_OFFSET;
|
||||
}
|
||||
setup_pgd(__pa(pgd), true)
|
||||
|
||||
#define cpu_context(cpu, mm) ((mm)->context.asid[cpu])
|
||||
#define cpu_asid(cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <linux/const.h>
|
||||
|
||||
/*
|
||||
* PAGE_SHIFT determines the page size
|
||||
* PAGE_SHIFT determines the page size: 4KB
|
||||
*/
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
|
||||
@@ -17,12 +17,18 @@
|
||||
#define THREAD_MASK (~(THREAD_SIZE - 1))
|
||||
#define THREAD_SHIFT (PAGE_SHIFT + 1)
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: virtual isn't really correct, actually it should be the offset into the
|
||||
* memory node, but we have no highmem, so that works for now.
|
||||
* TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots
|
||||
* of the shifts unnecessary.
|
||||
* For C-SKY "User-space:Kernel-space" is "2GB:2GB" fixed by hardware and there
|
||||
* are two segment registers (MSA0 + MSA1) to mapping 512MB + 512MB physical
|
||||
* address region. We use them mapping kernel 1GB direct-map address area and
|
||||
* for more than 1GB of memory we use highmem.
|
||||
*/
|
||||
#define PAGE_OFFSET 0x80000000
|
||||
#define SSEG_SIZE 0x20000000
|
||||
#define LOWMEM_LIMIT (SSEG_SIZE * 2)
|
||||
|
||||
#define PHYS_OFFSET_OFFSET (CONFIG_RAM_BASE & (SSEG_SIZE - 1))
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
@@ -50,9 +56,6 @@ struct page;
|
||||
|
||||
struct vm_area_struct;
|
||||
|
||||
/*
|
||||
* These are used to make use of C type-checking..
|
||||
*/
|
||||
typedef struct { unsigned long pte_low; } pte_t;
|
||||
#define pte_val(x) ((x).pte_low)
|
||||
|
||||
@@ -69,18 +72,13 @@ typedef struct page *pgtable_t;
|
||||
#define __pgd(x) ((pgd_t) { (x) })
|
||||
#define __pgprot(x) ((pgprot_t) { (x) })
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
extern unsigned long va_pa_offset;
|
||||
|
||||
#define PHYS_OFFSET (CONFIG_RAM_BASE & ~(LOWMEM_LIMIT - 1))
|
||||
#define PHYS_OFFSET_OFFSET (CONFIG_RAM_BASE & (LOWMEM_LIMIT - 1))
|
||||
#define ARCH_PFN_OFFSET PFN_DOWN(CONFIG_RAM_BASE)
|
||||
#define ARCH_PFN_OFFSET PFN_DOWN(va_pa_offset + PHYS_OFFSET_OFFSET)
|
||||
|
||||
#define PAGE_OFFSET 0x80000000
|
||||
#define LOWMEM_LIMIT 0x40000000
|
||||
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + va_pa_offset)
|
||||
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - va_pa_offset))
|
||||
|
||||
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
|
||||
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - \
|
||||
PHYS_OFFSET))
|
||||
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
|
||||
|
||||
#define MAP_NR(x) PFN_DOWN((unsigned long)(x) - PAGE_OFFSET - \
|
||||
@@ -90,15 +88,10 @@ typedef struct page *pgtable_t;
|
||||
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
|
||||
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
||||
|
||||
/*
|
||||
* main RAM and kernel working space are coincident at 0x80000000, but to make
|
||||
* life more interesting, there's also an uncached virtual shadow at 0xb0000000
|
||||
* - these mappings are fixed in the MMU
|
||||
*/
|
||||
|
||||
#define pfn_to_kaddr(x) __va(PFN_PHYS(x))
|
||||
|
||||
#include <asm-generic/memory_model.h>
|
||||
#include <asm-generic/getorder.h>
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* __ASM_CSKY_PAGE_H */
|
||||
|
@@ -4,4 +4,12 @@
|
||||
#ifndef __ASM_CSKY_PERF_EVENT_H
|
||||
#define __ASM_CSKY_PERF_EVENT_H
|
||||
|
||||
#include <abi/regdef.h>
|
||||
|
||||
#define perf_arch_fetch_caller_regs(regs, __ip) { \
|
||||
(regs)->pc = (__ip); \
|
||||
regs_fp(regs) = (unsigned long) __builtin_frame_address(0); \
|
||||
asm volatile("mov %0, sp\n":"=r"((regs)->usp)); \
|
||||
}
|
||||
|
||||
#endif /* __ASM_PERF_EVENT_ELF_H */
|
||||
|
41
arch/csky/include/asm/ptrace.h
Normal file
41
arch/csky/include/asm/ptrace.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
|
||||
#ifndef __ASM_CSKY_PTRACE_H
|
||||
#define __ASM_CSKY_PTRACE_H
|
||||
|
||||
#include <uapi/asm/ptrace.h>
|
||||
#include <asm/traps.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#define PS_S 0x80000000 /* Supervisor Mode */
|
||||
|
||||
#define arch_has_single_step() (1)
|
||||
#define current_pt_regs() \
|
||||
({ (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1; })
|
||||
|
||||
#define user_stack_pointer(regs) ((regs)->usp)
|
||||
|
||||
#define user_mode(regs) (!((regs)->sr & PS_S))
|
||||
#define instruction_pointer(regs) ((regs)->pc)
|
||||
#define profile_pc(regs) instruction_pointer(regs)
|
||||
|
||||
static inline bool in_syscall(struct pt_regs const *regs)
|
||||
{
|
||||
return ((regs->sr >> 16) & 0xff) == VEC_TRAP0;
|
||||
}
|
||||
|
||||
static inline void forget_syscall(struct pt_regs *regs)
|
||||
{
|
||||
regs->sr &= ~(0xff << 16);
|
||||
}
|
||||
|
||||
static inline unsigned long regs_return_value(struct pt_regs *regs)
|
||||
{
|
||||
return regs->a0;
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ASM_CSKY_PTRACE_H */
|
@@ -8,12 +8,21 @@
|
||||
#include <abi/regdef.h>
|
||||
#include <uapi/linux/audit.h>
|
||||
|
||||
extern void *sys_call_table[];
|
||||
|
||||
static inline int
|
||||
syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
|
||||
{
|
||||
return regs_syscallid(regs);
|
||||
}
|
||||
|
||||
static inline void
|
||||
syscall_set_nr(struct task_struct *task, struct pt_regs *regs,
|
||||
int sysno)
|
||||
{
|
||||
regs_syscallid(regs) = sysno;
|
||||
}
|
||||
|
||||
static inline void
|
||||
syscall_rollback(struct task_struct *task, struct pt_regs *regs)
|
||||
{
|
||||
|
@@ -51,29 +51,26 @@ static inline struct thread_info *current_thread_info(void)
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
/* entry.S relies on these definitions!
|
||||
* bits 0-5 are tested at every exception exit
|
||||
*/
|
||||
#define TIF_SIGPENDING 0 /* signal pending */
|
||||
#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
|
||||
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
|
||||
#define TIF_SYSCALL_TRACE 5 /* syscall trace active */
|
||||
#define TIF_DELAYED_TRACE 14 /* single step a syscall */
|
||||
#define TIF_SYSCALL_TRACE 3 /* syscall trace active */
|
||||
#define TIF_SYSCALL_TRACEPOINT 4 /* syscall tracepoint instrumentation */
|
||||
#define TIF_SYSCALL_AUDIT 5 /* syscall auditing */
|
||||
#define TIF_POLLING_NRFLAG 16 /* poll_idle() is TIF_NEED_RESCHED */
|
||||
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
|
||||
#define TIF_FREEZE 19 /* thread is freezing for suspend */
|
||||
#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */
|
||||
#define TIF_SECCOMP 21 /* secure computing */
|
||||
|
||||
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
|
||||
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
|
||||
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
|
||||
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
||||
#define _TIF_DELAYED_TRACE (1 << TIF_DELAYED_TRACE)
|
||||
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
|
||||
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
|
||||
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
|
||||
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
|
||||
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
||||
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
|
||||
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
|
||||
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
|
||||
#define _TIF_MEMDIE (1 << TIF_MEMDIE)
|
||||
#define _TIF_FREEZE (1 << TIF_FREEZE)
|
||||
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
|
||||
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
|
||||
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
|
||||
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
|
||||
|
||||
#endif /* _ASM_CSKY_THREAD_INFO_H */
|
||||
|
@@ -2,3 +2,5 @@
|
||||
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
|
||||
#include <uapi/asm/unistd.h>
|
||||
|
||||
#define NR_syscalls (__NR_syscalls)
|
||||
|
Reference in New Issue
Block a user