diff options
| author | Marc Zyngier <maz@kernel.org> | 2024-12-17 17:23:13 +0300 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2025-01-02 22:19:09 +0300 |
| commit | 338f8ea51944d02ea29eadb3d5fa9196e74a100d (patch) | |
| tree | ea99c5a6a28f4191a96420e7929a84fb4ba596da /include | |
| parent | 2cd2a77f9c32f1eaf599fb72cbcd0394938a8b58 (diff) | |
| download | linux-338f8ea51944d02ea29eadb3d5fa9196e74a100d.tar.xz | |
KVM: arm64: nv: Accelerate EL0 timer read accesses when FEAT_ECV in use
Although FEAT_ECV allows us to correctly emulate the timers, it also
reduces performances pretty badly.
Mitigate this by emulating the CTL/CVAL register reads in the
inner run loop, without returning to the general kernel.
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241217142321.763801-6-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/kvm/arm_arch_timer.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index 6e3f6b7ff2b2..c1ba31fab6f5 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -156,4 +156,19 @@ static inline bool has_cntpoff(void) return (has_vhe() && cpus_have_final_cap(ARM64_HAS_ECV_CNTPOFF)); } +static inline u64 timer_get_offset(struct arch_timer_context *ctxt) +{ + u64 offset = 0; + + if (!ctxt) + return 0; + + if (ctxt->offset.vm_offset) + offset += *ctxt->offset.vm_offset; + if (ctxt->offset.vcpu_offset) + offset += *ctxt->offset.vcpu_offset; + + return offset; +} + #endif |
