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 C2940C47DB3 for ; Fri, 2 Feb 2024 14:57:08 +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=74Y2PCReif/FhLMwhUgJziuvBGdqgnNRoJncTaGNXho=; b=e45kA8OTQHLupm mudMhenNZllkxx+VQVchbblMGgou0NNoiqHSPQrujSYoTnsz31S5FjRrTx5ltpGhcwt8CBbGGpR5Z M+gL08i1fyZQxpDsBrRlhagtg+GJjzK4Nu8a04WQfGkKdwJy6QseNfnb/XrmsRjCAPfvA5IjNkr5O npA/zrb0Vv/vQMrWKOdtAVUOCfgw7XwSgv7RsXf9qNNtOpGuLJGGAKsniplrif+s5aJwicGSrWYDt fIzUqXMBS0XNzKxdedUTIRFKI/GtrN1kZ8PfqZGAFw6hxeWaZAbeKmW+56zRoHR0VqCn3sMLAXvLR q7AZqXW2AqqWvsx5tLaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVuyP-0000000Brmx-23B2; Fri, 02 Feb 2024 14:56:57 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVuyM-0000000Brl8-2A8s for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2024 14:56:55 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 815A66262C; Fri, 2 Feb 2024 14:56:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AF16C433F1; Fri, 2 Feb 2024 14:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706885813; bh=CECvmIIhA7FaHci5GXCbPyJeXOB0NYrhJqSmfCFDKXs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hL6u6x0YzDVkLC7Ck0/akxOZnlHWQl10vCmIwD+CCshYgmVx/l8Htb6fJB4NpBvgb wGDcmnAQK2FEfKpmGJHHsPcb47yt9XeHp3kmT4UI0M1wwvVZZkGFHCNGZxCzkCffIY feWnvaKYxOwt0wwPQ+B1ZTsMkO84g3nyMxaEy1ZfXl++iw8u5k5SOy9pMBb0LKPOGe SaIOHwv+zl2M0qdmpB+LC6QWXfN1czUpk/RQ54LvRprXFlp2SNFZgm0lXHbfEAI8tt D9DaVLWvuuheJ40oQtztz/1V/KbPxOXBXAJ24oWqjpzE+CpGNzLEGZ2Mkt7F8GN04d +hzE9egsR0nug== 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 1rVuyI-00HI8Z-VE; Fri, 02 Feb 2024 14:56:51 +0000 Date: Fri, 02 Feb 2024 14:56:50 +0000 Message-ID: <86h6iq7w3x.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 v2 06/25] KVM: arm64: nv: Add sanitising to VNCR-backed HCRX_EL2 In-Reply-To: References: <20240130204533.693853-1-maz@kernel.org> <20240130204533.693853-7-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-20240202_065654_657807_0E427910 X-CRM114-Status: GOOD ( 27.36 ) 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 Fri, 02 Feb 2024 08:52:32 +0000, Oliver Upton wrote: > > On Tue, Jan 30, 2024 at 08:45:13PM +0000, Marc Zyngier wrote: > > Just like its little friends, HCRX_EL2 gets the feature set treatment > > when backed by VNCR. > > > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/kvm/nested.c | 42 +++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 42 insertions(+) > > > > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > > index cdeef3259193..72db632b115a 100644 > > --- a/arch/arm64/kvm/nested.c > > +++ b/arch/arm64/kvm/nested.c > > @@ -263,6 +263,48 @@ int kvm_init_nv_sysregs(struct kvm *kvm) > > res1 |= HCR_E2H; > > set_sysreg_masks(kvm, HCR_EL2, res0, res1); > > > > + /* HCRX_EL2 */ > > + res0 = HCRX_EL2_RES0; > > + res1 = HCRX_EL2_RES1; > > I'm a bit worried that we're depending on the meaning of these generated > RES0/RES1 bitmasks not changing behind our backs. > > Not like people read anything, but do you think it'd make sense to add a > warning comment to the sysreg file that adding new encodings can have a > functional change on KVM? No amount of warnings will do, because people don't give a damn. I'm actually in favour of something far more radical: we snapshot the raw value of all the used RES0/1, and put BUILD_BUG_ON()s that fire if any value has changed. They will have to touch the KVM code to fix that, and we catch them red-handed. > > > + if (!kvm_has_feat(kvm, ID_AA64ISAR3_EL1, PACM, TRIVIAL_IMP)) > > + res0 |= HCRX_EL2_PACMEn; > > + if (!kvm_has_feat(kvm, ID_AA64PFR2_EL1, FPMR, IMP)) > > + res0 |= HCRX_EL2_EnFPM; > > + if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, GCS, IMP)) > > + res0 |= HCRX_EL2_GCSEn; > > + if (!kvm_has_feat(kvm, ID_AA64ISAR2_EL1, SYSREG_128, IMP)) > > + res0 |= HCRX_EL2_EnIDCP128; > > + if (!kvm_has_feat(kvm, ID_AA64MMFR3_EL1, ADERR, DEV_ASYNC)) > > + res0 |= (HCRX_EL2_EnSDERR | HCRX_EL2_EnSNERR); > > + if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, DF2, IMP)) > > + res0 |= HCRX_EL2_TMEA; > > + if (!kvm_has_feat(kvm, ID_AA64MMFR3_EL1, D128, IMP)) > > + res0 |= HCRX_EL2_D128En; > > + if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, THE, IMP)) > > + res0 |= HCRX_EL2_PTTWI; > > Ok, not fair. The latest public version of the ARM ARM doesn't have any > of this. Where are you getting it from? The bloody XML, from which all of this should, in theory, be extracted without any human intervention. Sadly, it seems that we are not allowed to do so, from what I have been told. The ARM ARM is, unfortunately, being quickly rendered obsolete by the lack of updates (FEAT_THE is part of the v9.4 architecture, released in 2022). I'll make sure to add a link to the XML in the cover letter when I repost the series. 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