mbox series

[gmem,0/6] gmem fix-ups and interfaces for populating gmem pages

Message ID 20240329212444.395559-1-michael.roth@amd.com (mailing list archive)
Headers show
Series gmem fix-ups and interfaces for populating gmem pages | expand

Message

Michael Roth March 29, 2024, 9:24 p.m. UTC
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/20240227232100.478238-1-pbonzini@redhat.com/

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/Zb1yv67h6gkYqqv9@google.com/


----------------------------------------------------------------
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(-)