From: Paul Mundt Date: Wed, 13 Jan 2010 04:02:55 +0000 (+0900) Subject: Merge branches 'sh/xstate', 'sh/hw-breakpoints' and 'sh/stable-updates' X-Git-Tag: firefly_0821_release~9833^2~3107^2~136 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=644755e7867710a23e6243dcc69cfc071985f560;p=firefly-linux-kernel-4.4.55.git Merge branches 'sh/xstate', 'sh/hw-breakpoints' and 'sh/stable-updates' --- 644755e7867710a23e6243dcc69cfc071985f560 diff --cc arch/sh/include/asm/processor_32.h index 1f3d6fab660c,a359898206e8,259112cecbdf,1f3d6fab660c..5fd83125fb89 --- a/arch/sh/include/asm/processor_32.h +++ b/arch/sh/include/asm/processor_32.h @@@@@ -100,21 -104,21 -101,18 -100,21 +105,18 @@@@@ struct thread_struct unsigned long sp; unsigned long pc; -- - /* Hardware debugging registers */ -- - unsigned long ubc_pc; - - - - /* floating point info */ - - union sh_fpu_union fpu; ++ + /* Save middle states of ptrace breakpoints */ ++ + struct perf_event *ptrace_bps[HBP_NUM]; - /* floating point info */ - union sh_fpu_union fpu; - #ifdef CONFIG_SH_DSP /* Dsp status information */ struct sh_dsp_struct dsp_status; #endif - -}; + - -/* Count of active tasks with UBC settings */ - -extern int ubc_usercnt; + ++ /* Extended processor state */ + ++ union thread_xstate *xstate; + +}; - /* Count of active tasks with UBC settings */ - extern int ubc_usercnt; - #define INIT_THREAD { \ .sp = sizeof(init_stack) + (long) &init_stack, \ } diff --cc arch/sh/kernel/cpu/init.c index 89b4b76c0d76,2e23422280a7,39b93828c872,89b4b76c0d76..a5bb0550bbf3 --- a/arch/sh/kernel/cpu/init.c +++ b/arch/sh/kernel/cpu/init.c @@@@@ -24,10 -24,22 -24,7 -24,10 +24,19 @@@@@ #include #include #include -- -#ifdef CONFIG_SUPERH32 -- -#include - #endif + + + ++#ifdef CONFIG_SH_FPU + ++#define cpu_has_fpu 1 + ++#else + ++#define cpu_has_fpu 0 + ++#endif + ++ + ++#ifdef CONFIG_SH_DSP + ++#define cpu_has_dsp 1 + ++#else + ++#define cpu_has_dsp 0 + #endif + /* * Generic wrapper for command line arguments to disable on-chip * peripherals (nofpu, nodsp, and so forth). diff --cc arch/sh/kernel/ptrace_32.c index 9be35f348093,be9b5dcb4021,8e094c4c7bb4,9be35f348093..c625cdab76dd --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c @@@@@ -63,16 -63,16 -64,59 -63,16 +64,59 @@@@@ static inline int put_stack_long(struc return 0; } -- -void user_enable_single_step(struct task_struct *child) ++ +void ptrace_triggered(struct perf_event *bp, int nmi, ++ + struct perf_sample_data *data, struct pt_regs *regs) + { - - /* Next scheduling will set up UBC */ - - if (child->thread.ubc_pc == 0) - - ubc_usercnt += 1; ++ + struct perf_event_attr attr; ++ + ++ + /* ++ + * Disable the breakpoint request here since ptrace has defined a ++ + * one-shot behaviour for breakpoint exceptions. ++ + */ ++ + attr = bp->attr; ++ + attr.disabled = true; ++ + modify_user_hw_breakpoint(bp, &attr); ++ +} ++ + ++ +static int set_single_step(struct task_struct *tsk, unsigned long addr) + +{ - /* Next scheduling will set up UBC */ - if (child->thread.ubc_pc == 0) - ubc_usercnt += 1; ++ + struct thread_struct *thread = &tsk->thread; ++ + struct perf_event *bp; ++ + struct perf_event_attr attr; ++ + ++ + bp = thread->ptrace_bps[0]; ++ + if (!bp) { ++ + hw_breakpoint_init(&attr); ++ + ++ + attr.bp_addr = addr; ++ + attr.bp_len = HW_BREAKPOINT_LEN_2; ++ + attr.bp_type = HW_BREAKPOINT_R; + + - child->thread.ubc_pc = get_stack_long(child, - offsetof(struct pt_regs, pc)); ++ + bp = register_user_hw_breakpoint(&attr, ptrace_triggered, tsk); ++ + if (IS_ERR(bp)) ++ + return PTR_ERR(bp); ++ + ++ + thread->ptrace_bps[0] = bp; ++ + } else { ++ + int err; ++ + ++ + attr = bp->attr; ++ + attr.bp_addr = addr; ++ + err = modify_user_hw_breakpoint(bp, &attr); ++ + if (unlikely(err)) ++ + return err; ++ + } ++ + ++ + return 0; ++ +} + - - child->thread.ubc_pc = get_stack_long(child, - - offsetof(struct pt_regs, pc)); ++ +void user_enable_single_step(struct task_struct *child) ++ +{ ++ + unsigned long pc = get_stack_long(child, offsetof(struct pt_regs, pc)); set_tsk_thread_flag(child, TIF_SINGLESTEP); ++ + ++ + set_single_step(child, pc); } void user_disable_single_step(struct task_struct *child) diff --cc arch/sh/kernel/traps_32.c index 204def6ecb6a,204def6ecb6a,706c1c18a2f2,86639beac3a2..9c090cb68878 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c @@@@@ -846,12 -846,12 -956,9 -956,9 +846,12 @@@@@ void __init trap_init(void #endif #ifdef TRAP_UBC -- - set_exception_table_vec(TRAP_UBC, break_point_trap); ++ + set_exception_table_vec(TRAP_UBC, breakpoint_trap_handler); #endif ++ /* Save off the BIOS VBR, if there is one */ ++ sh_bios_vbr_init(); ++ /* Setup VBR for boot cpu */ per_cpu_trap_init(); }