All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: arm64: nv: Fix AT emulation for nested virtualization
@ 2026-11-27 15:31 Dan Carpenter
  2026-11-27 15:31 ` [PATCH 1/3] KVM: arm64: nv: Fix AT emulation for TCR2_EL1 Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2026-11-27 15:31 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton, Fuad Tabba, Joey Gouly, Steffen Eiden,
	Suzuki K Poulose, Zenghui Yu, Catalin Marinas, Will Deacon,
	Mark Rutland
  Cc: Karthik Bhargavan, Clément Blaudeau, linux-arm-kernel,
	kvmarm, Dan Carpenter, stable

This series fixes 3 issues found by our formal analysis at Pereq.

* VMs were potentially using the TCR2 bits which weren't intended for
  them.
* It turns out that guests could write to the TCR2 bits even when those
  bits are "hidden".
* The VMID wasn't handled correctly.  Roll over could happen before or
  during the AT execution leading to invalid results.

Changes in v3:
In v2 patches 2 and 3 added traps to prevent writes to hidden TCR2
bits.  Marc didn't like this approach and to be honest, the patch
had other issues as well.  Marc suggested that we load load
PIR/PIRE0/POR unconditionally instead and that's the approach here
in patch 2.

The other thing is that I have been trying to improve my review
process so I ended up fixing a bug handling POR_EL0 in __kvm_at_s1e01_fast().
That fix is now merged into patch 1 since it feels very related and
it gets backported to the same kernel.

Changes in v2:
1) Sashiko pointed out that we need to restore the original TCR2
   bits at the end of the AT command.
2) Clean up based on Marc's feedback.
3) Trap the writes to the TCR2 registers (normal and nested)

Signed-off-by: Dan Carpenter <dan@pereq.eu>
---
Dan Carpenter (3):
      KVM: arm64: nv: Fix AT emulation for TCR2_EL1
      KVM: arm64: Load no-access permissions when S1PIE or S1POE is hidden
      KVM: arm64: nv: Update the shadow MMU's VMID for AT emulation

 arch/arm64/kvm/at.c                        | 61 ++++++++++++++++++++++++++++--
 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 40 +++++++++++++++-----
 arch/arm64/kvm/hyp/vhe/sysreg-sr.c         | 15 +++++---
 3 files changed, 97 insertions(+), 19 deletions(-)
---
base-commit: 5a7235e9adff42aa043ac9473dbeb0354dca0967
change-id: 20261127-nv-tcr2-v3-53ec5459333a

Best regards,
--  
Dan Carpenter <dan@pereq.eu>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-28  9:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 15:31 [PATCH 0/3] KVM: arm64: nv: Fix AT emulation for nested virtualization Dan Carpenter
2026-11-27 15:31 ` [PATCH 1/3] KVM: arm64: nv: Fix AT emulation for TCR2_EL1 Dan Carpenter
2026-11-27 16:01   ` sashiko-bot
2026-11-28  9:28     ` Dan Carpenter
2026-11-27 15:31 ` [PATCH 2/3] KVM: arm64: Load no-access permissions when S1PIE or S1POE is hidden Dan Carpenter
2026-11-27 15:31 ` [PATCH 3/3] KVM: arm64: nv: Update the shadow MMU's VMID for AT emulation Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.