Skip to content

KVM: arm64: Nested Virtualization support (FEAT_NV2 only)

Marc Zyngier kvm kvmarm linux-arm-kernel 1 version Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v11 Latest43 patches 35 repliesApplied

Patches in v11 Applied

#Subject and filesSizeRepliesApplied
1/43arm64: cpufeatures: Restrict NV support to FEAT_NV2arch/arm64/kernel/cpufeature.c arch/arm64/tools/cpucaps+17 -72 replies
2/43KVM: arm64: nv: Hoist vcpu_has_nv() into is_hyp_ctxt()arch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arch_timer.c+10 -80 replies
3/43KVM: arm64: nv: Compute NV view of idregs as a one-offarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/arm.c +2 more+23 -140 replies
4/43KVM: arm64: nv: Drop EL12 register traps that are redirected to VNCRarch/arm64/kvm/sys_regs.c+0 -150 replies
5/43KVM: arm64: nv: Add non-VHE-EL2->EL1 translation helpersarch/arm64/include/asm/kvm_nested.h+49 -10 replies
6/43KVM: arm64: nv: Add include containing the VNCR_EL2 offsetsarch/arm64/include/asm/vncr_mapping.h+102 -00 replies
7/43KVM: arm64: Introduce a bad_trap() primitive for unexpected trap handlingarch/arm64/kvm/sys_regs.c+15 -80 replies
8/43KVM: arm64: nv: Add EL2_REG_VNCR()/EL2_REG_REDIR() sysreg helpersarch/arm64/kvm/sys_regs.c+47 -180 replies
9/43KVM: arm64: nv: Map VNCR-capable registers to a separate pagearch/arm64/include/asm/kvm_host.h+81 -460 replies
10/43KVM: arm64: nv: Handle virtual EL2 registers in vcpu_read/write_sys_reg()arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/sys_regs.c+126 -50 replies
11/43KVM: arm64: nv: Handle HCR_EL2.E2H speciallyarch/arm64/kvm/sys_regs.c+21 -00 replies
12/43KVM: arm64: nv: Handle CNTHCTL_EL2 speciallyarch/arm64/kvm/sys_regs.c include/kvm/arm_arch_timer.h+31 -00 replies
13/43KVM: arm64: nv: Save/Restore vEL2 sysregsarch/arm64/kvm/hyp/include/hyp/sysreg-sr.h arch/arm64/kvm/hyp/nvhe/sysreg-sr.c arch/arm64/kvm/hyp/vhe/sysreg-sr.c+135 -50 replies
14/43KVM: arm64: nv: Respect virtual HCR_EL2.TWX settingarch/arm64/include/asm/kvm_emulate.h arch/arm64/kvm/handle_exit.c+18 -10 replies
15/43KVM: arm64: nv: Respect virtual CPTR_EL2.{TFP,FPEN} settingsarch/arm64/include/asm/kvm_emulate.h arch/arm64/kvm/handle_exit.c arch/arm64/kvm/hyp/include/hyp/switch.h+41 -40 replies
16/43KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2arch/arm64/include/asm/kvm_nested.h arch/arm64/include/asm/sysreg.h arch/arm64/kvm/emulate-nested.c +4 more+90 -50 replies
17/43KVM: arm64: nv: Support multiple nested Stage-2 mmu structuresarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_mmu.h arch/arm64/include/asm/kvm_nested.h +4 more+338 -226 replies
18/43KVM: arm64: nv: Implement nested Stage-2 page table walk logicarch/arm64/include/asm/esr.h arch/arm64/include/asm/kvm_arm.h arch/arm64/include/asm/kvm_nested.h +1 more+283 -00 replies
19/43KVM: arm64: nv: Handle shadow stage 2 page faultsarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/mmu.c +1 more+153 -102 replies
20/43KVM: arm64: nv: Restrict S2 RD/WR permissions to match the guest'sarch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/mmu.c arch/arm64/kvm/nested.c+29 -20 replies
21/43KVM: arm64: nv: Unmap/flush shadow stage 2 page tablesarch/arm64/include/asm/kvm_mmu.h arch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/mmu.c +1 more+70 -50 replies
22/43KVM: arm64: nv: Set a handler for the system instruction trapsarch/arm64/kvm/sys_regs.c+44 -150 replies
23/43KVM: arm64: nv: Trap and emulate AT instructions from virtual EL2arch/arm64/include/asm/kvm_arm.h arch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/Makefile +2 more+440 -10 replies
24/43KVM: arm64: nv: Trap and emulate TLBI instructions from virtual EL2arch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_nested.h arch/arm64/include/asm/sysreg.h +4 more+385 -30 replies
25/43KVM: arm64: nv: Hide RAS from nested guestsarch/arm64/kvm/sys_regs.c+1 -00 replies
26/43KVM: arm64: nv: Add handling of EL2-specific timer registersarch/arm64/include/asm/sysreg.h arch/arm64/kvm/sys_regs.c+125 -00 replies
27/43KVM: 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 -00 replies
28/43KVM: arm64: nv: Publish emulated timer interrupt state in the in-memory statearch/arm64/kvm/arch_timer.c+19 -00 replies
29/43KVM: arm64: nv: Load timer before the GICarch/arm64/kvm/arm.c+1 -10 replies
30/43KVM: arm64: nv: Nested GICv3 Supportarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_hyp.h arch/arm64/include/asm/kvm_nested.h +11 more+537 -150 replies
31/43KVM: arm64: nv: Don't block in WFI from nested statearch/arm64/kvm/arm.c+9 -00 replies
32/43KVM: arm64: nv: vgic: Allow userland to set VGIC maintenance IRQDocumentation/virt/kvm/devices/arm-vgic-v3.rst arch/arm64/include/uapi/asm/kvm.h arch/arm64/kvm/vgic/vgic-kvm-device.c +1 more+40 -30 replies
33/43KVM: arm64: nv: Fold GICv3 host trapping requirements into guest setuparch/arm64/kvm/vgic/vgic-v3-nested.c+17 -30 replies
34/43KVM: arm64: nv: Deal with broken VGIC on maintenance interrupt deliveryarch/arm64/kvm/vgic/vgic-v3-nested.c+3 -00 replies
35/43KVM: arm64: nv: Add handling of FEAT_TTL TLB invalidationarch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/nested.c arch/arm64/kvm/sys_regs.c+93 -250 replies
36/43KVM: arm64: nv: Invalidate TLBs based on shadow S2 TTL-like informationarch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/nested.c+83 -00 replies
37/43KVM: arm64: nv: Tag shadow S2 entries with nested levelarch/arm64/include/asm/kvm_nested.h arch/arm64/kvm/mmu.c+20 -20 replies
38/43KVM: arm64: nv: Allocate VNCR page when requiredarch/arm64/kvm/nested.c arch/arm64/kvm/reset.c+9 -00 replies
39/43KVM: arm64: nv: Fast-track 'InHost' exception returnsarch/arm64/kvm/emulate-nested.c arch/arm64/kvm/hyp/vhe/switch.c+47 -260 replies
40/43KVM: arm64: nv: Fast-track EL1 TLBIs for VHE guestsarch/arm64/kvm/hyp/vhe/switch.c arch/arm64/kvm/hyp/vhe/tlb.c arch/arm64/kvm/sys_regs.c+47 -150 replies
41/43KVM: arm64: nv: Use FEAT_ECV to trap access to EL0 timersarch/arm64/kvm/arch_timer.c include/clocksource/arm_arch_timer.h+37 -30 replies
42/43KVM: arm64: nv: Accelerate EL0 timer read accesses when FEAT_ECV is onarch/arm64/kvm/arch_timer.c arch/arm64/kvm/hyp/vhe/switch.c include/kvm/arm_arch_timer.h+85 -150 replies
43/43KVM: arm64: nv: Allow userspace to request KVM_ARM_VCPU_NESTED_VIRTarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c include/uapi/linux/kvm.h+5 -10 replies

Reviews trailers per patch

4 of 43 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGanapatrao KulkarniAlexandru EliseiRussell King (Oracle)Oliver Upton
SeriesR-b
1/43
2/43
3/43
4/43
5/43
6/43
7/43
8/43
9/43
10/43R-b R-b R-b
11/43R-b
12/43
13/43R-b
14/43
15/43
16/43
17/43
18/43
19/43
20/43R-b
21/43
22/43
23/43
24/43
25/43
26/43
27/43
28/43
29/43
30/43
31/43
32/43
33/43
34/43
35/43
36/43
37/43
38/43
39/43
40/43
41/43
42/43
43/43

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v11 thread

Cover letter [PATCH v11 00/43] KVM: arm64: Nested Virtualization support (FEAT_NV2 only)

This is the 5th drop of NV support on arm64 for this year, and most probably the last one for this side of Christmas.

For the previous episodes, see [1].

What's changed:

- Drop support for the original FEAT_NV. No existing hardware supports it without FEAT_NV2, and the architecture is deprecating the former entirely. This results in fewer patches, and a slightly simpler model overall.

- Reorganise the series to make it a bit more logical now that FEAT_NV is gone.

- Apply the NV idreg restrictions on VM first run rather than on each access.

- Make the nested vgic shadow CPU interface a per-CPU structure rather than per-vcpu.

- Fix the EL0 timer fastpath

- Work around the architecture deficiencies when trapping WFI from a L2 guest.

- Fix sampling of nested vgic state (MISR, ELRSR, EISR)

- Drop the patches that have already been merged (NV trap forwarding, per-MMU VTCR)

- Rebased on top of 6.7-rc2 + the FEAT_E2H0 support [2].

The branch containing these patches (and more) is at [3]. As for the previous rounds, my intention is to take a prefix of this series into 6.8, provided that it gets enough reviewing.

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

Andre Przywara (1):
KVM: arm64: nv: vgic: Allow userland to set VGIC maintenance IRQ

Christoffer Dall (2):
KVM: arm64: nv: Implement nested Stage-2 page table walk logic
KVM: arm64: nv: Unmap/flush shadow stage 2 page tables

Jintack Lim (3):
KVM: arm64: nv: Respect virtual HCR_EL2.TWX setting
KVM: arm64: nv: Respect virtual CPTR_EL2.{TFP,FPEN} settings
KVM: arm64: nv: Trap and emulate TLBI instructions from virtual EL2

Marc Zyngier (37):
arm64: cpufeatures: Restrict NV support to FEAT_NV2
KVM: arm64: nv: Hoist vcpu_has_nv() into is_hyp_ctxt()
KVM: arm64: nv: Compute NV view of idregs as a one-off
KVM: arm64: nv: Drop EL12 register traps that are redirected to VNCR
KVM: arm64: nv: Add non-VHE-EL2->EL1 translation helpers
KVM: arm64: nv: Add include containing the VNCR_EL2 offsets
KVM: arm64: Introduce a bad_trap() primitive for unexpected trap
handling
KVM: arm64: nv: Add EL2_REG_VNCR()/EL2_REG_REDIR() sysreg helpers
KVM: arm64: nv: Map VNCR-capable registers to a separate page
KVM: arm64: nv: Handle virtual EL2 registers in
vcpu_read/write_sys_reg()
KVM: arm64: nv: Handle HCR_EL2.E2H specially
KVM: arm64: nv: Handle CNTHCTL_EL2 specially
KVM: arm64: nv: Save/Restore vEL2 sysregs
KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2
KVM: arm64: nv: Support multiple nested Stage-2 mmu structures
KVM: arm64: nv: Handle shadow stage 2 page faults
KVM: arm64: nv: Restrict S2 RD/WR permissions to match the guest's
KVM: arm64: nv: Set a handler for the system instruction traps
KVM: arm64: nv: Trap and emulate AT instructions from virtual EL2
KVM: arm64: nv: Hide RAS from nested guests
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: Load timer before the GIC
KVM: arm64: nv: Nested GICv3 Support
KVM: arm64: nv: Don't block in WFI from nested state
KVM: arm64: nv: Fold GICv3 host trapping requirements into guest setup
KVM: arm64: nv: Deal with broken VGIC on maintenance interrupt
delivery
KVM: arm64: nv: Add handling of FEAT_TTL TLB invalidation
KVM: arm64: nv: Invalidate TLBs based on shadow S2 TTL-like
information
KVM: arm64: nv: Tag shadow S2 entries with nested level
KVM: arm64: nv: Allocate VNCR page when required
KVM: arm64: nv: Fast-track 'InHost' exception returns
KVM: arm64: nv: Fast-track EL1 TLBIs for VHE guests
KVM: arm64: nv: Use FEAT_ECV to trap access to EL0 timers
KVM: arm64: nv: Accelerate EL0 timer read accesses when FEAT_ECV is on
KVM: arm64: nv: Allow userspace to request KVM_ARM_VCPU_NESTED_VIRT

 .../virt/kvm/devices/arm-vgic-v3.rst          |  12 +-
 arch/arm64/include/asm/esr.h                  |   1 +
 arch/arm64/include/asm/kvm_arm.h              |   3 +
 arch/arm64/include/asm/kvm_asm.h              |   4 +
 arch/arm64/include/asm/kvm_emulate.h          |  53 +-
 arch/arm64/include/asm/kvm_host.h             | 223 +++-
 arch/arm64/include/asm/kvm_hyp.h              |   2 +
 arch/arm64/include/asm/kvm_mmu.h              |  12 +
 arch/arm64/include/asm/kvm_nested.h           | 130 ++-
 arch/arm64/include/asm/sysreg.h               |   7 +
 arch/arm64/include/asm/vncr_mapping.h         | 102 ++
 arch/arm64/include/uapi/asm/kvm.h             |   1 +
 arch/arm64/kernel/cpufeature.c                |  22 +-
 arch/arm64/kvm/Makefile                       |   4 +-
 arch/arm64/kvm/arch_timer.c                   | 115 +-
 arch/arm64/kvm/arm.c                          |  46 +-
 arch/arm64/kvm/at.c                           | 219 ++++
 arch/arm64/kvm/emulate-nested.c               |  48 +-
 arch/arm64/kvm/handle_exit.c                  |  29 +-
 arch/arm64/kvm/hyp/include/hyp/switch.h       |   8 +-
 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h    |   5 +-
 arch/arm64/kvm/hyp/nvhe/switch.c              |   2 +-
 arch/arm64/kvm/hyp/nvhe/sysreg-sr.c           |   2 +-
 arch/arm64/kvm/hyp/vgic-v3-sr.c               |   6 +-
 arch/arm64/kvm/hyp/vhe/switch.c               | 211 +++-
 arch/arm64/kvm/hyp/vhe/sysreg-sr.c            | 133 ++-
 arch/arm64/kvm/hyp/vhe/tlb.c                  |  83 ++
 arch/arm64/kvm/mmu.c                          | 248 ++++-
 arch/arm64/kvm/nested.c                       | 813 ++++++++++++++-
 arch/arm64/kvm/reset.c                        |   7 +
 arch/arm64/kvm/sys_regs.c                     | 978 ++++++++++++++++--
 arch/arm64/kvm/vgic/vgic-init.c               |  35 +
 arch/arm64/kvm/vgic/vgic-kvm-device.c         |  29 +-
 arch/arm64/kvm/vgic/vgic-v3-nested.c          | 270 +++++
 arch/arm64/kvm/vgic/vgic-v3.c                 |  35 +-
 arch/arm64/kvm/vgic/vgic.c                    |  29 +
 arch/arm64/kvm/vgic/vgic.h                    |  10 +
 arch/arm64/tools/cpucaps                      |   2 +
 include/clocksource/arm_arch_timer.h          |   4 +
 include/kvm/arm_arch_timer.h                  |  19 +
 include/kvm/arm_vgic.h                        |  16 +
 include/uapi/linux/kvm.h                      |   1 +
 tools/arch/arm/include/uapi/asm/kvm.h         |   1 +
 43 files changed, 3725 insertions(+), 255 deletions(-)
 create mode 100644 arch/arm64/include/asm/vncr_mapping.h
 create mode 100644 arch/arm64/kvm/at.c
 create mode 100644 arch/arm64/kvm/vgic/vgic-v3-nested.c
Signature · 1 line
2.39.2