[PATCH v17 08/20] KVM: arm64: coco: Add a helper to check if a VM is confidential compute guest
Suzuki K Poulose
suzuki.poulose at arm.com
Tue Sep 8 09:22:11 PDT 2026
Both protected VMs and Realms are additionally secured by the trusted hypervisor
guarantees. Add a helper to detect if a given VM is a coco guest. Base this off
the ordering of the VM flavor type.
Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
---
arch/arm64/include/asm/kvm_host.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 824a3383409c8..020aef5a1b698 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -316,6 +316,7 @@ enum kvm_arm_vm_flavor {
VM_NVHE,
VM_VHE,
VM_PKVM, /* Normal guests on PKVM */
+ MARKER(__VM_CONFIDENTIAL),
VM_PROTECTED_PKVM, /* Protected VM */
VM_REALM, /* CCA */
VM_FLAVOR_MAX,
@@ -1524,9 +1525,11 @@ struct kvm *kvm_arch_alloc_vm(void);
#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
+#define kvm_vm_is_confidential(kvm) ((kvm)->arch.vm_flavor >= __VM_CONFIDENTIAL)
#define kvm_vm_is_protected(kvm) ((kvm)->arch.vm_flavor == VM_PROTECTED_PKVM)
#define kvm_vm_is_realm(kvm) ((kvm)->arch.vm_flavor == VM_REALM)
+#define vcpu_is_confidential(vcpu) kvm_vm_is_confidential((vcpu)->kvm)
#define vcpu_is_protected(vcpu) kvm_vm_is_protected((vcpu)->kvm)
#define vcpu_is_rec(vcpu) kvm_vm_is_realm((vcpu)->kvm)
--
2.43.0
More information about the linux-arm-kernel
mailing list