Re: [PATCH 03/17] KVM: arm64: Reject the PVTIME vCPU attribute for protected VMs
From: Vincent Donnefort
Date: Wed Sep 02 2026 - 09:48:53 EST
On Mon, Aug 31, 2026 at 05:34:07PM +0100, Fuad Tabba wrote:
> pKVM currently does not support steal time for protected guests:
> KVM_CAP_STEAL_TIME reports 0 for them. The host still accepts the
> KVM_ARM_VCPU_PVTIME_CTRL attribute, whose IPA would point
> kvm_update_stolen_time() at the guest's private memory on every vCPU
> load. Return -EPERM for the attribute group instead.
>
> Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
> ---
> arch/arm64/kvm/guest.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index b01d6622b8720..23f725e2cf745 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -916,6 +916,10 @@ int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
> ret = kvm_arm_timer_set_attr(vcpu, attr);
> break;
> case KVM_ARM_VCPU_PVTIME_CTRL:
> + /* Steal time is not offered to protected guests. */
> + if (kvm_vm_is_protected(vcpu->kvm))
> + return -EPERM;
> +
nit: We have vcpu_is_protected()
Also, would that make more sense to put that check in kvm_arm_pvtime_supported()?
> ret = kvm_arm_pvtime_set_attr(vcpu, attr);
> break;
> default:
> @@ -939,6 +943,9 @@ int kvm_arm_vcpu_arch_get_attr(struct kvm_vcpu *vcpu,
> ret = kvm_arm_timer_get_attr(vcpu, attr);
> break;
> case KVM_ARM_VCPU_PVTIME_CTRL:
> + if (kvm_vm_is_protected(vcpu->kvm))
> + return -EPERM;
> +
> ret = kvm_arm_pvtime_get_attr(vcpu, attr);
> break;
> default:
> @@ -962,6 +969,9 @@ int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu,
> ret = kvm_arm_timer_has_attr(vcpu, attr);
> break;
> case KVM_ARM_VCPU_PVTIME_CTRL:
> + if (kvm_vm_is_protected(vcpu->kvm))
> + return -EPERM;
> +
> ret = kvm_arm_pvtime_has_attr(vcpu, attr);
> break;
> default:
> --
> 2.39.5
>
--
Vincent