Skip to content

Transform the host into a vCPU

Andrew Scull kvmarm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest37 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/37smccc: Make constants available to assemblyinclude/linux/arm-smccc.h+22 -220 replies
2/37KVM: arm64: Move clearing of vcpu debug dirty bitarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/debug.c arch/arm64/kvm/hyp/include/hyp/debug-sr.h+3 -30 replies
3/37KVM: arm64: Track running vCPU outside of the CPU contextarch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_hyp.h +7 more+27 -190 replies
4/37KVM: arm64: nVHE: Pass pointers consistently to hyp-initarch/arm64/kvm/arm.c arch/arm64/kvm/hyp/nvhe/hyp-init.S+1 -10 replies
5/37KVM: arm64: nVHE: Break out of the hyp-init idmaparch/arm64/kvm/arm.c arch/arm64/kvm/hyp/nvhe/Makefile arch/arm64/kvm/hyp/nvhe/hyp-init.S +1 more+31 -80 replies
6/37KVM: arm64: Only check pending interrupts if it would traparch/arm64/kvm/hyp/entry.S+7 -31 reply
7/37KVM: arm64: Separate SError detection from VAXorcismarch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/entry.S arch/arm64/kvm/hyp/hyp-entry.S +1 more+25 -96 replies
8/37KVM: arm64: nVHE: Introduce a hyp run loop for the hostarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_hyp.h arch/arm64/kernel/image-vars.h +7 more+154 -330 replies
9/37smccc: Cast arguments to unsigned longinclude/linux/arm-smccc.h+10 -100 replies
10/37KVM: arm64: nVHE: Migrate hyp interface to SMCCCarch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c +2 more+139 -440 replies
11/37KVM: arm64: nVHE: Migrate hyp-init to SMCCCarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/Makefile arch/arm64/kvm/arm.c +3 more+48 -590 replies
12/37KVM: arm64: nVHE: Fix pointers during SMCCC convertionarch/arm64/kvm/hyp/nvhe/hyp-main.c arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/nvhe/tlb.c +1 more+8 -120 replies
13/37KVM: arm64: Rename workaround 2 helpersarch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/vhe/switch.c+10 -100 replies
14/37KVM: arm64: nVHE: Use __kvm_vcpu_run for the host vcpuarch/arm64/kvm/hyp/nvhe/hyp-main.c arch/arm64/kvm/hyp/nvhe/switch.c+74 -430 replies
15/37KVM: arm64: Share some context save and restore macrosarch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/hyp/entry.S arch/arm64/kvm/hyp/nvhe/hyp-start.S+39 -410 replies
16/37KVM: arm64: nVHE: Handle stub HVCs in the host looparch/arm64/kvm/hyp/hyp-entry.S arch/arm64/kvm/hyp/nvhe/hyp-init.S arch/arm64/kvm/hyp/nvhe/hyp-main.c+65 -360 replies
17/37KVM: arm64: nVHE: Store host sysregs in host vcpuarch/arm64/kvm/hyp/nvhe/switch.c+7 -50 replies
18/37KVM: arm64: nVHE: Access pmu_events directly in kvm_host_dataarch/arm64/kvm/hyp/nvhe/switch.c+6 -140 replies
19/37KVM: arm64: nVHE: Drop host_ctxt argument for context switchingarch/arm64/kvm/hyp/nvhe/switch.c+4 -80 replies
20/37KVM: arm64: nVHE: Use host vcpu context for host debug statearch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/include/hyp/debug-sr.h arch/arm64/kvm/hyp/nvhe/debug-sr.c +3 more+44 -180 replies
21/37KVM: arm64: Move host debug state from vcpu to percpuarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_hyp.h arch/arm64/kernel/image-vars.h +3 more+22 -160 replies
22/37KVM: arm64: nVHE: Store host's mdcr_el2 and hcr_el2 in its vcpuarch/arm64/kvm/hyp/nvhe/hyp-main.c arch/arm64/kvm/hyp/nvhe/switch.c+12 -120 replies
23/37KVM: arm64: Skip __hyp_panic and go direct to hyp_panicarch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/hyp-entry.S arch/arm64/kvm/hyp/nvhe/switch.c +1 more+7 -110 replies
24/37KVM: arm64: Break apart kvm_host_dataarch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_hyp.h +11 more+79 -590 replies
25/37KVM: arm64: nVHE: Unify sysreg state saving pathsarch/arm64/kvm/hyp/nvhe/switch.c+8 -50 replies
26/37KVM: arm64: nVHE: Unify 32-bit sysreg saving pathsarch/arm64/kvm/hyp/nvhe/switch.c+1 -10 replies
27/37KVM: arm64: nVHE: Unify vgic save and restorearch/arm64/kvm/hyp/nvhe/switch.c+9 -20 replies
28/37KVM: arm64: nVHE: Unify fpexc32 saving pathsarch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/vhe/switch.c+6 -50 replies
29/37KVM: arm64: nVHE: Separate the save and restore of debug statearch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/include/hyp/debug-sr.h arch/arm64/kvm/hyp/nvhe/debug-sr.c +2 more+65 -820 replies
30/37KVM: arm64: nVHE: Remove MMU assumption in speculative AT workaroundarch/arm64/kvm/hyp/include/hyp/sysreg-sr.h arch/arm64/kvm/hyp/nvhe/tlb.c+15 -60 replies
31/37KVM: arm64: Move speculative AT ISBs into contextarch/arm64/include/asm/kvm_mmu.h arch/arm64/kvm/hyp/nvhe/tlb.c arch/arm64/kvm/hyp/vhe/switch.c +1 more+4 -100 replies
32/37KVM: arm64: nVHE: Unify sysreg state restoration pathsarch/arm64/kvm/hyp/include/hyp/sysreg-sr.h arch/arm64/kvm/hyp/nvhe/switch.c+54 -900 replies
33/37KVM: arm64: Remove __activate_vm wrapperarch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/vhe/switch.c+6 -110 replies
34/37KVM: arm64: nVHE: Unify timer restore pathsarch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/nvhe/timer-sr.c+16 -290 replies
35/37KVM: arm64: nVHE: Unify PMU event restoration pathsarch/arm64/kvm/hyp/nvhe/switch.c+15 -270 replies
36/37KVM: arm64: nVHE: Unify GIC PMR restoration pathsarch/arm64/kvm/hyp/nvhe/switch.c+22 -280 replies
37/37KVM: arm64: Separate save and restore of vcpu trap statearch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/vhe/switch.c+14 -180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/37] Transform the host into a vCPU

As part of the effort to isolate hyp from the host on nVHE, this series provides hyp with its very own context and views the host as a vcpu from the point of view of context switching.

The journey begins by preparing for hyp-init to instantiate a run loop in hyp that __guest_enters back into the host. The interfaces then migrate to SMCCC rather than the raw function pointer intrface of today.

Next, the host state is fully migrated into its vcpu leaving a distinct context for hyp and host. Finally, the save and restore paths of guests and the host are unified such that __kvm_vcpu_run can switch to and run any vcpu it is given.

It's a long series, but that seems to be the way Marc likes things around here, hehe. I've tried to keep the patches simple where possible but let me know if there's ever too much in one go and I'll try and help you out.

This has been lightly tested on qemu with both VHE and nVHE booting VMs. More rigorous testing will be needed.

The first patch is already in arm64/for-next/misc 7af928851508
The second patch can also be seen in <[email protected]>

Andrew Scull (37):
smccc: Make constants available to assembly
KVM: arm64: Move clearing of vcpu debug dirty bit
KVM: arm64: Track running vCPU outside of the CPU context
KVM: arm64: nVHE: Pass pointers consistently to hyp-init
KVM: arm64: nVHE: Break out of the hyp-init idmap
KVM: arm64: Only check pending interrupts if it would trap
KVM: arm64: Separate SError detection from VAXorcism
KVM: arm64: nVHE: Introduce a hyp run loop for the host
smccc: Cast arguments to unsigned long
KVM: arm64: nVHE: Migrate hyp interface to SMCCC
KVM: arm64: nVHE: Migrate hyp-init to SMCCC
KVM: arm64: nVHE: Fix pointers during SMCCC convertion
KVM: arm64: Rename workaround 2 helpers
KVM: arm64: nVHE: Use __kvm_vcpu_run for the host vcpu
KVM: arm64: Share some context save and restore macros
KVM: arm64: nVHE: Handle stub HVCs in the host loop
KVM: arm64: nVHE: Store host sysregs in host vcpu
KVM: arm64: nVHE: Access pmu_events directly in kvm_host_data
KVM: arm64: nVHE: Drop host_ctxt argument for context switching
KVM: arm64: nVHE: Use host vcpu context for host debug state
KVM: arm64: Move host debug state from vcpu to percpu
KVM: arm64: nVHE: Store host's mdcr_el2 and hcr_el2 in its vcpu
KVM: arm64: Skip __hyp_panic and go direct to hyp_panic
KVM: arm64: Break apart kvm_host_data
KVM: arm64: nVHE: Unify sysreg state saving paths
KVM: arm64: nVHE: Unify 32-bit sysreg saving paths
KVM: arm64: nVHE: Unify vgic save and restore
KVM: arm64: nVHE: Unify fpexc32 saving paths
KVM: arm64: nVHE: Separate the save and restore of debug state
KVM: arm64: nVHE: Remove MMU assumption in speculative AT workaround
KVM: arm64: Move speculative AT ISBs into context
KVM: arm64: nVHE: Unify sysreg state restoration paths
KVM: arm64: Remove __activate_vm wrapper
KVM: arm64: nVHE: Unify timer restore paths
KVM: arm64: nVHE: Unify PMU event restoration paths
KVM: arm64: nVHE: Unify GIC PMR restoration paths
KVM: arm64: Separate save and restore of vcpu trap state

 arch/arm64/include/asm/kvm_asm.h           |  73 +++++-
 arch/arm64/include/asm/kvm_host.h          |  57 ++---
 arch/arm64/include/asm/kvm_hyp.h           |  33 ++-
 arch/arm64/include/asm/kvm_mmu.h           |   7 -
 arch/arm64/kernel/asm-offsets.c            |   2 -
 arch/arm64/kernel/image-vars.h             |   6 +-
 arch/arm64/kvm/Makefile                    |   2 +-
 arch/arm64/kvm/arm.c                       |  75 +++++-
 arch/arm64/kvm/debug.c                     |   2 +
 arch/arm64/kvm/hyp.S                       |  34 ---
 arch/arm64/kvm/hyp/entry.S                 |  92 +++----
 arch/arm64/kvm/hyp/hyp-entry.S             |  81 +-----
 arch/arm64/kvm/hyp/include/hyp/debug-sr.h  |  49 +---
 arch/arm64/kvm/hyp/include/hyp/switch.h    |  30 ++-
 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h |  46 ++--
 arch/arm64/kvm/hyp/nvhe/Makefile           |   3 +-
 arch/arm64/kvm/hyp/nvhe/debug-sr.c         |  28 +-
 arch/arm64/kvm/hyp/nvhe/hyp-init.S         |  86 ++++---
 arch/arm64/kvm/hyp/nvhe/hyp-main.c         | 218 ++++++++++++++++
 arch/arm64/kvm/hyp/nvhe/hyp-start.S        |  49 ++++
 arch/arm64/kvm/hyp/nvhe/switch.c           | 282 +++++++++++----------
 arch/arm64/kvm/hyp/nvhe/timer-sr.c         |  35 +--
 arch/arm64/kvm/hyp/nvhe/tlb.c              |  19 +-
 arch/arm64/kvm/hyp/vhe/debug-sr.c          |  34 ++-
 arch/arm64/kvm/hyp/vhe/switch.c            |  30 +--
 arch/arm64/kvm/hyp/vhe/sysreg-sr.c         |   4 +-
 arch/arm64/kvm/hyp/vhe/tlb.c               |   4 +-
 arch/arm64/kvm/pmu.c                       |  28 +-
 arch/arm64/kvm/vgic/vgic-v3.c              |   4 +-
 include/linux/arm-smccc.h                  |  64 ++---
 30 files changed, 873 insertions(+), 604 deletions(-)
 delete mode 100644 arch/arm64/kvm/hyp.S
 create mode 100644 arch/arm64/kvm/hyp/nvhe/hyp-main.c
 create mode 100644 arch/arm64/kvm/hyp/nvhe/hyp-start.S
Signature · 6 lines
2.27.0.389.gc38d7665816-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm