Skip to content

KVM: arm64: Add NV timer support

Marc Zyngier kvm kvmarm linux-arm-kernel 2 versions – Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 14 repliesApplied
  2. v111 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Repainted EL0->EL1 when rambling about the timers

- Simplified access to EL1 counters from HYP context

- Update the status register when handled as an early trap

- Added some documentation about the default PPI numbers

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/12KVM: arm64: nv: Add handling of EL2-specific timer registersarch/arm64/include/asm/sysreg.h arch/arm64/kvm/sys_regs.c include/clocksource/arm_arch_timer.h+149 -03 replies
2/12KVM: arm64: nv: Sync nested timer state with FEAT_NV2arch/arm64/kvm/arch_timer.c arch/arm64/kvm/arm.c include/kvm/arm_arch_timer.h+48 -06 replies
3/12KVM: arm64: nv: Publish emulated timer interrupt state in the in-memory statearch/arm64/kvm/arch_timer.c arch/arm64/kvm/arm.c+22 -10 replies
4/12KVM: arm64: nv: Use FEAT_ECV to trap access to EL0 timersarch/arm64/kvm/arch_timer.c include/clocksource/arm_arch_timer.h+35 -30 replies
5/12KVM: arm64: nv: Accelerate EL0 timer read accesses when FEAT_ECV in usearch/arm64/kvm/arch_timer.c arch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/vhe/switch.c +1 more+122 -180 replies
6/12KVM: arm64: nv: Accelerate EL0 counter accesses from hypervisor contextarch/arm64/kvm/hyp/vhe/switch.c+8 -00 replies
7/12KVM: arm64: Handle counter access early in non-HYP contextarch/arm64/kvm/hyp/include/hyp/switch.h+21 -130 replies
8/12KVM: arm64: nv: Add trap routing for CNTHCTL_EL2.EL1{NVPCT,NVVCT,TVT,TVCT}arch/arm64/kvm/emulate-nested.c+56 -20 replies
9/12KVM: arm64: nv: Propagate CNTHCTL_EL2.EL1NV{P,V}CT bitsarch/arm64/kvm/arch_timer.c+7 -03 replies
10/12KVM: arm64: nv: Sanitise CNTHCTL_EL2arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/nested.c include/clocksource/arm_arch_timer.h+18 -10 replies
11/12KVM: arm64: Work around x1e's CNTVOFF_EL2 bogosityarch/arm64/include/asm/cputype.h arch/arm64/kernel/cpu_errata.c arch/arm64/kernel/image-vars.h +5 more+90 -80 replies
12/12KVM: arm64: nv: Document EL2 timer APIDocumentation/virt/kvm/devices/vcpu.rst+9 -60 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchOliver Upton
SeriesA-b
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/12] KVM: arm64: Add NV timer support

Here's another version of the series initially posted at [1], which implements support for timers in NV context.

From v1:

- Repainted EL0->EL1 when rambling about the timers

- Simplified access to EL1 counters from HYP context

- Update the status register when handled as an early trap

- Added some documentation about the default PPI numbers

The whole thing has been tested with 6.13-rc3 as part of the my NV integration branch [2], and is functional enough to run an L3 guest with kvmtool as the VMM and EDK2 as the firmware. YMMV.

[1] https://lore.kernel.org/r/[email protected]
[2] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/nv-next

Marc Zyngier (12):
KVM: arm64: nv: Add handling of EL2-specific timer registers
KVM: arm64: nv: Sync nested timer state with FEAT_NV2
KVM: arm64: nv: Publish emulated timer interrupt state in the
in-memory state
KVM: arm64: nv: Use FEAT_ECV to trap access to EL0 timers
KVM: arm64: nv: Accelerate EL0 timer read accesses when FEAT_ECV in
use
KVM: arm64: nv: Accelerate EL0 counter accesses from hypervisor
context
KVM: arm64: Handle counter access early in non-HYP context
KVM: arm64: nv: Add trap routing for

    CNTHCTL_EL2.EL1{NVPCT,NVVCT,TVT,TVCT}

KVM: arm64: nv: Propagate CNTHCTL_EL2.EL1NV{P,V}CT bits
KVM: arm64: nv: Sanitise CNTHCTL_EL2
KVM: arm64: Work around x1e's CNTVOFF_EL2 bogosity
KVM: arm64: nv: Document EL2 timer API

 Documentation/virt/kvm/devices/vcpu.rst |  15 +-
 arch/arm64/include/asm/cputype.h        |   2 +
 arch/arm64/include/asm/kvm_host.h       |   2 +-
 arch/arm64/include/asm/sysreg.h         |   4 +
 arch/arm64/kernel/cpu_errata.c          |   8 ++
 arch/arm64/kernel/image-vars.h          |   3 +
 arch/arm64/kvm/arch_timer.c             | 179 +++++++++++++++++++++---
 arch/arm64/kvm/arm.c                    |   3 +
 arch/arm64/kvm/emulate-nested.c         |  58 +++++++-
 arch/arm64/kvm/hyp/include/hyp/switch.h |  39 ++++--
 arch/arm64/kvm/hyp/nvhe/timer-sr.c      |  16 ++-
 arch/arm64/kvm/hyp/vhe/switch.c         | 107 ++++++++++++++
 arch/arm64/kvm/nested.c                 |  15 ++
 arch/arm64/kvm/sys_regs.c               | 146 ++++++++++++++++++-
 arch/arm64/tools/cpucaps                |   1 +
 include/clocksource/arm_arch_timer.h    |   6 +
 include/kvm/arm_arch_timer.h            |  23 +++
 17 files changed, 580 insertions(+), 47 deletions(-)
Signature · 1 line
2.39.2