[PATCH v18 11/23] KVM: arm64: Use kvm_vm_is_unprotected() for !kvm_vm_is_protected()
Suzuki K Poulose
suzuki.poulose at arm.com
Thu Sep 17 09:47:52 PDT 2026
On 17/09/2026 12:47, Fuad Tabba wrote:
> Hi Suzuki,
>
> On Tue, 15 Sep 2026 17:01:29 +0100, Suzuki K Poulose
> <suzuki.poulose at arm.com> wrote:
> [...]
>> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> [...]
>> @@ -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.
Ack
Suzuki
>
> Cheers,
> /fuad
More information about the linux-arm-kernel
mailing list