[PATCH 3/3] KVM: arm64: Raise KVM's reported debug architecture to v8.2

Oliver Upton oupton at google.com
Thu Oct 28 17:32:02 PDT 2021


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 at google.com>
Cc: Ricardo Koller <ricarkol at google.com>
Suggested-by: Marc Zyngier <maz at kernel.org>
Signed-off-by: Oliver Upton <oupton at 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




More information about the linux-arm-kernel mailing list