x86/sev: Use KHZ_PER_MHZ in snp_secure_tsc_init()
PATCH v2 1/2 x86/sev: Use KHZ_PER_MHZ in snp_secure_tsc_init()
Replace the hard-coded conversion factor with KHZ_PER_MHZ to convert tsc_freq_mhz from MHz to kHz.
Acked-by Tom Lendacky <[email protected]>
Signed-off-by Thorsten Blum <[email protected]>
---
Changes in v2:
- Keep the change on a single line as suggested by Tom
- v1: https://lore.kernel.org/r/[email protected]/
--- arch/x86/coco/sev/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/coco/sev/core.c +2 -1
@@ -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,7 @@ 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;
PATCH v2 2/2 x86/sev: Fix CONFIG_SYSFS endif comment style
Fix the CONFIG_SYSFS endif comment style.
Signed-off-by Thorsten Blum <[email protected]>
---
No changes in patch 2/2.
--- arch/x86/coco/sev/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/coco/sev/core.c +1 -1
@@ -1469,7 +1469,7 @@ static int __init sev_sysfs_init(void) return ret; }arch_initcall (sev_sysfs_init); -#endif // CONFIG_SYSFS +#endif /* CONFIG_SYSFS */ static void free_shared_pages (void *buf,size_t sz) {