Move the check on having a Secure TSC to the common tsc_early_init() so that it's obvious that having a Secure TSC is conditional, and to prepare for adding TDX to the mix (blindly initializing *both* SNP and TDX TSC logic looks especially weird).
No functional change intended. Cc: Tom Lendacky <[email protected]> Reviewed-by: Nikunj A Dadhania <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> --- arch/x86/coco/sev/core.c | 3 --- arch/x86/kernel/tsc.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c index 14ced854cd83..39fb50697542 100644 --- a/arch/x86/coco/sev/core.c +++ b/arch/x86/coco/sev/core.c @@ -2029,9 +2029,6 @@ void __init snp_secure_tsc_init(void) unsigned long tsc_freq_mhz; void *mem; - if (!cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC)) - return; - mem = early_memremap_encrypted(sev_secrets_pa, PAGE_SIZE); if (!mem) { pr_err("Unable to get TSC_FACTOR: failed to map the SNP secrets page.\n"); diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 7e639c0a94a2..243999692aea 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1559,7 +1559,8 @@ void __init tsc_early_init(void) if (is_early_uv_system()) return; - snp_secure_tsc_init(); + if (cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC)) + snp_secure_tsc_init(); if (!determine_cpu_tsc_frequencies(true)) return; -- 2.54.0.563.g4f69b47b94-goog

