Re: [PATCH v17 10/20] KVM: arm64: coco: Disable Steal time accounting for coco guests

From: Fuad Tabba

Date: Thu Sep 10 2026 - 08:54:40 EST


Hi Suzuki,

On Thu, 10 Sept 2026 at 11:28, Suzuki K Poulose <suzuki.poulose@xxxxxxx> wrote:
...
> Just to make sure I understand the picture:
>
> For coco VMs:
>
> - check extension on coco KVM, KVM_CAP_STEAL_TIME => 0
>
> And a follow up DEVICE_HAS_ATTR => -EPERM ?
>
> But we tell the VMM, look you don't have the capabilit on this VM.
> But if you try to set the attribute isn't it more appropriate to
> say:
> -ENXIO - No you don't have that feature on this VM (-ENXIO)
> rather than
> -EPERM - No, I won't let you do that.
>
> Remember we are doing only in the "VM" context. It is a minor nit
> but I wanted to make sure we understand what we are thinking.

-ENXIO it is. I went back to api.rst for KVM_SET_DEVICE_ATTR: ENXIO is
for a group or attribute that's "unknown/unsupported for this device",
and EPERM for one that "cannot (currently) be accessed this way", a
state or access-mode refusal, so a VM type that doesn't have the
feature is the former. KVM_HAS_DEVICE_ATTR only documents ENXIO at
all. Your patch is good as it is.

Reviewed-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>

Cheers,
/fuad



>
> Cheers
> Suzuki
>
> > it's just not permitted for a confidential VM, and -EPERM says exactly
> > that, whereas -ENXIO reads as "no such feature".
> >
> > Cheers,
> > /fuad
> >
> >>
> >>> steal-time exists but isn't permitted for a confidential VM, whereas
> >>> -ENXIO reads as "no such feature".
> >>
> >> Cheers
> >> Suzuki
> >>
> >>
> >>>
> >>> Cheers,
> >>> /fuad
> >>>
> >>>>
> >>>> int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu,
> >>>> @@ -81,7 +81,7 @@ int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu,
> >>>> int ret = 0;
> >>>> int idx;
> >>>>
> >>>> - if (!kvm_arm_pvtime_supported() ||
> >>>> + if (!kvm_arm_pvtime_supported(kvm) ||
> >>>> attr->attr != KVM_ARM_VCPU_PVTIME_IPA)
> >>>> return -ENXIO;
> >>>>
> >>>> @@ -110,7 +110,7 @@ int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu,
> >>>> u64 __user *user = (u64 __user *)attr->addr;
> >>>> u64 ipa;
> >>>>
> >>>> - if (!kvm_arm_pvtime_supported() ||
> >>>> + if (!kvm_arm_pvtime_supported(vcpu->kvm) ||
> >>>> attr->attr != KVM_ARM_VCPU_PVTIME_IPA)
> >>>> return -ENXIO;
> >>>>
> >>>> @@ -126,7 +126,7 @@ int kvm_arm_pvtime_has_attr(struct kvm_vcpu *vcpu,
> >>>> {
> >>>> switch (attr->attr) {
> >>>> case KVM_ARM_VCPU_PVTIME_IPA:
> >>>> - if (kvm_arm_pvtime_supported())
> >>>> + if (kvm_arm_pvtime_supported(vcpu->kvm))
> >>>> return 0;
> >>>> }
> >>>> return -ENXIO;
> >>>> --
> >>>> 2.43.0
> >>>>
> >>
>