Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Jiaqi Yan <jiaqiyan@google.com>
Subject: Re: [PATCH v2 1/3] KVM: arm64: Only read HPFAR_EL2 when value is architecturally valid
Date: Thu, 03 Apr 2025 08:04:08 +0100	[thread overview]
Message-ID: <877c41zpxz.wl-maz@kernel.org> (raw)
In-Reply-To: <Z-2xgjsrRAI-sq2G@linux.dev>

On Wed, 02 Apr 2025 22:52:02 +0100,
Oliver Upton <oliver.upton@linux.dev> 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 <oliver.upton@linux.dev> 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 <oliver.upton@linux.dev>
> > > ---
> > >  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.

  reply	other threads:[~2025-04-03  7:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02 20:17 [PATCH v2 0/3] KVM: arm64: Fixes for resolving the fault IPA Oliver Upton
2025-04-02 20:17 ` [PATCH v2 1/3] KVM: arm64: Only read HPFAR_EL2 when value is architecturally valid Oliver Upton
2025-04-02 21:48   ` Marc Zyngier
2025-04-02 21:52     ` Oliver Upton
2025-04-03  7:04       ` Marc Zyngier [this message]
2025-04-02 20:17 ` [PATCH v2 2/3] arm64: Convert HPFAR_EL2 to sysreg table Oliver Upton
2025-04-02 20:17 ` [PATCH v2 3/3] KVM: arm64: Don't translate FAR if invalid/unsafe Oliver Upton
2025-04-02 21:53 ` [PATCH v2 0/3] KVM: arm64: Fixes for resolving the fault IPA Marc Zyngier
2025-04-03 15:45 ` Oliver Upton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877c41zpxz.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=jiaqiyan@google.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox