Re: [PATCH v2 1/3] KVM: x86: Make the hardcoded APIC bus frequency vm variable

From: Sean Christopherson
Date: Thu Dec 14 2023 - 11:41:51 EST


On Thu, Dec 14, 2023, Maxim Levitsky wrote:
> On Wed, 2023-12-13 at 15:10 -0800, Sean Christopherson wrote:
> > Upstream KVM's non-TDX behavior is fine, because KVM doesn't advertise support
> > for CPUID 0x15, i.e. doesn't announce to host userspace that it's safe to expose
> > CPUID 0x15 to the guest. Because TDX makes exposing CPUID 0x15 mandatory, KVM
> > needs to be taught to correctly emulate the guest's APIC bus frequency, a.k.a.
> > the TDX guest core crystal frequency of 25Mhz.
>
> I assume that TDX doesn't allow to change the CPUID 0x15 leaf.

Correct. I meant to call that out below, but left my sentence half-finished. It
was supposed to say:

I halfheartedly floated the idea of "fixing" the TDX module/architecture to either
use 1Ghz as the base frequency or to allow configuring the base frequency
advertised to the guest.

> > I halfheartedly floated the idea of "fixing" the TDX module/architecture to either
> > use 1Ghz as the base frequency (off list), but it definitely isn't a hill worth
> > dying on since the KVM changes are relatively simple.
> >
> > https://lore.kernel.org/all/ZSnIKQ4bUavAtBz6@xxxxxxxxxx
> >
>
> Best regards,
> Maxim Levitsky
>