[PATCH v5 01/11] KVM: arm64: guest_memfd: Drop mmap requirement for memslots

Steven Price steven.price at arm.com
Mon Nov 30 06:25:22 PST 2026


Arm64 rejects guest_memfd-backed memslots unless generic KVM marks
them KVM_MEMSLOT_GMEM_ONLY. Without in-place conversion, that flag is
set for mmap-capable guest_memfd files, reflecting the original arm64
requirement for userspace-mappable backing.

Realm VMs also need to bind private-only guest_memfd files, which do
not support mmap. Their fault path obtains PFNs directly from
guest_memfd through kvm_gmem_get_pfn(), without a userspace mapping.
Remove the memslot restriction so these files can be used by Realms.
Userspace remains responsible for supplying backing for shared IPAs.

Suggested-by: Ackerley Tng <ackerleytng at google.com>
Fixes: 32e200bd6e44 ("KVM: arm64: Enable support for guest_memfd backed memory")
Signed-off-by: Steven Price <steven.price at arm.com>

---
Changes since v4:
- Remove the arm64 memslot check that requires mmap-capable guest_memfd;
  Realms can use private-only guest_memfd backing.
---
 arch/arm64/kvm/mmu.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index 1db10d8d6db7..40e6159f4aed 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -2838,13 +2838,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
 	if ((new->base_gfn + new->npages) > (kvm_phys_size(&kvm->arch.mmu) >> PAGE_SHIFT))
 		return -EFAULT;
 
-	/*
-	 * Only support guest_memfd backed memslots with mappable memory, since
-	 * there aren't any CoCo VMs that support only private memory on arm64.
-	 */
-	if (kvm_slot_has_gmem(new) && !kvm_memslot_is_gmem_only(new))
-		return -EINVAL;
-
 	/* guest_memfd is incompatible with MTE. */
 	if (kvm_slot_has_gmem(new) && kvm_has_mte(kvm))
 		return -EINVAL;
-- 
2.43.0




More information about the linux-arm-kernel mailing list