Skip to content

gmem fix-ups and interfaces for populating gmem pages

Michael Roth kvm linux-coco 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6KVM: guest_memfd: Fix stub for kvm_gmem_get_uninit_pfn()include/linux/kvm_host.h+3 -10 replies
2/6KVM: guest_memfd: Only call kvm_arch_gmem_prepare hook if necessaryinclude/linux/kvm_host.h virt/kvm/guest_memfd.c+11 -02 replies
3/6KVM: x86: Pass private/shared fault indicator to gmem_validate_faultarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c+4 -20 replies
4/6mm: Introduce AS_INACCESSIBLE for encrypted/confidential memoryinclude/linux/pagemap.h mm/truncate.c+3 -11 reply
5/6KVM: guest_memfd: Use AS_INACCESSIBLE when creating guest_memfd inodevirt/kvm/guest_memfd.c+1 -01 reply
6/6KVM: guest_memfd: Add interface for populating gmem pages with user datainclude/linux/kvm_host.h virt/kvm/guest_memfd.c+80 -01 reply

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchVlastimil Babka
1/6
2/6
3/6
4/6A-b
5/6A-b
6/6

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

Read the v1 thread

Cover letter [PATCH gmem 0/6] gmem fix-ups and interfaces for populating gmem pages

These patches are based on top of:

https://git.kernel.org/pub/scm/virt/kvm/kvm.git/log/?h=kvm-coco-queue

and are also available from:

https://github.com/AMDESE/linux/commits/kvm-gmem-common-v1/

Overview
--------

This is a small collection of patches that addresses some review comments from Paolo's series:

[PATCH 00/21] TDX/SNP part 1 of n, for 6.9
https://lore.kernel.org/lkml/[email protected]/

and also introduces some flags and interfaces that might also be relevant to the scope of that series.

I'm posting these together initially as they comprise what may be the last batch of SNP dependencies that are potentially relevant to TDX and a common CoCo tree, but can split out or move back into SNP series, whatever is deemed preferable.

Patch Layout
------------

1-3: These are smaller fix-ups to address various review comments pertaining
to the gmem hooks that were originally part of the SNP hypervisor postings. In each case they can be potentially squashed into the corresponding patches in kvm-coco-queue if that's preferable.

4-5: This introduces an AS_INACCESSIBLE flag that prevents unexpected
accesses to hole-punched gmem pages before invalidation hooks have had a chance to make them safely accessible to the host again.

6: This implements an interface that was proposed by Sean during this[1]
discussion regarding SNP_LAUNCH_UPDATE and discussed in more detail during the PUCK session "Finalizing internal guest_memfd APIs for SNP/TDX". It is not verbatim what was discussed, but is hopefully a reasonable starting point to handle use-cases like SNP_LAUNCH_UPDATE. It may also avoid the need to export kvm_gmem_get_uninit_pfn() as an external interface if SNP_LAUNCH_UPDATE is still the only known/planned user.

Thanks!

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

----------------------------------------------------------------
Michael Roth (6):
KVM: guest_memfd: Fix stub for kvm_gmem_get_uninit_pfn()
KVM: guest_memfd: Only call kvm_arch_gmem_prepare hook if necessary
KVM: x86: Pass private/shared fault indicator to gmem_validate_fault
mm: Introduce AS_INACCESSIBLE for encrypted/confidential memory
KVM: guest_memfd: Use AS_INACCESSIBLE when creating guest_memfd inode
KVM: guest_memfd: Add interface for populating gmem pages with user data

 arch/x86/include/asm/kvm_host.h |  3 ++-
 arch/x86/kvm/mmu/mmu.c          |  3 ++-
 include/linux/kvm_host.h        | 45 +++++++++++++++++++++++++++++++++++-
 include/linux/pagemap.h         |  1 +
 mm/truncate.c                   |  3 ++-
 virt/kvm/guest_memfd.c          | 51 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 102 insertions(+), 4 deletions(-)