[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250211150114.GCZ6tmOqV4rI04HVuY@fat_crate.local>
Date: Tue, 11 Feb 2025 16:01:14 +0100
From: Borislav Petkov <bp@...en8.de>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Juergen Gross <jgross@...e.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Ajay Kaher <ajay.kaher@...adcom.com>,
Alexey Makhalov <alexey.amakhalov@...adcom.com>,
Jan Kiszka <jan.kiszka@...mens.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org,
linux-coco@...ts.linux.dev, virtualization@...ts.linux.dev,
linux-hyperv@...r.kernel.org, jailhouse-dev@...glegroups.com,
kvm@...r.kernel.org, xen-devel@...ts.xenproject.org,
Nikunj A Dadhania <nikunj@....com>,
Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [PATCH 01/16] x86/tsc: Add a standalone helpers for getting TSC
info from CPUID.0x15
On Fri, Jan 31, 2025 at 06:17:03PM -0800, Sean Christopherson wrote:
> Extract retrieval of TSC frequency information from CPUID into standalone
> helpers so that TDX guest support and kvmlock can reuse the logic. Provide
> a version that includes the multiplier math as TDX in particular does NOT
> want to use native_calibrate_tsc()'s fallback logic that derives the TSC
> frequency based on CPUID.0x16 when the core crystal frequency isn't known.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> arch/x86/include/asm/tsc.h | 41 ++++++++++++++++++++++++++++++++++++++
> arch/x86/kernel/tsc.c | 14 ++-----------
> 2 files changed, 43 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
> index 94408a784c8e..14a81a66b37c 100644
> --- a/arch/x86/include/asm/tsc.h
> +++ b/arch/x86/include/asm/tsc.h
Bah, why in the header as inlines? Just leave them in tsc.c and call them...
> @@ -28,6 +28,47 @@ static inline cycles_t get_cycles(void)
> }
> #define get_cycles get_cycles
>
> +static inline int cpuid_get_tsc_info(unsigned int *crystal_khz,
> + unsigned int *denominator,
> + unsigned int *numerator)
Can we pls do a
struct cpuid_tsc_info {
unsigned int denominator;
unsigned int numerator;
unsigned int crystal_khz;
unsigned int tsc_khz;
}
and hand that around instead of those I/O pointers?
It would make the code a bit saner to stare at and follow.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists