KVM: guest_memfd: Rename prepare() hook and Kconfig to make_private() / CONVERT

Rework guest_memfd's prepare() hook into a more accurate make_private(),
and rework its Kconfig from PREPARE to a more generic CONVERT.  This will
allow x86 to share (pun intended) a kvm_x86_ops.gmem_make_shared() hook
between the "convert to shared" and "reclaim" flows, which are one and the
same for SNP.

No functional change intended.

Reviewed-by: Ackerley Tng <ackerleytng@google.com>
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260723210811.72720-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Sean Christopherson
2026-07-27 09:42:42 -07:00
parent 3df611b5a0
commit 2131c4f763
10 changed files with 17 additions and 16 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ config KVM_GUEST_MEMFD
select XARRAY_MULTI
bool
config HAVE_KVM_ARCH_GMEM_PREPARE
config HAVE_KVM_ARCH_GMEM_CONVERT
bool
depends on KVM_GUEST_MEMFD
+2 -2
View File
@@ -73,11 +73,11 @@ static bool kvm_gmem_is_shared_mem(struct inode *inode, pgoff_t index)
static int __kvm_gmem_prepare_folio(struct kvm *kvm, struct kvm_memory_slot *slot,
pgoff_t index, struct folio *folio)
{
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_PREPARE
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_CONVERT
kvm_pfn_t pfn = folio_file_pfn(folio, index);
gfn_t gfn = slot->base_gfn + index - slot->gmem.pgoff;
return kvm_arch_gmem_prepare(kvm, gfn, pfn, folio_order(folio));
return kvm_arch_gmem_make_private(kvm, gfn, pfn, folio_order(folio));
#else
return 0;
#endif