[PATCH v2 0/4] KVM: arm64: nv: Fix AT emulation for nested virtualization

Dan Carpenter dan at pereq.eu
Thu Nov 19 05:25:33 PST 2026


This fixes two issues in handling AT emulation for nested virt.
* VMs were potentially using the TCR2 bits which weren't intended for
  them.
* It turned out that guests could write to the TCR2 bits even when
  those were supposed to be hidden.  That is patches 2 and 3.
* The VMID wasn't handled correctly.  Roll over could happen before
  or during the AT execution leading to invalid results.

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 feed back.
3) Trap the writes to the TCR2 registers (normal and nested)

Signed-off-by: Dan Carpenter <dan at pereq.eu>
---
Dan Carpenter (4):
      KVM: arm64: nv: Fix AT emulation for TCR2_EL1
      KVM: arm64: Trap TCR2_EL1 writes when S1PIE or S1POE is hidden
      KVM: arm64: nv: Clear hidden TCR2 bits for nested guests
      KVM: arm64: nv: Update the shadow MMU's VMID for AT emulation

 arch/arm64/kvm/at.c                        | 54 +++++++++++++++++++++++++++---
 arch/arm64/kvm/config.c                    |  5 +++
 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 10 +++++-
 arch/arm64/kvm/sys_regs.c                  | 33 ++++++++++++++++--
 4 files changed, 95 insertions(+), 7 deletions(-)
---
base-commit: 5a7235e9adff42aa043ac9473dbeb0354dca0967
change-id: 20261119-nv-tcr2-59b13df5ecf6

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




More information about the linux-arm-kernel mailing list