On Wed, 2026-07-01 at 14:47 -0700, Sean Christopherson wrote:
> On Mon, Jun 08, 2026, David Woodhouse wrote:
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index c1897d939da9..6337f9b9d7ac 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -5930,6 +5930,9 @@ static int kvm_arch_tsc_has_attr(struct
> > kvm_vcpu *vcpu,
> >     case KVM_VCPU_TSC_OFFSET:
> >             r = 0;
> >             break;
> > +   case KVM_VCPU_TSC_SCALE:
> > +           r = kvm_caps.has_tsc_control ? 0 : -ENXIO;
> > +           break;
> >     default:
> >             r = -ENXIO;
> >     }
> > @@ -5950,6 +5953,22 @@ static int kvm_arch_tsc_get_attr(struct
> > kvm_vcpu *vcpu,
> >                     break;
> >             r = 0;
> >             break;
> > +   case KVM_VCPU_TSC_SCALE: {
> > +           struct kvm_vcpu_tsc_scale scale;
> > +
> > +           if (!kvm_caps.has_tsc_control) {
> > +                   r = -ENXIO;
> > +                   break;
> > +           }
> 
> Uber nit.  For consistency with KVM's bizarre pattern here:
> 
>               r = -ENXIO;
>               if (!kvm_caps.has_tsc_control)
>                       break;

Ack.

> > +
> > +           scale.tsc_ratio = vcpu->arch.l1_tsc_scaling_ratio;
> > +           scale.tsc_frac_bits =
> > kvm_caps.tsc_scaling_ratio_frac_bits;
> > +           r = -EFAULT;
> > +           if (copy_to_user(uaddr, &scale, sizeof(scale)))
> > +                   break;
> > +           r = 0;
> > +           break;
> > +   }
> >     default:
> >             r = -ENXIO;
> >     }
> > @@ -5989,6 +6008,9 @@ static int kvm_arch_tsc_set_attr(struct
> > kvm_vcpu *vcpu,
> >             r = 0;
> >             break;
> >     }
> > +   case KVM_VCPU_TSC_SCALE:
> 
> Another stupid consistency nit.  Probably do this?
> 
>               /*
>                * TSC scaling information is read-only (it's a
> reflection of
>                * the TSC frequency, which can be set by
> userspace).
>                */
>               r = kvm_caps.has_tsc_control ? -EINVAL : -ENXIO;

Hm, I'd already done that, but it ended up squashed into the final
patch of the series. Putting it back in the right place for v6, along
with the above.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to