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 3034DCCF9E3 for ; Tue, 4 Nov 2025 15:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ctr8FbOJBob/AvzKE+HJP//LqJe91JqhDJ3i+EoAIdU=; b=jIPwfBrUes4BTUmcHo37u/2a69 osZHOSaqg3r64S0Kj4a8Y7y5Miobi0F8OflnKze5HaWnVLgYO4RyA8XozZJpzzi5ekzUkyeCVXtjt gZC4IBTWVVAXY/p9Xd4zbQlD18KxAedYZBdDdJ51+YSVyt+zwrBWHmytcpgaBYJAjffmIndSEnLy/ 9N3lLz++Z6BMqUuupiDbRRQgbogvPj5A72mtpbrcQ/E3ajxwIuZ6LC9p7UdiWktq51LDLG7zb8oec 4F6e9bGl9krYH4+iX8Pqiop3mvcu4S4esoK4LM5JbXPmflAZ31Ldl/O5MbHHmvzMF+uYy5HgPlEk0 clC6CZXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGIlJ-0000000C3Lf-0mQQ; Tue, 04 Nov 2025 15:15:57 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGIlH-0000000C3LQ-2iiy for linux-arm-kernel@lists.infradead.org; Tue, 04 Nov 2025 15:15:55 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 70063601EF; Tue, 4 Nov 2025 15:15:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BC1BC116B1; Tue, 4 Nov 2025 15:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762269354; bh=z4gLYdJzEW4GjlUvstMoQfV2hJ358bwR0e9XXreUMe4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cKjai/u3WEmrF0qoL4fCe1Nngh5Pl1Zg0wiQ/QT3YTLDo7X1BDgt35Qk/a+lQ56yD KdHUFLOcQ5XfiCjQbvbZq2nDWGj3ihi2Wuy9Z/0QqTxed700UwZMrC97/1X0+1ltzf Jk5qOzId4J/PSH83A/xNrIZb8R9UjVyq/ojtmvTX2mW02jQk3AJfiRr1JV/lYGu2UK CTmW5kZwt+6ar2i8A9baqopAW7zsFrAKbl6iGKAfMFMTI/Te3fGnGAmCmOsjx4/zkg SWnmj8eMagfm0cvmJlkgTHkCd8P9iKVvjGIvOZatIuOdwO2YbBxgFcaI/XKDHIR0ef OHZ0dcgZWn2uw== 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.98.2) (envelope-from ) id 1vGIlD-00000002Kft-2rtZ; Tue, 04 Nov 2025 15:15:51 +0000 Date: Tue, 04 Nov 2025 15:15:51 +0000 Message-ID: <86h5v9vnfc.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oliver.upton@linux.dev, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, vladimir.murzin@arm.com Subject: Re: [PATCH v1 2/8] KVM: arm64: Trap access to ALLINT if FEAT_NMI not supported by the guest In-Reply-To: <20251104125906.1919426-3-tabba@google.com> References: <20251104125906.1919426-1-tabba@google.com> <20251104125906.1919426-3-tabba@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/30.1 (aarch64-unknown-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: tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oliver.upton@linux.dev, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, vladimir.murzin@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 04 Nov 2025 12:59:00 +0000, Fuad Tabba wrote: > > Access to ALLINT is part of FEAT_NMI. If a guest does not support this > feature, any access to this register must be trapped to the hypervisor > (EL2). > > KVM didn't configure this trap, potentially allowing a guest to toggle > all interrupt mask when it doesn't support FEAT_NMI. Fix this by > checking if the guest has FEAT_NMI support. > > Signed-off-by: Fuad Tabba > --- > arch/arm64/include/asm/kvm_emulate.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h > index 0f8311263edf..3fc62808c548 100644 > --- a/arch/arm64/include/asm/kvm_emulate.h > +++ b/arch/arm64/include/asm/kvm_emulate.h > @@ -688,6 +688,9 @@ static inline void vcpu_set_hcrx(struct kvm_vcpu *vcpu) > else > vcpu->arch.hcrx_el2 |= HCRX_EL2_MCE2; > > + if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, NMI, IMP)) > + vcpu->arch.hcrx_el2 |= HCRX_EL2_TALLINT; > + > if (kvm_has_tcr2(kvm)) > vcpu->arch.hcrx_el2 |= HCRX_EL2_TCR2En; > I think this is moving in the wrong direction. We have for quite some time now tried to automatically derive these behaviours from the guest config, as we do for FGUs. I would like to see a similar behaviour being introduced for non-FGT bits so that we don't have to worry about these things anymore. Thanks, M. -- Without deviation from the norm, progress is not possible.