Skip to content

Track shared pages at EL2 in protected mode

Quentin Perret kvmarm linux-arm-kernel lkml 4 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. v4 Latest21 patches 15 repliesApplied
  2. v321 patches 23 repliesSuperseded
  3. v216 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v114 patches27 repliesSuperseded

Changes in v4 from the cover letter

- Fixed typos in comments / commit messages;
- Various small cleanups and refactoring;
- Rebased on 5.14-rc5.

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/21KVM: arm64: Add hyp_spin_is_locked() for basic locking assertions at EL2arch/arm64/kvm/hyp/include/nvhe/spinlock.h+8 -00 replies
2/21KVM: arm64: Introduce hyp_assert_lock_held()arch/arm64/kvm/Kconfig arch/arm64/kvm/hyp/include/nvhe/spinlock.h+26 -00 replies
3/21KVM: arm64: Provide the host_stage2_try() helper macroarch/arm64/kvm/hyp/nvhe/mem_protect.c+22 -181 reply
4/21KVM: arm64: Introduce helper to retrieve a PTE and its levelarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/pgtable.c+58 -01 reply
5/21KVM: arm64: Expose page-table helpersarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/pgtable.c+40 -391 reply
6/21KVM: arm64: Optimize host memory abortsarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/nvhe/mem_protect.c arch/arm64/kvm/hyp/pgtable.c+44 -1050 replies
7/21KVM: arm64: Rename KVM_PTE_LEAF_ATTR_S2_IGNOREDarch/arm64/kvm/hyp/pgtable.c+2 -20 replies
8/21KVM: arm64: Don't overwrite software bits with owner idarch/arm64/kvm/hyp/pgtable.c+1 -10 replies
9/21KVM: arm64: Tolerate re-creating hyp mappings to set software bitsarch/arm64/kvm/hyp/pgtable.c+16 -20 replies
10/21KVM: arm64: Enable forcing page-level stage-2 mappingsarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/nvhe/mem_protect.c arch/arm64/kvm/hyp/pgtable.c+94 -351 reply
11/21KVM: arm64: Allow populating software bitsarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/pgtable.c+16 -11 reply
12/21KVM: arm64: Add helpers to tag shared pages in SW bitsarch/arm64/kvm/hyp/include/nvhe/mem_protect.h+26 -00 replies
13/21KVM: arm64: Expose host stage-2 manipulation helpersarch/arm64/kvm/hyp/include/nvhe/mem_protect.h arch/arm64/kvm/hyp/nvhe/mem_protect.c+19 -11 reply
14/21KVM: arm64: Expose pkvm_hyp_idarch/arm64/kvm/hyp/include/nvhe/mem_protect.h arch/arm64/kvm/hyp/nvhe/mem_protect.c+3 -11 reply
15/21KVM: arm64: Introduce addr_is_memory()arch/arm64/kvm/hyp/include/nvhe/mem_protect.h arch/arm64/kvm/hyp/nvhe/mem_protect.c+8 -01 reply
16/21KVM: arm64: Enable retrieving protections attributes of PTEsarch/arm64/include/asm/kvm_pgtable.h arch/arm64/kvm/hyp/pgtable.c+57 -01 reply
17/21KVM: arm64: Mark host bss and rodata section as sharedarch/arm64/kvm/hyp/nvhe/setup.c+74 -81 reply
18/21KVM: arm64: Remove __pkvm_mark_hyparch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/arm.c arch/arm64/kvm/hyp/include/nvhe/mem_protect.h +2 more+1 -771 reply
19/21KVM: arm64: Refactor protected nVHE stage-1 lockingarch/arm64/kvm/hyp/include/nvhe/mm.h arch/arm64/kvm/hyp/nvhe/mm.c+17 -21 reply
20/21KVM: arm64: Restrict EL2 stage-1 changes in protected modearch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/hyp/include/nvhe/mem_protect.h arch/arm64/kvm/hyp/nvhe/hyp-main.c +2 more+118 -121 reply
21/21KVM: arm64: Make __pkvm_create_mappings staticarch/arm64/kvm/hyp/include/nvhe/mm.h arch/arm64/kvm/hyp/nvhe/mm.c+2 -41 reply

Reviews trailers per patch

19 of 21 patches have a Reviewed-by or Acked-by.

PatchFuad TabbaAndrew Walbran
1/21
2/21
3/21R-b R-b
4/21R-b
5/21R-b
6/21R-b
7/21R-b
8/21R-b
9/21R-b
10/21R-b
11/21R-b
12/21R-b
13/21R-b
14/21R-b
15/21R-b
16/21R-b
17/21R-b
18/21R-b
19/21R-b
20/21R-b
21/21R-b

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

Read the v4 thread

Cover letter [PATCH v4 00/21] Track shared pages at EL2 in protected mode

Hi all,

This is v4 of the patch series previously posted here:

https://lore.kernel.org/lkml/[email protected]/

This series aims to improve how the nVHE hypervisor tracks ownership of memory pages when running in protected mode ("kvm-arm.mode=protected" on the kernel command line).

The main issue with the existing ownership tracking code is that it is completely binary: a page is either owned by an entity (e.g. the host) or not. However, we'll need something smarter to track shared pages, as is needed for virtio, or even just host/hypervisor communications.

This series introduces a few changes to the kvm page-table library to allow annotating shared pages in ignored bits (a.k.a. software bits) of leaf entries, and makes use of that infrastructure to track all pages that are shared between the host and the hypervisor. We will obviously want to apply the same treatment to guest stage-2 page-tables, but that is not really possible to do until EL2 manages them directly, so I'll keep that for another series.

The series is based on the 5.14-rc5, and has been tested on AML-S905X-CC (Le Potato) and using various Qemu configurations.

Changes since v3
- Fixed typos in comments / commit messages;
- Various small cleanups and refactoring;
- Rebased on 5.14-rc5.

Marc Zyngier (1):
KVM: arm64: Introduce helper to retrieve a PTE and its level

Quentin Perret (19):
KVM: arm64: Introduce hyp_assert_lock_held()
KVM: arm64: Provide the host_stage2_try() helper macro
KVM: arm64: Expose page-table helpers
KVM: arm64: Optimize host memory aborts
KVM: arm64: Rename KVM_PTE_LEAF_ATTR_S2_IGNORED
KVM: arm64: Don't overwrite software bits with owner id
KVM: arm64: Tolerate re-creating hyp mappings to set software bits
KVM: arm64: Enable forcing page-level stage-2 mappings
KVM: arm64: Allow populating software bits
KVM: arm64: Add helpers to tag shared pages in SW bits
KVM: arm64: Expose host stage-2 manipulation helpers
KVM: arm64: Expose pkvm_hyp_id
KVM: arm64: Introduce addr_is_memory()
KVM: arm64: Enable retrieving protections attributes of PTEs
KVM: arm64: Mark host bss and rodata section as shared
KVM: arm64: Remove __pkvm_mark_hyp
KVM: arm64: Refactor protected nVHE stage-1 locking
KVM: arm64: Restrict EL2 stage-1 changes in protected mode
KVM: arm64: Make __pkvm_create_mappings static

Will Deacon (1):
KVM: arm64: Add hyp_spin_is_locked() for basic locking assertions at

    EL2
 arch/arm64/include/asm/kvm_asm.h              |   5 +-
 arch/arm64/include/asm/kvm_pgtable.h          | 167 ++++++++----
 arch/arm64/kvm/Kconfig                        |   9 +
 arch/arm64/kvm/arm.c                          |  46 ----
 arch/arm64/kvm/hyp/include/nvhe/mem_protect.h |  33 ++-
 arch/arm64/kvm/hyp/include/nvhe/mm.h          |   3 +-
 arch/arm64/kvm/hyp/include/nvhe/spinlock.h    |  25 ++
 arch/arm64/kvm/hyp/nvhe/hyp-main.c            |  20 +-
 arch/arm64/kvm/hyp/nvhe/mem_protect.c         | 225 +++++++++++++---
 arch/arm64/kvm/hyp/nvhe/mm.c                  |  22 +-
 arch/arm64/kvm/hyp/nvhe/setup.c               |  82 +++++-
 arch/arm64/kvm/hyp/pgtable.c                  | 247 +++++++++---------
 arch/arm64/kvm/mmu.c                          |  28 +-
 13 files changed, 628 insertions(+), 284 deletions(-)
Signature · 6 lines
2.32.0.605.g8dce9f2422-goog

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