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 58C2CCCD184 for ; Thu, 9 Oct 2025 21:30:58 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From: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=hklQ8tRKwaKYDErRF1YB8TiLgUmmzMXzG7ufFj2s09M=; b=ZMjHgiOvYmAticywTyFQLlT58N QG/KRFEGCmTW77uifPdass4ddHpkGoofSDv6b2/9rV+r8uHGiH9dV98MmKoWd7MbBNrh8sfVbK++U cL+uFaLPvCR+GZBh+vYSYeC2IS6zdcjwvGD9NSAX3SFxicbNG/3x8LakwhYsZXfoS0uoloATINeZ7 wQ06R5EWbkSQYdcRoWGYSJ+UAJEDhFRlHCdDnkcmJsHnDryQUeaH1n4IWrcYgHazyGHiQR6s24kdo 7PZkey/l+LznUi504HFa21y6CDtmITaZKaq065OjJ+fwY9eT+d/i6NkYyFWDkc8RHrgoV5EamtGPd G8y0z/fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v6yDs-00000007A60-0Kri; Thu, 09 Oct 2025 21:30:52 +0000 Received: from out-179.mta0.migadu.com ([2001:41d0:1004:224b::b3]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v6yDo-00000007A5c-1Niz for linux-arm-kernel@lists.infradead.org; Thu, 09 Oct 2025 21:30:50 +0000 Date: Thu, 9 Oct 2025 14:30:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1760045442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hklQ8tRKwaKYDErRF1YB8TiLgUmmzMXzG7ufFj2s09M=; b=LYBnXVhr7HKEZhFK/rpCBX05+lNJQbAeLcyG6znaqW322vOApbiJ11HbXmcSeloGn6inU+ UB1sdWNkpE26QkRLpsDh/SOvJmV4p+EiO5/sLHOdOeCTgGWpbLAYXLOH3hoyqFaxjMlG6T 9DVXB3nksCyhIe04RrgnTvECZjxrSlY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Joey Gouly , Suzuki K Poulose , Zenghui Yu , Will Deacon , Catalin Marinas , Mark Rutland , Jan Kotas Subject: Re: [PATCH] arm64: Revamp HCR_EL2.E2H RES1 detection Message-ID: References: <20251009121239.29370-1-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251009121239.29370-1-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251009_143049_100307_56482E1F X-CRM114-Status: GOOD ( 19.57 ) 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 Hey, On Thu, Oct 09, 2025 at 01:12:39PM +0100, Marc Zyngier wrote: > We currently have two ways to identify CPUs that only implement FEAT_VHE > and not FEAT_E2H0: > > - either they advertise it via ID_AA64MMFR4_EL1.E2H0, > - or the HCR_EL2.E2H bit is RAO/WI > > However, there is a third category of "cpus" that fall between these > two cases: on CPUs that do not implement FEAT_FGT, it is IMPDEF whether > an access to ID_AA64MMFR4_EL1 can trap to EL2 when the register value > is zero. > > A consequence of this is that on systems such as Neoverse V2, a NV > guest cannot reliably detect that it is in a VHE-only configuration > (E2H is writable, and ID_AA64MMFR0_EL1 is 0), despite the hypervisor's > best effort to repaint the id register. > > Replace the RAO/WI test by a sequence that makes use of the VHE > register remnapping between EL1 and EL2 to detect this situation, > and work out whether we get the VHE behaviour even after having > set HCR_EL2.E2H to 0. > > This solves the NV problem, and provides a more reliable acid test > for CPUs that do not completely follow the letter of the architecture > while providing a RES1 behaviour for HCR_EL2.E2H. > > Suggested-by: Marc Rutland ^~~~ Thank you *Mark* for the suggestion here, neat trick :) I'd be in favor of this patch being sent to stable, happy to handle the backports if you don't have the time for it. VMs mysteriously dying isn't a very good experience on NV and I'd like to not scare folks away. Reviewed-by: Oliver Upton Thanks, Oliver