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 21D38CCF2D3 for ; Mon, 19 Oct 2026 07:31:29 +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=uCGtUkkqng5DDwzVzyRNOsFv9259MjO3krkZaoJj3eQ=; b=Nn63Wp+IEPn2mEC/66pB1SL69n 5BbwirkwQNtMoKB10bsQln1q8X9E8s1/E2Yn7/x6+wcC/oBN76AMqM9AcxxpVVwHgMKmX1aA6+iff vnMGftpRlsfymyTKa7lOnsbtfU6RvVVwXDHXgHSbhT22bLAgSrsgzk6S4rA4KMpaNfd2agBF0BpBZ frcCVFpWgKiXqjN0o6ejH3fADdBuVngPSMA/6NUeunz7YNr0ZgUaSSGDk4oQhLPpFV34PReOjgqaN ZmPeCSiWX5b+DV2bygX3EN7olHvBqn9UE2NeKLdw6Ti1Z4ytWXFNr3A/ATTN671Z5XPA4utP69RqJ LTadsSeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xIhq7-00000006lUO-0cnz; Mon, 19 Oct 2026 07:31:23 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xIhq5-00000006lUH-4C6U for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2026 07:31:22 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 657424040C; Mon, 19 Oct 2026 07:31:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 443D51F000C4; Mon, 19 Oct 2026 07:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792395081; bh=uCGtUkkqng5DDwzVzyRNOsFv9259MjO3krkZaoJj3eQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=KvfNtmig5fCNWGhuipioroXwY0AvPKlNdMITkMj9ZkKqe7C+O5kX2SnBY121fAqA/ Bph8ibNC+RGUQIxQc40JM1NBRntlrTSsHQ08UiNNdu7FaOkfdNsr3XFHpe9W7M8shZ MdZiO7MztaOU9iLTjdIflb2diiBr8YsPXMp3Amwkg5n0LuC3n0G+PnimtjpJTlekiB ov4POiOwi5eDWKlc410o5uP/Yo+o+tm2brI7GAezQEldB7PJ4wlANZ19MMT4eZgulO VOHzNiTE8Cm7hNtluUfx55gTho5ftjfSesYOy5jOkebVjzstvQseNmqxJXxFF8hNYV WidbvNl3v9nKw== 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 1xIhq3-00000004WLX-0LYn; Mon, 19 Oct 2026 07:31:19 +0000 Date: Mon, 19 Oct 2026 08:31:18 +0100 Message-ID: <861p9m1709.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Oliver Upton , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Mark Brown , Lorenzo Stoakes , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] KVM: arm64: Only enable S1PIE and S1POE with the features they imply In-Reply-To: References: <20261018080921.3942517-1-fuad.tabba@linux.dev> <8633u229lq.wl-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: fuad.tabba@linux.dev, oupton@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, 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, broonie@kernel.org, ljs@kernel.org, linux-kernel@vger.kernel.org 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 Sun, 18 Oct 2026 19:52:35 +0100, Fuad Tabba wrote: > > Hi Marc, > > On Sun, 18 Oct 2026 18:37:37 +0100, Marc Zyngier wrote: > [...] > > I'm afraid that this only addresses part of the problem. Ultimately, > > the idregs themselves require some sanitisation because KVM uses this > > as the source of truth. I was pointing this in my reply to Broonie, > > and this is (probably) what sashiko is blabbing on about. > > It seems so. The trap tables were only one of the places that read > S1PIE and S1POE. Sashiko found another: PIR_EL2, PIRE0_EL2 and POR_EL2 > accessed from vEL2 have no FGT bit, so accesses to them reached the > hardware registers. > > > I hacked something that could be used as the bases for such > > sanitisation, although it is quite crude and doesn't cover all of the > > possible requirements, see below. I've only boot-tested it in a nested > > guest, and I'm not even sure it actually works (my test box doesn't > > have these features). > > I'll send your patch as v3, rebased on -rc3 with you as the author, Please at least add yourself as a co-author. > once I've tested it. I'm dropping v2's trap table changes, since > they're redundant once the ID registers are sanitised. I made two > changes to your patch. The sanitisation now runs before > kvm_init_nv_sysregs(), so the nested RESx masks are computed from the > sanitised values. Isn't that already the case? At least with kvmarm-7.4, kvm_vm_finalize_sys_regs() is called before kvm_init_nv_sysregs(). > I dropped the res1 half, which isn't set by anything. I'd like to keep this, as it will eventually get used, just like the recompute loop is a bit useless for now, but will become useful in the future as dependencies get recomputed. The way I imagine this to work is that each sanitised field entry will point to a subtable containing the encoding of the field and the a function that checks for the dependency. That's not required for now, as S1P[IO]E is only a boolean, but I expect some features to eventually need something more fine-grained. Thanks, M. -- Without deviation from the norm, progress is not possible.