From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
kvm@vger.kernel.org, James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: timers: Use CNTHCTL_EL2 when setting non-CNTKCTL_EL1 bits
Date: Tue, 27 Jun 2023 18:14:58 +0100 [thread overview]
Message-ID: <86cz1gygh9.wl-maz@kernel.org> (raw)
In-Reply-To: <ZJsQAFlsx0GssfL2@linux.dev>
On Tue, 27 Jun 2023 17:36:16 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> On Tue, Jun 27, 2023 at 03:05:57PM +0100, Marc Zyngier wrote:
> > It recently appeared that, whien running VHE, there is a notable
> > difference between using CNTKCTL_EL1 and CNTHCTL_EL2, despite what
> > the architecture documents:
> >
> > - When accessed from EL2, bits [19:18] and [16:10] same bits have
> > the same assignment as CNTHCTL_EL2
> > - When accessed from EL1, bits [19:18] and [16:10] are RES0
> >
> > It is all OK, until you factor in NV, where the EL2 guest runs at EL1.
> > In this configuration, CNTKCTL_EL11 doesn't trap, nor ends up in
> > the VNCR page. This means that any write from the guest affecting
> > CNTHCTL_EL2 using CNTKCTL_EL1 ends up losing some state. Not good.
> >
> > The fix it obvious: don't use CNTKCTL_EL1 if you want to change bits
> > that are not part of the EL1 definition of CNTKCTL_EL1, and use
> > CNTHCTL_EL2 instead. This doesn't change anything for a bare-metal OS,
> > and fixes it when running under NV. The NV hypervisor will itself
> > have to work harder to merge the two accessors.
> >
> > Note that there is a pending update to the architecture to address
> > this issue by making the affected bits UNKNOWN when CNTKCTL_EL1 is
> > user from EL2 with VHE enabled.
> >
> > Fixes: c605ee245097 ("KVM: arm64: timers: Allow physical offset without CNTPOFF_EL2")
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > Cc: stable@vger.kernel.org # v6.4
>
> Looks good. I'll probably open a fixes branch around -rc1 and pick this
> patch up then.
Awesome, thanks.
(/me goes back to encoding FGT handling by hand... :-/)
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-06-27 17:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 14:05 [PATCH] KVM: arm64: timers: Use CNTHCTL_EL2 when setting non-CNTKCTL_EL1 bits Marc Zyngier
2023-06-27 16:36 ` Oliver Upton
2023-06-27 17:14 ` Marc Zyngier [this message]
2023-07-11 10:35 ` Eric Auger
2023-07-11 20:02 ` Oliver Upton
2023-07-11 20:00 ` 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=86cz1gygh9.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oliver.upton@linux.dev \
--cc=stable@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.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).