lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f97dc87e18fccbca6663225f11f47bc1a927ad4.camel@intel.com>
Date:   Fri, 6 Oct 2023 10:43:29 +0000
From:   "Huang, Kai" <kai.huang@...el.com>
To:     "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "Nakajima, Jun" <jun.nakajima@...el.com>,
        "Annapurve, Vishal" <vannapurve@...gle.com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "Aktas, Erdem" <erdemaktas@...gle.com>,
        "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "bp@...en8.de" <bp@...en8.de>, "Shahar, Sagi" <sagis@...gle.com>
CC:     "sathyanarayanan.kuppuswamy@...ux.intel.com" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        "hpa@...or.com" <hpa@...or.com>,
        "nik.borisov@...e.com" <nik.borisov@...e.com>,
        "Christopherson,, Sean" <seanjc@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Jason@...c4.com" <Jason@...c4.com>,
        "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH] x86/tdx: Override the tsc calibration for TDX VMs


>  
> +/**
> + * Determine TSC frequency via CPUID, else return 0.
> + */

Nit: looks you don't need the k-doc style comment here?

> +static unsigned long tdx_calibrate_tsc(void)
> +{
> +	unsigned int eax_denominator = 0, ebx_numerator = 0, ecx_hz = 0, edx = 0;
> +	unsigned int crystal_khz;
> +
> +	/* CPUID 15H TSC/Crystal ratio, plus optionally Crystal Hz */
> +	cpuid(0x15, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
> +
> +	if (ebx_numerator == 0 || eax_denominator == 0)
> +		return 0;
> +
> +	crystal_khz = ecx_hz / 1000;
> +
> +	/*
> +	 * TSC frequency reported directly by CPUID is a "hardware reported"
> +	 * frequency and is the most accurate one so far we have. This
> +	 * is considered a known frequency.
> +	 */
> +	if (crystal_khz != 0)
> +		setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
> +
> +	return crystal_khz * ebx_numerator / eax_denominator;
> +}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ