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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A9DEC4828F for ; Wed, 7 Feb 2024 11:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vw6gMHgUixlyKUOqjsvNPXhlW3cMsMmVjJLnIlfQvzA=; b=zgY/zUnL7jWN8F aIFiNBkhmj08TN2e6jZWikuo9enYFgOPSVdAqkJlPSN3xbUJkEuwMVyriKqHk6TmdAthB4oRisu5E chZoxu5W1XCIJTUvxJinx8pix8CFrXjafKlvlA59u+EpVmy0Irl3mL4gBAoDiPK/YGqH/cqWhMM5b nlBtNP0i9QMuhK/Ax9jTKS/DohqX0EE8VGH+Gp3tjHYa8+L6BcNqwEgHkzy0c3kFbyFM5jM7IMwrp 407cKD6BdtzOST42wesQSI+dwBDakON4miZCfGPoA3RD6QMlW5wrYmw8fzpV19AB+gpUT7J4vhVTm fAZO5oMcH6SJR8PpiFrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXfri-0000000ARuO-1TV4; Wed, 07 Feb 2024 11:13:18 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXfrf-0000000ARt0-1rnS for linux-arm-kernel@lists.infradead.org; Wed, 07 Feb 2024 11:13:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id CD63BCE18DD; Wed, 7 Feb 2024 11:13:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11E57C433C7; Wed, 7 Feb 2024 11:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707304393; bh=PlMmZWkNND6WcQqrcatfW2YaQpSiO6vrQWd7RUzRbVY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q+Q8i0aaThZbWa4rTS8T9w2J6zziftZD56g/ltjhKTNgq0sMNlOTgceUooammyOKO Xm0xgjCh+/vX6oPvkR6sXopYWwsekKe4CAf7appdbCNvBz1BmRtPlkpZrYu0wr8OeM 3P1IIX/i88xjfjB2/jg/y/OzLyHcecCWexeSQVASCvXX19pzmzLwcd/t6PuWbhIGA6 rosBGSCC52BUFnGziMeBoqBAGneyigxGSBnBHrmDNK5zRsg0Drg4H+cgi1ZGqlTxXw NRCMTbfgEXFvmYbHSPiUEzhDN9FqNO7RQ0DsIFwrdhqtXX2SFpIq03tWmIPcdXTPR8 TfUdaAxBbUZxg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rXfra-0016Ff-Nt; Wed, 07 Feb 2024 11:13:11 +0000 Date: Wed, 07 Feb 2024 11:13:10 +0000 Message-ID: <86o7cs5xyx.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Joey Gouly , Mark Brown Subject: Re: [PATCH v3 05/26] KVM: arm64: nv: Add sanitising to VNCR-backed FGT sysregs In-Reply-To: References: <20240205103431.1104133-1-maz@kernel.org> <20240205103431.1104133-6-maz@kernel.org> 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/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, broonie@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_031315_858908_62D7C796 X-CRM114-Status: GOOD ( 25.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 07 Feb 2024 11:09:08 +0000, Oliver Upton wrote: > > On Wed, Feb 07, 2024 at 10:57:49AM +0000, Oliver Upton wrote: > > On Mon, Feb 05, 2024 at 10:34:10AM +0000, Marc Zyngier wrote: > > > Fine Grained Traps are controlled by a whole bunch of features. > > > Each one of them must be checked and the corresponding masks > > > computed so that we don't let the guest apply traps it shouldn't > > > be using. > > > > > > This takes care of HFG[IRW]TR_EL2, HDFG[RW]TR_EL2, and HAFGRTR_EL2. > > > > > > Signed-off-by: Marc Zyngier > > > Reviewed-by: Joey Gouly > > > --- > > > arch/arm64/kvm/nested.c | 128 ++++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 128 insertions(+) > > > > > > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > > > index a8fe0f970e04..31c4ce0439d6 100644 > > > --- a/arch/arm64/kvm/nested.c > > > +++ b/arch/arm64/kvm/nested.c > > > @@ -265,6 +265,134 @@ int kvm_init_nv_sysregs(struct kvm *kvm) > > > res1 |= HCR_E2H; > > > set_sysreg_masks(kvm, HCR_EL2, res0, res1); > > > > > > + /* HFG[RW]TR_EL2 */ > > > + res0 = res1 = 0; > > > + if (!(__vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS) && > > > + __vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS))) > > > > Same thing here w/ the different flags. Yup, fixed both occurrences already. > > > > > + /* HDFG[RW]TR_EL2 */ > > > + res0 = res1 = 0; > > > + if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, DoubleLock, IMP)) > > > + res0 |= HDFGRTR_EL2_OSDLR_EL1; > > > + if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, PMUVer, IMP)) > > > + res0 |= (HDFGRTR_EL2_PMEVCNTRn_EL0 | HDFGRTR_EL2_PMEVTYPERn_EL0 | > > > + HDFGRTR_EL2_PMCCFILTR_EL0 | HDFGRTR_EL2_PMCCNTR_EL0 | > > > + HDFGRTR_EL2_PMCNTEN | HDFGRTR_EL2_PMINTEN | > > > + HDFGRTR_EL2_PMOVS | HDFGRTR_EL2_PMSELR_EL0 | > > > + HDFGRTR_EL2_PMMIR_EL1 | HDFGRTR_EL2_PMUSERENR_EL0 | > > > + HDFGRTR_EL2_PMCEIDn_EL0); > > > > I think you're missing HDFGWTR_EL2_PMSWINC_EL0 and HDFGWTR_EL2_PMCR_EL0 > > here. Silly write-only and read-only registers... > > I can't read. Looks like you're doing this a few lines down. Yeah, it's a bit tucked away to reuse the previously constructed masks. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel