All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>,
	Tianyu Lan <tiala@microsoft.com>,
	Kishon Vijay Abraham I <kvijayab@amd.com>,
	Ard Biesheuvel <ardb@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] x86/sev: Use KHZ_PER_MHZ in snp_secure_tsc_init()
Date: Tue,  7 Jul 2026 09:34:44 +0200	[thread overview]
Message-ID: <20260707073444.438054-3-thorsten.blum@linux.dev> (raw)

Replace the hard-coded conversion factor with KHZ_PER_MHZ to convert
tsc_freq_mhz from MHz to kHz.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/x86/coco/sev/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index ecd77d3217f3..b7be9a8ab484 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -15,6 +15,7 @@
 #include <linux/printk.h>
 #include <linux/mm_types.h>
 #include <linux/set_memory.h>
+#include <linux/units.h>
 #include <linux/memblock.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -2042,7 +2043,8 @@ void __init snp_secure_tsc_init(void)
 	/* Extract the GUEST TSC MHZ from BIT[17:0], rest is reserved space */
 	tsc_freq_mhz &= GENMASK_ULL(17, 0);
 
-	snp_tsc_freq_khz = SNP_SCALE_TSC_FREQ(tsc_freq_mhz * 1000, secrets->tsc_factor);
+	snp_tsc_freq_khz = SNP_SCALE_TSC_FREQ(tsc_freq_mhz * KHZ_PER_MHZ,
+					      secrets->tsc_factor);
 
 	x86_platform.calibrate_cpu = securetsc_get_tsc_khz;
 	x86_platform.calibrate_tsc = securetsc_get_tsc_khz;

             reply	other threads:[~2026-07-07  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  7:34 Thorsten Blum [this message]
2026-07-07  7:34 ` [PATCH 2/2] x86/sev: Fix CONFIG_SYSFS endif comment style Thorsten Blum
2026-07-07 16:16 ` [PATCH 1/2] x86/sev: Use KHZ_PER_MHZ in snp_secure_tsc_init() Tom Lendacky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260707073444.438054-3-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=Neeraj.Upadhyay@amd.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvijayab@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=tiala@microsoft.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.