Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752226AbbEMFYN (ORCPT ); Wed, 13 May 2015 01:24:13 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:42016 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751988AbbEMFYJ (ORCPT ); Wed, 13 May 2015 01:24:09 -0400 X-AuditID: cbfee68d-f79106d00000728c-18-5552dff75f43 Date: Wed, 13 May 2015 05:24:07 +0000 (GMT) From: Maninder Singh Subject: [EDT][PATCH 1/1] hw_breakpoint.c :cpu hotplug handling To: will.deacon@arm.com, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "v.narang@samsung.com" , Amit Arora , AJEET YADAV , AKHILESH KUMAR Reply-to: maninder1.s@samsung.com MIME-version: 1.0 X-MTR: 20150513051857628@maninder1.s Msgkey: 20150513051857628@maninder1.s X-EPLocale: en_US.windows-1252 X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-MLAttribute: X-RootMTR: 20150513051857628@maninder1.s X-ParentMTR: X-ArchiveUser: X-CPGSPASS: N X-ConfirmMail: N,general Content-type: text/plain; charset=windows-1252 MIME-version: 1.0 Message-id: <556690501.99511431494646065.JavaMail.weblogic@ep2mlwas05a> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWyRsSkVvf7/aBQg/+39Swu75rD5sDo8XmT XABjFJdNSmpOZllqkb5dAlfGrg3vmQo6ZCpmz+VoYFwh3cXIySEkoCaxaO9jNhBbQsBE4kDH R3YIW0ziwr31QHEuoJqljBKbz/xhgSk6OucVC0RiDqPEgW/NYN0sAqoS1zuPMYPYbAL6Emf3 rgOzhQXsJZ6tuMUM0iAi0MsocejxXSYQh1lgHaPEjIb9rBB3KEqsv/GEEcTmFRCUODnzCdQ6 FYnG4x1MEHFViZU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Y8l2nljPD rLq/ZS5Uq4TE1pYnYOczA50/pfshO4RtIHFk0RxWdK/wCrhLPLn7lWUCo+wsJKlZSNpnIWlH VrOAkWUVo2hqQXJBcVJ6hYlecWJucWleul5yfu4mRnAierZkB2PDBetDjAIcjEo8vAobgkKF WBPLiitzDzFKcDArifBeug0U4k1JrKxKLcqPLyrNSS0+xGgKjLaJzFKiyfnAJJlXEm9obGJu amxqYWBobm6mJM77/1xuiJBAemJJanZqakFqEUwfEwenVAOjvcuWzcFHStQOfe2RNqprsU3t 3uhed6PnzNxra3/GSp37sbjnwSPx6SVBmxZ9yU8/fnW2g8KHL+XrPpxXPNO45NPy01/vc5jo SSvzmyh5n1DOvc+zxmmWxWbdOk1ejw/c3oymjm3JcptzVbP2v5zwWZ1jZVpurK38oZNnV7/o 4dqbzPkkcCOfEktxRqKhFnNRcSIAU/e6YVoDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t4D5OIQI023310 Content-Length: 2782 Lines: 95 EP-2DAD0AFA905A4ACB804C4F82A001242F Subject: [PATCH 1/1] hw_breakpoint.c :cpu hotplug handling This patch adds support for CPU hotplug, It re-installl all installed watchpoints and breakpoints back on H/W in case of cpu-hot plug. Signed-off-by: Vaneet Narang Signed-off-by: Maninder Singh Reviewed-by: Amit Arora Reviewed-by: Ajeet Yadav --- arch/arm/kernel/hw_breakpoint.c | 56 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index dc7d0a9..172bfa8 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -388,6 +388,56 @@ int arch_install_hw_breakpoint(struct perf_event *bp) return 0; } +/* + * reInstall a perf counter breakpoint. + */ +void arch_reinstall_hw_breakpoint(int index, int type) +{ + struct arch_hw_breakpoint *info; + struct perf_event **slots; + int ctrl_base, val_base; + u32 addr, ctrl; + struct perf_event *bp; + + if (type == ARM_ENTRY_BREAKPOINT) { + /* Breakpoint */ + ctrl_base = ARM_BASE_BCR; + val_base = ARM_BASE_BVR; + slots = (struct perf_event **)__get_cpu_var(bp_on_reg); + } else { + /* Watchpoint */ + ctrl_base = ARM_BASE_WCR; + val_base = ARM_BASE_WVR; + slots = (struct perf_event **)__get_cpu_var(wp_on_reg); + } + + bp = slots[index]; + if (!bp) + return; + + info = counter_arch_bp(bp); + addr = info->address; + ctrl = encode_ctrl_reg(info->ctrl) | 0x1; + + + /* Override the breakpoint data with the step data. */ + if (info->step_ctrl.enabled) { + addr = info->trigger & ~0x3; + ctrl = encode_ctrl_reg(info->step_ctrl); + if (info->ctrl.type != ARM_BREAKPOINT_EXECUTE) { + index = 0; + ctrl_base = ARM_BASE_BCR + core_num_brps; + val_base = ARM_BASE_BVR + core_num_brps; + } + } + + /* Setup the address register. */ + write_wb_reg(val_base + index, addr); + + /* Setup the control register. */ + write_wb_reg(ctrl_base + index, ctrl); +} + void arch_uninstall_hw_breakpoint(struct perf_event *bp) { struct arch_hw_breakpoint *info = counter_arch_bp(bp); @@ -1019,6 +1069,12 @@ clear_vcr: out_mdbgen: if (enable_monitor_mode()) cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); + + for (i = 0; i < core_num_brps; ++i) + arch_reinstall_hw_breakpoint(i, ARM_ENTRY_BREAKPOINT); + for (i = 0; i < core_num_wrps; ++i) + arch_reinstall_hw_breakpoint(i, ARM_ENTRY_SYNC_WATCHPOINT); + } static int dbg_reset_notify(struct notifier_block *self, -- 1.7.1 Thanks Maninder Singh????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?