[PATCH v5 01/11] KVM: arm64: guest_memfd: Drop mmap requirement for memslots
Suzuki K Poulose
suzuki.poulose at arm.com
Mon Nov 30 07:40:55 PST 2026
Hi Steven
On 30/11/2026 14:25, Steven Price wrote:
> 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
We don't want to support private-only guest-memfd for Realms. When we
enable inplace conversion support, all guest-memfd slots become
implicitly GMEM_ONLY, implying if a VMM creates a guest-memfd slot
with a userspace address for shared pages, KVM ignores it and
VMM would be shooting on its foot.
This is true for all architectures with in-place conversion and in
our case CCA is simply turning the switch on. So, please drop this
patch.
Cheers
Suzuki
> 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;
More information about the linux-arm-kernel
mailing list