From: Marc Zyngier <maz@kernel.org>
To: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
Zenghui Yu <yuzenghui@huawei.com>, Will Deacon <will@kernel.org>
Subject: [PATCH 0/2] KVM: arm64: Synchronise speculative page table walks on translation regime change
Date: Thu, 30 Mar 2023 11:04:17 +0100 [thread overview]
Message-ID: <20230330100419.1436629-1-maz@kernel.org> (raw)
It recently became apparent that the way we switch our EL1&0
translation regime is not entirely fool proof.
On taking an exception from EL1&0 to EL2(&0), the page table walker is
allowed to carry on with speculative walks started from EL1&0 while
running at EL2 (see R_LFHQG). Given that the PTW may be actively using
the EL1&0 system registers, the only safe way to deal with it is to
issue a DSB before changing any of it.
We already did the right thing for SPE and TRBE, but ignored the PTW
for unknown reasons (probably because the architecture wasn't crystal
clear at the time).
This requires a bit of surgery in the nvhe code, though most of these
patches are comments so that my future self can understand the purpose
of these barriers. The VHE code is largely unaffected, thanks to the
DSB in the context switch.
Marc Zyngier (2):
KVM: arm64: nvhe: Synchronise with page table walker on MMU update
KVM: arm64: vhe: Synchronise with page table walker on MMU update
arch/arm64/kvm/hyp/nvhe/debug-sr.c | 2 --
arch/arm64/kvm/hyp/nvhe/mem_protect.c | 7 +++++++
arch/arm64/kvm/hyp/nvhe/switch.c | 18 ++++++++++++++++++
arch/arm64/kvm/hyp/nvhe/tlb.c | 7 +++++++
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 12 ++++++++++++
5 files changed, 44 insertions(+), 2 deletions(-)
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2023-03-30 10:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 10:04 Marc Zyngier [this message]
2023-03-30 10:04 ` [PATCH 1/2] KVM: arm64: nvhe: Synchronise with page table walker on MMU update Marc Zyngier
2023-04-06 16:56 ` Oliver Upton
2023-04-07 11:26 ` Marc Zyngier
2023-04-07 11:37 ` Marc Zyngier
2023-03-30 10:04 ` [PATCH 2/2] KVM: arm64: vhe: " Marc Zyngier
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=20230330100419.1436629-1-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=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--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).