From: Oliver Upton <oliver.upton@linux.dev>
To: Marc Zyngier <maz@kernel.org>
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: Wed, 2 Apr 2025 14:52:02 -0700 [thread overview]
Message-ID: <Z-2xgjsrRAI-sq2G@linux.dev> (raw)
In-Reply-To: <87cyduz138.wl-maz@kernel.org>
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.
Thanks,
Oliver
next prev parent reply other threads:[~2025-04-02 21:52 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 [this message]
2025-04-03 7:04 ` Marc Zyngier
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=Z-2xgjsrRAI-sq2G@linux.dev \
--to=oliver.upton@linux.dev \
--cc=jiaqiyan@google.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--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