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 3F4DF8BF1 for ; Wed, 7 Dec 2022 19:05:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1579C433D6; Wed, 7 Dec 2022 19:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670439910; bh=4pRrfPHrYBe6IY9OjvKZNVGDF905GBv+j6LDFko/JLQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pSG/dnMStZz1/XKIcLTjSwv0GcAw2//GNdYc1v84roDJmCWcoAwELDGrpYlmy7q4H FWDi/1BzI2c3Bz2pKl8HiKfoh4sZti//rNCKHbEQYpXQ+BjLLp3VzMXO+kk0bCgkBS E1d02JPs/xFOFhCczlBjVlxoiwvwPgrpdQ1BzOE0LpW03dCSD9/P3RjlvkYZCCWIZe obt2jZSQ/UJ/dfOtBGzzbVHX6+iN7Ul4JHk9nb3jzR0ihxbYBGjynyci/Vfcb586AM BQut5fK/Kf4uU5q+ZenPuoN8NcxKzFe6GV/3BInjvqau9Ve6zvp+dLjyUBDtbhfCRL sD8HTHVRmYhHQ== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] helo=wait-a-minute.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 1p2zjA-00BBiW-F5; Wed, 07 Dec 2022 19:05:08 +0000 Date: Wed, 07 Dec 2022 19:03:28 +0000 Message-ID: <87y1rjrq7z.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Catalin Marinas , Will Deacon , Lorenzo Pieralisi , Mark Rutland , Sami Mujawar , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v2 09/14] KVM: arm64: Hide FEAT_NMI from guests In-Reply-To: References: <20221112151708.175147-1-broonie@kernel.org> <20221112151708.175147-10-broonie@kernel.org> <86pmcxlo7z.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/27.1 (x86_64-pc-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.104.136.29 X-SA-Exim-Rcpt-To: broonie@kernel.org, catalin.marinas@arm.com, will@kernel.org, lpieralisi@kernel.org, mark.rutland@arm.com, Sami.Mujawar@arm.com, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 05 Dec 2022 19:03:50 +0000, Mark Brown wrote: > > [1 ] > On Mon, Dec 05, 2022 at 06:06:24PM +0000, Marc Zyngier wrote: > > Mark Brown wrote: > > > > FEAT_NMI is not yet useful to guests pending implementation of vGIC > > > support. Mask out the feature from the ID register and prevent guests > > > creating state in ALLINT.ALLINT by activating the trap on write provided > > > in HCRX_EL2.TALLINT when they are running. There is no trap available > > > for reads from ALLINT. > > > > We do not need to check for FEAT_HCRX since it is mandatory since v8.7 > > > and FEAT_NMI is a v8.8 feature. > > > And yet you check for it in hyp-stub.S after having checked for > > FEAT_NMI. What gives? > > Being aware that you have a strong preference for not having safety > checks for mandatory features I didn't add any here but noted it so > people could see why they were omitted. The checks in hyp-stub.S were > probably written before I'd checked the dependency situation out. > > I can remove those checks if preferred but TBH given that the failure > mode in hyp-stub.S is typically going to be to die with no output if > something goes wrong it does feel like it's worth the extra couple of > instructions to double check things just in case, especially with the > virtual platforms being so easy to misconfigure. I'm not hell bent on it, and if we can spot the issue early, that's fine by me. But let's then disable the feature if the implementation lacks some essential dependencies. A simple check on ID_AA64MMFR1_EL1.HCX when detecting FEAT_NMI should do the trick. M. -- Without deviation from the norm, progress is not possible.