Skip to content

Commit 81dc950

Browse files
author
Marc Zyngier
committed
KVM: arm64: nv: timers: Support hyp timer emulation
Emulating EL2 also means emulating the EL2 timers. To do so, we expand our timer framework to deal with at most 4 timers. At any given time, two timers are using the HW timers, and the two others are purely emulated. The role of deciding which is which at any given time is left to a mapping function which is called every time we need to make such a decision. Reviewed-by: Colton Lewis <coltonlewis@google.com> Co-developed-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230330174800.2677007-18-maz@kernel.org
1 parent 1e0eec0 commit 81dc950

8 files changed

Lines changed: 220 additions & 12 deletions

File tree

arch/arm64/include/asm/kvm_host.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ enum vcpu_sysreg {
369369
TPIDR_EL2, /* EL2 Software Thread ID Register */
370370
CNTHCTL_EL2, /* Counter-timer Hypervisor Control register */
371371
SP_EL2, /* EL2 Stack Pointer */
372+
CNTHP_CTL_EL2,
373+
CNTHP_CVAL_EL2,
374+
CNTHV_CTL_EL2,
375+
CNTHV_CVAL_EL2,
372376

373377
NR_SYS_REGS /* Nothing after this line! */
374378
};

arch/arm64/include/uapi/asm/kvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ enum {
420420
#define KVM_ARM_VCPU_TIMER_CTRL 1
421421
#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
422422
#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
423+
#define KVM_ARM_VCPU_TIMER_IRQ_HVTIMER 2
424+
#define KVM_ARM_VCPU_TIMER_IRQ_HPTIMER 3
423425
#define KVM_ARM_VCPU_PVTIME_CTRL 2
424426
#define KVM_ARM_VCPU_PVTIME_IPA 0
425427

0 commit comments

Comments
 (0)