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 E8F6F23ED53 for ; Thu, 3 Apr 2025 07:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743663850; cv=none; b=m1cp9EpAy5aOtxNc0h6zjaH2E0N4CKVC6iyJSIA8p+6lAVTn7/GPCfJ99W1HWGrVBn8Q8BoEq7+NNhXOYE5NHK6NvI9zlfbg4EwUWAuxI27yXT/MO9LLjbDCxcVX2vhbO9wj4LX8PFWj9HUtRGH7QVqimv7KIJe9v3uNcTpTExk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743663850; c=relaxed/simple; bh=hl6lPBFM1k0e/IKS+t0QKCaUoDsDzpZvntTMgsWWCLw=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=T6KYxFmttU0pCs4+CkBBOfCGmhzJkt9kypCMxSbZnOx20cvi0ldLxAIgXQotR1eTB1IeySqeQa5iHePUinO2gQLs4cR8xlavvPxdY8HSKCjhaEdbtqVbGOIuz08Yro070hgBEoykroNy5l1FMlPLed+14vGY1tbF7GbSBuVpEgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IBf3y+22; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IBf3y+22" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AAE8C4CEE3; Thu, 3 Apr 2025 07:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743663849; bh=hl6lPBFM1k0e/IKS+t0QKCaUoDsDzpZvntTMgsWWCLw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IBf3y+22Fh9WObMxLoocDNC4HgEjuTmJziiFknxFQDOQf4zfkN2FTLETwGZfZlfzX 0Jni+v6jlABLuXLnF7ptB9a/RbuJwHQEbpeQNahDMeZNzo/eqhfAVBD6EgGlHydtmF nw1f2aDnkyQfd+1l7Ii/uCwwLMlEUDiCtRzCdB8XoHcEdJsndNx8043U+/mkve7FZX ByOqdZQwVNpwKt1/Pa3f381+RykrUx0Et20AMbZtZvoOMjm50l3Tf1Tq9SFxnDaP0S XLf+FD6nOxcxObcELFJTUXrFrBhzR0En2hYsekVXvHIK/XUKP4alrT9Q9IXXbUDTnK IiZxNLF6QGoaw== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-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 1u0EcR-001se4-1L; Thu, 03 Apr 2025 08:04:07 +0100 Date: Thu, 03 Apr 2025 08:04:08 +0100 Message-ID: <877c41zpxz.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, Joey Gouly , Suzuki K Poulose , Jiaqi Yan Subject: Re: [PATCH v2 1/3] KVM: arm64: Only read HPFAR_EL2 when value is architecturally valid In-Reply-To: References: <20250402201725.2963645-1-oliver.upton@linux.dev> <20250402201725.2963645-2-oliver.upton@linux.dev> <87cyduz138.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: 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.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, jiaqiyan@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 02 Apr 2025 22:52:02 +0100, Oliver Upton wrote: > > On Wed, Apr 02, 2025 at 10:48:43PM +0100, Marc Zyngier wrote: > > On Wed, 02 Apr 2025 21:17:23 +0100, > > Oliver Upton wrote: > > > > > > KVM's logic for deciding when HPFAR_EL2 is UNKNOWN doesn't align with > > > the architecture. Most notably, KVM assumes HPFAR_EL2 contains the > > > faulting IPA even in the case of an SEA. > > > > > > Align the logic with the architecture rather than attempting to > > > paraphrase it. Additionally, take the opportunity to improve the > > > language around ARM erratum #834220 such that it actually describes the > > > bug. > > > > > > Signed-off-by: Oliver Upton > > > --- > > > arch/arm64/include/asm/esr.h | 22 ++++++++++-- > > > arch/arm64/kvm/hyp/include/hyp/fault.h | 46 ++++++++++++++++---------- > > > 2 files changed, 48 insertions(+), 20 deletions(-) > > > > > > diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h > > > index d1b1a33f9a8b..92fb26e90840 100644 > > > --- a/arch/arm64/include/asm/esr.h > > > +++ b/arch/arm64/include/asm/esr.h > > > @@ -121,6 +121,15 @@ > > > #define ESR_ELx_FSC_SEA_TTW(n) (0x14 + (n)) > > > #define ESR_ELx_FSC_SECC (0x18) > > > #define ESR_ELx_FSC_SECC_TTW(n) (0x1c + (n)) > > > +#define ESR_ELx_FSC_ADDRSZ (0x00) > > > + > > > +/* > > > + * Annoyingly, the negative levels for Address size faults aren't laid out > > > + * contiguously (or in the desired order) > > > + */ > > > +#define ESR_ELx_FSC_ADDRSZ_nL(n) ((n) == -1 ? 0x25 : 0x2C) > > > +#define ESR_ELx_FSC_ADDRSZ_L(n) ((n) < 0 ? ESR_ELx_FSC_ADDRSZ_nL(n) : \ > > > + (ESR_ELx_FSC_ADDRSZ + (n))) > > > > Oh gawd, D128 and its level -2. Do we really want to add this now? > > I certainly don't want to, but the other FSC level macros (whether > intentional or not) already cope with D128. So I did the same for the > sake of consisency. Ah, fair enough. Let's have it then. Thanks, M. -- Jazz isn't dead. It just smells funny.