diff options
Diffstat (limited to 'arch/arm/kernel/hw_breakpoint.c')
| -rw-r--r-- | arch/arm/kernel/hw_breakpoint.c | 25 | 
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index 7b95de60135..4d963fb66e3 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -167,7 +167,7 @@ static int debug_arch_supported(void)  /* Can we determine the watchpoint access type from the fsr? */  static int debug_exception_updates_fsr(void)  { -	return 0; +	return get_debug_arch() >= ARM_DEBUG_ARCH_V8;  }  /* Determine number of WRP registers available. */ @@ -257,6 +257,7 @@ static int enable_monitor_mode(void)  		break;  	case ARM_DEBUG_ARCH_V7_ECP14:  	case ARM_DEBUG_ARCH_V7_1: +	case ARM_DEBUG_ARCH_V8:  		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));  		isb();  		break; @@ -344,13 +345,13 @@ int arch_install_hw_breakpoint(struct perf_event *bp)  		/* Breakpoint */  		ctrl_base = ARM_BASE_BCR;  		val_base = ARM_BASE_BVR; -		slots = (struct perf_event **)__get_cpu_var(bp_on_reg); +		slots = this_cpu_ptr(bp_on_reg);  		max_slots = core_num_brps;  	} else {  		/* Watchpoint */  		ctrl_base = ARM_BASE_WCR;  		val_base = ARM_BASE_WVR; -		slots = (struct perf_event **)__get_cpu_var(wp_on_reg); +		slots = this_cpu_ptr(wp_on_reg);  		max_slots = core_num_wrps;  	} @@ -396,12 +397,12 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)  	if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {  		/* Breakpoint */  		base = ARM_BASE_BCR; -		slots = (struct perf_event **)__get_cpu_var(bp_on_reg); +		slots = this_cpu_ptr(bp_on_reg);  		max_slots = core_num_brps;  	} else {  		/* Watchpoint */  		base = ARM_BASE_WCR; -		slots = (struct perf_event **)__get_cpu_var(wp_on_reg); +		slots = this_cpu_ptr(wp_on_reg);  		max_slots = core_num_wrps;  	} @@ -697,7 +698,7 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,  	struct arch_hw_breakpoint *info;  	struct arch_hw_breakpoint_ctrl ctrl; -	slots = (struct perf_event **)__get_cpu_var(wp_on_reg); +	slots = this_cpu_ptr(wp_on_reg);  	for (i = 0; i < core_num_wrps; ++i) {  		rcu_read_lock(); @@ -768,7 +769,7 @@ static void watchpoint_single_step_handler(unsigned long pc)  	struct perf_event *wp, **slots;  	struct arch_hw_breakpoint *info; -	slots = (struct perf_event **)__get_cpu_var(wp_on_reg); +	slots = this_cpu_ptr(wp_on_reg);  	for (i = 0; i < core_num_wrps; ++i) {  		rcu_read_lock(); @@ -802,7 +803,7 @@ static void breakpoint_handler(unsigned long unknown, struct pt_regs *regs)  	struct arch_hw_breakpoint *info;  	struct arch_hw_breakpoint_ctrl ctrl; -	slots = (struct perf_event **)__get_cpu_var(bp_on_reg); +	slots = this_cpu_ptr(bp_on_reg);  	/* The exception entry code places the amended lr in the PC. */  	addr = regs->ARM_pc; @@ -1072,6 +1073,8 @@ static int __init arch_hw_breakpoint_init(void)  	core_num_brps = get_num_brps();  	core_num_wrps = get_num_wrps(); +	cpu_notifier_register_begin(); +  	/*  	 * We need to tread carefully here because DBGSWENABLE may be  	 * driven low on this core and there isn't an architected way to @@ -1088,6 +1091,7 @@ static int __init arch_hw_breakpoint_init(void)  	if (!cpumask_empty(&debug_err_mask)) {  		core_num_brps = 0;  		core_num_wrps = 0; +		cpu_notifier_register_done();  		return 0;  	} @@ -1107,7 +1111,10 @@ static int __init arch_hw_breakpoint_init(void)  			TRAP_HWBKPT, "breakpoint debug exception");  	/* Register hotplug and PM notifiers. */ -	register_cpu_notifier(&dbg_reset_nb); +	__register_cpu_notifier(&dbg_reset_nb); + +	cpu_notifier_register_done(); +  	pm_init();  	return 0;  }  | 
