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 D8C52C43458 for ; Fri, 10 Jul 2026 22:34:36 +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=nUz9HhdoqrTHsTCS29Z7m1e2TJuVsJLqCaqg2KWgFhs=; b=mmopekb0MAgsjvj9ZxZnhGNEx9 e1CajbItLN4Ezjr348alWgZ+SVr73oHtkpI3rAbMT4I3MKzZHZZK6ulirpWnl/m21aErmKzX/AKwA 5CjdWsEagFI0brJn8GkCgbxjvfWrq2tR6HLNLclHx6Oj3QR+TsumPUPhrbTzejzm9MELnvLeLrnIi JlITDuMVMsBsWs9COT2atEx58IF6hsVLrB5/meIxPaygdQu+dxFjzv5S2MZ8AxvGie4nRhVXxPON+ eScMBwJLxO92r7rbyYsZTlNMPJP7qZGziP1sjupZhgZDKJ/oRVQ3uI4v4lBNbWzWxdrnxV0XpR9P3 2NUOYmzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wiJni-00000005xTg-24Ob; Fri, 10 Jul 2026 22:34:30 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wiJnh-00000005xTN-0u0D for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2026 22:34:29 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3B60460052; Fri, 10 Jul 2026 22:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3D481F000E9; Fri, 10 Jul 2026 22:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783722867; bh=nUz9HhdoqrTHsTCS29Z7m1e2TJuVsJLqCaqg2KWgFhs=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=ldMowH7dw+6DV4uL7fBEOoevsFZvKYQaQZ0NYOt6ItRnFeUywfKm5Cb6NvParqi+9 VmDRAp5HRtgrrZS+H/xscZYf7mEkKRXvw/dTF9dqQII+z3qAzNZmH17FrT0MSl8Vco OL3JVIojHQe4yEY07qjeJ4ZzZnObffTiJNTGm9OFAkIQgP+fQ85UN4P795oFP9zChT qcSC0tFEaLX7RIrb3DEJVmmLWEqUzUHjOjmHPxiyLDukzvzrNWKxhSVLhALNDNKcb9 hLEi0xGQRMIn5YD9rWje8GJg6tKzS6p43ZxvaehWPLgG7tgo3udLSbTa1EM9TFHFOC IQ7P4kLrL34eg== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-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 1wiJnd-00000003seu-29RZ; Fri, 10 Jul 2026 22:34:25 +0000 Date: Fri, 10 Jul 2026 23:36:14 +0100 Message-ID: <87pl0u5v6p.wl-maz@kernel.org> From: Marc Zyngier To: Joey Gouly Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Steffen Eiden , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: Re: [PATCH 18/28] KVM: arm64: Add kvm_has_nv{2,3}() predicates In-Reply-To: <20260710153016.GF12293@e124191.cambridge.arm.com> References: <20260702160248.1377250-1-maz@kernel.org> <20260702160248.1377250-19-maz@kernel.org> <20260710153016.GF12293@e124191.cambridge.arm.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: joey.gouly@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, seiden@linux.ibm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.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 Fri, 10 Jul 2026 16:30:16 +0100, Joey Gouly wrote: > > Question, > > On Thu, Jul 02, 2026 at 05:02:38PM +0100, Marc Zyngier wrote: > > Add a new set of predicates indicating whether VM is capable of > > NV2, NV3, and is in a nested NV3 context. > > > > This is going to become useful as we start dealing with a mix of > > behaviours (NV2, NV3, NV2 on NV3...). > > > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/include/asm/kvm_emulate.h | 20 ++++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h > > index 9831166695186..c562d8171d5e1 100644 > > --- a/arch/arm64/include/asm/kvm_emulate.h > > +++ b/arch/arm64/include/asm/kvm_emulate.h > > @@ -266,6 +266,26 @@ static inline bool vserror_state_is_nested(struct kvm_vcpu *vcpu) > > (__vcpu_sys_reg(vcpu, HCRX_EL2) & HCRX_EL2_TMEA); > > } > > > > +static inline bool kvm_has_nv2(struct kvm *kvm) > > +{ > > + return (cpus_have_final_cap(ARM64_HAS_NESTED_VIRT) && > > + kvm_has_feat(kvm, ID_AA64MMFR4_EL1, NV_frac, NV2_ONLY)); > > Should this also check ID_AA64MMFR2_EL1.NV=0b10? (aka NV2, not just NV2_ONLY) That'd be unnecessary, as KVM always exposes ID_AA64MMFR2_EL1.NV==0, owing to the absence of support for the original FEAT_NV (we only support FEAT_NV2, and treat FEAT_NV with the utmost contempt). For all intents and purposes, ID_AA64MMFR2_EL1.NV is a dead field, and KVM will forever expose it as 0 (unless someone at ARM is mad enough to repurpose it...). Thanks, M. -- Jazz isn't dead. It just smells funny.