From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A63934D2EF1 for ; Wed, 1 Jul 2026 19:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934357; cv=none; b=Pn/mfO4r7vH4NftJoV/8kSNwZdmP1xLhZqTBsHRJIbDbI46aB6OUozX1GUB7mR6XGrXLqTLlkhv3/YL7M4F3d+rvCVtD8hmF3eLO9SvSop0E/Yeue7sVCtgwM28K4KEv8kLQivqBedFhjEbuFqpRwghun81uPogLMacPWVm2Qx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934357; c=relaxed/simple; bh=p5tLZkB3crC07vF32aPnSFAmwAQDDSFCr6tkFys+CMo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ja53STJVrKgl2l7YqCL97UjhOh2o05StFaLaoPawYp6+hIByR4tje/mk28Lw62Qp7aI4hOhhJD3Pc3hOpX1fbpwdpCLAQqKrzGQYaTWA2VOFduJpeyVX2DTz9VzNAuRQbkJjqpLGYoN3HP0J1t9UAz7xDtLJc3xwXjsbDSbYLRQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Hn9tEGsg; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Hn9tEGsg" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2c9f0073e20so11863225ad.1 for ; Wed, 01 Jul 2026 12:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782934354; x=1783539154; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=evwxLM71EsC76xUKnJUsM6sZDhf4kmGP6xo/jdNLobw=; b=Hn9tEGsg81obPWeBySjt9n3Y/aqivac4a9GG7opEcrcdjO73D94oWJMEzYPjq7sKgZ egiSEepBrJCPb89Fsla+BxHujqnLcrY9W+antf9uHGsglS+BMY2hbPnvsK47XeOFw4ji IdhEqvi6pZQR3vDX4d+HbJbUG8V7r37a3g343+2HR1tvSA1geiccFk+1FbBVE8XFFbbv jHZ6O0mdWMdD6PxN5KIbAkHXwK30XRblPp74DsJTfLZN2Uvo0wJid7Xr8DOuidFJP7lo HW2F06uKrgcR4yJN2GZZuwx8f1aqVd6HfGzMxmDRPL3DsJouJ4AZ5AMPUgzJYkgNi6jf 3wMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782934354; x=1783539154; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=evwxLM71EsC76xUKnJUsM6sZDhf4kmGP6xo/jdNLobw=; b=PPdh5Y2CONfX3kicq0SlFdqMbgbbXCP6qNk22Wt2SCEv/5VTQdN3cOZSuvwY0U+/ov v0A2iifi1JSrverbzIxSzSuwQZjPXopTeUoShr9TIU5//C+uRjXLqlCch4KQ9SI8h8Bq FMNsmjZCywczN4SXVk63R66AwnGwWs6WOk9tOkOkJq9yclkFXI2QFYS4GPVv1jSGo0D5 P1QcXnW1EcGBGoJy1iibgEp1FuMBIqoA5X59GuCfDhz5akwgjZWBi17OamJmTCLUPLKh PaW6a35gXSiSVlFeepVlrgM9Gd1S4EJtfPBSd/Z3rUPjZhexHuovbyo7VGJ1au5GloEc DCEA== X-Forwarded-Encrypted: i=1; AHgh+RqdZ86HhbJoedttj2cATH4PIYqOMfeHEppUp0TW9K6OOy8CEROeKE3lI1NiNgFqVBR/DfngDF7nDSKM35M=@vger.kernel.org X-Gm-Message-State: AOJu0YxfouMHIwitdklY1Cf2MxpvreRPbXVry/7qGDN3Jvh+Mj+85OWH dEHCRs/mu3qal8NgXZmTgrx4MuppCwEjomwGkz686JnRUkoDtFBeJCtT800NuXcfyVKSneFbUhp F0sgqfA== X-Received: from plha8.prod.google.com ([2002:a17:902:ecc8:b0:2c6:a75b:2129]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:f8c:b0:2c7:d603:117f with SMTP id d9443c01a7336-2ca7e754b82mr34808385ad.26.1782934353608; Wed, 01 Jul 2026 12:32:33 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 1 Jul 2026 12:31:27 -0700 In-Reply-To: <20260701193212.749551-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260701193212.749551-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260701193212.749551-7-seanjc@google.com> Subject: [PATCH v5 06/51] x86/sev: Don't override CPU frequency calibration for SNP's Secure TSC From: Sean Christopherson To: Jonathan Corbet , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , Rick Edgecombe , Sean Christopherson , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , John Stultz Cc: Shuah Khan , "H. Peter Anvin" , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, xen-devel@lists.xenproject.org, Tom Lendacky , Nikunj A Dadhania , David Woodhouse , David Woodhouse , Michael Kelley , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Don't override the kernel's CPU frequency calibration routine when registering SNP's Secure TSC calibration routine. SNP (the architecture) provides zero guarantees that the CPU runs at the same frequency as the TSC. The justification for clobbering the CPU routine was: Since the difference between CPU base and TSC frequency does not apply in this case, the same callback is being used. but that's simply not true. E.g. if APERF/MPERF is exposed to the VM, then the CPU frequency absolutely does matter. While relying on heuristics and/or the untrusted hypervisor to provide the CPU frequency isn't ideal, it's at least not outright wrong. Fixes: 73bbf3b0fbba ("x86/tsc: Init the TSC for Secure TSC guests") Cc: Nikunj A Dadhania Cc: Tom Lendacky Signed-off-by: Sean Christopherson --- arch/x86/coco/sev/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c index ed0ac52a765e..665de1aea0ee 100644 --- a/arch/x86/coco/sev/core.c +++ b/arch/x86/coco/sev/core.c @@ -2046,7 +2046,6 @@ void __init snp_secure_tsc_init(void) snp_tsc_freq_khz = SNP_SCALE_TSC_FREQ(tsc_freq_mhz * 1000, secrets->tsc_factor); - x86_platform.calibrate_cpu = securetsc_get_tsc_khz; x86_platform.calibrate_tsc = securetsc_get_tsc_khz; early_memunmap(mem, PAGE_SIZE); -- 2.55.0.rc0.799.gd6f94ed593-goog