On Tue, Dec 03, 2024 at 02:30:41PM +0530, Nikunj A Dadhania wrote: > Subject: Re: [PATCH v15 09/13] tsc: Use the GUEST_TSC_FREQ MSR for... The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq/core:'. Please do not use file names or complete file paths as prefix. 'git log path/to/file' should give you a reasonable hint in most cases. Audit your whole set pls. > +void __init snp_secure_tsc_init(void) > +{ > + x86_platform.calibrate_cpu = securetsc_get_tsc_khz; > + x86_platform.calibrate_tsc = securetsc_get_tsc_khz; The fact that you assign the same function to two different function ptrs already hints at some sort of improper functionality split. > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > index 67aeaba4ba9c..c0eef924b84e 100644 > --- a/arch/x86/kernel/tsc.c > +++ b/arch/x86/kernel/tsc.c > @@ -30,6 +30,7 @@ > #include <asm/i8259.h> > #include <asm/topology.h> > #include <asm/uv/uv.h> > +#include <asm/sev.h> > > unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ > EXPORT_SYMBOL(cpu_khz); > @@ -1515,6 +1516,10 @@ void __init tsc_early_init(void) > /* Don't change UV TSC multi-chassis synchronization */ > if (is_early_uv_system()) > return; > + > + if (cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC)) > + snp_secure_tsc_init(); diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c index aac066d798ef..24e7c6cf3e29 100644 --- a/arch/x86/coco/sev/core.c +++ b/arch/x86/coco/sev/core.c @@ -3287,6 +3287,9 @@ static unsigned long securetsc_get_tsc_khz(void) void __init snp_secure_tsc_init(void) { + if (!cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC)) + return; + x86_platform.calibrate_cpu = securetsc_get_tsc_khz; x86_platform.calibrate_tsc = securetsc_get_tsc_khz; } diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index c0eef924b84e..0864b314c26a 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1517,8 +1517,7 @@ void __init tsc_early_init(void) if (is_early_uv_system()) return; - if (cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC)) - snp_secure_tsc_init(); + snp_secure_tsc_init(); if (!determine_cpu_tsc_frequencies(true)) return; -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette