From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F3942D23A6 for ; Thu, 3 Jul 2025 08:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751532762; cv=none; b=dCOcxn/XRu9ndvIBgPq97Wq2U10L6lVGzA/jyj0CObluo4viUlYT8NC0brbbA1Mvm1i73OVTo7a1AAoVe5e8D7/bd8yrs4TFBrtcIYTbsi90321nevwIl4p6X8CdL5OP+nQ1GyzwEZ0FKXBUuHpoxkl5h8wxKwdZ8RkowP1xpJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751532762; c=relaxed/simple; bh=BuwIyiWx2Bfy0ODpSDaJQ/B7lSJN9CFVeVzpWX8PfvQ=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=n2pFNr1D/uW1VBcBxX/6CKeFYEEXFiCT8thIWotNb05mqGAMv9vLTOP5s/8kVT1fFhQVbkhe05vEwa9Qdwolra9qTW86us2G4rDe+uA+h7aHyyMphoLaJ8JDkvtKQ+rX8JtGMZQE8by5Ybh+IYcdwjAt0AIqJvvbxno8m0iOo0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iNNFS70l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iNNFS70l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDEF2C4CEEB; Thu, 3 Jul 2025 08:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751532762; bh=BuwIyiWx2Bfy0ODpSDaJQ/B7lSJN9CFVeVzpWX8PfvQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iNNFS70laQ6RwUlkI0uLVy4XTqh0MDw/Ujca9iHudOOe6Im1n++FdXaFmamNED19C raPbeERIvTEydLjIXAx96QGzuzQwVE4LgF6lgohzczhT3QoPn1EbiOhLlL2L9e1uhg ude3UjE8rs3ol6bs9UI1u0hxYoUJRRApEjZcdLTw2/tMASGw/fWhbmVqLG1+RArnQx L5bWki4qAHfpsXbKOH7W1uEDul1OLvSDi/ZfADGFksvEmw/IJm3iED9MriugF2Jyun YjFs3tMiQXxUubNYFVnx2y0WP3rIf0IwL3fXSotLZe1eT3Vez7c0T5NktI1pWcrcYl j0QQa6iSyTjog== 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 1uXFgO-00CEUT-1K; Thu, 03 Jul 2025 09:52:40 +0100 Date: Thu, 03 Jul 2025 09:52:38 +0100 Message-ID: <865xg9bqqx.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Joey Gouly , Suzuki K Poulose , Zenghui Yu Subject: Re: [PATCH] KVM: arm64: Fix handling of FEAT_GTG for unimplemented granule sizes In-Reply-To: References: <20250701142225.753984-1-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/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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: oliver.upton@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, suzuki.poulose@arm.com, 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 On Wed, 02 Jul 2025 03:35:44 +0100, Oliver Upton wrote: > > On Tue, Jul 01, 2025 at 03:22:25PM +0100, Marc Zyngier wrote: > > Booting an EL2 guest on a system only supporting a subset of the > > possible page sizes leads to interesting situations. > > > > For example, on a system that only supports 4kB and 64kB, and is > > booted with a 4kB kernel, we end-up advertising 16kB support at > > stage-2, which is pretty weird. > > > > That's because we consider that any S2 bigger than our base granule > > is fair game, irrespective of what the HW actually supports. > > While this is ugly as hell, it is _technically_ OK though right? Since > we always shadow the stage-2 MMU we can emulate the otherwise > unsupported page size. > > Now, mismatched granularity at S1 and S2 is a massive can of worms we > should not entertain :) > > > Add new checks that will verify that this granule size is actually > > supported before publishing it to the guest. > > > > Fixes: e7ef6ed4583ea ("KVM: arm64: Enforce NV limits on a per-idregs basis") > > Signed-off-by: Marc Zyngier > > It'd be good to clarify the rationale a bit further in the changelog, > but full agreement on disallowing this sort of stupidity. Indeed, I have now added some verbiage to that effect. > Reviewed-by: Oliver Upton Thanks! M. -- Without deviation from the norm, progress is not possible.