Re: [PATCH v16 24/45] KVM: arm64: Expose support for private memory

From: Suzuki K Poulose

Date: Fri Aug 07 2026 - 06:19:07 EST


On 05/08/2026 17:02, Ackerley Tng wrote:
Steven Price <steven.price@xxxxxxx> writes:

Select KVM_GENERIC_MEMORY_ATTRIBUTES and provide the necessary support
functions.

Reviewed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Signed-off-by: Steven Price <steven.price@xxxxxxx>
---
Changes since v14:
* Switch to guest_memfd in-place memory conversion and drop support
for KVM_VM_MEMORY_ATTRIBUTES.

[...snip...]

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 15d42d1993bb..146c52f867c0 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -1510,6 +1510,8 @@ struct kvm *kvm_arch_alloc_vm(void);

#define vcpu_is_protected(vcpu) kvm_vm_is_protected((vcpu)->kvm)

+#define kvm_arch_has_private_mem(kvm) ((kvm)->arch.is_realm)
+

Perhaps related to Fuad's question about pKVM and CCA state: would
conditioning this on is_realm mess up pKVM?

Not really. The comment is about unifiying the conditions which
both pKVM and Realm selects. Right now, only CCA uses guest_memfd.
When pkvm comes along to use guest_memfd, this could be something
like:

kvm->arch.needs_private_mem (set by both pKVM and Realm) ?

Cheers
Suzuki



int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature);
bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu);

--
2.43.0