From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 790E5C433F5 for ; Fri, 29 Oct 2021 11:31:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CDB461166 for ; Fri, 29 Oct 2021 11:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232002AbhJ2Ldx (ORCPT ); Fri, 29 Oct 2021 07:33:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:49332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbhJ2Ldr (ORCPT ); Fri, 29 Oct 2021 07:33:47 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED34361167; Fri, 29 Oct 2021 11:31:18 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mgQ6O-002P4Z-QB; Fri, 29 Oct 2021 12:31:16 +0100 Date: Fri, 29 Oct 2021 12:31:16 +0100 Message-ID: <87k0hw9iez.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Andrew Jones , Peter Shier , Ricardo Koller , Reiji Watanabe Subject: Re: [PATCH 3/3] KVM: arm64: Raise KVM's reported debug architecture to v8.2 In-Reply-To: <20211029003202.158161-4-oupton@google.com> References: <20211029003202.158161-1-oupton@google.com> <20211029003202.158161-4-oupton@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oupton@google.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, drjones@redhat.com, pshier@google.com, ricarkol@google.com, reijiw@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, 29 Oct 2021 01:32:02 +0100, Oliver Upton wrote: > > 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 > Cc: Ricardo Koller > Suggested-by: Marc Zyngier > Signed-off-by: Oliver Upton > --- > 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), 0CF); > + One issue with that is that this will break migration from an older kernel (DFR0 will be different between source and destination). You'll need a set_user handler and deal with it in a similar way to CSV2/CSV3. Thanks, M. -- Without deviation from the norm, progress is not possible.