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 C58BAC83030 for ; Thu, 3 Jul 2025 08:56:33 +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=0YgA6xtAGxM+vmwPKB/HmJU5PnvU/lpGxp1Uj5xdGLY=; b=jAmDxyQYzm2o4AZ8HblG1E5lbw g57iYJjBIF5Aa51DVJ7v/8CNoIoBuWcivsX0D0CpMWWPDSRHaGeDiD1Mzwsv+vnIU1ufLeHtIjccr 8cEDV8EcbkcYSjikUtvXLLPXI8oJ8+fCHE7p3zVYMCq4T9mjtiEhjrPOd+y62Ztr4xo9ct48uKOFu Jl+i/nptaP2m2fj5f0c8iknUm2hYnfKhN6ABGHtY/3w0h+MdRZNPLtZCtVVsATz4HelHbFYyqG1aG fwoTZtTlRCQMg1/y+XBdMrHErFcIYxS5e3GzyOWknywFWMr9UwPEyJlwcF2D0wiBtXZV9NkQB7KNh 3JX8l/aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uXFk3-0000000AkQ9-1cq8; Thu, 03 Jul 2025 08:56:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uXFgQ-0000000Ajnl-3CAt for linux-arm-kernel@lists.infradead.org; Thu, 03 Jul 2025 08:52:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 489515C5C69; Thu, 3 Jul 2025 08:52:42 +0000 (UTC) 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250703_015242_843520_A4E90D70 X-CRM114-Status: GOOD ( 22.11 ) 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, 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.