From: Marc Zyngier <maz@kernel.org>
To: D Scott Phillips <scott@os.amperecomputing.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
James Clark <james.clark@linaro.org>,
James Morse <james.morse@arm.com>,
Joey Gouly <joey.gouly@arm.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
Mark Brown <broonie@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
"Rob Herring (Arm)" <robh@kernel.org>,
Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>,
Shiqi Liu <shiqiliu@hust.edu.cn>, Will Deacon <will@kernel.org>,
Yicong Yang <yangyicong@hisilicon.com>,
kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] arm64: errata: Work around AmpereOne's erratum AC03_CPU_36
Date: Sun, 27 Apr 2025 13:21:16 +0100 [thread overview]
Message-ID: <86frhtkd6r.wl-maz@kernel.org> (raw)
In-Reply-To: <86frhx9ex6.fsf@scott-ph-mail.amperecomputing.com>
On Fri, 25 Apr 2025 03:02:29 +0100,
D Scott Phillips <scott@os.amperecomputing.com> wrote:
>
> Marc Zyngier <maz@kernel.org> writes:
>
> > On Tue, 15 Apr 2025 16:47:10 +0100,
> > D Scott Phillips <scott@os.amperecomputing.com> wrote:
> >>
> >> AC03_CPU_36 can cause asynchronous exceptions to be routed to the wrong
> >> exception level if an async exception coincides with an update to the
> >> controls for the target exception level in HCR_EL2. On affected
> >> machines, always do writes to HCR_EL2 with async exceptions blocked.
> >
> > From the actual errata document [1]:
> >
> > <quote>
> > If an Asynchronous Exception to EL2 occurs, while EL2 software is
> > changing the EL2 exception control bits from a configuration where
> > asynchronous exceptions are routed to EL2 to a configuration where
> > asynchronous exceptions are routed to EL1, the processor may exhibit
> > the incorrect exception behavior of routing an interrupt taken at EL2
> > to EL1. The affected system register is HCR_EL2, which contains
> > control bits for routing and enabling of EL2 exceptions.
> > </quote>
> >
> > My reading is that things can go wrong when clearing the xMO bits.
> >
> > I don't think we need to touch the xMO bits at all when running
> > VHE. So my preference would be to:
> >
> > - simply leave the xMO bits set at all times (nothing bad can happen
> > from that, can it?)
> >
> > - prevent these systems from using anything but VHE (and fail KVM init
> > otherwise)
>
> Hi Marc, I started writing up this patch and then realized that the
> issue can also not happen in nvhe mode. While xMO bits are modified
> there, async exceptions are always masked and so the "simultaneously
> take an async exception" part of the erratum can't happen.
>
> Does that sound right to you, or are there cases that I'm missing. If
> it's right the nvhe is also can't hit the erratum case, then what do you
> think is the right thing for me to do here?
That's an interesting point. We always run the nVHE/hVHE hypervisor
code with interrupts disabled by virtue of taking an HVC exception
into EL2, so that particular case seems OK as it literally implements
the proposed workaround.
However, there's at least one catch: the SError handling code in
hyp/entry.S relies on clearing PSTATE.A to take a pending abort (the
so-called VAXorcism). I take that this CPU implements FEAT_RAS, and
that we don't need to worry about this code path either, and that the
erratum cannot trigger on speculatively executed paths?
If we're OK with that, then I don't think there is much to do, other
than always setting the xMO bits at all times, for which I already
have a patch in review (v2 coming shortly).
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-04-27 12:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 15:47 [PATCH 1/2] arm64: errata: Work around AmpereOne's erratum AC03_CPU_36 D Scott Phillips
2025-04-15 15:47 ` [PATCH 2/2] arm64: errata: Work around AmpereOne's erratum AC04_CPU_23 D Scott Phillips
2025-04-15 17:06 ` Oliver Upton
2025-04-15 22:13 ` D Scott Phillips
2025-04-16 0:29 ` Oliver Upton
2025-04-16 23:05 ` D Scott Phillips
2025-04-16 7:11 ` Marc Zyngier
2025-04-16 23:06 ` D Scott Phillips
2025-04-15 18:38 ` Marc Zyngier
2025-04-15 17:12 ` [PATCH 1/2] arm64: errata: Work around AmpereOne's erratum AC03_CPU_36 Oliver Upton
2025-04-15 17:30 ` D Scott Phillips
2025-04-15 18:12 ` Oliver Upton
2025-04-15 18:17 ` D Scott Phillips
2025-04-16 7:19 ` Marc Zyngier
2025-04-16 23:14 ` D Scott Phillips
2025-04-25 2:02 ` D Scott Phillips
2025-04-27 12:21 ` Marc Zyngier [this message]
2025-04-28 16:35 ` D Scott Phillips
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=86frhtkd6r.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.clark@linaro.org \
--cc=james.morse@arm.com \
--cc=joey.gouly@arm.com \
--cc=kevin.brodsky@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=oliver.upton@linux.dev \
--cc=robh@kernel.org \
--cc=scott@os.amperecomputing.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shiqiliu@hust.edu.cn \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.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;
as well as URLs for NNTP newsgroup(s).