From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B61A93ECBDA; Mon, 19 Oct 2026 07:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792395082; cv=none; b=W1wNYnH8CaSbY1bLiyvU5pzSlSGr2z9bFAcfiAbpYBL7B/SuSACTkLJ7Lu9CZMk2aR3Mp3ycs/Q1v8CQz7Ni6eghMvtPV/oPk9HLIVA2CWUWVeFDuNI3qjr2bMVtA+/4mNlWA7iUqDuGCCBdmpH0t+A3+6d//FGDqN8HxgT8Gec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792395082; c=relaxed/simple; bh=udJeHtKFc+AI2kfdvBt/OjQRSFLlHhk/kt6ygA/+jxc=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=bbZxKnTJL4fNtAPW2Cvm/n2aqEUkbDS8CVp03BhDn+tAcAVlsPZR3nuL0jhqHsuJEJr/1pqB+dARMVQcAq8t6uJ9BVN+n4rilDzOVs0mXeb5E/mVdSqx3suWY2AC9oUiLt+yKVycSrpLh/AhpjWAnVfVXupDm4tq3jGpFEymdfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KvfNtmig; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KvfNtmig" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org 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: 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 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.