[PATCH 2/3] KVM: arm64: nv: Forward CNTP_TVAL_EL02 and CNTV_TVAL_EL02 traps

Dan Carpenter dan at pereq.eu
Wed Nov 18 07:30:02 PST 2026


There are a couple timer related entries messing in the nested
virtualization traps.

With nested virtualization you can run a hypervisor in L1 and then you
can run another hypervisor under that one in L2 and a guest under that
in L3.  Without these then if L2 tries to read or write L3's timers it
instead reads and writes to its own timers.

Fixes: c271269e3570 ("KVM: arm64: nv: Add trap routing for CNTHCTL_EL2.EL1{NVPCT,NVVCT,TVT,TVCT}")
Cc: stable at vger.kernel.org
Signed-off-by: Dan Carpenter <dan at pereq.eu>
---
 arch/arm64/kvm/emulate-nested.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
index bf4b8a44b9c4..9e0c15e6be47 100644
--- a/arch/arm64/kvm/emulate-nested.c
+++ b/arch/arm64/kvm/emulate-nested.c
@@ -942,8 +942,10 @@ static const struct encoding_to_trap_config encoding_to_cgt[] __initconst = {
 		      sys_reg(3, 5, 14, 1, 0), CGT_HCR_NV),
 	SR_TRAP(SYS_CNTP_CTL_EL02,	CGT_CNTHCTL_EL1NVPCT),
 	SR_TRAP(SYS_CNTP_CVAL_EL02,	CGT_CNTHCTL_EL1NVPCT),
+	SR_TRAP(SYS_CNTP_TVAL_EL02,	CGT_HCR_NV),
 	SR_TRAP(SYS_CNTV_CTL_EL02,	CGT_CNTHCTL_EL1NVVCT),
 	SR_TRAP(SYS_CNTV_CVAL_EL02,	CGT_CNTHCTL_EL1NVVCT),
+	SR_TRAP(SYS_CNTV_TVAL_EL02,	CGT_HCR_NV),
 	SR_TRAP(OP_AT_S1E2R,		CGT_HCR_NV),
 	SR_TRAP(OP_AT_S1E2W,		CGT_HCR_NV),
 	SR_TRAP(OP_AT_S12E1R,		CGT_HCR_NV),
-- 
2.53.0




More information about the linux-arm-kernel mailing list