mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
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:
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user