Skip to content

RFC KVM: guest memory: Misc enhacnement

[email protected] kvm linux-coco lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest11 patches 6 repliesIn review
  2. v2 RFC6 patches 14 repliesSuperseded
  3. v1 RFC6 patches 11 repliesSuperseded

Changes in v3 from the cover letter

- Imported common patches from Michael Roth which can be useful for both SNP and TDX. And reorder patches.
- Update struct kvm_gfn_range to drop flag, and add add only_private, and only_shared
- Update kvm_arch_set_memory_attributes() and added a x86 vendor callback for it.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11KVM: selftests: Fix test_add_overlapping_private_memory_regions()tools/testing/selftests/kvm/set_memory_region_test.c+14 -20 replies
2/11KVM: selftests: Fix guest_memfd()tools/testing/selftests/kvm/guest_memfd_test.c+2 -20 replies
3/11KVM: selftests: x86: typo in private_mem_conversions_test.ctools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c+1 -10 replies
4/11KVM: x86: Add is_vm_type_supported callbackarch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/include/uapi/asm/kvm.h +4 more+27 -10 replies
5/11KVM: x86/mmu: Pass around full 64-bit error code for the KVM page faultarch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h arch/x86/kvm/mmu/mmutrace.h +1 more+6 -70 replies
6/11KVM: x86: Introduce PFERR_GUEST_ENC_MASK to indicate fault is privatearch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h+25 -70 replies
7/11KVM: x86: Export the kvm_zap_gfn_range() for the SNP usearch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.h arch/x86/kvm/mmu/mmu.c+3 -20 replies
8/11KVM: Fix set_mem_attr ioctl when error casevirt/kvm/kvm_main.c+8 -43 replies
9/11KVM: Add new members to struct kvm_gfn_range to operate onarch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c +3 more+35 -162 replies
10/11KVM: x86: Add gmem hook for initializing private memoryarch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c+14 -10 replies
11/11KVM: x86: Add gmem hook for invalidating private memoryarch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c +2 more+57 -20 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [RFC PATCH v3 00/11] KVM: guest memory: Misc enhacnement

From: Isaku Yamahata <[email protected]>

Hello. I've updated the patch series based on the feedback. Here are the discussion points.

- 06/11 KVM: x86: Introduce PFERR_GUEST_ENC_MASK to indicate fault is private Michael has his own opinion on how to indicate private fault.

- 09/11 KVM: Add new members to struct kvm_gfn_range to operate on

- 10/11 KVM: x86: Add gmem hook for initializing private memory SNP needs the callback. TDX won't use this one.

- 11/11 KVM: x86: Add gmem hook for invalidating private memory SNP needs the callback. TDX doesn't use this one at the moment, but would use it.

- VM type:
I didn't rename KVM_X86_PROTECTED_VM to KVM_X86_SW_PROTECTED_VM in this patch series. It's easy to rename it if desired.

Thanks,

This is an RFC patch series based on KVM gmem [1] and [2] for the common use of TDX and SEV-SNP.

[1] KVM gmem patches
https://github.com/sean-jc/linux/tree/x86/kvm_gmem_solo

[2] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
https://lore.kernel.org/lkml/[email protected]/

---
v3:
- Imported common patches from Michael Roth which can be useful for both SNP and TDX. And reorder patches.
- Update struct kvm_gfn_range to drop flag, and add add only_private, and only_shared
- Update kvm_arch_set_memory_attributes() and added a x86 vendor callback for it.

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

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

Brijesh Singh (1):
KVM: x86: Export the kvm_zap_gfn_range() for the SNP use

Isaku Yamahata (8):
KVM: selftests: Fix test_add_overlapping_private_memory_regions()
KVM: selftests: Fix guest_memfd()
KVM: selftests: x86: typo in private_mem_conversions_test.c
KVM: x86: Add is_vm_type_supported callback
KVM: x86/mmu: Pass around full 64-bit error code for the KVM page
fault
KVM: x86: Introduce PFERR_GUEST_ENC_MASK to indicate fault is private
KVM: Fix set_mem_attr ioctl when error case
KVM: Add new members to struct kvm_gfn_range to operate on

Michael Roth (2):
KVM: x86: Add gmem hook for initializing private memory
KVM: x86: Add gmem hook for invalidating private memory

 arch/x86/include/asm/kvm-x86-ops.h            |  4 ++
 arch/x86/include/asm/kvm_host.h               | 12 +++++
 arch/x86/include/uapi/asm/kvm.h               |  1 +
 arch/x86/kvm/mmu.h                            |  2 -
 arch/x86/kvm/mmu/mmu.c                        | 51 ++++++++++++++-----
 arch/x86/kvm/mmu/mmu_internal.h               | 20 ++++++--
 arch/x86/kvm/mmu/mmutrace.h                   |  2 +-
 arch/x86/kvm/mmu/paging_tmpl.h                |  2 +-
 arch/x86/kvm/svm/svm.c                        |  7 +++
 arch/x86/kvm/vmx/vmx.c                        |  6 +++
 arch/x86/kvm/x86.c                            | 16 +++++-
 arch/x86/kvm/x86.h                            |  2 +
 include/linux/kvm_host.h                      | 16 ++++--
 .../testing/selftests/kvm/guest_memfd_test.c  |  4 +-
 .../selftests/kvm/set_memory_region_test.c    | 16 +++++-
 .../kvm/x86_64/private_mem_conversions_test.c |  2 +-
 virt/kvm/guest_mem.c                          | 50 +++++++++++++++++-
 virt/kvm/kvm_main.c                           | 24 +++++----
 18 files changed, 192 insertions(+), 45 deletions(-)

base-commit: be8abcec83c87d4e15ae04816b685fe260c4bcfd

Signature · 1 line
2.25.1