Skip to content

Commit 9b3b2f0

Browse files
author
Marc Zyngier
committed
KVM: arm64: nv: Accelerate EL0 counter accesses from hypervisor context
Similarly to handling the physical timer accesses early when FEAT_ECV causes a trap, we try to handle the physical counter without returning to the general sysreg handling. More surprisingly, we introduce something similar for the virtual counter. Although this isn't necessary yet, it will prove useful on systems that have a broken CNTVOFF_EL2 implementation. Yes, they exist. Acked-by: Oliver Upton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 338f8ea commit 9b3b2f0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/arm64/kvm/hyp/vhe/switch.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ static bool kvm_hyp_handle_timer(struct kvm_vcpu *vcpu, u64 *exit_code)
324324
val = __vcpu_sys_reg(vcpu, CNTP_CVAL_EL0);
325325
}
326326
break;
327+
case SYS_CNTPCT_EL0:
328+
case SYS_CNTPCTSS_EL0:
329+
val = compute_counter_value(vcpu_hptimer(vcpu));
330+
break;
327331
case SYS_CNTV_CTL_EL02:
328332
val = compute_emulated_cntx_ctl_el0(vcpu, CNTV_CTL_EL0);
329333
break;
@@ -342,6 +346,10 @@ static bool kvm_hyp_handle_timer(struct kvm_vcpu *vcpu, u64 *exit_code)
342346
else
343347
val = __vcpu_sys_reg(vcpu, CNTV_CVAL_EL0);
344348
break;
349+
case SYS_CNTVCT_EL0:
350+
case SYS_CNTVCTSS_EL0:
351+
val = compute_counter_value(vcpu_hvtimer(vcpu));
352+
break;
345353
default:
346354
return false;
347355
}

0 commit comments

Comments
 (0)