Skip to content

Move pKVM ownership state to hyp_vmemmap

Quentin Perret kvmarm linux-arm-kernel lkml 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 Latest7 patches 1 replyApplied
  2. v16 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- fixed page-tracking comments in nvhe/memory.h
- rebased on 6.15-rc2
- applied Marc's Reviewed-by

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/7KVM: arm64: Track SVE state in the hypervisor vcpu structurearch/arm64/include/asm/kvm_host.h arch/arm64/kvm/hyp/nvhe/hyp-main.c arch/arm64/kvm/hyp/nvhe/pkvm.c+51 -120 replies
2/7KVM: arm64: Fix pKVM page-tracking commentsarch/arm64/kvm/hyp/include/nvhe/memory.h+19 -100 replies
3/7KVM: arm64: Use 0b11 for encoding PKVM_NOPAGEarch/arm64/kvm/hyp/include/nvhe/memory.h+1 -30 replies
4/7KVM: arm64: Introduce {get,set}_host_state() helpersarch/arm64/kvm/hyp/include/nvhe/memory.h arch/arm64/kvm/hyp/nvhe/mem_protect.c arch/arm64/kvm/hyp/nvhe/setup.c+20 -100 replies
5/7KVM: arm64: Move hyp state to hyp_vmemmaparch/arm64/kvm/hyp/include/nvhe/memory.h arch/arm64/kvm/hyp/nvhe/mem_protect.c arch/arm64/kvm/hyp/nvhe/setup.c+53 -330 replies
6/7KVM: arm64: Defer EL2 stage-1 mapping on sharearch/arm64/kvm/hyp/nvhe/mem_protect.c+16 -70 replies
7/7KVM: arm64: Unconditionally cross check hyp statearch/arm64/kvm/hyp/nvhe/mem_protect.c+9 -150 replies

Reviews trailers per patch

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

PatchMarc Zyngier
1/7Co-authored-by
2/7
3/7R-b
4/7R-b
5/7R-b
6/7R-b
7/7R-b

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 0/7] Move pKVM ownership state to hyp_vmemmap

Hi all,

This series moves the hypervisor's ownership state to the hyp_vmemmap, as discussed in [1]. The two main benefits are:

1. much cheaper hyp state lookups, since we can avoid the hyp stage-1

    page-table walk;

2. de-correlates the hyp state from the presence of a mapping in the linear map range of the hypervisor; which enables a bunch of clean-ups in the existing code and will simplify the introduction of other features in the future (hyp tracing, ...)

Patch 01 is a self-sufficient cleanup that I found thanks to patch 06. Patch 02 is another self-sufficient cleanup that came out from the discussion with Marc at [2]. Patches 03-05 implement the aforementioned migration of the hyp state to the vmemmap. Patches 06 and 07 are further improvements enabled by that migration.

Changes since v1:
- fixed page-tracking comments in nvhe/memory.h
- rebased on 6.15-rc2
- applied Marc's Reviewed-by

Thanks,
Quentin

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

Fuad Tabba (1):
KVM: arm64: Track SVE state in the hypervisor vcpu structure

Quentin Perret (6):
KVM: arm64: Fix pKVM page-tracking comments
KVM: arm64: Use 0b11 for encoding PKVM_NOPAGE
KVM: arm64: Introduce {get,set}_host_state() helpers
KVM: arm64: Move hyp state to hyp_vmemmap
KVM: arm64: Defer EL2 stage-1 mapping on share
KVM: arm64: Unconditionally cross check hyp state

 arch/arm64/include/asm/kvm_host.h        |  12 +--
 arch/arm64/kvm/hyp/include/nvhe/memory.h |  58 ++++++++++---
 arch/arm64/kvm/hyp/nvhe/hyp-main.c       |   4 -
 arch/arm64/kvm/hyp/nvhe/mem_protect.c    | 106 ++++++++++++-----------
 arch/arm64/kvm/hyp/nvhe/pkvm.c           |  47 +++++++++-
 arch/arm64/kvm/hyp/nvhe/setup.c          |  10 ++-
 6 files changed, 158 insertions(+), 79 deletions(-)
Signature · 1 line
2.49.0.604.gff1f9ca942-goog