From: test.tberghammer@gmail.com (Pavel Labath)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] arm64: hw_breakpoint: Add get_hwbkt_alignment_mask
Date: Fri, 23 Sep 2016 16:18:59 +0100 [thread overview]
Message-ID: <1474643941-109020-1-git-send-email-labath@google.com> (raw)
This commit adds a utility function for computing the alignment mask of a
hardware breakpoint and fixes arch_validate_hwbkpt_settings to use that
instead.
Signed-off-by: Pavel Labath <labath@google.com>
---
arch/arm64/kernel/hw_breakpoint.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 26a6bf7..14562ae 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -473,6 +473,16 @@ static int arch_build_bp_info(struct perf_event *bp)
return 0;
}
+static unsigned int get_hwbkpt_alignment_mask(struct perf_event *bp)
+{
+ const struct arch_hw_breakpoint *info = counter_arch_bp(bp);
+
+ if (is_compat_bp(bp))
+ return info->ctrl.len == ARM_BREAKPOINT_LEN_8 ? 0x7 : 0x3;
+ else
+ return info->ctrl.type == ARM_BREAKPOINT_EXECUTE ? 0x3 : 0x7;
+}
+
/*
* Validate the arch-specific HW Breakpoint register settings.
*/
@@ -496,11 +506,8 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
* AArch32 tasks expect some simple alignment fixups, so emulate
* that here.
*/
+ alignment_mask = get_hwbkpt_alignment_mask(bp);
if (is_compat_bp(bp)) {
- if (info->ctrl.len == ARM_BREAKPOINT_LEN_8)
- alignment_mask = 0x7;
- else
- alignment_mask = 0x3;
offset = info->address & alignment_mask;
switch (offset) {
case 0:
@@ -521,10 +528,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
info->address &= ~alignment_mask;
info->ctrl.len <<= offset;
} else {
- if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE)
- alignment_mask = 0x3;
- else
- alignment_mask = 0x7;
if (info->address & alignment_mask)
return -EINVAL;
}
--
2.8.0.rc3.226.g39d4020
next reply other threads:[~2016-09-23 15:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 15:18 Pavel Labath [this message]
2016-09-23 15:19 ` [PATCH 2/3] arm64: hw_breakpoint: Handle inexact watchpoint addresses Pavel Labath
2016-09-26 14:06 ` Will Deacon
2016-10-07 16:38 ` Pratyush Anand
2016-10-07 17:24 ` Pavel Labath
2016-10-08 5:10 ` Pratyush Anand
2016-10-12 13:50 ` Pavel Labath
2016-10-13 9:58 ` Pratyush Anand
2016-10-13 17:03 ` Pavel Labath
2016-10-14 3:15 ` Pratyush Anand
2016-10-19 12:07 ` Will Deacon
2016-10-19 13:30 ` Pavel Labath
2016-10-20 5:53 ` Pratyush Anand
2016-10-10 17:08 ` Pratyush Anand
2016-09-23 15:19 ` [PATCH 3/3] selftests: arm64: add test for inexact watchpoint address handling Pavel Labath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474643941-109020-1-git-send-email-labath@google.com \
--to=test.tberghammer@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).