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

From: Fuad Tabba

Date: Fri Sep 18 2026 - 05:23:31 EST


Hi Suzuki,

On <date>, Suzuki K Poulose <suzuki.poulose@xxxxxxx> wrote:
[...]
> + if (WARN_ON_ONCE(!kvm))
> + return false;
> +
> + /* Cover both pKVM host and Realm VMs */
> + if (!kvm_vm_hyp_is_distrusting(kvm))
> + return true;

I'd drop the WARN_ON_ONCE. And this early return needs the `>=` from
patch 13, or non-protected pKVM VMs skip the filter.

> I resorted to is_protected_kvm_enabled() to make it faster than using
> the vm_flavor checks. I could rever those anyways.

Agreed it's the faster test. I'd just call it by name at the three
sites rather than through a macro.

> Do you mean something like :
>
> if (kvm_vm_is_protected_pkvm(host_kvm))
> hyp_vm->kvm.arch.vm_flavor = VM_PROTECTED_PKVM;
> else
> hyp_vm->kvm.arch.vm_flavor = VM_PKVM;

Yes, exactly that.

> Do we additionally need to WARN_ON() if we encounter a VM_REALM ?

No, the host shouldn't be able to trigger a WARN at EL2.

> Apologies, I thought this one didn't change, but later patches changes
> them, which is why I kept this.

No worries. With those two in, please keep the tag.

Cheers,
/fuad