From: Oliver Upton <oupton@google.com>
To: kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, Marc Zyngier <maz@kernel.org>,
James Morse <james.morse@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
linux-arm-kernel@lists.infradead.org,
Andrew Jones <drjones@redhat.com>,
Peter Shier <pshier@google.com>,
Ricardo Koller <ricarkol@google.com>,
Reiji Watanabe <reijiw@google.com>,
Oliver Upton <oupton@google.com>
Subject: [PATCH 3/3] KVM: arm64: Raise KVM's reported debug architecture to v8.2
Date: Fri, 29 Oct 2021 00:32:02 +0000 [thread overview]
Message-ID: <20211029003202.158161-4-oupton@google.com> (raw)
In-Reply-To: <20211029003202.158161-1-oupton@google.com>
The additions made to the Debug architecture between v8.0 and v8.2 are
only applicable to external debug. KVM does not (and likely will never)
support external debug, so KVM can proudly report support for v8.2 to
its guests.
Raise the reported Debug architecture to v8.2. Additionally, v8.2 makes
FEAT_DoubleLock optional. Even though KVM never supported it in the
first place, report DoubleLock as not implemented now as the
architecture permits it for v8.2.
Cc: Reiji Watanabe <reijiw@google.com>
Cc: Ricardo Koller <ricarkol@google.com>
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Oliver Upton <oupton@google.com>
---
arch/arm64/kvm/sys_regs.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 0840ae081290..f56ee5830d18 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1109,9 +1109,14 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu,
ARM64_FEATURE_MASK(ID_AA64ISAR1_GPI));
break;
case SYS_ID_AA64DFR0_EL1:
- /* Limit debug to ARMv8.0 */
+ /* Limit debug to ARMv8.2 */
val &= ~ARM64_FEATURE_MASK(ID_AA64DFR0_DEBUGVER);
- val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_DEBUGVER), 6);
+ val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_DEBUGVER), 8);
+
+ /* Hide DoubleLock from guests */
+ val &= ~ARM64_FEATURE_MASK(ID_AA64DFR0_DOUBLELOCK);
+ val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_DOUBLELOCK), 0xf);
+
/* Limit guests to PMUv3 for ARMv8.4 */
val = cpuid_feature_cap_perfmon_field(val,
ID_AA64DFR0_PMUVER_SHIFT,
--
2.33.0.1079.g6e70778dc9-goog
next prev parent reply other threads:[~2021-10-29 0:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 0:31 [PATCH 0/3] KVM: arm64: Fixes for the exposed debug architecture Oliver Upton
2021-10-29 0:32 ` [PATCH 1/3] KVM: arm64: Stash OSLSR_EL1 in the cpu context Oliver Upton
2021-10-29 11:27 ` Marc Zyngier
2021-10-29 0:32 ` [PATCH 2/3] KVM: arm64: Allow the guest to change the OS Lock status Oliver Upton
2021-10-29 11:16 ` Marc Zyngier
2021-10-29 0:32 ` Oliver Upton [this message]
2021-10-29 11:31 ` [PATCH 3/3] KVM: arm64: Raise KVM's reported debug architecture to v8.2 Marc Zyngier
2021-10-29 18:18 ` Oliver Upton
2021-11-01 10:21 ` Marc Zyngier
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=20211029003202.158161-4-oupton@google.com \
--to=oupton@google.com \
--cc=alexandru.elisei@arm.com \
--cc=drjones@redhat.com \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=pshier@google.com \
--cc=reijiw@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