On 7/15/2025 5:33 PM, Fuad Tabba wrote:
Introduce a new boolean member, supports_gmem, to kvm->arch.
Previously, the has_private_mem boolean within kvm->arch was implicitly
used to indicate whether guest_memfd was supported for a KVM instance.
However, with the broader support for guest_memfd, it's not exclusively
for private or confidential memory. Therefore, it's necessary to
distinguish between a VM's general guest_memfd capabilities and its
support for private memory.
This new supports_gmem member will now explicitly indicate guest_memfd
support for a given VM, allowing has_private_mem to represent only
support for private memory.
Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>
Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>
Reviewed-by: Shivank Garg <shivankg@xxxxxxx>
Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
Co-developed-by: David Hildenbrand <david@xxxxxxxxxx>
Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
Signed-off-by: Fuad Tabba <tabba@xxxxxxxxxx>
Reviewed-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
Btw, it seems that supports_gmem can be enabled for all the types of VM?
Even without mmap support, allow all the types of VM to create
guest_memfd seems not something wrong. It's just that the guest_memfd
allocated might not be used, e.g., for KVM_X86_DEFAULT_VM.