]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: Rename CONFIG_KVM_GENERIC_PRIVATE_MEM to CONFIG_HAVE_KVM_ARCH_GMEM_POPULATE
authorFuad Tabba <tabba@google.com>
Tue, 29 Jul 2025 22:54:36 +0000 (15:54 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 27 Aug 2025 08:35:00 +0000 (04:35 -0400)
The original name was vague regarding its functionality. This Kconfig
option specifically enables and gates the kvm_gmem_populate() function,
which is responsible for populating a GPA range with guest data.

The new name, HAVE_KVM_ARCH_GMEM_POPULATE, describes the purpose of the
option: to enable arch-specific guest_memfd population mechanisms. It
also follows the same pattern as the other HAVE_KVM_ARCH_* configuration
options.

This improves clarity for developers and ensures the name accurately
reflects the functionality it controls, especially as guest_memfd
support expands beyond purely "private" memory scenarios.

Temporarily keep KVM_GENERIC_PRIVATE_MEM as an x86-only config so as to
minimize churn, and to hopefully make it easier to see what features
require HAVE_KVM_ARCH_GMEM_POPULATE.  On that note, omit GMEM_POPULATE
for KVM_X86_SW_PROTECTED_VM, as regular ol' memset() suffices for
software-protected VMs.

As for KVM_GENERIC_PRIVATE_MEM, a future change will select KVM_GUEST_MEMFD
for all 64-bit KVM builds, at which point the intermediate config will
become obsolete and can/will be dropped.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shivank Garg <shivankg@amd.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Co-developed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20250729225455.670324-6-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/Kconfig
include/linux/kvm_host.h
virt/kvm/Kconfig
virt/kvm/guest_memfd.c

index 13ab7265b505d55ad26bfd283c719f54a61e2bf7..c763446d9b9f5f311c70dd7347a3ded583abbdeb 100644 (file)
@@ -79,11 +79,16 @@ config KVM_WERROR
 
          If in doubt, say "N".
 
+config KVM_X86_PRIVATE_MEM
+       select KVM_GENERIC_MEMORY_ATTRIBUTES
+       select KVM_GUEST_MEMFD
+       bool
+
 config KVM_SW_PROTECTED_VM
        bool "Enable support for KVM software-protected VMs"
        depends on EXPERT
        depends on KVM_X86 && X86_64
-       select KVM_GENERIC_PRIVATE_MEM
+       select KVM_X86_PRIVATE_MEM
        help
          Enable support for KVM software-protected VMs.  Currently, software-
          protected VMs are purely a development and testing vehicle for
@@ -133,8 +138,8 @@ config KVM_INTEL_TDX
        bool "Intel Trust Domain Extensions (TDX) support"
        default y
        depends on INTEL_TDX_HOST
-       select KVM_GENERIC_PRIVATE_MEM
-       select KVM_GENERIC_MEMORY_ATTRIBUTES
+       select KVM_X86_PRIVATE_MEM
+       select HAVE_KVM_ARCH_GMEM_POPULATE
        help
          Provides support for launching Intel Trust Domain Extensions (TDX)
          confidential VMs on Intel processors.
@@ -157,9 +162,10 @@ config KVM_AMD_SEV
        depends on KVM_AMD && X86_64
        depends on CRYPTO_DEV_SP_PSP && !(KVM_AMD=y && CRYPTO_DEV_CCP_DD=m)
        select ARCH_HAS_CC_PLATFORM
-       select KVM_GENERIC_PRIVATE_MEM
+       select KVM_X86_PRIVATE_MEM
        select HAVE_KVM_ARCH_GMEM_PREPARE
        select HAVE_KVM_ARCH_GMEM_INVALIDATE
+       select HAVE_KVM_ARCH_GMEM_POPULATE
        help
          Provides support for launching encrypted VMs which use Secure
          Encrypted Virtualization (SEV), Secure Encrypted Virtualization with
index 8cdc0b3cc1b1253e2a757f7621d3bd59f0588833..ddfb6cfe20a6d8b3895958993fff81e81bb1fde4 100644 (file)
@@ -2534,7 +2534,7 @@ static inline int kvm_gmem_get_pfn(struct kvm *kvm,
 int kvm_arch_gmem_prepare(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn, int max_order);
 #endif
 
-#ifdef CONFIG_KVM_GENERIC_PRIVATE_MEM
+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_POPULATE
 /**
  * kvm_gmem_populate() - Populate/prepare a GPA range with guest data
  *
index e4b400feff948ad9576e86f8f4c2378b9e5db7b7..1b7d5be0b6c431d42d59d59ea13cba7b5bfd36c0 100644 (file)
@@ -116,11 +116,6 @@ config KVM_GUEST_MEMFD
        select XARRAY_MULTI
        bool
 
-config KVM_GENERIC_PRIVATE_MEM
-       select KVM_GENERIC_MEMORY_ATTRIBUTES
-       select KVM_GUEST_MEMFD
-       bool
-
 config HAVE_KVM_ARCH_GMEM_PREPARE
        bool
        depends on KVM_GUEST_MEMFD
@@ -128,3 +123,7 @@ config HAVE_KVM_ARCH_GMEM_PREPARE
 config HAVE_KVM_ARCH_GMEM_INVALIDATE
        bool
        depends on KVM_GUEST_MEMFD
+
+config HAVE_KVM_ARCH_GMEM_POPULATE
+       bool
+       depends on KVM_GUEST_MEMFD
index 7d85cc33c0bb8506ac31927ccf4cc66f60ad7f61..b2b50560e80ea8d003c30278c16c493dff331822 100644 (file)
@@ -627,7 +627,7 @@ out:
 }
 EXPORT_SYMBOL_GPL(kvm_gmem_get_pfn);
 
-#ifdef CONFIG_KVM_GENERIC_PRIVATE_MEM
+#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_POPULATE
 long kvm_gmem_populate(struct kvm *kvm, gfn_t start_gfn, void __user *src, long npages,
                       kvm_gmem_populate_cb post_populate, void *opaque)
 {