Thread (46 messages) flat view 46 messages, 6 authors, 1d ago

Re: [PATCH v18 05/23] KVM: arm64: Track the type of VM in kvm_arch

From: Fuad Tabba <fuad.tabba@linux.dev>
Date: 2026-09-17 11:25:03
Also in: kvm, kvmarm, linux-coco, lkml

Hi Suzuki,

On Tue, 15 Sep 2026 17:01:23 +0100, Suzuki K Poulose
[off-list ref] wrote:
[...]
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
[...]
+#define kvm_vm_hyp_is_pkvm(kvm)                (is_protected_kvm_enabled())
I'd keep is_protected_kvm_enabled() at the three call sites: this
takes a VM and ignores it, so it reads as per-VM when it's the mode,
and patch 20's comment about not being able to use the kvm_vm_ helpers
with a NULL kvm goes away too.
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
[...]
quoted hunk ↗ jump to hunk
@@ -432,7 +432,7 @@ static void init_pkvm_hyp_vm(struct kvm *host_kvm, struct pkvm_hyp_vm *hyp_vm,

         hyp_vm->host_kvm = host_kvm;
         hyp_vm->kvm.created_vcpus = nr_vcpus;
-        hyp_vm->kvm.arch.pkvm.is_protected = READ_ONCE(host_kvm->arch.pkvm.is_protected);
+        hyp_vm->kvm.arch.vm_flavor = READ_ONCE(host_kvm->arch.vm_flavor);
Could EL2 reduce this to VM_PKVM or VM_PROTECTED_PKVM here instead of
storing what it reads? The host supplies the value, and it's now an
enum rather than a bool. Patch 12 relies on EL2 only ever seeing those
two, and with VM_REALM above the marker a host-written value passes
kvm_vm_is_protected() but not the == form, if EL2 ever adds one.

Both hunks are new since v17, which is where I gave the Reviewed-by.
Happy to keep it if you can settle these please.

Cheers,
/fuad
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help