From nobody Tue Aug 25 11:38:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1782934385; cv=none; d=zohomail.com; s=zohoarc; b=L4UNmao/MNcwgO7EQqEvQ671B+u+qUh9ogkwEFIWdL24JDFYRFOaFlwi8iw40rdvc/QR0zZrM31n83vrX7f1wW4I+cyFLecnLAdxZkTgcPB7YibBi/tImwdXj8xIAVPin0/aT4x+d7Dwiisb6ub3bLCrN0M71NYnZLRNq58lsZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782934385; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=evwxLM71EsC76xUKnJUsM6sZDhf4kmGP6xo/jdNLobw=; b=FUYF+uRqqQ/+PEKMZXDk5BhFDNi/PIc1iNywMHiLXm7gxUntNcHPvCykuewarUxPjuS4dodLtExEl413BbAc+HlPwWLr7Yg/aTXQ2bXf3dAOHJIcFG3ieT7S3+gQXXxGi1/CsLsHpTzY2Y30J148b3eMWizlslGbIcp3AWITa7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1782934385258810.6845538273287; Wed, 1 Jul 2026 12:33:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1350370.1607858 (Exim 4.92) (envelope-from ) id 1wf0fm-0000Pg-IU; Wed, 01 Jul 2026 19:32:38 +0000 Received: by outflank-mailman (output) from mailman id 1350370.1607858; Wed, 01 Jul 2026 19:32:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf0fm-0000Nv-AK; Wed, 01 Jul 2026 19:32:38 +0000 Received: by outflank-mailman (input) for mailman id 1350370; Wed, 01 Jul 2026 19:32:36 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <3UWtFagYKCZYI40D926EE6B4.2ECN4D-34L4BB8IJI.N4DFHE942J.EH6@flex--seanjc.bounces.google.com>) id 1wf0fk-0008Vj-MH for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 19:32:36 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wf0fk-004o0g-38 for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 21:32:36 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from <3UWtFagYKCZYI40D926EE6B4.2ECN4D-34L4BB8IJI.N4DFHE942J.EH6@flex--seanjc.bounces.google.com>) id 6a456b44-2eae-0a2a0a5409dd-0a2a4509ddee-42 for ; Wed, 01 Jul 2026 21:32:36 +0200 Received: from [209.85.214.202] (helo=mail-pl1-f202.google.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from <3UWtFagYKCZYI40D926EE6B4.2ECN4D-34L4BB8IJI.N4DFHE942J.EH6@flex--seanjc.bounces.google.com>) id 6a456b52-97e6-0a2a45090019-d155d6cab14e-3 for ; Wed, 01 Jul 2026 21:32:35 +0200 Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2ca0d4fb061so13562385ad.3 for ; Wed, 01 Jul 2026 12:32:35 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=google.com header.i="@google.com" header.h="Cc:To:From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782934354; x=1783539154; darn=lists.xenproject.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=lxUVIHgq8AO7SvMwRCNuRvewFIS2NKjniwRvFBiMfw0yUR0tAHTzcVH1C7PzXzWBXI +YK8tgKQmr8tCHCMYtmPWDFpwp0Op673LizsMvi6kXAOROZGlAb54h/NStk8yxuIw0Ca noUGaNHSz+vcxkQAZDVTNz/GsYFoVDukSR0Vycg8GjlWimY+meKsFyuHjZiK2JF+QXkG S7p6Sygfgqrh1E534KDf11rDel7r8iLHn+yO7MZNxtvyxe+PiwiqOvm2DgQMxGl8hxuW x9smr1AAGmtTM64SWNQ3pnv4SrihYzgfz2yc1Mq5gHfcI2U5KXq2QyAnMS039xVUyJ7N xGfQ== 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=hPYRXzSMQTZ0iW8Myo3EIm6UaoXCMqzwJPSDDkhSRQZ3/2Cq+ZN+9KY089shlIdvXx tPURrKNtn1OU1ReMlHfl1Z+YfoxbyWofYhWkpw+Q9y/Fx7TY8jdfCDAz6hQ/OrExctoc HgE81m7wqyKbc7GiwNxiXAewiRfmaCu+IenlpYlJDXIp5nIYwvWQ62MplWTZL5Oyc54r uRiLXW6+nHXlqgFrHb+0rSxHEmO6RKMQFLvGbQlD4IjBY+z8Akq6pkY4GW6nr0T48ZZS muXc7XtNa77dScJnJVLXgdfuolpePjF1RZ3f6+Sdzt2Mkd3hHxW20I9BuIpsUjFKpMpE ATBQ== X-Forwarded-Encrypted: i=1; AHgh+Ro1+1VaaBmBh+bPkzfdBrxHVtWnCPwUNtjEUWvMJHIOHHg8ETNAm5ZTYx1QCgo/ubo0HzH8J4OCP7s=@lists.xenproject.org X-Gm-Message-State: AOJu0YzR+TorBNVTaCe05tRk4CSoTfXmnhUHsyTx3cRkpEHEdFAYxXsw 7tTSKTQWGpZ/KRxZVSubrv7niTWSFNLNyX3LGyAPE0upT7IE4p4D+21itQGmE7fXH+pT+vvvldR gUQEK2g== 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> 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 X-purgate-ID: tlsNG-bad1c0/1782934356-4512E986-3CC5EFD8/0/0 X-purgate-type: clean X-purgate-size: 1458 X-ZohoMail-DKIM: pass (identity @google.com) X-ZM-MESSAGEID: 1782934386098158500 Content-Transfer-Encoding: quoted-printable 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 Reviewed-by: Nikunj A Dadhania --- 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) =20 snp_tsc_freq_khz =3D SNP_SCALE_TSC_FREQ(tsc_freq_mhz * 1000, secrets->tsc= _factor); =20 - x86_platform.calibrate_cpu =3D securetsc_get_tsc_khz; x86_platform.calibrate_tsc =3D securetsc_get_tsc_khz; =20 early_memunmap(mem, PAGE_SIZE); --=20 2.55.0.rc0.799.gd6f94ed593-goog