On Tue, Jun 09, 2026, Thomas Gleixner wrote:
> On Mon, Jun 08 2026 at 15:38, Sean Christopherson wrote:
> > On Sat, Jun 06, 2026, David Woodhouse wrote:
> >> > Along with:
> >> >
> >> > if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
> >> > if (tsc_khz_early)
> >> > pr_warn("Ignoring non-sensical tsc_early_khz command line
> >> > argument\n");
> >> >
> >> > or something daft like that.
> >
> > Ya, I ended up in the same place once Sashiko pointed out that skipping the
> > SNP/TDX
> > setup was hazardous[*], and also once I realized that tsc_khz_early
> > *complemented*
> > the refinement instead of replacing it.
> >
> > This is what I have locally:
> >
> > if (cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC))
> > known_tsc_khz = snp_secure_tsc_init();
> > else if (boot_cpu_has(X86_FEATURE_TDX_GUEST))
> > known_tsc_khz = tdx_tsc_init();
> >
> > /*
> > * If the TSC frequency wasn't provided by trusted firmware, try to
> > get
> > * it from the hypervisor (which is untrusted when running as a
> > CoCo guest).
> > */
> > if (!known_tsc_khz && x86_init.hyper.get_tsc_khz)
> > known_tsc_khz = x86_init.hyper.get_tsc_khz();
> >
> > /*
> > * Mark the TSC frequency as known if it was obtained from a
> > hypervisor
> > * or trusted firmware. Don't mark the frequency as known if the
> > user
> > * specified the frequency, as the user-provided frequency is
> > intended
> > * as a "starting point", not a known, guaranteed frequency.
> > */
> > if (known_tsc_khz && !tsc_early_khz)
> > setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
>
> If the frequenct is known via the above then you want to set the
> KNOWN_FREQ feature bit unconditionally. SNP/TDX/hypervisor override the
> command line argument as you print below.
Doh, forgot to remove that check when I shuffled things around. Thank you!