From: Reiji Watanabe <reijiw@google.com>
To: Marc Zyngier <maz@kernel.org>, kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
James Morse <james.morse@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Andrew Jones <andrew.jones@linux.dev>,
Ricardo Koller <ricarkol@google.com>,
Oliver Upton <oupton@google.com>,
Jing Zhang <jingzhangos@google.com>,
Raghavendra Rao Anata <rananta@google.com>,
Reiji Watanabe <reijiw@google.com>
Subject: [PATCH 4/9] KVM: arm64: selftests: Add helpers to enable debug exceptions
Date: Wed, 24 Aug 2022 22:08:41 -0700 [thread overview]
Message-ID: <20220825050846.3418868-5-reijiw@google.com> (raw)
In-Reply-To: <20220825050846.3418868-1-reijiw@google.com>
Add helpers to enable breakpoint and watchpoint exceptions.
Signed-off-by: Reiji Watanabe <reijiw@google.com>
---
.../selftests/kvm/aarch64/debug-exceptions.c | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
index 183ee16acb7d..713c7240b680 100644
--- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
+++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c
@@ -128,10 +128,20 @@ static void enable_os_lock(void)
GUEST_ASSERT(read_sysreg(oslsr_el1) & 2);
}
+static void enable_debug_bwp_exception(void)
+{
+ uint32_t mdscr;
+
+ asm volatile("msr daifclr, #8");
+
+ mdscr = read_sysreg(mdscr_el1) | MDSCR_KDE | MDSCR_MDE;
+ write_sysreg(mdscr, mdscr_el1);
+ isb();
+}
+
static void install_wp(uint8_t wpn, uint64_t addr)
{
uint32_t wcr;
- uint32_t mdscr;
wcr = DBGWCR_LEN8 | DBGWCR_RD | DBGWCR_WR | DBGWCR_EL1 | DBGWCR_E;
write_dbgwcr(wpn, wcr);
@@ -139,28 +149,19 @@ static void install_wp(uint8_t wpn, uint64_t addr)
isb();
- asm volatile("msr daifclr, #8");
-
- mdscr = read_sysreg(mdscr_el1) | MDSCR_KDE | MDSCR_MDE;
- write_sysreg(mdscr, mdscr_el1);
- isb();
+ enable_debug_bwp_exception();
}
static void install_hw_bp(uint8_t bpn, uint64_t addr)
{
uint32_t bcr;
- uint32_t mdscr;
bcr = DBGBCR_LEN8 | DBGBCR_EXEC | DBGBCR_EL1 | DBGBCR_E;
write_dbgbcr(bpn, bcr);
write_dbgbvr(bpn, addr);
isb();
- asm volatile("msr daifclr, #8");
-
- mdscr = read_sysreg(mdscr_el1) | MDSCR_KDE | MDSCR_MDE;
- write_sysreg(mdscr, mdscr_el1);
- isb();
+ enable_debug_bwp_exception();
}
static void install_ss(void)
--
2.37.1.595.g718a3a8f04-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-08-25 5:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 5:08 [PATCH 0/9] KVM: arm64: selftests: Test linked {break,watch}points Reiji Watanabe
2022-08-25 5:08 ` [PATCH 1/9] KVM: arm64: selftests: Add helpers to extract a field of an ID register Reiji Watanabe
2022-08-25 16:48 ` Oliver Upton
2022-08-25 16:52 ` Ricardo Koller
2022-08-25 16:58 ` Oliver Upton
2022-08-26 0:50 ` Reiji Watanabe
2022-08-25 5:08 ` [PATCH 2/9] KVM: arm64: selftests: Add write_dbg{b,w}{c,v}r helpers in debug-exceptions Reiji Watanabe
2022-09-09 19:40 ` Ricardo Koller
2022-08-25 5:08 ` [PATCH 3/9] KVM: arm64: selftests: Remove the hard-coded {b,w}pn#0 from debug-exceptions Reiji Watanabe
2022-08-25 16:55 ` Oliver Upton
2022-08-26 0:53 ` Reiji Watanabe
2022-09-09 19:46 ` Ricardo Koller
2022-09-10 4:15 ` Reiji Watanabe
2022-08-25 5:08 ` Reiji Watanabe [this message]
2022-08-25 17:21 ` [PATCH 4/9] KVM: arm64: selftests: Add helpers to enable debug exceptions Oliver Upton
2022-08-26 0:55 ` Reiji Watanabe
2022-09-09 19:57 ` Ricardo Koller
2022-08-25 5:08 ` [PATCH 5/9] KVM: arm64: selftests: Have debug_version() use cpuid_get_ufield() helper Reiji Watanabe
2022-08-25 17:29 ` Oliver Upton
2022-08-26 0:59 ` Reiji Watanabe
2022-08-25 5:08 ` [PATCH 6/9] KVM: arm64: selftests: Change debug_version() to take ID_AA64DFR0_EL1 Reiji Watanabe
2022-08-25 5:08 ` [PATCH 7/9] KVM: arm64: selftests: Add a test case for a linked breakpoint Reiji Watanabe
2022-08-26 1:29 ` Reiji Watanabe
2022-09-09 20:18 ` Ricardo Koller
2022-09-09 20:26 ` Ricardo Koller
2022-09-10 5:22 ` Reiji Watanabe
2022-09-09 21:01 ` Ricardo Koller
2022-09-10 5:19 ` Reiji Watanabe
2022-08-25 5:08 ` [PATCH 8/9] KVM: arm64: selftests: Add a test case for a linked watchpoint Reiji Watanabe
2022-08-25 5:08 ` [PATCH 9/9] KVM: arm64: selftests: Test with every breakpoint/watchpoint Reiji Watanabe
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=20220825050846.3418868-5-reijiw@google.com \
--to=reijiw@google.com \
--cc=alexandru.elisei@arm.com \
--cc=andrew.jones@linux.dev \
--cc=james.morse@arm.com \
--cc=jingzhangos@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=rananta@google.com \
--cc=ricarkol@google.com \
--cc=suzuki.poulose@arm.com \
/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).