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 EB646C88E50 for ; Fri, 11 Sep 2026 09:09: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: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=6o+QncrTqmoqAMM3f1Bikm2mAzRwxYrhaW4iMNLfgSQ=; b=b0RsPHHgrMpM14rhyk4hUBDnKK 3YCHzOXOTqMXetcTblidPp3YzQdgMoJE2TeWZg6g7XDqokGh/LdPAFD9maORN6TBJ4KbsbDkcgZ6x omYnOP7ijU3WQPtAZu2yq0vQVkl5rpSdx4BY+vCYPbfnx7y0D2YhVKmjalN+DgGPcGKy8CGbPptbn n0wCEguqebpv050sWMB4ORdHBLoXDhR8YIj74yfAbZhUlVcbwHlWpftdwmgnzwRa9h43p0tGxy7oW qxSvgTQmbCUAd7Ow5aIlN1RmChNzy3F1Xn5m71ooC/+TAGcdCGAzo9udMsaNHbLH3UaGAByynEpf6 X1/YPfiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x4xFm-0000000GDoG-2UbN; Fri, 11 Sep 2026 09:09:02 +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 1x4xFm-0000000GDo7-0ZZt for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2026 09:09:02 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3834A60210; Fri, 11 Sep 2026 09:09:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4411F000FF; Fri, 11 Sep 2026 09:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789117740; bh=6o+QncrTqmoqAMM3f1Bikm2mAzRwxYrhaW4iMNLfgSQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=JIJ+9wt3rF81Eca2UtXQV4IcTUqdXhVTY8CAcPrThQRhMYBrE6gkZv1bb8U51pVaL 4Xmks7Zs/q9xAsEP1K8jhx+dkRFEhndo+FikfrgAqqM2H/z/8bOem3RhEN97IMnkEi R1zx62K7s7lX9Sop6+WvP8mWAiuouAjk4QAE72HA6CcGhtAHE0BTaDTsKLtXiWMynA RXzE4KeUXHfxpMUOXxSN2c82wAeCo4E8dJLUiz9fKk9m+LpsP0Mgs6QaQcfCr6iCQg 6x8VjZeU1vDdsZlKJu+LaDp4DLDLJmfKH1azBsTGW4ZZZ4ke5RoEHqglZgxq068568 e8Hc1iO3/VOxw== 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 1x4xFi-00000007fc4-3XmF; Fri, 11 Sep 2026 09:08:58 +0000 Date: Fri, 11 Sep 2026 10:08:58 +0100 Message-ID: <86mrto6tp1.wl-maz@kernel.org> From: Marc Zyngier To: Wei-Lin Chang Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Oliver Upton , Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Sascha Bischoff , Ben Horgan , Lorenzo Pieralisi , Thomas Huth , James Clark , Mark Brown , Anshuman Khandual Subject: Re: [PATCH v1 1/3] KVM: arm64: nv: Don't advertise FEAT_LPA2 for guest stage-1 In-Reply-To: <20260909222015.3046432-2-weilin.chang@arm.com> References: <20260909222015.3046432-1-weilin.chang@arm.com> <20260909222015.3046432-2-weilin.chang@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: weilin.chang@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, oupton@kernel.org, fuad.tabba@linux.dev, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, Sascha.Bischoff@arm.com, ben.horgan@arm.com, lpieralisi@kernel.org, thuth@redhat.com, james.clark@linaro.org, broonie@kernel.org, anshuman.khandual@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 Wed, 09 Sep 2026 23:20:13 +0100, Wei-Lin Chang wrote: > > There is no FEAT_LPA2 support for NV guests as of now, but we missed > limiting it for the non-stage-2 granule size fields (TGRAN4, TGRAN16) in > ID_AA64MMFR0_EL1. Add the sanitisation. > > Signed-off-by: Wei-Lin Chang > --- > arch/arm64/kvm/nested.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > index 3c4fc566eafc..1fd98117df23 100644 > --- a/arch/arm64/kvm/nested.c > +++ b/arch/arm64/kvm/nested.c > @@ -1731,6 +1731,19 @@ u64 limit_nv_id_reg(struct kvm *kvm, u32 reg, u64 val) > /* Hide CNTPOFF if present */ > val = ID_REG_LIMIT_FIELD_ENUM(val, ID_AA64MMFR0_EL1, ECV, IMP); > > + /* NV does not support FEAT_LPA2. */ > + if (SYS_FIELD_GET(ID_AA64MMFR0_EL1, TGRAN4, val) == > + ID_AA64MMFR0_EL1_TGRAN4_52_BIT) { nit: keep both sides of == on a single line. > + val &= ~ID_AA64MMFR0_EL1_TGRAN4; > + val |= SYS_FIELD_PREP_ENUM(ID_AA64MMFR0_EL1, TGRAN4, IMP); > + } > + > + if (SYS_FIELD_GET(ID_AA64MMFR0_EL1, TGRAN16, val) == > + ID_AA64MMFR0_EL1_TGRAN16_52_BIT) { > + val &= ~ID_AA64MMFR0_EL1_TGRAN16; > + val |= SYS_FIELD_PREP_ENUM(ID_AA64MMFR0_EL1, TGRAN16, IMP); > + } > + > /* Disallow unsupported S2 page sizes */ > switch (PAGE_SIZE) { > case SZ_64K: In theory, we should also change the userspace interface to accept (but ignore) FEAT_LPA2 being set from userspace. But since there is no LPA2 HW in the wild, I'm not too worried about that. You probably want to Cc stable on this patch though. Thanks, M. -- Without deviation from the norm, progress is not possible.