Skip to content

KVM: arm64: pKVM vCPU state management at EL2

Fuad Tabba kvmarm linux-arm-kernel lkml sashiko-reviews 5 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. v7 Latest8 patches 7 repliesApplied
  2. v68 patches 4 repliesSuperseded
  3. v58 patches 10 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v48 patches5 repliesSuperseded
v38 patches5 repliesSuperseded

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/8KVM: arm64: Extract MPIDR computation into a shared headerarch/arm64/kvm/sys_regs.c arch/arm64/kvm/sys_regs.h+20 -130 replies
2/8KVM: arm64: Make vcpu_{read,write}_sys_reg available to HYP codearch/arm64/include/asm/kvm_emulate.h arch/arm64/kvm/hyp/exception.c+15 -253 replies
3/8KVM: arm64: Factor out reusable vCPU reset helpersarch/arm64/include/asm/kvm_arm.h arch/arm64/include/asm/kvm_emulate.h arch/arm64/kvm/reset.c+72 -570 replies
4/8KVM: arm64: Move PSCI helper functions to a shared headerarch/arm64/kvm/psci.c include/kvm/arm_psci.h+28 -291 reply
5/8KVM: arm64: Add host and hypervisor vCPU lookup primitivesarch/arm64/kvm/hyp/nvhe/hyp-main.c+38 -140 replies
6/8KVM: arm64: Minimise EL2's exposure of host VGIC state during world switcharch/arm64/kvm/hyp/nvhe/hyp-main.c+63 -41 reply
7/8KVM: arm64: Add primitives to flush/sync the VGIC state at EL2arch/arm64/kvm/hyp/nvhe/hyp-main.c+41 -140 replies
8/8KVM: arm64: Implement lazy vCPU state sync for non-protected guestsarch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c +2 more+117 -51 reply

Reviews trailers per patch

7 of 8 patches have a Reviewed-by or Acked-by.

PatchVincent DonnefortSteffen Eiden
1/8R-b
2/8
3/8R-b R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b

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

Read the v7 thread

Cover letter [PATCH v7 0/8] KVM: arm64: pKVM vCPU state management at EL2

Hi folks,

Changes since v6 [1]:
- Rebased onto v7.2-rc5.
- Expanded the comment and commit message in patch 8 explaining why PC and PSTATE are copied back on every exit. No functional change.
- Collected Steffen's Reviewed-by on patch 3 (thanks!).

Building on Will's pKVM infrastructure series [2], this series reworks how pKVM moves vCPU state between the host and EL2, and stops copying a non-protected guest's state on every world switch.

EL2 gains proper primitives for the state it transfers: vCPU lookup helpers, and VGIC flush/sync that reduces how much host state EL2 dereferences. The series also moves some preparatory code (such as sys reg access and PSCI helpers) to shared headers and HYP, and implements lazy copying of a non-protected guest's register state back to the host until the host actually needs it, instead of on every exit.

This is the first of two series moving pKVM vCPU state management to EL2. The follow-up completes the job for protected VMs: state isolation, PSCI handling at EL2, and the resulting API behaviour.

The series is structured as follows:

01-04: Preparatory refactoring (MPIDR, sys reg access, vCPU reset, PSCI
helpers) to shared headers and HYP.

  05:     Host and hypervisor vCPU lookup primitives.
  06-07:  VGIC: reduce EL2's exposure to host state, add flush/sync primitives.
  08:     Lazy state sync for non-protected guests.

Based on v7.2-rc5 (f5098b6bae761).

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (5):
KVM: arm64: Extract MPIDR computation into a shared header
KVM: arm64: Make vcpu_{read,write}_sys_reg available to HYP code
KVM: arm64: Factor out reusable vCPU reset helpers
KVM: arm64: Move PSCI helper functions to a shared header
KVM: arm64: Implement lazy vCPU state sync for non-protected guests

Marc Zyngier (3):
KVM: arm64: Add host and hypervisor vCPU lookup primitives
KVM: arm64: Minimise EL2's exposure of host VGIC state during world
switch
KVM: arm64: Add primitives to flush/sync the VGIC state at EL2

 arch/arm64/include/asm/kvm_arm.h     |  12 ++
 arch/arm64/include/asm/kvm_asm.h     |   1 +
 arch/arm64/include/asm/kvm_emulate.h |  63 +++++++
 arch/arm64/include/asm/kvm_host.h    |   2 +
 arch/arm64/kvm/arm.c                 |   7 +
 arch/arm64/kvm/handle_exit.c         |  23 +++
 arch/arm64/kvm/hyp/exception.c       |  34 +---
 arch/arm64/kvm/hyp/nvhe/hyp-main.c   | 261 +++++++++++++++++++++++----
 arch/arm64/kvm/psci.c                |  30 +--
 arch/arm64/kvm/reset.c               |  60 +-----
 arch/arm64/kvm/sys_regs.c            |  14 +-
 arch/arm64/kvm/sys_regs.h            |  19 ++
 include/kvm/arm_psci.h               |  27 +++
 13 files changed, 393 insertions(+), 160 deletions(-)

base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff

Signature · 1 line
2.39.5