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

Re: [PATCH v18 11/23] KVM: arm64: Use kvm_vm_is_unprotected() for !kvm_vm_is_protected()

From: Fuad Tabba <hidden>
Date: 2026-09-17 11:47:50
Also in: kvm, kvmarm, linux-coco, lkml

Hi Suzuki,

On Tue, 15 Sep 2026 17:01:29 +0100, Suzuki K Poulose
[off-list ref] wrote:
[...]
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
[...]
quoted hunk ↗ jump to hunk
@@ -490,7 +490,7 @@ static void handle_exit_pkvm_state(struct kvm_vcpu *vcpu, int exception_index)
 {
         int exception_code = ARM_EXCEPTION_CODE(exception_index);

-        if (!is_protected_kvm_enabled() || kvm_vm_is_protected(vcpu->kvm))
+        if (!kvm_vm_is_unprotected_pkvm(vcpu->kvm))
                 return;
Could the two pKVM-only helpers keep the static key in front? With
`is_protected_kvm_enabled() &&` inside kvm_vm_is_unprotected_pkvm()
and kvm_vm_is_protected_pkvm(), as kvm_vm_is_protected() had it before
patch 5, the boot-patched branch skips the load again for every user.
This runs on every exit: the old test is a cpucap, so on a host
without pKVM the function returns straight away, while the new one
loads vcpu->kvm->arch.vm_flavor on every host. The wide
kvm_vm_is_protected() can't have it, since Realms run without pKVM.

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